Skip to contentSkip to conversation

mac80211/minstrel_ht: add support for using CCK rates

PATCH Applied Felix Fietkau 4 participants 9 messages Feb 13, 2013 – Mar 17, 2013 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 mac80211/minstrel_ht: add support for using CCK rates

When MCS rates start to get bad in 2.4 GHz because of long range or strong interference, CCK rates can be a lot more robust.

This patch adds a pseudo MCS group containing CCK rates (long preamble in the lower 4 slots, short preamble in the upper slots).

---
 net/mac80211/rc80211_minstrel.c            |  29 ++++++
 net/mac80211/rc80211_minstrel.h            |   2 +
 net/mac80211/rc80211_minstrel_ht.c         | 152 +++++++++++++++++++++++++----
 net/mac80211/rc80211_minstrel_ht.h         |   5 +-
 net/mac80211/rc80211_minstrel_ht_debugfs.c | 109 +++++++++++++--------
 5 files changed, 237 insertions(+), 60 deletions(-)
net/mac80211/rc80211_minstrel.c +29 -0
index 8c5acdc..eea45a2 100644
@@ -494,6 +494,33 @@ minstrel_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta)
 	kfree(mi);
 }
 
+static void
+minstrel_init_cck_rates(struct minstrel_priv *mp)
+{
+	static const int bitrates[4] = { 10, 20, 55, 110 };
+	struct ieee80211_supported_band *sband;
+	int i, j;
+
+	sband = mp->hw->wiphy->bands[IEEE80211_BAND_2GHZ];
+	if (!sband)
+		return;
+
+	for (i = 0, j = 0; i < sband->n_bitrates; i++) {
+		struct ieee80211_rate *rate = &sband->bitrates[i];
+
+		if (rate->flags & IEEE80211_RATE_ERP_G)
+			continue;
+
+		for (j = 0; j < ARRAY_SIZE(bitrates); j++) {
+			if (rate->bitrate != bitrates[j])
+				continue;
+
+			mp->cck_rates[j] = i;
+			break;
+		}
+	}
+}
+
 static void *
 minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
 {
@@ -539,6 +566,8 @@ minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
 			S_IRUGO | S_IWUGO, debugfsdir, &mp->fixed_rate_idx);
 #endif
 
+	minstrel_init_cck_rates(mp);
+
 	return mp;
 }
 
