Message ID | 1419837299-10157-1-git-send-email-janusz.dziedzic@tieto.com |
---|---|
State | Changes Requested |
Headers | show |
On Mon, Dec 29, 2014 at 08:14:58AM +0100, Janusz Dziedzic wrote: > Add WPA_DRIVER_FLAGS_HT_IBSS driver feature flag. > Some drivers could not set this feature and next could > fail when we will enable HT support (mac80211 based > drivers always have this flag set). > Move setting freq structure to the dedicated function. > diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c > @@ -1595,6 +1595,34 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, > +static void ibss_setup_freq(struct wpa_supplicant *wpa_s, const struct wpa_ssid *ssid, struct hostapd_freq_params *freq) > + if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_HT_IBSS)) > + return; > @@ -1909,23 +1937,9 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) > > /* Initial frequency for IBSS/mesh */ > if ((ssid->mode == WPAS_MODE_IBSS || ssid->mode == WPAS_MODE_MESH) && Note that mesh part here.. > + ibss_setup_freq(wpa_s, ssid, ¶ms.freq); Why would a function with ibss_ prefix be used with mesh? And why would HT_IBSS flag be used with mesh for that matter?
On 4 January 2015 at 14:20, Jouni Malinen <j@w1.fi> wrote: > On Mon, Dec 29, 2014 at 08:14:58AM +0100, Janusz Dziedzic wrote: >> Add WPA_DRIVER_FLAGS_HT_IBSS driver feature flag. >> Some drivers could not set this feature and next could >> fail when we will enable HT support (mac80211 based >> drivers always have this flag set). >> Move setting freq structure to the dedicated function. > >> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c >> @@ -1595,6 +1595,34 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, > >> +static void ibss_setup_freq(struct wpa_supplicant *wpa_s, const struct wpa_ssid *ssid, struct hostapd_freq_params *freq) > >> + if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_HT_IBSS)) >> + return; > >> @@ -1909,23 +1937,9 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) >> >> /* Initial frequency for IBSS/mesh */ >> if ((ssid->mode == WPAS_MODE_IBSS || ssid->mode == WPAS_MODE_MESH) && > > Note that mesh part here.. > >> + ibss_setup_freq(wpa_s, ssid, ¶ms.freq); > > Why would a function with ibss_ prefix be used with mesh? And why would > HT_IBSS flag be used with mesh for that matter? > Will fix that. BR Janusz
diff --git a/src/drivers/driver.h b/src/drivers/driver.h index b8ee825..60edc50 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1079,6 +1079,8 @@ struct wpa_driver_capa { #define WPA_DRIVER_FLAGS_ACS_OFFLOAD 0x0000000200000000ULL /* Driver supports key management offload */ #define WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD 0x0000000400000000ULL +/* Driver supports IBSS with HT datarates */ +#define WPA_DRIVER_FLAGS_HT_IBSS 0x0000000800000000ULL u64 flags; #define WPA_DRIVER_SMPS_MODE_STATIC 0x00000001 diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 657f38c..8c19937 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -381,6 +381,9 @@ static void wiphy_info_feature_flags(struct wiphy_info_data *info, if (flags & NL80211_FEATURE_TX_POWER_INSERTION) capa->rrm_flags |= WPA_DRIVER_FLAGS_TX_POWER_INSERTION; + + if (flags & NL80211_FEATURE_HT_IBSS) + capa->flags |= WPA_DRIVER_FLAGS_HT_IBSS; } diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 995c8d8..4e1bd55 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1595,6 +1595,34 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, } } +static void ibss_setup_freq(struct wpa_supplicant *wpa_s, const struct wpa_ssid *ssid, struct hostapd_freq_params *freq) +{ + enum hostapd_hw_mode hw_mode; + struct hostapd_hw_modes *mode = NULL; + u8 channel; + int i; + + freq->freq = ssid->frequency; + + if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_HT_IBSS)) + return; + + hw_mode = ieee80211_freq_to_chan(ssid->frequency, &channel); + for (i = 0; wpa_s->hw.modes && i < wpa_s->hw.num_modes; i++) { + if (wpa_s->hw.modes[i].mode == hw_mode) { + mode = &wpa_s->hw.modes[i]; + break; + } + } + + if (!mode) + return; + + freq->ht_enabled = ht_supported(mode); + + return; +} + static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) { @@ -1909,23 +1937,9 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) /* Initial frequency for IBSS/mesh */ if ((ssid->mode == WPAS_MODE_IBSS || ssid->mode == WPAS_MODE_MESH) && - ssid->frequency > 0 && params.freq.freq == 0) { - enum hostapd_hw_mode hw_mode; - u8 channel; - - params.freq.freq = ssid->frequency; + ssid->frequency > 0 && params.freq.freq == 0) + ibss_setup_freq(wpa_s, ssid, ¶ms.freq); - hw_mode = ieee80211_freq_to_chan(ssid->frequency, &channel); - for (i = 0; wpa_s->hw.modes && i < wpa_s->hw.num_modes; i++) { - if (wpa_s->hw.modes[i].mode == hw_mode) { - struct hostapd_hw_modes *mode; - - mode = &wpa_s->hw.modes[i]; - params.freq.ht_enabled = ht_supported(mode); - break; - } - } - } if (ssid->mode == WPAS_MODE_IBSS) { if (ssid->beacon_int)
Add WPA_DRIVER_FLAGS_HT_IBSS driver feature flag. Some drivers could not set this feature and next could fail when we will enable HT support (mac80211 based drivers always have this flag set). Move setting freq structure to the dedicated function. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> --- src/drivers/driver.h | 2 ++ src/drivers/driver_nl80211_capa.c | 3 +++ wpa_supplicant/wpa_supplicant.c | 46 +++++++++++++++++++++++++-------------- 3 files changed, 35 insertions(+), 16 deletions(-)