linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
	Johannes Berg <johannes.berg@intel.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 9/9] mac80211: reprogram in interface order
Date: Tue,  8 Dec 2015 16:04:39 +0200	[thread overview]
Message-ID: <1449583479-26658-10-git-send-email-emmanuel.grumbach@intel.com> (raw)
In-Reply-To: <1449583479-26658-1-git-send-email-emmanuel.grumbach@intel.com>

From: Johannes Berg <johannes.berg@intel.com>

During reprogramming, mac80211 currently first adds all the channel
contexts, then binds them to the vifs and then goes to reconfigure
all the interfaces. Drivers might, perhaps implicitly, rely on the
operation order for certain things that typically happen within a
single function elsewhere in mac80211. To avoid problems with that,
reorder the code in mac80211's restart/reprogramming to work fully
within the interface loop so that the order of operations is like
in normal operation.

For iwlwifi, this fixes a firmware crash when reprogramming with an
AP/GO interface active.

Reported-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 net/mac80211/util.c | 76 ++++++++++++++++++++++++++---------------------------
 1 file changed, 37 insertions(+), 39 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 1a26ebd..f4b2c04 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1726,6 +1726,27 @@ static void ieee80211_assign_chanctx(struct ieee80211_local *local,
 	mutex_unlock(&local->chanctx_mtx);
 }
 
+static void ieee80211_reconfig_stations(struct ieee80211_sub_if_data *sdata)
+{
+	struct ieee80211_local *local = sdata->local;
+	struct sta_info *sta;
+
+	/* add STAs back */
+	mutex_lock(&local->sta_mtx);
+	list_for_each_entry(sta, &local->sta_list, list) {
+		enum ieee80211_sta_state state;
+
+		if (!sta->uploaded || sta->sdata != sdata)
+			continue;
+
+		for (state = IEEE80211_STA_NOTEXIST;
+		     state < sta->sta_state; state++)
+			WARN_ON(drv_sta_state(local, sta->sdata, sta, state,
+					      state + 1));
+	}
+	mutex_unlock(&local->sta_mtx);
+}
+
 int ieee80211_reconfig(struct ieee80211_local *local)
 {
 	struct ieee80211_hw *hw = &local->hw;
@@ -1861,50 +1882,11 @@ int ieee80211_reconfig(struct ieee80211_local *local)
 				WARN_ON(drv_add_chanctx(local, ctx));
 		mutex_unlock(&local->chanctx_mtx);
 
-		list_for_each_entry(sdata, &local->interfaces, list) {
-			if (!ieee80211_sdata_running(sdata))
-				continue;
-			ieee80211_assign_chanctx(local, sdata);
-		}
-
 		sdata = rtnl_dereference(local->monitor_sdata);
 		if (sdata && ieee80211_sdata_running(sdata))
 			ieee80211_assign_chanctx(local, sdata);
 	}
 
-	/* add STAs back */
-	mutex_lock(&local->sta_mtx);
-	list_for_each_entry(sta, &local->sta_list, list) {
-		enum ieee80211_sta_state state;
-
-		if (!sta->uploaded)
-			continue;
-
-		/* AP-mode stations will be added later */
-		if (sta->sdata->vif.type == NL80211_IFTYPE_AP)
-			continue;
-
-		for (state = IEEE80211_STA_NOTEXIST;
-		     state < sta->sta_state; state++)
-			WARN_ON(drv_sta_state(local, sta->sdata, sta, state,
-					      state + 1));
-	}
-	mutex_unlock(&local->sta_mtx);
-
-	/* reconfigure tx conf */
-	if (hw->queues >= IEEE80211_NUM_ACS) {
-		list_for_each_entry(sdata, &local->interfaces, list) {
-			if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
-			    sdata->vif.type == NL80211_IFTYPE_MONITOR ||
-			    !ieee80211_sdata_running(sdata))
-				continue;
-
-			for (i = 0; i < IEEE80211_NUM_ACS; i++)
-				drv_conf_tx(local, sdata, i,
-					    &sdata->tx_conf[i]);
-		}
-	}
-
 	/* reconfigure hardware */
 	ieee80211_hw_config(local, ~0);
 
