nl80211: Allow compilation with both vendor do_acs() handlers

Use a helper function as the do_acs() callback to allow builds to pull
in all the vendor specific operations into a single binary.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2021-02-27 17:57:08 +02:00
parent 61a258e784
commit 205c35ceff
3 changed files with 31 additions and 10 deletions

View file

@ -10926,10 +10926,9 @@ static int add_acs_freq_list(struct nl_msg *msg, const int *freq_list)
}
static int wpa_driver_do_acs(void *priv, struct drv_acs_params *params)
static int nl80211_qca_do_acs(struct wpa_driver_nl80211_data *drv,
struct drv_acs_params *params)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
struct nl_msg *msg;
struct nlattr *data;
int ret;
@ -11607,10 +11606,9 @@ fail:
#ifdef CONFIG_DRIVER_NL80211_BRCM
static int wpa_driver_do_broadcom_acs(void *priv, struct drv_acs_params *params)
static int wpa_driver_do_broadcom_acs(struct wpa_driver_nl80211_data *drv,
struct drv_acs_params *params)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
struct nl_msg *msg;
struct nlattr *data;
int freq_list_len;
@ -11660,6 +11658,27 @@ fail:
#endif /* CONFIG_DRIVER_NL80211_BRCM */
static int nl80211_do_acs(void *priv, struct drv_acs_params *params)
{
#if defined(CONFIG_DRIVER_NL80211_QCA) || defined(CONFIG_DRIVER_NL80211_BRCM)
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
#endif /* CONFIG_DRIVER_NL80211_QCA || CONFIG_DRIVER_NL80211_BRCM */
#ifdef CONFIG_DRIVER_NL80211_QCA
if (drv->qca_do_acs)
return nl80211_qca_do_acs(drv, params);
#endif /* CONFIG_DRIVER_NL80211_QCA */
#ifdef CONFIG_DRIVER_NL80211_BRCM
if (drv->brcm_do_acs)
return wpa_driver_do_broadcom_acs(drv, params);
#endif /* CONFIG_DRIVER_NL80211_BRCM */
return -1;
}
static int nl80211_write_to_file(const char *name, unsigned int val)
{
int fd, len;
@ -12090,7 +12109,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
#ifdef CONFIG_DRIVER_NL80211_QCA
.roaming = nl80211_roaming,
.disable_fils = nl80211_disable_fils,
.do_acs = wpa_driver_do_acs,
.set_band = nl80211_set_band,
.get_pref_freq_list = nl80211_get_pref_freq_list,
.set_prob_oper_freq = nl80211_set_prob_oper_freq,
@ -12105,9 +12123,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.set_bssid_tmp_disallow = nl80211_set_bssid_tmp_disallow,
.add_sta_node = nl80211_add_sta_node,
#endif /* CONFIG_DRIVER_NL80211_QCA */
#ifdef CONFIG_DRIVER_NL80211_BRCM
.do_acs = wpa_driver_do_broadcom_acs,
#endif /* CONFIG_DRIVER_NL80211_BRCM */
.do_acs = nl80211_do_acs,
.configure_data_frame_filters = nl80211_configure_data_frame_filters,
.get_ext_capab = nl80211_get_ext_capab,
.update_connect_params = nl80211_update_connection_params,

View file

@ -177,6 +177,8 @@ struct wpa_driver_nl80211_data {
unsigned int get_sta_info_vendor_cmd_avail:1;
unsigned int fils_discovery:1;
unsigned int unsol_bcast_probe_resp:1;
unsigned int qca_do_acs:1;
unsigned int brcm_do_acs:1;
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;

View file

@ -996,6 +996,7 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
case QCA_NL80211_VENDOR_SUBCMD_DO_ACS:
drv->capa.flags |=
WPA_DRIVER_FLAGS_ACS_OFFLOAD;
drv->qca_do_acs = 1;
break;
case QCA_NL80211_VENDOR_SUBCMD_SETBAND:
drv->setband_vendor_cmd_avail = 1;
@ -1028,6 +1029,8 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
WPA_DRIVER_FLAGS_ACS_OFFLOAD;
wpa_printf(MSG_DEBUG,
"Enabled BRCM ACS");
drv->brcm_do_acs = 1;
break;
}
#endif /* CONFIG_DRIVER_NL80211_BRCM */
}