diff mbox

[v2,2/2] mac80211: fix the check for mcs rates masking

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

Commit Message

Karl Beldan March 4, 2013, 6:27 p.m. UTC
From: Karl Beldan <karl.beldan@rivierawaves.com>

Currently the mcs bitrates mask rate_idx_mcs_mask is only applied when
the pre-ht bitrates mask rate_idx_mask of the same band differs from the
default mask.
Fix it by comparing the rate_idx_mcs_mask with the driver ht caps.

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

Comments

Johannes Berg March 4, 2013, 8:13 p.m. UTC | #1
On Mon, 2013-03-04 at 19:27 +0100, Karl Beldan wrote:
> From: Karl Beldan <karl.beldan@rivierawaves.com>
> 
> Currently the mcs bitrates mask rate_idx_mcs_mask is only applied when
> the pre-ht bitrates mask rate_idx_mask of the same band differs from the
> default mask.
> Fix it by comparing the rate_idx_mcs_mask with the driver ht caps.
> 
> Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
> ---
>  net/mac80211/rate.c |   10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
> index c1e5f25..28f1936 100644
> --- a/net/mac80211/rate.c
> +++ b/net/mac80211/rate.c
> @@ -455,13 +455,15 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
>  	ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
>  
>  	/*
> -	 * Try to enforce the rateidx mask the user wanted. skip this if the
> -	 * default mask (allow all rates) is used to save some processing for
> -	 * the common case.
> +	 * Try to enforce the rateidx masks the user wanted. Skip this if mask
> +	 * is the default mask (allow all rates) and mcs_mask does not differ
> +	 * from the driver ht caps to save some processing for the common case.
>  	 */
>  	mask = &txrc->rate_idx_mask;
>  	mcs_mask = txrc->rate_idx_mcs_mask;
> -	if (*mask != (1 << txrc->sband->n_bitrates) - 1) {
> +	if (*mask != (1 << txrc->sband->n_bitrates) - 1 ||
> +		memcmp(txrc->sband->ht_cap.mcs.rx_mask, txrc->rate_idx_mcs_mask,
> +		       sizeof(txrc->rate_idx_mcs_mask))) {

Please fix the indentation, the memcmp should be indented to just after
the opening parenthesis of "if ("

johannes

--
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 March 4, 2013, 8:51 p.m. UTC | #2
On Mon, Mar 04, 2013 at 09:13:00PM +0100, Johannes Berg wrote:
> On Mon, 2013-03-04 at 19:27 +0100, Karl Beldan wrote:
> > From: Karl Beldan <karl.beldan@rivierawaves.com>
> > 
> > Currently the mcs bitrates mask rate_idx_mcs_mask is only applied when
> > the pre-ht bitrates mask rate_idx_mask of the same band differs from the
> > default mask.
> > Fix it by comparing the rate_idx_mcs_mask with the driver ht caps.
> > 
> > Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
> > ---
> >  net/mac80211/rate.c |   10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
> > index c1e5f25..28f1936 100644
> > --- a/net/mac80211/rate.c
> > +++ b/net/mac80211/rate.c
> > @@ -455,13 +455,15 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
> >  	ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
> >  
> >  	/*
> > -	 * Try to enforce the rateidx mask the user wanted. skip this if the
> > -	 * default mask (allow all rates) is used to save some processing for
> > -	 * the common case.
> > +	 * Try to enforce the rateidx masks the user wanted. Skip this if mask
> > +	 * is the default mask (allow all rates) and mcs_mask does not differ
> > +	 * from the driver ht caps to save some processing for the common case.
> >  	 */
> >  	mask = &txrc->rate_idx_mask;
> >  	mcs_mask = txrc->rate_idx_mcs_mask;
> > -	if (*mask != (1 << txrc->sband->n_bitrates) - 1) {
> > +	if (*mask != (1 << txrc->sband->n_bitrates) - 1 ||
> > +		memcmp(txrc->sband->ht_cap.mcs.rx_mask, txrc->rate_idx_mcs_mask,
> > +		       sizeof(txrc->rate_idx_mcs_mask))) {
> 
> Please fix the indentation, the memcmp should be indented to just after
> the opening parenthesis of "if ("
> 
Yes, sorry.
 
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/rate.c b/net/mac80211/rate.c
index c1e5f25..28f1936 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -455,13 +455,15 @@  void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
 	ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
 
 	/*
-	 * Try to enforce the rateidx mask the user wanted. skip this if the
-	 * default mask (allow all rates) is used to save some processing for
-	 * the common case.
+	 * Try to enforce the rateidx masks the user wanted. Skip this if mask
+	 * is the default mask (allow all rates) and mcs_mask does not differ
+	 * from the driver ht caps to save some processing for the common case.
 	 */
 	mask = &txrc->rate_idx_mask;
 	mcs_mask = txrc->rate_idx_mcs_mask;
-	if (*mask != (1 << txrc->sband->n_bitrates) - 1) {
+	if (*mask != (1 << txrc->sband->n_bitrates) - 1 ||
+		memcmp(txrc->sband->ht_cap.mcs.rx_mask, txrc->rate_idx_mcs_mask,
+		       sizeof(txrc->rate_idx_mcs_mask))) {
 		if (sta) {
 			/* Filter out rates that the STA does not support */
 			*mask &= sta->sta.supp_rates[info->band];