mac80211: fix RX chains configuration

If the driver doesn't support 40 MHz channels, then
mac80211 erroneously sets number of RX chains to one
although the number of chains is independent of the
support for 40 MHz channels.

Fix this by checking the 40 MHz support only for the
code that sets the 40 MHz channel not the complete
HT code block.

This also means the HT20 channel type will always be
set in the changed code block so there's no need to
set it in case we override the AP due to invalid IEs
in the probe response/beacon.

The indentation is a bit quirky, but I'm rewriting
this code for VHT support so this will change again
very soon.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2012-11-22 14:17:23 +01:00
parent 605f1a5b5e
commit 76c5fa0fb9
1 changed files with 21 additions and 16 deletions

View File

@ -3219,12 +3219,10 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
ht_cfreq, ht_oper->primary_chan, ht_cfreq, ht_oper->primary_chan,
cbss->channel->band); cbss->channel->band);
ht_oper = NULL; ht_oper = NULL;
} else {
channel_type = NL80211_CHAN_HT20;
} }
} }
if (ht_oper && sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) { if (ht_oper) {
/* /*
* cfg80211 already verified that the channel itself can * cfg80211 already verified that the channel itself can
* be used, but it didn't check that we can do the right * be used, but it didn't check that we can do the right
@ -3237,19 +3235,26 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
channel_type = NL80211_CHAN_HT20; channel_type = NL80211_CHAN_HT20;
switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: switch (ht_oper->ht_param &
if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40PLUS) IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ; case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
else if (cbss->channel->flags &
channel_type = NL80211_CHAN_HT40PLUS; IEEE80211_CHAN_NO_HT40PLUS)
break; ifmgd->flags |=
case IEEE80211_HT_PARAM_CHA_SEC_BELOW: IEEE80211_STA_DISABLE_40MHZ;
if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40MINUS) else
ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ; channel_type = NL80211_CHAN_HT40PLUS;
else break;
channel_type = NL80211_CHAN_HT40MINUS; case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
break; if (cbss->channel->flags &
IEEE80211_CHAN_NO_HT40MINUS)
ifmgd->flags |=
IEEE80211_STA_DISABLE_40MHZ;
else
channel_type = NL80211_CHAN_HT40MINUS;
break;
}
} }
ht_cap_ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, ht_cap_ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY,