Search Linux Wireless

Re: [PATCH] mac80211: use min rate as basic rate for buggy APs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux