Skip to contentSkip to conversation

cfg80211: beacon hint improvements

PATCH In review Luis R. Rodriguez 2 participants 6 messages Dec 13, 2012 – Dec 14, 2012 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

cover cfg80211: beacon hint improvements

From: "Luis R. Rodriguez" <[email protected]>

Just a few improvements for beacon hint processing due to scheduling considerations and discovered by Ben with a lot of stations. For details see:

http://article.gmane.org/gmane.linux.kernel.wireless.general/101482

Luis R. Rodriguez (3):
cfg80211: do not process beacon hints if one is already queued
cfg80211: move reg_is_world_roaming()
cfg80211: move world roaming check for beacon hints

 net/wireless/reg.c |   48 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 34 insertions(+), 14 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/3 cfg80211: do not process beacon hints if one is already queued

From: "Luis R. Rodriguez" <[email protected]>

Regulatory beacon hints are used to help with world roaming and as it is right now we learn from a beacon hint processed on one wiphy to all other wiphys. The processing of beacon hints however is scheduled and if we have a lot of interfaces we may hit the case that we'll queue a the same beacon hint many times until its processed.

To avoid this do a lookup on the queued up beacon hints prior to adding a new beacon hint. If the beacon hint is removed from the pending reg beacon hint list then it would be processed and we'd ensure all wiphys would have learned from it, if its on the pending reg beacon list we'd now find it prior to it being processed.

---
 net/wireless/reg.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
net/wireless/reg.c +19 -0
index 6e53089..a2d5a03 100644
@@ -2051,11 +2051,23 @@ static bool freq_is_chan_12_13_14(u16 freq)
 	return false;
 }
 
+static bool pending_reg_beacon(struct ieee80211_channel *beacon_chan)
+{
+	struct reg_beacon *pending_beacon;
+
+	list_for_each_entry(pending_beacon, &reg_pending_beacons, list)
+		if (beacon_chan->center_freq ==
+		    pending_beacon->chan.center_freq)
+			return true;
+	return false;
+}
+
 int regulatory_hint_found_beacon(struct wiphy *wiphy,
 				 struct ieee80211_channel *beacon_chan,
 				 gfp_t gfp)
 {
 	struct reg_beacon *reg_beacon;
+	bool processing;
 
 	if (likely((beacon_chan->beacon_found ||
 	    (beacon_chan->flags & IEEE80211_CHAN_RADAR) ||
@@ -2063,6 +2075,13 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy,
 	     !freq_is_chan_12_13_14(beacon_chan->center_freq)))))
 		return 0;
 
+	spin_lock_bh(&reg_pending_beacons_lock);
+	processing = pending_reg_beacon(beacon_chan);
+	spin_unlock_bh(&reg_pending_beacons_lock);
+
+	if (processing)
+		return 0;
+
 	reg_beacon = kzalloc(sizeof(struct reg_beacon), gfp);
 	if (!reg_beacon)
 		return -ENOMEM;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/3 cfg80211: move reg_is_world_roaming()

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This will be used later by other code. This has no functional change.

---
 net/wireless/reg.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
net/wireless/reg.c +12 -12
index a2d5a03..f649b5e 100644
@@ -1042,6 +1042,18 @@ static bool ignore_reg_update(struct wiphy *wiphy,
 	return false;
 }
 
+static bool reg_is_world_roaming(struct wiphy *wiphy)
+{
+	if (is_world_regdom(cfg80211_regdomain->alpha2) ||
+	    (wiphy->regd && is_world_regdom(wiphy->regd->alpha2)))
+		return true;
+	if (last_request &&
+	    last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
+	    wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)
+		return true;
+	return false;
+}
+
 static void handle_reg_beacon(struct wiphy *wiphy,
 			      unsigned int chan_idx,
 			      struct reg_beacon *reg_beacon)
@@ -1128,18 +1140,6 @@ static void wiphy_update_beacon_reg(struct wiphy *wiphy)
 	}
 }
 
-static bool reg_is_world_roaming(struct wiphy *wiphy)
-{
-	if (is_world_regdom(cfg80211_regdomain->alpha2) ||
-	    (wiphy->regd && is_world_regdom(wiphy->regd->alpha2)))
-		return true;
-	if (last_request &&
-	    last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
-	    wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)
-		return true;
-	return false;
-}
-
 /* Reap the advantages of previously found beacons */
 static void reg_process_beacons(struct wiphy *wiphy)
 {
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/3 cfg80211: move world roaming check for beacon hints

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

We should not add new beacon hints even if the wiphy is not world roaming. Without this we were always adding a beacon hint if not world roaming for every non world roaming wiphy interface.

---
 net/wireless/reg.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/wireless/reg.c +3 -2
index f649b5e..bdc42d9 100644
@@ -1076,6 +1076,9 @@ static void handle_reg_beacon(struct wiphy *wiphy,
 
 	chan->beacon_found = true;
 
+	if (!reg_is_world_roaming(wiphy))
+		return;
+
 	if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS)
 		return;
 
@@ -1149,8 +1152,6 @@ static void reg_process_beacons(struct wiphy *wiphy)
 	 */
 	if (!last_request)
 		return;
-	if (!reg_is_world_roaming(wiphy))
-		return;
 	wiphy_update_beacon_reg(wiphy);
 }
 
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [RFT 3/3] cfg80211: move world roaming check for beacon hints

Quoted 3 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

We should not add new beacon hints even if the wiphy

Maybe 'even' shouldn't be there?

I'll add this series to our kernels for testing...

Thanks,
Ben

Quoted 35 lines

is not world roaming. Without this we were always adding a beacon hint if not world roaming for every non world roaming wiphy interface.

---
  net/wireless/reg.c |    5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
net/wireless/reg.c +3 -2
index f649b5e..bdc42d9 100644
@@ -1076,6 +1076,9 @@ static void handle_reg_beacon(struct wiphy *wiphy,
 
  	chan->beacon_found = true;
 
+	if (!reg_is_world_roaming(wiphy))
+		return;
+
  	if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS)
  		return;
 
@@ -1149,8 +1152,6 @@ static void reg_process_beacons(struct wiphy *wiphy)
  	 */
  	if (!last_request)
  		return;
-	if (!reg_is_world_roaming(wiphy))
-		return;
  	wiphy_update_beacon_reg(wiphy);
  }
 
Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
Tested-by on the v1 series
#5 lore raw
In reply to Luis R. Rodriguez
Quoted 5 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

Just a few improvements for beacon hint processing due to scheduling considerations and discovered by Ben with a lot of stations. For details see:

I added this and Johannes' station cleanup patches to 3.7 and the 600-station tests are running well so far. I see a few beacon messages, but no spammage. (I also backed out my rate-limit patch on the beacon messages, so if they *were* inclined to spam, I should have seen it).

So:

Thanks,
Ben

Quoted 11 lines

http://article.gmane.org/gmane.linux.kernel.wireless.general/101482

Luis R. Rodriguez (3):
cfg80211: do not process beacon hints if one is already queued
cfg80211: move reg_is_world_roaming()
cfg80211: move world roaming check for beacon hints

  net/wireless/reg.c |   48 ++++++++++++++++++++++++++++++++++--------------
  1 file changed, 34 insertions(+), 14 deletions(-)
Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com