diff mbox

[2/2] mac80211: minstrel_ht: do not sample unsupported rates

Message ID 1383928473-798-2-git-send-email-karl.beldan@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Karl Beldan Nov. 8, 2013, 4:34 p.m. UTC
From: Karl Beldan <karl.beldan@rivierawaves.com>

ATM minstrel_ht does not check whether the sampling rate is supported.
Unsupported rates attempts can trigger when there are holes between
supported MCSes belonging to the same group (e.g many devices are
capable of MCS32 without being capable of MCS33->MCS39).
This change replaces an unsupported sample index with the fls of the
bitfield of supported indexes.
This is not a problem in minstrel which fills a per STA sample table
with only supported rates (though only at init).

Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
---
 net/mac80211/rc80211_minstrel_ht.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Felix Fietkau Nov. 8, 2013, 4:43 p.m. UTC | #1
On 2013-11-08 17:34, Karl Beldan wrote:
> From: Karl Beldan <karl.beldan@rivierawaves.com>
> 
> ATM minstrel_ht does not check whether the sampling rate is supported.
> Unsupported rates attempts can trigger when there are holes between
> supported MCSes belonging to the same group (e.g many devices are
> capable of MCS32 without being capable of MCS33->MCS39).
> This change replaces an unsupported sample index with the fls of the
> bitfield of supported indexes.
> This is not a problem in minstrel which fills a per STA sample table
> with only supported rates (though only at init).
> 
> Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
> ---
>  net/mac80211/rc80211_minstrel_ht.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
> index aeec401..1b835ad 100644
> --- a/net/mac80211/rc80211_minstrel_ht.c
> +++ b/net/mac80211/rc80211_minstrel_ht.c
> @@ -703,6 +703,8 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
>  
>  	mg = &mi->groups[mi->sample_group];
>  	sample_idx = sample_table[mg->column][mg->index];
> +	if (!(mg->supported & BIT(sample_idx)))
> +		sample_idx = fls(sample_idx) - 1;
You probably meant fls(mg->supported) - 1 here, however I think a better
approach would be to just skip the sample attempt. If there are fewer
rates in a group, we can run fewer sample attempts on it.

- Felix
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Karl Beldan Nov. 8, 2013, 4:54 p.m. UTC | #2
On Fri, Nov 08, 2013 at 05:43:35PM +0100, Felix Fietkau wrote:
> On 2013-11-08 17:34, Karl Beldan wrote:
> > From: Karl Beldan <karl.beldan@rivierawaves.com>
> > 
> > ATM minstrel_ht does not check whether the sampling rate is supported.
> > Unsupported rates attempts can trigger when there are holes between
> > supported MCSes belonging to the same group (e.g many devices are
> > capable of MCS32 without being capable of MCS33->MCS39).
> > This change replaces an unsupported sample index with the fls of the
> > bitfield of supported indexes.
> > This is not a problem in minstrel which fills a per STA sample table
> > with only supported rates (though only at init).
> > 
> > Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
> > ---
> >  net/mac80211/rc80211_minstrel_ht.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
> > index aeec401..1b835ad 100644
> > --- a/net/mac80211/rc80211_minstrel_ht.c
> > +++ b/net/mac80211/rc80211_minstrel_ht.c
> > @@ -703,6 +703,8 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
> >  
> >  	mg = &mi->groups[mi->sample_group];
> >  	sample_idx = sample_table[mg->column][mg->index];
> > +	if (!(mg->supported & BIT(sample_idx)))
> > +		sample_idx = fls(sample_idx) - 1;
> You probably meant fls(mg->supported) - 1 here, however I think a better
Arf, yes.

> approach would be to just skip the sample attempt. If there are fewer
> rates in a group, we can run fewer sample attempts on it.
> 
Agreed :)

I was skimming through minstrel before leaving for the week-end because
I had planned to put in shape a hack I did a while ago for vht in
minstrel monday is a holiday here and I have absolutely nothing planned.
 
Karl
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index aeec401..1b835ad 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -703,6 +703,8 @@  minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
 
 	mg = &mi->groups[mi->sample_group];
 	sample_idx = sample_table[mg->column][mg->index];
+	if (!(mg->supported & BIT(sample_idx)))
+		sample_idx = fls(sample_idx) - 1;
 	mr = &mg->rates[sample_idx];
 	sample_group = mi->sample_group;
 	sample_idx += sample_group * MCS_GROUP_RATES;