@@ -1917,6 +1899,22 @@ int ieee80211_reconfig(struct ieee80211_local *local)
 		if (!ieee80211_sdata_running(sdata))
 			continue;
 
+		ieee80211_assign_chanctx(local, sdata);
+
+		switch (sdata->vif.type) {
+		case NL80211_IFTYPE_AP_VLAN:
+		case NL80211_IFTYPE_MONITOR:
+			break;
+		default:
+			ieee80211_reconfig_stations(sdata);
+			/* fall through */
+		case NL80211_IFTYPE_AP: /* AP stations are handled later */
+			for (i = 0; i < IEEE80211_NUM_ACS; i++)
+				drv_conf_tx(local, sdata, i,
+					    &sdata->tx_conf[i]);
+			break;
+		}
+
 		/* common change flags for all interface types */
 		changed = BSS_CHANGED_ERP_CTS_PROT |
 			  BSS_CHANGED_ERP_PREAMBLE |
-- 
2.5.0


      parent reply	other threads:[~2015-12-08 14:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 14:04 [PATCH 0/9] various mac80211 / cfg80211 patches Emmanuel Grumbach
2015-12-08 14:04 ` [PATCH 1/9] mac80211: process and save VHT MU-MIMO group frame Emmanuel Grumbach
2015-12-08 14:04 ` [PATCH 2/9] mac80211: limit the A-MSDU Tx based on peer's capabilities Emmanuel Grumbach
2015-12-08 16:02   ` Krishna Chaitanya
2015-12-08 16:31     ` Grumbach, Emmanuel
     [not found]       ` <CABPxzYKp-97mNgtZZubiQ3Ew2VjOh-hFRPRwLY5WLvac9kU32g@mail.gmail.com>
2015-12-08 16:43         ` Grumbach, Emmanuel
     [not found]           ` <CABPxzYKZ8k1HvkygEuEy4dhc4xcc2ss9Bt8jJKcQ98DWZK9pvw@mail.gmail.com>
2015-12-08 19:06             ` Grumbach, Emmanuel
     [not found]               ` <CABPxzYJ445Xb1-znpG8w_8cUbZ1OVtBCCpgY9gOTPTpcs66DAQ@mail.gmail.com>
2015-12-08 19:22                 ` Grumbach, Emmanuel
2015-12-09  7:00                   ` Krishna Chaitanya
2015-12-08 14:04 ` [PATCH 3/9] mac80211: add flag for duplication check Emmanuel Grumbach
2015-12-08 14:04 ` [PATCH 4/9] mac80211: pass aggregation window size to lower level Emmanuel Grumbach
2015-12-08 14:04 ` [PATCH 5/9] mac80211: document status.freq restrictions Emmanuel Grumbach
2015-12-08 14:04 ` [PATCH 6/9] mac80211: handle width changes from opmode notification IE in beacon Emmanuel Grumbach
2015-12-08 15:38   ` Krishna Chaitanya
2015-12-08 15:42     ` Johannes Berg
2015-12-08 15:47       ` Krishna Chaitanya
2015-12-08 15:53         ` Johannes Berg
2015-12-08 15:55           ` Krishna Chaitanya
2015-12-08 15:58             ` Johannes Berg
2015-12-08 16:03               ` Krishna Chaitanya
2015-12-08 14:04 ` [PATCH 7/9] mac80211: suppress unchanged "limiting TX power" messages Emmanuel Grumbach
2015-12-08 14:04 ` [PATCH 8/9] mac80211: run scan completed work on reconfig failure Emmanuel Grumbach
2015-12-08 14:04 ` Emmanuel Grumbach [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449583479-26658-10-git-send-email-emmanuel.grumbach@intel.com \
    --to=emmanuel.grumbach@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).