All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Eliad Peller <eliad@wizery.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mac80211: use min rate as basic rate for buggy APs
Date: Tue, 25 Oct 2011 15:56:48 +0200	[thread overview]
Message-ID: <20111025135647.GB2231@redhat.com> (raw)
In-Reply-To: <1319531194-26839-1-git-send-email-eliad@wizery.com>

On Tue, Oct 25, 2011 at 10:26:34AM +0200, Eliad Peller wrote:
> Some buggy APs (and even P2P_GO) don't advertise their
> basic rates in the association response.
> 
> In such case, use the min supported rate as the
> basic rate.

Can we do this in simpler way?

   if (unlikely(!basic_rates))
	basic_rates = BIT(ffs(rates) - 1);

Stanislaw

> Signed-off-by: Eliad Peller <eliad@wizery.com>
> ---
>  net/mac80211/mlme.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 0e5d8da..064df37 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -1482,6 +1482,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
>  	int i, j, err;
>  	bool have_higher_than_11mbit = false;
>  	u16 ap_ht_cap_flags;
> +	int min_rate = INT_MAX, min_rate_index = -1;
>  
>  	/* AssocResp and ReassocResp have identical structure */
>  
> @@ -1537,6 +1538,10 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
>  				rates |= BIT(j);
>  				if (is_basic)
>  					basic_rates |= BIT(j);
> +				if (rate < min_rate) {
> +					min_rate = rate;
> +					min_rate_index = j;
> +				}
>  				break;
>  			}
>  		}
> @@ -1554,11 +1559,22 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
>  				rates |= BIT(j);
>  				if (is_basic)
>  					basic_rates |= BIT(j);
> +				if (rate < min_rate) {
> +					min_rate = rate;
> +					min_rate_index = j;
> +				}
>  				break;
>  			}
>  		}
>  	}
>  
> +	/*
> +	 * some buggy APs don't advertise basic_rates. use the lowest
> +	 * supported rate instead.
> +	 */
> +	if (unlikely(!basic_rates) && min_rate_index >= 0)
> +		basic_rates = BIT(min_rate_index);
> +
>  	sta->sta.supp_rates[wk->chan->band] = rates;
>  	sdata->vif.bss_conf.basic_rates = basic_rates;
>  
> -- 
> 1.7.6.401.g6a319
> 
> --
> 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

  reply	other threads:[~2011-10-25 13:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-25  8:26 [PATCH] mac80211: use min rate as basic rate for buggy APs Eliad Peller
2011-10-25 13:56 ` Stanislaw Gruszka [this message]
2011-10-25 14:06   ` Eliad Peller
2011-10-26  9:53 ` Johannes Berg
2011-10-26 17:40   ` Eliad Peller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111025135647.GB2231@redhat.com \
    --to=sgruszka@redhat.com \
    --cc=eliad@wizery.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.