Skip to contentSkip to conversation

mac80211: Recalculate channel-type on iface removal.

PATCH In review [email protected] 2 participants 2 messages Jan 31, 2011 – Feb 1, 2011 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---
v2: Just deal with channel-change calc, not the WARN_ON_ONCE
stuff. Will get that later in separate patch.

:100644 100644 605c222... abf5f8e... M net/mac80211/iface.c

 net/mac80211/iface.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
net/mac80211/iface.c +8 -1
index 605c222..abf5f8e 100644
@@ -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
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 5 lines · On Mon, 2011-01-31 at 11:30 -0800, [email protected] wrote:

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.

Seems fine to me.

Quoted 37 lines

---
v2: Just deal with channel-change calc, not the WARN_ON_ONCE
stuff. Will get that later in separate patch.

:100644 100644 605c222... abf5f8e... M net/mac80211/iface.c

 net/mac80211/iface.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
net/mac80211/iface.c +8 -1
index 605c222..abf5f8e 100644
@@ -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);