net/mac80211/rc80211_minstrel.h +2 -0
index 5d278ec..5ecf757 100644
@@ -79,6 +79,8 @@ struct minstrel_priv {
 	unsigned int lookaround_rate;
 	unsigned int lookaround_rate_mrr;
 
+	u8 cck_rates[4];
+
 #ifdef CONFIG_MAC80211_DEBUGFS
 	/*
 	 * enable fixed rate processing per RC
net/mac80211/rc80211_minstrel_ht.c +135 -17

278 lines not on this page · raw message

net/mac80211/rc80211_minstrel_ht.h +4 -1
index 462d2b2..302dbd5 100644
@@ -107,8 +107,11 @@ struct minstrel_ht_sta {
 	/* current MCS group to be sampled */
 	u8 sample_group;
 
+	u8 cck_supported;
+	u8 cck_supported_short;
+
 	/* MCS rate group info and statistics */
-	struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS];
+	struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS + 1];
 };
 
 struct minstrel_ht_sta_priv {
net/mac80211/rc80211_minstrel_ht_debugfs.c +67 -42

129 lines not on this page · raw message

Signature · 1 line
1.8.0.2
maintainer Applied
#1 lore raw
Quoted 5 lines · Felix Fietkau

When MCS rates start to get bad in 2.4 GHz because of long range or strong interference, CCK rates can be a lot more robust.

This patch adds a pseudo MCS group containing CCK rates (long preamble in the lower 4 slots, short preamble in the upper slots).

Applied, I made minstrel_ht_get_stats static.

johannes

#2 lore raw
In reply to Felix Fietkau
Quoted 6 lines · Felix Fietkau

When MCS rates start to get bad in 2.4 GHz because of long range or strong interference, CCK rates can be a lot more robust.

This patch adds a pseudo MCS group containing CCK rates (long preamble in the lower 4 slots, short preamble in the upper slots).

With this, mac80211 might send CCK rates with IEEE80211_TX_CTL_AMPDU set. For aggregates, if we don't currently set NO_CCK, at the very least the 1st rate index should belong to an MCS_GROUP.

Karl

maintainer
#3 lore raw
Quoted 10 lines · Karl Beldan
Quoted 6 lines · Felix Fietkau

When MCS rates start to get bad in 2.4 GHz because of long range or strong interference, CCK rates can be a lot more robust.

This patch adds a pseudo MCS group containing CCK rates (long preamble in the lower 4 slots, short preamble in the upper slots).

With this, mac80211 might send CCK rates with IEEE80211_TX_CTL_AMPDU set. For aggregates, if we don't currently set NO_CCK, at the very least the 1st rate index should belong to an MCS_GROUP.

I guess that depends on how you expect rate control to work ... I'd kinda expect the driver to skip aggregation then? I think only ath9k even uses minstrel + aggregation?

johannes

#4 lore raw
Quoted 8 lines · Johannes Berg
Quoted 7 lines · Karl Beldan
Quoted 6 lines · Felix Fietkau

When MCS rates start to get bad in 2.4 GHz because of long range or strong interference, CCK rates can be a lot more robust.

This patch adds a pseudo MCS group containing CCK rates (long preamble in the lower 4 slots, short preamble in the upper slots).

Quoted 8 lines
Quoted 3 lines

With this, mac80211 might send CCK rates with IEEE80211_TX_CTL_AMPDU set. For aggregates, if we don't currently set NO_CCK, at the very least the 1st rate index should belong to an MCS_GROUP.

I guess that depends on how you expect rate control to work ... I'd kinda expect the driver to skip aggregation then? I think only ath9k even uses minstrel + aggregation?

This changes the meaning of IEEE80211_TX_CTL_AMPDU.
With this there are more possible RC feedback pitfalls with the tx statuses IEEE80211_TX_{CTL,STAT}_AMPDU flags.
Regarding the drivers using minstrel + aggregation I can't really say, I know ath9k runs ok with it and at work I settled for minstrel too with a driver for our IP on a demo board.

Karl

#5 lore raw
Quoted 18 lines · Karl Beldan
Quoted 8 lines · Johannes Berg
Quoted 7 lines · Karl Beldan
Quoted 6 lines · Felix Fietkau

When MCS rates start to get bad in 2.4 GHz because of long range or strong interference, CCK rates can be a lot more robust.

This patch adds a pseudo MCS group containing CCK rates (long preamble in the lower 4 slots, short preamble in the upper slots).

Quoted 8 lines
Quoted 3 lines

With this, mac80211 might send CCK rates with IEEE80211_TX_CTL_AMPDU set. For aggregates, if we don't currently set NO_CCK, at the very least the 1st rate index should belong to an MCS_GROUP.

I guess that depends on how you expect rate control to work ... I'd kinda expect the driver to skip aggregation then? I think only ath9k even uses minstrel + aggregation?

Quoted 6 lines

This changes the meaning of IEEE80211_TX_CTL_AMPDU.
With this there are more possible RC feedback pitfalls with the tx statuses IEEE80211_TX_{CTL,STAT}_AMPDU flags.
Regarding the drivers using minstrel + aggregation I can't really say, I know ath9k runs ok with it and at work I settled for minstrel too with a driver for our IP on a demo board.

It's important that the IEEE80211_TX_CTL_AMPDU flag is still set, because the frame is still part of the BlockAck window, just sent with a rate that doesn't allow aggregating it with other frames, so it is still part of the A-MPDU session.
If there are any drivers that cannot easily be changed to support that, we should have an explicit flag to disable using CCK with 802.11n stations.

- Felix

#6 lore raw
Quoted 25 lines · Felix Fietkau
Quoted 18 lines · Karl Beldan
Quoted 8 lines · Johannes Berg
Quoted 7 lines · Karl Beldan
Quoted 6 lines · Felix Fietkau

When MCS rates start to get bad in 2.4 GHz because of long range or strong interference, CCK rates can be a lot more robust.

This patch adds a pseudo MCS group containing CCK rates (long preamble in the lower 4 slots, short preamble in the upper slots).

Quoted 8 lines
Quoted 3 lines

With this, mac80211 might send CCK rates with IEEE80211_TX_CTL_AMPDU set. For aggregates, if we don't currently set NO_CCK, at the very least the 1st rate index should belong to an MCS_GROUP.

I guess that depends on how you expect rate control to work ... I'd kinda expect the driver to skip aggregation then? I think only ath9k even uses minstrel + aggregation?

Quoted 6 lines

This changes the meaning of IEEE80211_TX_CTL_AMPDU.
With this there are more possible RC feedback pitfalls with the tx statuses IEEE80211_TX_{CTL,STAT}_AMPDU flags.
Regarding the drivers using minstrel + aggregation I can't really say, I know ath9k runs ok with it and at work I settled for minstrel too with a driver for our IP on a demo board.

Quoted 4 lines

It's important that the IEEE80211_TX_CTL_AMPDU flag is still set, because the frame is still part of the BlockAck window, just sent with a rate that doesn't allow aggregating it with other frames, so it is still part of the A-MPDU session.

The best way I could look at it was that it would let drivers know the frame is being transmitted under BA, but it still changes the meaning and thus the handling of the flag.
Frankly, if the meaning "officially" becomes "this frames is being transmitted under BA", as the code behaves, and you seem to say, I am all for it ;)

Karl

#7 lore raw
Quoted 6 lines · Karl Beldan

The best way I could look at it was that it would let drivers know the frame is being transmitted under BA, but it still changes the meaning and thus the handling of the flag.
Frankly, if the meaning "officially" becomes "this frames is being transmitted under BA", as the code behaves, and you seem to say, I am all for it ;)

Well, having it be "This frame is being transmitted under aggregation" can't be guaranteed anyway.

Eg, imagine the case where your BA window is such that you've sent 0 .. 63 and only received a BA for 1..63.
So you have to send one single frame - why would you request a blockack and why would you transmit it as an aggregate? :)

So hopefully hardware already knows how to deal with this.

Now, whether firmware deals with being given multiple frames to transmit that fall inside the BA window _but_ you've requested to transmit it at CCK rates (or legacy OFDM rates for 11na) then.. who knows. :)

Adrian

#8 lore raw
Quoted 9 lines · Adrian Chadd
Quoted 6 lines · Karl Beldan

The best way I could look at it was that it would let drivers know the frame is being transmitted under BA, but it still changes the meaning and thus the handling of the flag.
Frankly, if the meaning "officially" becomes "this frames is being transmitted under BA", as the code behaves, and you seem to say, I am all for it ;)

Quoted 8 lines

Well, having it be "This frame is being transmitted under aggregation" can't be guaranteed anyway.

Eg, imagine the case where your BA window is such that you've sent 0 .. 63 and only received a BA for 1..63.
So you have to send one single frame - why would you request a blockack and why would you transmit it as an aggregate? :)

When I wrote "under BA", I meant "under BlockAck Aggreement" not "will be aggregated" ;)

Karl