Skip to contentSkip to conversation

mac80211/minstrel_ht: show the number of retries for each rate in debugfs

PATCH Superseded Felix Fietkau 3 participants 7 messages Feb 11, 2013 mac80211

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 mac80211/minstrel_ht: show the number of retries for each rate in debugfs

---
 net/mac80211/rc80211_minstrel_ht_debugfs.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
net/mac80211/rc80211_minstrel_ht_debugfs.c +6 -5
index e788f76..f2b7d26 100644
@@ -38,8 +38,8 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file)
 
 	file->private_data = ms;
 	p = ms->buf;
-	p += sprintf(p, "type      rate     throughput  ewma prob   this prob  "
-			"this succ/attempt   success    attempts\n");
+	p += sprintf(p, "type         rate     throughput  ewma prob   this prob  "
+			"retry   this succ/attempt   success    attempts\n");
 	for (i = 0; i < MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS; i++) {
 		char htmode = '2';
 		char gimode = 'L';
@@ -64,18 +64,19 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file)
 			*(p++) = (idx == mi->max_tp_rate) ? 'T' : ' ';
 			*(p++) = (idx == mi->max_tp_rate2) ? 't' : ' ';
 			*(p++) = (idx == mi->max_prob_rate) ? 'P' : ' ';
-			p += sprintf(p, "MCS%-2u", (minstrel_mcs_groups[i].streams - 1) *
+			p += sprintf(p, " MCS%-2u", (minstrel_mcs_groups[i].streams - 1) *
 					MCS_GROUP_RATES + j);
 
 			tp = mr->cur_tp / 10;
 			prob = MINSTREL_TRUNC(mr->cur_prob * 1000);
 			eprob = MINSTREL_TRUNC(mr->probability * 1000);
 
-			p += sprintf(p, "  %6u.%1u   %6u.%1u   %6u.%1u        "
-					"%3u(%3u)   %8llu    %8llu\n",
+			p += sprintf(p, "      %6u.%1u   %6u.%1u    %6u.%1u    "
+					"%3u            %3u(%3u)  %8llu    %8llu\n",
 					tp / 10, tp % 10,
 					eprob / 10, eprob % 10,
 					prob / 10, prob % 10,
+					mr->retry_count,
 					mr->last_success,
 					mr->last_attempts,
 					(unsigned long long)mr->succ_hist,
Signature · 1 line
1.8.0.2
#1 lore raw

PATCH v2 2/3 mac80211/minstrel_ht: remove the sampling bypass check for the lowest rate

It's more of an unnecessary micro-optimization and it prevents switching from long-GI to short-GI in HT20/single-stream for the lowest rate

---
 net/mac80211/rc80211_minstrel_ht.c | 4 ----
 1 file changed, 4 deletions(-)
net/mac80211/rc80211_minstrel_ht.c +0 -4
index 9f9c453..5bb316a 100644
@@ -231,10 +231,6 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
 			if (!mr->cur_tp)
 				continue;
 
-			/* ignore the lowest rate of each single-stream group */
-			if (!i && minstrel_mcs_groups[group].streams == 1)
-				continue;
-
 			if ((mr->cur_tp > cur_prob_tp && mr->probability >
 			     MINSTREL_FRAC(3, 4)) || mr->probability > cur_prob) {
 				mg->max_prob_rate = index;
Signature · 1 line
1.8.0.2
#2 lore raw

PATCH v2 3/3 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
#3 lore raw

Re: [PATCH v2 3/3] mac80211/minstrel_ht: add support for using CCK rates

Quoted 13 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).

---
static void

net/mac80211/rc80211_minstrel_ht.c +4 -0
+minstrel_ht_update_cck(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
+		       struct ieee80211_supported_band *sband,
+		       struct ieee80211_sta *sta)
+{

net/mac80211/rc80211_minstrel_ht.c minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, · line 788

Quoted 10 lines
net/mac80211/rc80211_minstrel_ht.c +10 -0
+	int i;
+
+	if (sband->band != IEEE80211_BAND_2GHZ)
+		return;
+
+	mi->cck_supported = 0;
+	mi->cck_supported_short = 0;
+	for (i = 0; i < 4; i++) {
+		if (!rate_supported(sta, sband->band, mp->cck_rates[i]))
+			continue;

Don't we need to check if the receiver (and the minstrel_ht sender) supports IEEE80211_HT_CAP_DSSSCCK40 when the phy is in HT40+/- mode?

Regards,
Christian

#4 lore raw

Re: [PATCH v2 3/3] mac80211/minstrel_ht: add support for using CCK rates

Quoted 19 lines · Christian Lamparter
Quoted 18 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).

---
static void

net/mac80211/rc80211_minstrel_ht.c +9 -0
+minstrel_ht_update_cck(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
+		       struct ieee80211_supported_band *sband,
+		       struct ieee80211_sta *sta)
+{
+	int i;
+
+	if (sband->band != IEEE80211_BAND_2GHZ)
+		return;
+
Quoted 8 lines

net/mac80211/rc80211_minstrel_ht.c minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, · line 788

Quoted 5 lines
net/mac80211/rc80211_minstrel_ht.c +5 -0
+	mi->cck_supported = 0;
+	mi->cck_supported_short = 0;
+	for (i = 0; i < 4; i++) {
+		if (!rate_supported(sta, sband->band, mp->cck_rates[i]))
+			continue;

Don't we need to check if the receiver (and the minstrel_ht sender) supports IEEE80211_HT_CAP_DSSSCCK40 when the phy is in HT40+/- mode?

I don't think this should be handled in the rate control modules, when mac80211 can easily handle that through the supported rates set (which seems to be the intention behind this flag in the standard as well).

- Felix

maintainer
#5 lore raw

Re: [PATCH v2 3/3] mac80211/minstrel_ht: add support for using CCK rates

Quoted 28 lines · Felix Fietkau
Quoted 19 lines · Christian Lamparter
Quoted 18 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).

---
static void

net/mac80211/rc80211_minstrel_ht.c +9 -0
+minstrel_ht_update_cck(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
+		       struct ieee80211_supported_band *sband,
+		       struct ieee80211_sta *sta)
+{
+	int i;
+
+	if (sband->band != IEEE80211_BAND_2GHZ)
+		return;
+
Quoted 8 lines

net/mac80211/rc80211_minstrel_ht.c minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, · line 788

Quoted 5 lines
net/mac80211/rc80211_minstrel_ht.c +5 -0
+	mi->cck_supported = 0;
+	mi->cck_supported_short = 0;
+	for (i = 0; i < 4; i++) {
+		if (!rate_supported(sta, sband->band, mp->cck_rates[i]))
+			continue;

Don't we need to check if the receiver (and the minstrel_ht sender) supports IEEE80211_HT_CAP_DSSSCCK40 when the phy is in HT40+/- mode?

Quoted 3 lines

I don't think this should be handled in the rate control modules, when mac80211 can easily handle that through the supported rates set (which seems to be the intention behind this flag in the standard as well).

Patches welcome. This corner of the spec doesn't seem to be implemented at all :)

johannes

maintainer
#6 lore raw

Re: [PATCH v2 3/3] mac80211/minstrel_ht: add support for using CCK rates

In reply to Felix Fietkau

Applied patches 1 and 2 but this one had too many smatch complaints:

Quoted 8 lines
#define CCK_GROUP                                       \
        {                                               \
                .streams = 0,                           \
                .duration = {                           \
                        CCK_DURATION_LIST(false),       \
                        CCK_DURATION_LIST(true)         \
                }                                       \
        }

This seems to have caused smatch to complain, because after having

#define MCS_GROUP(_streams, _sgi, _ht40)                                \
        [GROUP_IDX(_streams, _sgi, _ht40)] = {                          \

it couldn't prove that the CCK went into slot 12. Are you sure they go there for sure, with the different initialization?

net/mac80211/rc80211_minstrel_ht.c minstrel_ht_get_group_idx(struct ieee80211_tx_rate *rate) · line 163

Quoted 13 lines
net/mac80211/rc80211_minstrel_ht.c +13 -0
+struct minstrel_rate_stats *
+minstrel_ht_get_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
+		      struct ieee80211_tx_rate *rate)
+{
+	int group, idx;
+
+	if (rate->flags & IEEE80211_TX_RC_MCS) {
+		group = minstrel_ht_get_group_idx(rate);
+		idx = rate->idx % MCS_GROUP_RATES;
+	} else {
+		group = MINSTREL_CCK_GROUP;
+
+		for (idx = 0; idx <= ARRAY_SIZE(mp->cck_rates); idx++)

should be < rather than <=?

net/mac80211/rc80211_minstrel_ht.c minstrel_ht_txstat_valid(struct ieee80211_tx_rate *rate) · line 359

Quoted 2 lines
net/mac80211/rc80211_minstrel_ht.c +2 -0
+	if (rate->flags & IEEE80211_TX_RC_MCS);
+		return true;

ho humm ...

johannes