Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277759
b: refs/heads/master
c: c74d084
h: refs/heads/master
i:
  277757: b116edb
  277755: 67408d5
  277751: 9e8d72d
  277743: b069c2f
  277727: cbfee86
  277695: c6cd586
  277631: b209814
  277503: 3d6add5
v: v3
  • Loading branch information
Christian Lamparter authored and John W. Linville committed Nov 9, 2011
1 parent 26953e2 commit fc39efc
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa5e91bc7715c772342b197269a85aa3ced16900
refs/heads/master: c74d084f914e16e42730bcf625ab3f37a4cae8d4
3 changes: 3 additions & 0 deletions trunk/include/linux/ieee80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,9 @@ struct ieee80211_mgmt {
} u;
} __attribute__ ((packed));

/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127

/* mgmt header + 1 byte category code */
#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)

Expand Down
90 changes: 49 additions & 41 deletions trunk/net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,47 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
return RX_MGMT_CFG80211_DISASSOC;
}

static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
u8 *supp_rates, unsigned int supp_rates_len,
u32 *rates, u32 *basic_rates,
bool *have_higher_than_11mbit,
int *min_rate, int *min_rate_index)
{
int i, j;

for (i = 0; i < supp_rates_len; i++) {
int rate = (supp_rates[i] & 0x7f) * 5;
bool is_basic = !!(supp_rates[i] & 0x80);

if (rate > 110)
*have_higher_than_11mbit = true;

/*
* BSS_MEMBERSHIP_SELECTOR_HT_PHY is defined in 802.11n-2009
* 7.3.2.2 as a magic value instead of a rate. Hence, skip it.
*
* Note: Even through the membership selector and the basic
* rate flag share the same bit, they are not exactly
* the same.
*/
if (!!(supp_rates[i] & 0x80) &&
(supp_rates[i] & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY)
continue;

for (j = 0; j < sband->n_bitrates; j++) {
if (sband->bitrates[j].bitrate == rate) {
*rates |= BIT(j);
if (is_basic)
*basic_rates |= BIT(j);
if (rate < *min_rate) {
*min_rate = rate;
*min_rate_index = j;
}
break;
}
}
}
}

static bool ieee80211_assoc_success(struct ieee80211_work *wk,
struct ieee80211_mgmt *mgmt, size_t len)
Expand All @@ -1482,7 +1523,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
struct ieee802_11_elems elems;
struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
u32 changed = 0;
int i, j, err;
int err;
bool have_higher_than_11mbit = false;
u16 ap_ht_cap_flags;
int min_rate = INT_MAX, min_rate_index = -1;
Expand Down Expand Up @@ -1540,47 +1581,14 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
basic_rates = 0;
sband = local->hw.wiphy->bands[wk->chan->band];

for (i = 0; i < elems.supp_rates_len; i++) {
int rate = (elems.supp_rates[i] & 0x7f) * 5;
bool is_basic = !!(elems.supp_rates[i] & 0x80);

if (rate > 110)
have_higher_than_11mbit = true;
ieee80211_get_rates(sband, elems.supp_rates, elems.supp_rates_len,
&rates, &basic_rates, &have_higher_than_11mbit,
&min_rate, &min_rate_index);

for (j = 0; j < sband->n_bitrates; j++) {
if (sband->bitrates[j].bitrate == rate) {
rates |= BIT(j);
if (is_basic)
basic_rates |= BIT(j);
if (rate < min_rate) {
min_rate = rate;
min_rate_index = j;
}
break;
}
}
}

for (i = 0; i < elems.ext_supp_rates_len; i++) {
int rate = (elems.ext_supp_rates[i] & 0x7f) * 5;
bool is_basic = !!(elems.ext_supp_rates[i] & 0x80);

if (rate > 110)
have_higher_than_11mbit = true;

for (j = 0; j < sband->n_bitrates; j++) {
if (sband->bitrates[j].bitrate == rate) {
rates |= BIT(j);
if (is_basic)
basic_rates |= BIT(j);
if (rate < min_rate) {
min_rate = rate;
min_rate_index = j;
}
break;
}
}
}
ieee80211_get_rates(sband, elems.ext_supp_rates,
elems.ext_supp_rates_len, &rates, &basic_rates,
&have_higher_than_11mbit,
&min_rate, &min_rate_index);

/*
* some buggy APs don't advertise basic_rates. use the lowest
Expand Down

0 comments on commit fc39efc

Please sign in to comment.