Message ID | 1419837299-10157-2-git-send-email-janusz.dziedzic@tieto.com |
---|---|
State | Changes Requested |
Headers | show |
On Mon, Dec 29, 2014 at 08:14:59AM +0100, Janusz Dziedzic wrote: > Setup HT40+/HT40- if supported by driver. How would this handle 20/40 MHz coexistence requirements and overlapped BSS scanning expectations? > + int allowed_40[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 184, 192 }; That is very confusingly named variable.. I'd assume this is supposed to be something like ht40plus[], i.e., a list of primary channels on which the secondary channel is above the primary channel. > + wpa_printf(MSG_DEBUG, "ibss setup freq channel %d, sec_channel_offset %d", This function was used with mesh, so this is getting even more confusing when debug logs would talk about IBSS.
On 4 January 2015 at 14:22, Jouni Malinen <j@w1.fi> wrote: > On Mon, Dec 29, 2014 at 08:14:59AM +0100, Janusz Dziedzic wrote: >> Setup HT40+/HT40- if supported by driver. > > How would this handle 20/40 MHz coexistence requirements and overlapped > BSS scanning expectations? > I am not sure who should run obss scan here. Now seem mac80211 run scan and decide if merge or create new ibss. From other side we could implement something like hostapd_check_ht_capab() also for ibss/ap/mesh supplicant version? But this seems like a more work. BR Janusz
On Mon, Jan 05, 2015 at 07:42:32AM +0100, Janusz Dziedzic wrote: > On 4 January 2015 at 14:22, Jouni Malinen <j@w1.fi> wrote: > > On Mon, Dec 29, 2014 at 08:14:59AM +0100, Janusz Dziedzic wrote: > >> Setup HT40+/HT40- if supported by driver. > > > > How would this handle 20/40 MHz coexistence requirements and overlapped > > BSS scanning expectations? > > > I am not sure who should run obss scan here. Now seem mac80211 run > scan and decide if merge or create new ibss. > From other side we could implement something like > hostapd_check_ht_capab() also for ibss/ap/mesh supplicant version? > But this seems like a more work. A reasonable compromise could be to run the initial co-ex scan part on overlapping channels and swap primary/secondary channels, if needed, in case a new IBSS is being started (i.e., the IBSS was not already present in the scan results). I agree that the dynamic changes during the lifetime of the IBSS could well be left for the drivers/mac80211 to handle since the design here is quite different compared to AP mode.
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 4e1bd55..086b382 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1599,8 +1599,10 @@ static void ibss_setup_freq(struct wpa_supplicant *wpa_s, const struct wpa_ssid { enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; + int allowed_40[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 184, 192 }; + struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL; + int i, chan_idx, ht40 = -1; u8 channel; - int i; freq->freq = ssid->frequency; @@ -1620,6 +1622,72 @@ static void ibss_setup_freq(struct wpa_supplicant *wpa_s, const struct wpa_ssid freq->ht_enabled = ht_supported(mode); + if (!freq->ht_enabled) + return; + + /* Setup higher BW only for 5GHz */ + if (mode->mode != HOSTAPD_MODE_IEEE80211A) + return; + + for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) { + pri_chan = &mode->channels[chan_idx]; + if (pri_chan->chan == channel) + break; + } + + if (chan_idx == mode->num_channels) + return; + + /* Check primary channel flags */ + if (pri_chan->flag & HOSTAPD_CHAN_DISABLED) + return; + + if (pri_chan->flag & HOSTAPD_CHAN_NO_IR) + return; + + /* Check/setup HT40+/HT40- */ + for (i = 0; i < ARRAY_SIZE(allowed_40); i++) { + if (allowed_40[i] == channel) { + ht40 = 1; + break; + } + } + + /* Find secondary channel */ + for (i = 0; i < mode->num_channels; i++) { + sec_chan = &mode->channels[i]; + if (sec_chan->chan == channel + ht40 * 4) + break; + } + + if (sec_chan->chan != pri_chan->chan + ht40 * 4) + return; + + /* Check secondary channel flags */ + if (sec_chan->flag & HOSTAPD_CHAN_DISABLED) + return; + + if (sec_chan->flag & HOSTAPD_CHAN_NO_IR) + return; + + switch (ht40) { + case -1: + if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) + return; + freq->sec_channel_offset = -1; + break; + case 1: + if (!(pri_chan->flag & HOSTAPD_CHAN_HT40PLUS)) + return; + freq->sec_channel_offset = 1; + break; + default: + break; + } + + wpa_printf(MSG_DEBUG, "ibss setup freq channel %d, sec_channel_offset %d", + pri_chan->chan, freq->sec_channel_offset); + return; }
Setup HT40+/HT40- if supported by driver. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> --- wpa_supplicant/wpa_supplicant.c | 70 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-)