Skip to contentSkip to conversation

mac80211: dynamic short slot time for MBSSs

PATCH Superseded Thomas Pedersen 2 participants 6 messages Jan 26, 2013 mac80211

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mac80211: dynamic short slot time for MBSSs

The standard mandates mesh STAs to set the ERP Short Slot Time capability info bit in beacons to 0. Even though this is their way of disallowing short slot time for mesh STAs, there should be no harm in enabling it if we determine all STAs in the current MBSS support ERP rates.

Increases throughput about 20% for legacy rates when enabled.

---

v2:
fix survey logic

 net/mac80211/mesh.c       |    5 ----
 net/mac80211/mesh_plink.c |   67 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 5 deletions(-)
net/mac80211/mesh.c +0 -5
index 694e273..f920da1 100644
@@ -629,11 +629,6 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
 	sdata->vif.bss_conf.basic_rates =
 		ieee80211_mandatory_rates(local, band);
 
-	if (band == IEEE80211_BAND_5GHZ) {
-		sdata->vif.bss_conf.use_short_slot = true;
-		changed |= BSS_CHANGED_ERP_SLOT;
-	}
-
 	ieee80211_bss_info_change_notify(sdata, changed);
 
 	netif_carrier_on(sdata->dev);
net/mac80211/mesh_plink.c +67 -0

91 lines not on this page · raw message

Signature · 1 line
1.7.10.4
maintainer
#1 lore raw

net/mac80211/mesh_plink.c static inline void mesh_plink_fsm_restart(struct sta_info *sta) · line 100

Quoted 4 lines · Thomas Pedersen
net/mac80211/mesh_plink.c +3 -0
+	u32 rates, changed = 0;
 
+		for_each_set_bit(i, (unsigned long *)&rates,
+				 sizeof(rates) * BITS_PER_BYTE) {

this is broken on 64-bit architectures.

johannes

maintainer
#3 lore raw
In reply to Thomas Pedersen

net/mac80211/mesh_plink.c static inline void mesh_plink_fsm_restart(struct sta_info *sta) · line 89

Quoted 3 lines
net/mac80211/mesh_plink.c +2 -0
+	sband = local->hw.wiphy->bands[band];
+	bitrates = sband->bitrates;

It might be interesting to loop once here and build a bitmap (in an unsigned long) of rates marked ERP_G. Something like

erp_rates = 0;
for (i = 0; i < sband->n_bitrates; i++)

	if (bitrates[i].flags & ...)
		erp_rates |= BIT(i);
Quoted 8 lines
net/mac80211/mesh_plink.c +8 -0
+	rcu_read_lock();
+	list_for_each_entry_rcu(sta, &local->sta_list, list) {
+		if (sdata != sta->sdata ||
+		    sta->plink_state != NL80211_PLINK_ESTAB)
+			continue;
+
+		short_slot = false;
+		rates = sta->sta.supp_rates[band];

net/mac80211/mesh_plink.c static inline void mesh_plink_fsm_restart(struct sta_info *sta) · line 108

Quoted 10 lines
net/mac80211/mesh_plink.c +10 -0
+		for_each_set_bit(i, (unsigned long *)&rates,
+				 sizeof(rates) * BITS_PER_BYTE) {
+			if (bitrates[i].flags & IEEE80211_RATE_ERP_G) {
+				short_slot = true;
+				break;
+			}
+		}
+
+		if (!short_slot)
+			break;

Then the inner bitrate loop here becomes just

		if (!(rates & erp_rates)) {
			short_slot = false;
			break;
		}

which assumes "short_slot = true" as a precondition to going into the sta loop.

(although that does change the overall logic to enable short slot when NO stations are present)

johannes

maintainer
#2 lore raw
In reply to Johannes Berg
Quoted 8 lines · Johannes Berg

net/mac80211/mesh_plink.c static inline void mesh_plink_fsm_restart(struct sta_info *sta) · line 100

Quoted 4 lines · Thomas Pedersen
net/mac80211/mesh_plink.c +3 -0
+	u32 rates, changed = 0;
 
+		for_each_set_bit(i, (unsigned long *)&rates,
+				 sizeof(rates) * BITS_PER_BYTE) {

this is broken on 64-bit architectures.

Actually, probably only on big endian 64-bit architectures.

johannes

#4 lore raw
In reply to Johannes Berg
Quoted 34 lines · Johannes Berg

net/mac80211/mesh_plink.c static inline void mesh_plink_fsm_restart(struct sta_info *sta) · line 89

Quoted 3 lines
net/mac80211/mesh_plink.c +2 -0
+     sband = local->hw.wiphy->bands[band];
+     bitrates = sband->bitrates;

It might be interesting to loop once here and build a bitmap (in an unsigned long) of rates marked ERP_G. Something like

erp_rates = 0;
for (i = 0; i < sband->n_bitrates; i++)

        if (bitrates[i].flags & ...)
                erp_rates |= BIT(i);
Quoted 8 lines
net/mac80211/mesh_plink.c +8 -0
+     rcu_read_lock();
+     list_for_each_entry_rcu(sta, &local->sta_list, list) {
+             if (sdata != sta->sdata ||
+                 sta->plink_state != NL80211_PLINK_ESTAB)
+                     continue;
+
+             short_slot = false;
+             rates = sta->sta.supp_rates[band];

net/mac80211/mesh_plink.c static inline void mesh_plink_fsm_restart(struct sta_info *sta) · line 108

Quoted 10 lines
net/mac80211/mesh_plink.c +10 -0
+             for_each_set_bit(i, (unsigned long *)&rates,
+                              sizeof(rates) * BITS_PER_BYTE) {
+                     if (bitrates[i].flags & IEEE80211_RATE_ERP_G) {
+                             short_slot = true;
+                             break;
+                     }
+             }
+
+             if (!short_slot)
+                     break;

Then the inner bitrate loop here becomes just

Quoted 4 lines
                if (!(rates & erp_rates)) {
                        short_slot = false;
                        break;
                }

Huh, that's actually pretty nice. I don't really get why the for_each_set_bit() is broken on big endian 64-bit systems, but hey this approach takes care of that concern :)

Quoted 5 lines

which assumes "short_slot = true" as a precondition to going into the sta loop.

(although that does change the overall logic to enable short slot when NO stations are present)

Sure. We'll disable it when not locally supported anyway.

Thanks.

Signature · 1 line
Thomas
maintainer
#5 lore raw
Quoted 1 line · Thomas Pedersen

Huh, that's actually pretty nice.

:)

Quoted 3 lines

I don't really get why the
for_each_set_bit() is broken on big endian 64-bit systems, but hey this approach takes care of that concern :)

Because then you're taking the address of a 32-bit variable, and treating it as an unsigned long (64 bits), so if you iterate its 64 bits then you'll get some random other stuff from the stack (on both big and little endian actually, I thought you were limiting it to n_bitrates then it would work on little endian)

johannes