* [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA
@ 2014-10-28 11:33 Luca Coelho
2014-10-28 11:33 ` [PATCH 1/2] mac80211: use secondary channel offset IE also beacons during CSA Luca Coelho
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Luca Coelho @ 2014-10-28 11:33 UTC (permalink / raw)
To: johill; +Cc: j, linux-wireless
From: Luciano Coelho <luciano.coelho@intel.com>
These two patches fix a bug that Jouni found when running his hostap
hwsim test scripts (ap_ht40_csa). The failure was caused by two
different bugs which are fixed in this patchset.
The first bug was that we were not using the secondary channel offset
IE of beacons for the switch, but the offset of the current channel,
which cause us to use the same offset.
The second bug was that we were trying to switch at the exact time of
the switch on the station side, which, because of the processing time,
was causing us to be too late.
Luciano Coelho (2):
mac80211: use secondary channel offset IE also beacons during CSA
mac80211: schedule the actual switch of the station before CSA count 0
net/mac80211/ibss.c | 2 +-
net/mac80211/ieee80211_i.h | 3 +--
net/mac80211/mesh.c | 2 +-
net/mac80211/mlme.c | 5 +++--
net/mac80211/spectmgmt.c | 18 ++++++------------
5 files changed, 12 insertions(+), 18 deletions(-)
--
2.1.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] mac80211: use secondary channel offset IE also beacons during CSA 2014-10-28 11:33 [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA Luca Coelho @ 2014-10-28 11:33 ` Luca Coelho 2014-10-28 11:33 ` [PATCH 2/2] mac80211: schedule the actual switch of the station before CSA count 0 Luca Coelho 2014-10-28 13:32 ` [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA Luca Coelho 2 siblings, 0 replies; 6+ messages in thread From: Luca Coelho @ 2014-10-28 11:33 UTC (permalink / raw) To: johill; +Cc: j, linux-wireless From: Luciano Coelho <luciano.coelho@intel.com> If we are switching from an HT40+ to an HT40- channel (or vice-versa), we need the secondary channel offset IE to specify what is the post-CSA offset to be used. This applies both to beacons and to probe responses. In ieee80211_parse_ch_switch_ie() we were ignoring this IE from beacons and using the *current* HT information IE instead. This was causing us to use the same offset as before the switch. Fix that by using the secondary channel offset IE also for beacons and don't ever use the pre-switch offset. Additionally, remove the "beacon" argument from ieee80211_parse_ch_switch_ie(), since it's not needed anymore. Reported-by: Jouni Malinen <j@w1.fi> Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> --- net/mac80211/ibss.c | 2 +- net/mac80211/ieee80211_i.h | 3 +-- net/mac80211/mesh.c | 2 +- net/mac80211/mlme.c | 2 +- net/mac80211/spectmgmt.c | 18 ++++++------------ 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 56b5357..509bc15 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -805,7 +805,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, memset(¶ms, 0, sizeof(params)); memset(&csa_ie, 0, sizeof(csa_ie)); - err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, + err = ieee80211_parse_ch_switch_ie(sdata, elems, ifibss->chandef.chan->band, sta_flags, ifibss->bssid, &csa_ie); /* can't switch to destination channel, fail */ diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 146a818..96074df 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1676,7 +1676,6 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, * ieee80211_parse_ch_switch_ie - parses channel switch IEs * @sdata: the sdata of the interface which has received the frame * @elems: parsed 802.11 elements received with the frame - * @beacon: indicates if the frame was a beacon or probe response * @current_band: indicates the current band * @sta_flags: contains information about own capabilities and restrictions * to decide which channel switch announcements can be accepted. Only the @@ -1690,7 +1689,7 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, * Return: 0 on success, <0 on error and >0 if there is nothing to parse. */ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, - struct ieee802_11_elems *elems, bool beacon, + struct ieee802_11_elems *elems, enum ieee80211_band current_band, u32 sta_flags, u8 *bssid, struct ieee80211_csa_ie *csa_ie); diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index e9f99c1..0c8b2a7 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -874,7 +874,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, memset(¶ms, 0, sizeof(params)); memset(&csa_ie, 0, sizeof(csa_ie)); - err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, band, + err = ieee80211_parse_ch_switch_ie(sdata, elems, band, sta_flags, sdata->vif.addr, &csa_ie); if (err < 0) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index c078cd3..ae9f3bd 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -1096,7 +1096,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, current_band = cbss->channel->band; memset(&csa_ie, 0, sizeof(csa_ie)); - res = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, current_band, + res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band, ifmgd->flags, ifmgd->associated->bssid, &csa_ie); if (res < 0) diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c index 6ab0090..efeba56 100644 --- a/net/mac80211/spectmgmt.c +++ b/net/mac80211/spectmgmt.c @@ -22,7 +22,7 @@ #include "wme.h" int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, - struct ieee802_11_elems *elems, bool beacon, + struct ieee802_11_elems *elems, enum ieee80211_band current_band, u32 sta_flags, u8 *bssid, struct ieee80211_csa_ie *csa_ie) @@ -91,19 +91,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, return -EINVAL; } - if (!beacon && sec_chan_offs) { + if (sec_chan_offs) { secondary_channel_offset = sec_chan_offs->sec_chan_offs; - } else if (beacon && ht_oper) { - secondary_channel_offset = - ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET; } else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) { - /* If it's not a beacon, HT is enabled and the IE not present, - * it's 20 MHz, 802.11-2012 8.5.2.6: - * This element [the Secondary Channel Offset Element] is - * present when switching to a 40 MHz channel. It may be - * present when switching to a 20 MHz channel (in which - * case the secondary channel offset is set to SCN). - */ + /* If the secondary channel offset IE is not present, + * we can't know what's the post-CSA offset, so the + * best we can do is use 20MHz. + */ secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; } -- 2.1.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] mac80211: schedule the actual switch of the station before CSA count 0 2014-10-28 11:33 [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA Luca Coelho 2014-10-28 11:33 ` [PATCH 1/2] mac80211: use secondary channel offset IE also beacons during CSA Luca Coelho @ 2014-10-28 11:33 ` Luca Coelho 2014-10-28 13:32 ` [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA Luca Coelho 2 siblings, 0 replies; 6+ messages in thread From: Luca Coelho @ 2014-10-28 11:33 UTC (permalink / raw) To: johill; +Cc: j, linux-wireless From: Luciano Coelho <luciano.coelho@intel.com> Due to the time it takes to process the beacon that started the CSA process, we may be late for the switch if we try to reach exactly beacon 0. To avoid that, use count - 1 when calculating the switch time. Reported-by: Jouni Malinen <j@w1.fi> Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> --- net/mac80211/mlme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index ae9f3bd..284ddda 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -1195,7 +1195,8 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); else mod_timer(&ifmgd->chswitch_timer, - TU_TO_EXP_TIME(csa_ie.count * cbss->beacon_interval)); + TU_TO_EXP_TIME((csa_ie.count - 1) * + cbss->beacon_interval)); } static bool -- 2.1.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA 2014-10-28 11:33 [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA Luca Coelho 2014-10-28 11:33 ` [PATCH 1/2] mac80211: use secondary channel offset IE also beacons during CSA Luca Coelho 2014-10-28 11:33 ` [PATCH 2/2] mac80211: schedule the actual switch of the station before CSA count 0 Luca Coelho @ 2014-10-28 13:32 ` Luca Coelho 2014-10-29 15:37 ` Johannes Berg 2 siblings, 1 reply; 6+ messages in thread From: Luca Coelho @ 2014-10-28 13:32 UTC (permalink / raw) To: johannes; +Cc: j, linux-wireless (fixed Johannes' email address) Both these bugs go far back, so IMHO they should go to 3.8 and stable. 1/2 goes back to 3.13 2/2 goes back to 2.6.30 (though the affected code changed somewhat since then) -- Luca. On Tue, 2014-10-28 at 13:33 +0200, Luca Coelho wrote: > From: Luciano Coelho <luciano.coelho@intel.com> > > These two patches fix a bug that Jouni found when running his hostap > hwsim test scripts (ap_ht40_csa). The failure was caused by two > different bugs which are fixed in this patchset. > > The first bug was that we were not using the secondary channel offset > IE of beacons for the switch, but the offset of the current channel, > which cause us to use the same offset. > > The second bug was that we were trying to switch at the exact time of > the switch on the station side, which, because of the processing time, > was causing us to be too late. > > Luciano Coelho (2): > mac80211: use secondary channel offset IE also beacons during CSA > mac80211: schedule the actual switch of the station before CSA count 0 > > net/mac80211/ibss.c | 2 +- > net/mac80211/ieee80211_i.h | 3 +-- > net/mac80211/mesh.c | 2 +- > net/mac80211/mlme.c | 5 +++-- > net/mac80211/spectmgmt.c | 18 ++++++------------ > 5 files changed, 12 insertions(+), 18 deletions(-) > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA 2014-10-28 13:32 ` [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA Luca Coelho @ 2014-10-29 15:37 ` Johannes Berg 2014-10-29 15:41 ` Luca Coelho 0 siblings, 1 reply; 6+ messages in thread From: Johannes Berg @ 2014-10-29 15:37 UTC (permalink / raw) To: Luca Coelho; +Cc: j, linux-wireless On Tue, 2014-10-28 at 15:32 +0200, Luca Coelho wrote: > (fixed Johannes' email address) > > Both these bugs go far back, so IMHO they should go to 3.8 and stable. Both applied. I think you meant 3.18 :) johannes ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA 2014-10-29 15:37 ` Johannes Berg @ 2014-10-29 15:41 ` Luca Coelho 0 siblings, 0 replies; 6+ messages in thread From: Luca Coelho @ 2014-10-29 15:41 UTC (permalink / raw) To: Johannes Berg; +Cc: j, linux-wireless On October 29, 2014 5:37:35 PM EET, Johannes Berg <johannes@sipsolutions.net> wrote: >On Tue, 2014-10-28 at 15:32 +0200, Luca Coelho wrote: >> (fixed Johannes' email address) >> >> Both these bugs go far back, so IMHO they should go to 3.8 and >stable. > >Both applied. I think you meant 3.18 :) Oops! Ahrrmmm... The "one" key in my keyboard is stuck. Hrmhrm! :P ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-29 15:41 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-28 11:33 [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA Luca Coelho 2014-10-28 11:33 ` [PATCH 1/2] mac80211: use secondary channel offset IE also beacons during CSA Luca Coelho 2014-10-28 11:33 ` [PATCH 2/2] mac80211: schedule the actual switch of the station before CSA count 0 Luca Coelho 2014-10-28 13:32 ` [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA Luca Coelho 2014-10-29 15:37 ` Johannes Berg 2014-10-29 15:41 ` Luca Coelho
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox