From patchwork Mon Jan 31 18:37:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 520541 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0VIbwFO027884 for ; Mon, 31 Jan 2011 18:37:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755689Ab1AaSh5 (ORCPT ); Mon, 31 Jan 2011 13:37:57 -0500 Received: from mail.candelatech.com ([208.74.158.172]:54267 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755541Ab1AaSh5 (ORCPT ); Mon, 31 Jan 2011 13:37:57 -0500 Received: from localhost.localdomain (firewall.candelatech.com [70.89.124.249]) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id p0VIbrLe027907 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 31 Jan 2011 10:37:54 -0800 From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH] mac80211: Recalculate channel-type on iface removal. Date: Mon, 31 Jan 2011 10:37:52 -0800 Message-Id: <1296499072-6721-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.2.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 31 Jan 2011 18:37:59 +0000 (UTC) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 5b24740..ad9055d 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -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; } diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 605c222..abf5f8e 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -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);