mac80211: Recalculate channel-type on iface removal.
PATCH 1/1 mac80211: Recalculate channel-type on iface removal.
From: Ben Greear <[email protected]>
When a vif goes away, it could cause the super-chan to be recalculated differently, so do that calculation on iface removal.
Also, use WARN_ON_ONCE instead of WARN_ON if user has ht40- stations in conjunction with ht40+. It's not really a kernel bug, just a mis-configuration of the user's wifi environment.
---
:100644 100644 5b24740... ad9055d... M net/mac80211/chan.c
:100644 100644 605c222... abf5f8e... M net/mac80211/iface.c
net/mac80211/chan.c | 4 ++-- net/mac80211/iface.c | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-)
net/mac80211/chan.c +2 -2
@@ -80,11 +80,11 @@ bool ieee80211_set_channel_type(struct ieee80211_local *local, superchan = tmp->vif.bss_conf.channel_type;break ;case NL80211_CHAN_HT40PLUS : -WARN_ON (superchan ==NL80211_CHAN_HT40MINUS ); +WARN_ON_ONCE (superchan ==NL80211_CHAN_HT40MINUS ); superchan =NL80211_CHAN_HT40PLUS ;break ;case NL80211_CHAN_HT40MINUS : -WARN_ON (superchan ==NL80211_CHAN_HT40PLUS ); +WARN_ON_ONCE (superchan ==NL80211_CHAN_HT40PLUS ); superchan =NL80211_CHAN_HT40MINUS ;break ; }
net/mac80211/iface.c +8 -1
@@ -382,6 +382,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,struct sk_buff *skb, *tmp;u32 hw_reconf_flags =0 ;int i; +enum nl80211_channel_type orig_ct;if (local->scan_sdata == sdata)ieee80211_scan_cancel (local);
@@ -542,8 +543,14 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, hw_reconf_flags =0 ; } +/* Re-calculate channel-type, in case there are multiple vifs +* on different channel types. +*/ + orig_ct = local->_oper_channel_type; +ieee80211_set_channel_type (local,NULL ,NL80211_CHAN_NO_HT ); +/* do after stop to avoid reconfiguring when we stop anyway */ -if (hw_reconf_flags) +if (hw_reconf_flags || (orig_ct != local->_oper_channel_type))ieee80211_hw_config (local, hw_reconf_flags);spin_lock_irqsave (&local->queue_stop_reason_lock, flags);
Signature · 1 line
1.7.2.3
Johannes Berg
maintainerQuoted 4 lines · On Mon, 2011-01-31 at 10:37 -0800, [email protected] wrote:
Also, use
WARN_ON_ONCEinstead ofWARN_ONif user has ht40- stations in conjunction with ht40+. It's not really a kernel bug, just a mis-configuration of the user's wifi environment.
But how did we end up here to start with -- shouldn't that have been rejected?
johannes
Quoted 9 lines · Johannes Berg
Quoted 4 lines · On Mon, 2011-01-31 at 10:37 -0800, [email protected] wrote:
Also, use
WARN_ON_ONCEinstead ofWARN_ONif user has ht40- stations in conjunction with ht40+. It's not really a kernel bug, just a mis-configuration of the user's wifi environment.But how did we end up here to start with -- shouldn't that have been rejected?
The set-channel-type logic will complain, and I imagine the interfaces will bounce around and attempt to re-associate, but I think it can get into the mixed state.
Regardless of that, it may be something more mundane where we have some HT-40 and HT-20 interfaces that can co-exist, but one of those leaves. We should still re-calculate in case their leaving changes the super-chan calculation.
Thanks,
Ben
Quoted 2 lines
johannes
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Johannes Berg
maintainerQuoted 8 lines · Ben Greear
Quoted 7 lines · Johannes Berg
Quoted 4 lines · On Mon, 2011-01-31 at 10:37 -0800, [email protected] wrote:
Also, use
WARN_ON_ONCEinstead ofWARN_ONif user has ht40- stations in conjunction with ht40+. It's not really a kernel bug, just a mis-configuration of the user's wifi environment.
Quoted 6 lines
Quoted 2 lines
But how did we end up here to start with -- shouldn't that have been rejected?
The set-channel-type logic will complain, and I imagine the interfaces will bounce around and attempt to re-associate, but I think it can get into the mixed state.
I think we should try to avoid that.
Quoted 4 lines
Regardless of that, it may be something more mundane where we have some HT-40 and HT-20 interfaces that can co-exist, but one of those leaves. We should still re-calculate in case their leaving changes the super-chan calculation.
Yeah, no argument about that part of the patch.
johannes
Quoted 9 lines · Johannes Berg
Quoted 8 lines · Ben Greear
Quoted 7 lines · Johannes Berg
Quoted 4 lines · On Mon, 2011-01-31 at 10:37 -0800, [email protected] wrote:
Also, use
WARN_ON_ONCEinstead ofWARN_ONif user has ht40- stations in conjunction with ht40+. It's not really a kernel bug, just a mis-configuration of the user's wifi environment.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
But how did we end up here to start with -- shouldn't that have been rejected?
The set-channel-type logic will complain, and I imagine the interfaces will bounce around and attempt to re-associate, but I think it can get into the mixed state.
I think we should try to avoid that.
Ok. I haven't actually tested that case yet. It's possible that we can't actually get in that case..but I haven't found anything that prevents it while reading code. Assuming there is a problem, what would be the preferred fix? Maybe force to NO_HT if an interface tries to associate with HT40+/- mis-match?
Do you want me to repost this patch without the WARN_ON_ONCE changes?
Quoted 8 lines
Quoted 4 lines
Regardless of that, it may be something more mundane where we have some HT-40 and HT-20 interfaces that can co-exist, but one of those leaves. We should still re-calculate in case their leaving changes the super-chan calculation.
Yeah, no argument about that part of the patch.
johannes
Thanks,
Ben
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Johannes Berg
maintainerQuoted 11 lines · Ben Greear
Quoted 5 lines
Quoted 3 lines
The set-channel-type logic will complain, and I imagine the interfaces will bounce around and attempt to re-associate, but I think it can get into the mixed state.
I think we should try to avoid that.
Ok. I haven't actually tested that case yet. It's possible that we can't actually get in that case..but I haven't found anything that prevents it while reading code. Assuming there is a problem, what would be the preferred fix? Maybe force to
NO_HTif an interface tries to associate with HT40+/- mis-match?
I think ieee80211_enable_ht() checks this?
Quoted 2 lines
Do you want me to repost this patch without the
WARN_ON_ONCEchanges?
For now, I think that'd be nicer. I suspect it doesn't actually matter since the above means we can't get into that situation. Still we may want WARN_ON_ONCE to prevent being flooded, but I guess it should be a separate patch?
johannes