aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-09 06:13:49 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:06 -0400
commitd9fe60dea7779d412b34679f1177c5ca1940ea8d (patch)
treea51e16b013f7c1d16ded502cb32c03872bcbfcaa
parent40333e4fb476014cdd939d27e20eb54573172b32 (diff)
802.11: clean up/fix HT support
This patch cleans up a number of things: * the unusable definition of the HT capabilities/HT information information elements * variable names that are hard to understand * mac80211: move ieee80211_handle_ht to ht.c and remove the unused enable_ht parameter * mac80211: fix bug with MCS rate 32 in ieee80211_handle_ht * mac80211: fix bug with casting the result of ieee80211_bss_get_ie to an information element _contents_ rather than the whole element, add size checking (another out-of-bounds access bug fixed!) * mac80211: remove some unused return values in favour of BUG_ON checking * a few minor other things Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath9k/main.c57
-rw-r--r--drivers/net/wireless/ath9k/rc.c10
-rw-r--r--drivers/net/wireless/ath9k/rc.h1
-rw-r--r--drivers/net/wireless/ath9k/recv.c2
-rw-r--r--drivers/net/wireless/ath9k/xmit.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c71
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c6
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c19
-rw-r--r--include/linux/ieee80211.h133
-rw-r--r--include/net/mac80211.h12
-rw-r--r--include/net/wireless.h15
-rw-r--r--net/mac80211/cfg.c7
-rw-r--r--net/mac80211/ht.c151
-rw-r--r--net/mac80211/ieee80211_i.h16
-rw-r--r--net/mac80211/main.c94
-rw-r--r--net/mac80211/mlme.c45
-rw-r--r--net/mac80211/util.c4
-rw-r--r--net/mac80211/wext.c4
23 files changed, 386 insertions, 319 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 186d75acb326..5e087c92a6d9 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -61,24 +61,24 @@ static u32 ath_get_extchanmode(struct ath_softc *sc,
61 61
62 switch (chan->band) { 62 switch (chan->band) {
63 case IEEE80211_BAND_2GHZ: 63 case IEEE80211_BAND_2GHZ:
64 if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_NONE) && 64 if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_NONE) &&
65 (tx_chan_width == ATH9K_HT_MACMODE_20)) 65 (tx_chan_width == ATH9K_HT_MACMODE_20))
66 chanmode = CHANNEL_G_HT20; 66 chanmode = CHANNEL_G_HT20;
67 if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_ABOVE) && 67 if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) &&
68 (tx_chan_width == ATH9K_HT_MACMODE_2040)) 68 (tx_chan_width == ATH9K_HT_MACMODE_2040))
69 chanmode = CHANNEL_G_HT40PLUS; 69 chanmode = CHANNEL_G_HT40PLUS;
70 if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_BELOW) && 70 if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW) &&
71 (tx_chan_width == ATH9K_HT_MACMODE_2040)) 71 (tx_chan_width == ATH9K_HT_MACMODE_2040))
72 chanmode = CHANNEL_G_HT40MINUS; 72 chanmode = CHANNEL_G_HT40MINUS;
73 break; 73 break;
74 case IEEE80211_BAND_5GHZ: 74 case IEEE80211_BAND_5GHZ:
75 if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_NONE) && 75 if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_NONE) &&
76 (tx_chan_width == ATH9K_HT_MACMODE_20)) 76 (tx_chan_width == ATH9K_HT_MACMODE_20))
77 chanmode = CHANNEL_A_HT20; 77 chanmode = CHANNEL_A_HT20;
78 if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_ABOVE) && 78 if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) &&
79 (tx_chan_width == ATH9K_HT_MACMODE_2040)) 79 (tx_chan_width == ATH9K_HT_MACMODE_2040))
80 chanmode = CHANNEL_A_HT40PLUS; 80 chanmode = CHANNEL_A_HT40PLUS;
81 if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_BELOW) && 81 if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW) &&
82 (tx_chan_width == ATH9K_HT_MACMODE_2040)) 82 (tx_chan_width == ATH9K_HT_MACMODE_2040))
83 chanmode = CHANNEL_A_HT40MINUS; 83 chanmode = CHANNEL_A_HT40MINUS;
84 break; 84 break;
@@ -215,24 +215,24 @@ static void ath_key_delete(struct ath_softc *sc, struct ieee80211_key_conf *key)
215 ath_key_reset(sc, key->keyidx, freeslot); 215 ath_key_reset(sc, key->keyidx, freeslot);
216} 216}
217 217
218static void setup_ht_cap(struct ieee80211_ht_info *ht_info) 218static void setup_ht_cap(struct ieee80211_sta_ht_cap *ht_info)
219{ 219{
220#define ATH9K_HT_CAP_MAXRXAMPDU_65536 0x3 /* 2 ^ 16 */ 220#define ATH9K_HT_CAP_MAXRXAMPDU_65536 0x3 /* 2 ^ 16 */
221#define ATH9K_HT_CAP_MPDUDENSITY_8 0x6 /* 8 usec */ 221#define ATH9K_HT_CAP_MPDUDENSITY_8 0x6 /* 8 usec */
222 222
223 ht_info->ht_supported = 1; 223 ht_info->ht_supported = true;
224 ht_info->cap = (u16)IEEE80211_HT_CAP_SUP_WIDTH 224 ht_info->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
225 |(u16)IEEE80211_HT_CAP_SM_PS 225 IEEE80211_HT_CAP_SM_PS |
226 |(u16)IEEE80211_HT_CAP_SGI_40 226 IEEE80211_HT_CAP_SGI_40 |
227 |(u16)IEEE80211_HT_CAP_DSSSCCK40; 227 IEEE80211_HT_CAP_DSSSCCK40;
228 228
229 ht_info->ampdu_factor = ATH9K_HT_CAP_MAXRXAMPDU_65536; 229 ht_info->ampdu_factor = ATH9K_HT_CAP_MAXRXAMPDU_65536;
230 ht_info->ampdu_density = ATH9K_HT_CAP_MPDUDENSITY_8; 230 ht_info->ampdu_density = ATH9K_HT_CAP_MPDUDENSITY_8;
231 /* setup supported mcs set */ 231 /* set up supported mcs set */
232 memset(ht_info->supp_mcs_set, 0, 16); 232 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
233 ht_info->supp_mcs_set[0] = 0xff; 233 ht_info->mcs.rx_mask[0] = 0xff;
234 ht_info->supp_mcs_set[1] = 0xff; 234 ht_info->mcs.rx_mask[1] = 0xff;
235 ht_info->supp_mcs_set[12] = IEEE80211_HT_CAP_MCS_TX_DEFINED; 235 ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
236} 236}
237 237
238static int ath_rate2idx(struct ath_softc *sc, int rate) 238static int ath_rate2idx(struct ath_softc *sc, int rate)
@@ -328,31 +328,28 @@ static u8 parse_mpdudensity(u8 mpdudensity)
328static void ath9k_ht_conf(struct ath_softc *sc, 328static void ath9k_ht_conf(struct ath_softc *sc,
329 struct ieee80211_bss_conf *bss_conf) 329 struct ieee80211_bss_conf *bss_conf)
330{ 330{
331#define IEEE80211_HT_CAP_40MHZ_INTOLERANT BIT(14)
332 struct ath_ht_info *ht_info = &sc->sc_ht_info; 331 struct ath_ht_info *ht_info = &sc->sc_ht_info;
333 332
334 if (bss_conf->assoc_ht) { 333 if (bss_conf->assoc_ht) {
335 ht_info->ext_chan_offset = 334 ht_info->ext_chan_offset =
336 bss_conf->ht_bss_conf->bss_cap & 335 bss_conf->ht_bss_conf->bss_cap &
337 IEEE80211_HT_IE_CHA_SEC_OFFSET; 336 IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
338 337
339 if (!(bss_conf->ht_conf->cap & 338 if (!(bss_conf->ht_cap->cap &
340 IEEE80211_HT_CAP_40MHZ_INTOLERANT) && 339 IEEE80211_HT_CAP_40MHZ_INTOLERANT) &&
341 (bss_conf->ht_bss_conf->bss_cap & 340 (bss_conf->ht_bss_conf->bss_cap &
342 IEEE80211_HT_IE_CHA_WIDTH)) 341 IEEE80211_HT_PARAM_CHAN_WIDTH_ANY))
343 ht_info->tx_chan_width = ATH9K_HT_MACMODE_2040; 342 ht_info->tx_chan_width = ATH9K_HT_MACMODE_2040;
344 else 343 else
345 ht_info->tx_chan_width = ATH9K_HT_MACMODE_20; 344 ht_info->tx_chan_width = ATH9K_HT_MACMODE_20;
346 345
347 ath9k_hw_set11nmac2040(sc->sc_ah, ht_info->tx_chan_width); 346 ath9k_hw_set11nmac2040(sc->sc_ah, ht_info->tx_chan_width);
348 ht_info->maxampdu = 1 << (IEEE80211_HTCAP_MAXRXAMPDU_FACTOR + 347 ht_info->maxampdu = 1 << (IEEE80211_HTCAP_MAXRXAMPDU_FACTOR +
349 bss_conf->ht_conf->ampdu_factor); 348 bss_conf->ht_cap->ampdu_factor);
350 ht_info->mpdudensity = 349 ht_info->mpdudensity =
351 parse_mpdudensity(bss_conf->ht_conf->ampdu_density); 350 parse_mpdudensity(bss_conf->ht_cap->ampdu_density);
352 351
353 } 352 }
354
355#undef IEEE80211_HT_CAP_40MHZ_INTOLERANT
356} 353}
357 354
358static void ath9k_bss_assoc_info(struct ath_softc *sc, 355static void ath9k_bss_assoc_info(struct ath_softc *sc,
@@ -411,7 +408,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
411 return; 408 return;
412 } 409 }
413 410
414 if (hw->conf.ht_conf.ht_supported) 411 if (hw->conf.ht_cap.ht_supported)
415 sc->sc_ah->ah_channels[pos].chanmode = 412 sc->sc_ah->ah_channels[pos].chanmode =
416 ath_get_extchanmode(sc, curchan); 413 ath_get_extchanmode(sc, curchan);
417 else 414 else
@@ -534,7 +531,7 @@ int _ath_rx_indicate(struct ath_softc *sc,
534 531
535 if (an) { 532 if (an) {
536 ath_rx_input(sc, an, 533 ath_rx_input(sc, an,
537 hw->conf.ht_conf.ht_supported, 534 hw->conf.ht_cap.ht_supported,
538 skb, status, &st); 535 skb, status, &st);
539 } 536 }
540 if (!an || (st != ATH_RX_CONSUMED)) 537 if (!an || (st != ATH_RX_CONSUMED))
@@ -943,7 +940,7 @@ static int ath_attach(u16 devid,
943 940
944 if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) 941 if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT)
945 /* Setup HT capabilities for 2.4Ghz*/ 942 /* Setup HT capabilities for 2.4Ghz*/
946 setup_ht_cap(&sc->sbands[IEEE80211_BAND_2GHZ].ht_info); 943 setup_ht_cap(&sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
947 944
948 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 945 hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
949 &sc->sbands[IEEE80211_BAND_2GHZ]; 946 &sc->sbands[IEEE80211_BAND_2GHZ];
@@ -958,7 +955,7 @@ static int ath_attach(u16 devid,
958 955
959 if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) 956 if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT)
960 /* Setup HT capabilities for 5Ghz*/ 957 /* Setup HT capabilities for 5Ghz*/
961 setup_ht_cap(&sc->sbands[IEEE80211_BAND_5GHZ].ht_info); 958 setup_ht_cap(&sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
962 959
963 hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 960 hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
964 &sc->sbands[IEEE80211_BAND_5GHZ]; 961 &sc->sbands[IEEE80211_BAND_5GHZ];
@@ -1254,7 +1251,7 @@ static int ath9k_config(struct ieee80211_hw *hw,
1254 (curchan->band == IEEE80211_BAND_2GHZ) ? 1251 (curchan->band == IEEE80211_BAND_2GHZ) ?
1255 CHANNEL_G : CHANNEL_A; 1252 CHANNEL_G : CHANNEL_A;
1256 1253
1257 if (sc->sc_curaid && hw->conf.ht_conf.ht_supported) 1254 if (sc->sc_curaid && hw->conf.ht_cap.ht_supported)
1258 sc->sc_ah->ah_channels[pos].chanmode = 1255 sc->sc_ah->ah_channels[pos].chanmode =
1259 ath_get_extchanmode(sc, curchan); 1256 ath_get_extchanmode(sc, curchan);
1260 1257
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index b1e535b8ec48..ee2dbce42b4d 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -1838,7 +1838,7 @@ void ath_rc_node_update(struct ieee80211_hw *hw, struct ath_rate_node *rc_priv)
1838 struct ath_softc *sc = hw->priv; 1838 struct ath_softc *sc = hw->priv;
1839 u32 capflag = 0; 1839 u32 capflag = 0;
1840 1840
1841 if (hw->conf.ht_conf.ht_supported) { 1841 if (hw->conf.ht_cap.ht_supported) {
1842 capflag |= ATH_RC_HT_FLAG | ATH_RC_DS_FLAG; 1842 capflag |= ATH_RC_HT_FLAG | ATH_RC_DS_FLAG;
1843 if (sc->sc_ht_info.tx_chan_width == ATH9K_HT_MACMODE_2040) 1843 if (sc->sc_ht_info.tx_chan_width == ATH9K_HT_MACMODE_2040)
1844 capflag |= ATH_RC_CW40_FLAG; 1844 capflag |= ATH_RC_CW40_FLAG;
@@ -1910,7 +1910,7 @@ static void ath_tx_aggr_resp(struct ath_softc *sc,
1910 */ 1910 */
1911 si = container_of(sta, struct sta_info, sta); 1911 si = container_of(sta, struct sta_info, sta);
1912 buffersize = IEEE80211_MIN_AMPDU_BUF << 1912 buffersize = IEEE80211_MIN_AMPDU_BUF <<
1913 sband->ht_info.ampdu_factor; /* FIXME */ 1913 sband->ht_cap.ampdu_factor; /* FIXME */
1914 state = si->ampdu_mlme.tid_state_tx[tidno]; 1914 state = si->ampdu_mlme.tid_state_tx[tidno];
1915 1915
1916 if (state & HT_ADDBA_RECEIVED_MSK) { 1916 if (state & HT_ADDBA_RECEIVED_MSK) {
@@ -1979,7 +1979,7 @@ static void ath_get_rate(void *priv, struct ieee80211_supported_band *sband,
1979 1979
1980 /* Check if aggregation has to be enabled for this tid */ 1980 /* Check if aggregation has to be enabled for this tid */
1981 1981
1982 if (hw->conf.ht_conf.ht_supported) { 1982 if (hw->conf.ht_cap.ht_supported) {
1983 if (ieee80211_is_data_qos(fc)) { 1983 if (ieee80211_is_data_qos(fc)) {
1984 qc = ieee80211_get_qos_ctl(hdr); 1984 qc = ieee80211_get_qos_ctl(hdr);
1985 tid = qc[0] & 0xf; 1985 tid = qc[0] & 0xf;
@@ -2027,8 +2027,8 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
2027 2027
2028 ath_setup_rates(sc, sband, sta, ath_rc_priv); 2028 ath_setup_rates(sc, sband, sta, ath_rc_priv);
2029 if (sc->hw->conf.flags & IEEE80211_CONF_SUPPORT_HT_MODE) { 2029 if (sc->hw->conf.flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
2030 for (i = 0; i < MCS_SET_SIZE; i++) { 2030 for (i = 0; i < 77; i++) {
2031 if (sc->hw->conf.ht_conf.supp_mcs_set[i/8] & (1<<(i%8))) 2031 if (sc->hw->conf.ht_cap.mcs.rx_mask[i/8] & (1<<(i%8)))
2032 ath_rc_priv->neg_ht_rates.rs_rates[j++] = i; 2032 ath_rc_priv->neg_ht_rates.rs_rates[j++] = i;
2033 if (j == ATH_RATE_MAX) 2033 if (j == ATH_RATE_MAX)
2034 break; 2034 break;
diff --git a/drivers/net/wireless/ath9k/rc.h b/drivers/net/wireless/ath9k/rc.h
index b95b41508b98..6671097fad72 100644
--- a/drivers/net/wireless/ath9k/rc.h
+++ b/drivers/net/wireless/ath9k/rc.h
@@ -59,7 +59,6 @@ struct ath_softc;
59#define FALSE 0 59#define FALSE 0
60 60
61#define ATH_RATE_MAX 30 61#define ATH_RATE_MAX 30
62#define MCS_SET_SIZE 128
63 62
64enum ieee80211_fixed_rate_mode { 63enum ieee80211_fixed_rate_mode {
65 IEEE80211_FIXED_RATE_NONE = 0, 64 IEEE80211_FIXED_RATE_NONE = 0,
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 4983402af559..010fcdfec3f6 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -1119,7 +1119,7 @@ int ath_rx_aggr_start(struct ath_softc *sc,
1119 1119
1120 sband = hw->wiphy->bands[hw->conf.channel->band]; 1120 sband = hw->wiphy->bands[hw->conf.channel->band];
1121 buffersize = IEEE80211_MIN_AMPDU_BUF << 1121 buffersize = IEEE80211_MIN_AMPDU_BUF <<
1122 sband->ht_info.ampdu_factor; /* FIXME */ 1122 sband->ht_cap.ampdu_factor; /* FIXME */
1123 1123
1124 rxtid = &an->an_aggr.rx.tid[tid]; 1124 rxtid = &an->an_aggr.rx.tid[tid];
1125 1125
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 13866043dec9..3770fbe84fce 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -300,7 +300,7 @@ static int ath_tx_prepare(struct ath_softc *sc,
300 if (ieee80211_is_data(fc) && !txctl->use_minrate) { 300 if (ieee80211_is_data(fc) && !txctl->use_minrate) {
301 301
302 /* Enable HT only for DATA frames and not for EAPOL */ 302 /* Enable HT only for DATA frames and not for EAPOL */
303 txctl->ht = (hw->conf.ht_conf.ht_supported && 303 txctl->ht = (hw->conf.ht_cap.ht_supported &&
304 (tx_info->flags & IEEE80211_TX_CTL_AMPDU)); 304 (tx_info->flags & IEEE80211_TX_CTL_AMPDU));
305 305
306 if (is_multicast_ether_addr(hdr->addr1)) { 306 if (is_multicast_ether_addr(hdr->addr1)) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index b497d40dc396..cd1bff590491 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -1134,10 +1134,10 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1134 s8 is_green = lq_sta->is_green; 1134 s8 is_green = lq_sta->is_green;
1135 1135
1136 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || 1136 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
1137 !sta->ht_info.ht_supported) 1137 !sta->ht_cap.ht_supported)
1138 return -1; 1138 return -1;
1139 1139
1140 if (((sta->ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2) 1140 if (((sta->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >> 2)
1141 == WLAN_HT_CAP_SM_PS_STATIC) 1141 == WLAN_HT_CAP_SM_PS_STATIC)
1142 return -1; 1142 return -1;
1143 1143
@@ -1202,7 +1202,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
1202 s32 rate; 1202 s32 rate;
1203 1203
1204 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || 1204 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
1205 !sta->ht_info.ht_supported) 1205 !sta->ht_cap.ht_supported)
1206 return -1; 1206 return -1;
1207 1207
1208 IWL_DEBUG_RATE("LQ: try to switch to SISO\n"); 1208 IWL_DEBUG_RATE("LQ: try to switch to SISO\n");
@@ -2238,19 +2238,19 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
2238 * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), 2238 * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3),
2239 * supp_rates[] does not; shift to convert format, force 9 MBits off. 2239 * supp_rates[] does not; shift to convert format, force 9 MBits off.
2240 */ 2240 */
2241 lq_sta->active_siso_rate = conf->ht_conf.supp_mcs_set[0] << 1; 2241 lq_sta->active_siso_rate = conf->ht_cap.mcs.rx_mask[0] << 1;
2242 lq_sta->active_siso_rate |= conf->ht_conf.supp_mcs_set[0] & 0x1; 2242 lq_sta->active_siso_rate |= conf->ht_cap.mcs.rx_mask[0] & 0x1;
2243 lq_sta->active_siso_rate &= ~((u16)0x2); 2243 lq_sta->active_siso_rate &= ~((u16)0x2);
2244 lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE; 2244 lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE;
2245 2245
2246 /* Same here */ 2246 /* Same here */
2247 lq_sta->active_mimo2_rate = conf->ht_conf.supp_mcs_set[1] << 1; 2247 lq_sta->active_mimo2_rate = conf->ht_cap.mcs.rx_mask[1] << 1;
2248 lq_sta->active_mimo2_rate |= conf->ht_conf.supp_mcs_set[1] & 0x1; 2248 lq_sta->active_mimo2_rate |= conf->ht_cap.mcs.rx_mask[1] & 0x1;
2249 lq_sta->active_mimo2_rate &= ~((u16)0x2); 2249 lq_sta->active_mimo2_rate &= ~((u16)0x2);
2250 lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE; 2250 lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE;
2251 2251
2252 lq_sta->active_mimo3_rate = conf->ht_conf.supp_mcs_set[2] << 1; 2252 lq_sta->active_mimo3_rate = conf->ht_cap.mcs.rx_mask[2] << 1;
2253 lq_sta->active_mimo3_rate |= conf->ht_conf.supp_mcs_set[2] & 0x1; 2253 lq_sta->active_mimo3_rate |= conf->ht_cap.mcs.rx_mask[2] & 0x1;
2254 lq_sta->active_mimo3_rate &= ~((u16)0x2); 2254 lq_sta->active_mimo3_rate &= ~((u16)0x2);
2255 lq_sta->active_mimo3_rate <<= IWL_FIRST_OFDM_RATE; 2255 lq_sta->active_mimo3_rate <<= IWL_FIRST_OFDM_RATE;
2256 2256
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 2cac09405afe..e6695e80fb53 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -552,7 +552,7 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv)
552static void iwl4965_ht_conf(struct iwl_priv *priv, 552static void iwl4965_ht_conf(struct iwl_priv *priv,
553 struct ieee80211_bss_conf *bss_conf) 553 struct ieee80211_bss_conf *bss_conf)
554{ 554{
555 struct ieee80211_ht_info *ht_conf = bss_conf->ht_conf; 555 struct ieee80211_sta_ht_cap *ht_conf = bss_conf->ht_cap;
556 struct ieee80211_ht_bss_info *ht_bss_conf = bss_conf->ht_bss_conf; 556 struct ieee80211_ht_bss_info *ht_bss_conf = bss_conf->ht_bss_conf;
557 struct iwl_ht_info *iwl_conf = &priv->current_ht_config; 557 struct iwl_ht_info *iwl_conf = &priv->current_ht_config;
558 558
@@ -573,27 +573,27 @@ static void iwl4965_ht_conf(struct iwl_priv *priv,
573 !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU); 573 !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU);
574 574
575 iwl_conf->supported_chan_width = 575 iwl_conf->supported_chan_width =
576 !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH); 576 !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40);
577 iwl_conf->extension_chan_offset = 577 iwl_conf->extension_chan_offset =
578 ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_SEC_OFFSET; 578 ht_bss_conf->bss_cap & IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
579 /* If no above or below channel supplied disable FAT channel */ 579 /* If no above or below channel supplied disable FAT channel */
580 if (iwl_conf->extension_chan_offset != IEEE80211_HT_IE_CHA_SEC_ABOVE && 580 if (iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_ABOVE &&
581 iwl_conf->extension_chan_offset != IEEE80211_HT_IE_CHA_SEC_BELOW) { 581 iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_BELOW) {
582 iwl_conf->extension_chan_offset = IEEE80211_HT_IE_CHA_SEC_NONE; 582 iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
583 iwl_conf->supported_chan_width = 0; 583 iwl_conf->supported_chan_width = 0;
584 } 584 }
585 585
586 iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2); 586 iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2);
587 587
588 memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16); 588 memcpy(&iwl_conf->mcs, &ht_conf->mcs, 16);
589 589
590 iwl_conf->control_channel = ht_bss_conf->primary_channel; 590 iwl_conf->control_channel = ht_bss_conf->primary_channel;
591 iwl_conf->tx_chan_width = 591 iwl_conf->tx_chan_width =
592 !!(ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_WIDTH); 592 !!(ht_bss_conf->bss_cap & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY);
593 iwl_conf->ht_protection = 593 iwl_conf->ht_protection =
594 ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_HT_PROTECTION; 594 ht_bss_conf->bss_op_mode & IEEE80211_HT_OP_MODE_PROTECTION;
595 iwl_conf->non_GF_STA_present = 595 iwl_conf->non_GF_STA_present =
596 !!(ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_NON_GF_STA_PRSNT); 596 !!(ht_bss_conf->bss_op_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
597 597
598 IWL_DEBUG_MAC80211("control channel %d\n", iwl_conf->control_channel); 598 IWL_DEBUG_MAC80211("control channel %d\n", iwl_conf->control_channel);
599 IWL_DEBUG_MAC80211("leave\n"); 599 IWL_DEBUG_MAC80211("leave\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 4c312c55f90c..4678da447ff6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -382,10 +382,10 @@ void iwl_reset_qos(struct iwl_priv *priv)
382} 382}
383EXPORT_SYMBOL(iwl_reset_qos); 383EXPORT_SYMBOL(iwl_reset_qos);
384 384
385#define MAX_BIT_RATE_40_MHZ 0x96 /* 150 Mbps */ 385#define MAX_BIT_RATE_40_MHZ 150 /* Mbps */
386#define MAX_BIT_RATE_20_MHZ 0x48 /* 72 Mbps */ 386#define MAX_BIT_RATE_20_MHZ 72 /* Mbps */
387static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, 387static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv,
388 struct ieee80211_ht_info *ht_info, 388 struct ieee80211_sta_ht_cap *ht_info,
389 enum ieee80211_band band) 389 enum ieee80211_band band)
390{ 390{
391 u16 max_bit_rate = 0; 391 u16 max_bit_rate = 0;
@@ -393,45 +393,46 @@ static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv,
393 u8 tx_chains_num = priv->hw_params.tx_chains_num; 393 u8 tx_chains_num = priv->hw_params.tx_chains_num;
394 394
395 ht_info->cap = 0; 395 ht_info->cap = 0;
396 memset(ht_info->supp_mcs_set, 0, 16); 396 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
397 397
398 ht_info->ht_supported = 1; 398 ht_info->ht_supported = true;
399 399
400 ht_info->cap |= (u16)IEEE80211_HT_CAP_GRN_FLD; 400 ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD;
401 ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20; 401 ht_info->cap |= IEEE80211_HT_CAP_SGI_20;
402 ht_info->cap |= (u16)(IEEE80211_HT_CAP_SM_PS & 402 ht_info->cap |= (IEEE80211_HT_CAP_SM_PS &
403 (WLAN_HT_CAP_SM_PS_DISABLED << 2)); 403 (WLAN_HT_CAP_SM_PS_DISABLED << 2));
404 404
405 max_bit_rate = MAX_BIT_RATE_20_MHZ; 405 max_bit_rate = MAX_BIT_RATE_20_MHZ;
406 if (priv->hw_params.fat_channel & BIT(band)) { 406 if (priv->hw_params.fat_channel & BIT(band)) {
407 ht_info->cap |= (u16)IEEE80211_HT_CAP_SUP_WIDTH; 407 ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
408 ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_40; 408 ht_info->cap |= IEEE80211_HT_CAP_SGI_40;
409 ht_info->supp_mcs_set[4] = 0x01; 409 ht_info->mcs.rx_mask[4] = 0x01;
410 max_bit_rate = MAX_BIT_RATE_40_MHZ; 410 max_bit_rate = MAX_BIT_RATE_40_MHZ;
411 } 411 }
412 412
413 if (priv->cfg->mod_params->amsdu_size_8K) 413 if (priv->cfg->mod_params->amsdu_size_8K)
414 ht_info->cap |= (u16)IEEE80211_HT_CAP_MAX_AMSDU; 414 ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU;
415 415
416 ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; 416 ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF;
417 ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF; 417 ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF;
418 418
419 ht_info->supp_mcs_set[0] = 0xFF; 419 ht_info->mcs.rx_mask[0] = 0xFF;
420 if (rx_chains_num >= 2) 420 if (rx_chains_num >= 2)
421 ht_info->supp_mcs_set[1] = 0xFF; 421 ht_info->mcs.rx_mask[1] = 0xFF;
422 if (rx_chains_num >= 3) 422 if (rx_chains_num >= 3)
423 ht_info->supp_mcs_set[2] = 0xFF; 423 ht_info->mcs.rx_mask[2] = 0xFF;
424 424
425 /* Highest supported Rx data rate */ 425 /* Highest supported Rx data rate */
426 max_bit_rate *= rx_chains_num; 426 max_bit_rate *= rx_chains_num;
427 ht_info->supp_mcs_set[10] = (u8)(max_bit_rate & 0x00FF); 427 WARN_ON(max_bit_rate & ~IEEE80211_HT_MCS_RX_HIGHEST_MASK);
428 ht_info->supp_mcs_set[11] = (u8)((max_bit_rate & 0xFF00) >> 8); 428 ht_info->mcs.rx_highest = cpu_to_le16(max_bit_rate);
429 429
430 /* Tx MCS capabilities */ 430 /* Tx MCS capabilities */
431 ht_info->supp_mcs_set[12] = IEEE80211_HT_CAP_MCS_TX_DEFINED; 431 ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
432 if (tx_chains_num != rx_chains_num) { 432 if (tx_chains_num != rx_chains_num) {
433 ht_info->supp_mcs_set[12] |= IEEE80211_HT_CAP_MCS_TX_RX_DIFF; 433 ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF;
434 ht_info->supp_mcs_set[12] |= ((tx_chains_num - 1) << 2); 434 ht_info->mcs.tx_params |= ((tx_chains_num - 1) <<
435 IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
435 } 436 }
436} 437}
437 438
@@ -495,7 +496,7 @@ static int iwlcore_init_geos(struct iwl_priv *priv)
495 sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; 496 sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE;
496 497
497 if (priv->cfg->sku & IWL_SKU_N) 498 if (priv->cfg->sku & IWL_SKU_N)
498 iwlcore_init_ht_hw_capab(priv, &sband->ht_info, 499 iwlcore_init_ht_hw_capab(priv, &sband->ht_cap,
499 IEEE80211_BAND_5GHZ); 500 IEEE80211_BAND_5GHZ);
500 501
501 sband = &priv->bands[IEEE80211_BAND_2GHZ]; 502 sband = &priv->bands[IEEE80211_BAND_2GHZ];
@@ -505,7 +506,7 @@ static int iwlcore_init_geos(struct iwl_priv *priv)
505 sband->n_bitrates = IWL_RATE_COUNT; 506 sband->n_bitrates = IWL_RATE_COUNT;
506 507
507 if (priv->cfg->sku & IWL_SKU_N) 508 if (priv->cfg->sku & IWL_SKU_N)
508 iwlcore_init_ht_hw_capab(priv, &sband->ht_info, 509 iwlcore_init_ht_hw_capab(priv, &sband->ht_cap,
509 IEEE80211_BAND_2GHZ); 510 IEEE80211_BAND_2GHZ);
510 511
511 priv->ieee_channels = channels; 512 priv->ieee_channels = channels;
@@ -595,8 +596,8 @@ static void iwlcore_free_geos(struct iwl_priv *priv)
595static bool is_single_rx_stream(struct iwl_priv *priv) 596static bool is_single_rx_stream(struct iwl_priv *priv)
596{ 597{
597 return !priv->current_ht_config.is_ht || 598 return !priv->current_ht_config.is_ht ||
598 ((priv->current_ht_config.supp_mcs_set[1] == 0) && 599 ((priv->current_ht_config.mcs.rx_mask[1] == 0) &&
599 (priv->current_ht_config.supp_mcs_set[2] == 0)); 600 (priv->current_ht_config.mcs.rx_mask[2] == 0));
600} 601}
601 602
602static u8 iwl_is_channel_extension(struct iwl_priv *priv, 603static u8 iwl_is_channel_extension(struct iwl_priv *priv,
@@ -609,10 +610,10 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv,
609 if (!is_channel_valid(ch_info)) 610 if (!is_channel_valid(ch_info))
610 return 0; 611 return 0;
611 612
612 if (extension_chan_offset == IEEE80211_HT_IE_CHA_SEC_ABOVE) 613 if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE)
613 return !(ch_info->fat_extension_channel & 614 return !(ch_info->fat_extension_channel &
614 IEEE80211_CHAN_NO_FAT_ABOVE); 615 IEEE80211_CHAN_NO_FAT_ABOVE);
615 else if (extension_chan_offset == IEEE80211_HT_IE_CHA_SEC_BELOW) 616 else if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW)
616 return !(ch_info->fat_extension_channel & 617 return !(ch_info->fat_extension_channel &
617 IEEE80211_CHAN_NO_FAT_BELOW); 618 IEEE80211_CHAN_NO_FAT_BELOW);
618 619
@@ -620,18 +621,18 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv,
620} 621}
621 622
622u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, 623u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
623 struct ieee80211_ht_info *sta_ht_inf) 624 struct ieee80211_sta_ht_cap *sta_ht_inf)
624{ 625{
625 struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config; 626 struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config;
626 627
627 if ((!iwl_ht_conf->is_ht) || 628 if ((!iwl_ht_conf->is_ht) ||
628 (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) || 629 (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) ||
629 (iwl_ht_conf->extension_chan_offset == IEEE80211_HT_IE_CHA_SEC_NONE)) 630 (iwl_ht_conf->extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_NONE))
630 return 0; 631 return 0;
631 632
632 if (sta_ht_inf) { 633 if (sta_ht_inf) {
633 if ((!sta_ht_inf->ht_supported) || 634 if ((!sta_ht_inf->ht_supported) ||
634 (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH))) 635 (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)))
635 return 0; 636 return 0;
636 } 637 }
637 638
@@ -671,13 +672,13 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
671 672
672 /* Note: control channel is opposite of extension channel */ 673 /* Note: control channel is opposite of extension channel */
673 switch (ht_info->extension_chan_offset) { 674 switch (ht_info->extension_chan_offset) {
674 case IEEE80211_HT_IE_CHA_SEC_ABOVE: 675 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
675 rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); 676 rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
676 break; 677 break;
677 case IEEE80211_HT_IE_CHA_SEC_BELOW: 678 case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
678 rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; 679 rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK;
679 break; 680 break;
680 case IEEE80211_HT_IE_CHA_SEC_NONE: 681 case IEEE80211_HT_PARAM_CHA_SEC_NONE:
681 default: 682 default:
682 rxon->flags &= ~RXON_FLG_CHANNEL_MODE_MIXED_MSK; 683 rxon->flags &= ~RXON_FLG_CHANNEL_MODE_MIXED_MSK;
683 break; 684 break;
@@ -693,9 +694,9 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
693 "rxon flags 0x%X operation mode :0x%X " 694 "rxon flags 0x%X operation mode :0x%X "
694 "extension channel offset 0x%x " 695 "extension channel offset 0x%x "
695 "control chan %d\n", 696 "control chan %d\n",
696 ht_info->supp_mcs_set[0], 697 ht_info->mcs.rx_mask[0],
697 ht_info->supp_mcs_set[1], 698 ht_info->mcs.rx_mask[1],
698 ht_info->supp_mcs_set[2], 699 ht_info->mcs.rx_mask[2],
699 le32_to_cpu(rxon->flags), ht_info->ht_protection, 700 le32_to_cpu(rxon->flags), ht_info->ht_protection,
700 ht_info->extension_chan_offset, 701 ht_info->extension_chan_offset,
701 ht_info->control_channel); 702 ht_info->control_channel);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 288b6a800e03..1a3ad8b1ebdb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -190,7 +190,7 @@ void iwl_set_rxon_chain(struct iwl_priv *priv);
190int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); 190int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch);
191void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info); 191void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info);
192u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, 192u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
193 struct ieee80211_ht_info *sta_ht_inf); 193 struct ieee80211_sta_ht_cap *sta_ht_inf);
194int iwl_hw_nic_init(struct iwl_priv *priv); 194int iwl_hw_nic_init(struct iwl_priv *priv);
195int iwl_setup_mac(struct iwl_priv *priv); 195int iwl_setup_mac(struct iwl_priv *priv);
196int iwl_set_hw_params(struct iwl_priv *priv); 196int iwl_set_hw_params(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 34306b6798e2..572250ee9d58 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -411,7 +411,7 @@ struct iwl_ht_info {
411 u8 max_amsdu_size; 411 u8 max_amsdu_size;
412 u8 ampdu_factor; 412 u8 ampdu_factor;
413 u8 mpdu_density; 413 u8 mpdu_density;
414 u8 supp_mcs_set[16]; 414 struct ieee80211_mcs_info mcs;
415 /* BSS related data */ 415 /* BSS related data */
416 u8 control_channel; 416 u8 control_channel;
417 u8 extension_chan_offset; 417 u8 extension_chan_offset;
@@ -585,7 +585,7 @@ struct iwl_addsta_cmd;
585extern int iwl_send_add_sta(struct iwl_priv *priv, 585extern int iwl_send_add_sta(struct iwl_priv *priv,
586 struct iwl_addsta_cmd *sta, u8 flags); 586 struct iwl_addsta_cmd *sta, u8 flags);
587extern u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, 587extern u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr,
588 int is_ap, u8 flags, struct ieee80211_ht_info *ht_info); 588 int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info);
589extern void iwl4965_update_chain_flags(struct iwl_priv *priv); 589extern void iwl4965_update_chain_flags(struct iwl_priv *priv);
590extern int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); 590extern int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
591extern const u8 iwl_bcast_addr[ETH_ALEN]; 591extern const u8 iwl_bcast_addr[ETH_ALEN];
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 3b0bee331a33..78d16bd7b745 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -550,7 +550,7 @@ static void iwl_ht_cap_to_ie(const struct ieee80211_supported_band *sband,
550{ 550{
551 struct ieee80211_ht_cap *ht_cap; 551 struct ieee80211_ht_cap *ht_cap;
552 552
553 if (!sband || !sband->ht_info.ht_supported) 553 if (!sband || !sband->ht_cap.ht_supported)
554 return; 554 return;
555 555
556 if (*left < sizeof(struct ieee80211_ht_cap)) 556 if (*left < sizeof(struct ieee80211_ht_cap))
@@ -559,12 +559,12 @@ static void iwl_ht_cap_to_ie(const struct ieee80211_supported_band *sband,
559 *pos++ = sizeof(struct ieee80211_ht_cap); 559 *pos++ = sizeof(struct ieee80211_ht_cap);
560 ht_cap = (struct ieee80211_ht_cap *) pos; 560 ht_cap = (struct ieee80211_ht_cap *) pos;
561 561
562 ht_cap->cap_info = cpu_to_le16(sband->ht_info.cap); 562 ht_cap->cap_info = cpu_to_le16(sband->ht_cap.cap);
563 memcpy(ht_cap->supp_mcs_set, sband->ht_info.supp_mcs_set, 16); 563 memcpy(&ht_cap->mcs, &sband->ht_cap.mcs, 16);
564 ht_cap->ampdu_params_info = 564 ht_cap->ampdu_params_info =
565 (sband->ht_info.ampdu_factor & IEEE80211_HT_CAP_AMPDU_FACTOR) | 565 (sband->ht_cap.ampdu_factor & IEEE80211_HT_AMPDU_PARM_FACTOR) |
566 ((sband->ht_info.ampdu_density << 2) & 566 ((sband->ht_cap.ampdu_density << 2) &
567 IEEE80211_HT_CAP_AMPDU_DENSITY); 567 IEEE80211_HT_AMPDU_PARM_DENSITY);
568 *left -= sizeof(struct ieee80211_ht_cap); 568 *left -= sizeof(struct ieee80211_ht_cap);
569} 569}
570 570
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index a28a8decc79c..b9b8554433a6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -181,7 +181,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
181EXPORT_SYMBOL(iwl_send_add_sta); 181EXPORT_SYMBOL(iwl_send_add_sta);
182 182
183static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, 183static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
184 struct ieee80211_ht_info *sta_ht_inf) 184 struct ieee80211_sta_ht_cap *sta_ht_inf)
185{ 185{
186 __le32 sta_flags; 186 __le32 sta_flags;
187 u8 mimo_ps_mode; 187 u8 mimo_ps_mode;
@@ -229,7 +229,7 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
229 * iwl_add_station_flags - Add station to tables in driver and device 229 * iwl_add_station_flags - Add station to tables in driver and device
230 */ 230 */
231u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap, 231u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap,
232 u8 flags, struct ieee80211_ht_info *ht_info) 232 u8 flags, struct ieee80211_sta_ht_cap *ht_info)
233{ 233{
234 int i; 234 int i;
235 int sta_id = IWL_INVALID_STATION; 235 int sta_id = IWL_INVALID_STATION;
@@ -894,7 +894,7 @@ int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
894 894
895 /* Add station to device's station table */ 895 /* Add station to device's station table */
896 struct ieee80211_conf *conf = &priv->hw->conf; 896 struct ieee80211_conf *conf = &priv->hw->conf;
897 struct ieee80211_ht_info *cur_ht_config = &conf->ht_conf; 897 struct ieee80211_sta_ht_cap *cur_ht_config = &conf->ht_cap;
898 898
899 if ((is_ap) && 899 if ((is_ap) &&
900 (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && 900 (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) &&
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index e23d9a52d083..3f236b546683 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -563,19 +563,18 @@ static int __init init_mac80211_hwsim(void)
563 data->band.n_channels = ARRAY_SIZE(hwsim_channels); 563 data->band.n_channels = ARRAY_SIZE(hwsim_channels);
564 data->band.bitrates = data->rates; 564 data->band.bitrates = data->rates;
565 data->band.n_bitrates = ARRAY_SIZE(hwsim_rates); 565 data->band.n_bitrates = ARRAY_SIZE(hwsim_rates);
566 data->band.ht_info.ht_supported = 1; 566 data->band.ht_cap.ht_supported = true;
567 data->band.ht_info.cap = IEEE80211_HT_CAP_SUP_WIDTH | 567 data->band.ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
568 IEEE80211_HT_CAP_GRN_FLD | 568 IEEE80211_HT_CAP_GRN_FLD |
569 IEEE80211_HT_CAP_SGI_40 | 569 IEEE80211_HT_CAP_SGI_40 |
570 IEEE80211_HT_CAP_DSSSCCK40; 570 IEEE80211_HT_CAP_DSSSCCK40;
571 data->band.ht_info.ampdu_factor = 0x3; 571 data->band.ht_cap.ampdu_factor = 0x3;
572 data->band.ht_info.ampdu_density = 0x6; 572 data->band.ht_cap.ampdu_density = 0x6;
573 memset(data->band.ht_info.supp_mcs_set, 0, 573 memset(&data->band.ht_cap.mcs, 0,
574 sizeof(data->band.ht_info.supp_mcs_set)); 574 sizeof(data->band.ht_cap.mcs));
575 data->band.ht_info.supp_mcs_set[0] = 0xff; 575 data->band.ht_cap.mcs.rx_mask[0] = 0xff;
576 data->band.ht_info.supp_mcs_set[1] = 0xff; 576 data->band.ht_cap.mcs.rx_mask[1] = 0xff;
577 data->band.ht_info.supp_mcs_set[12] = 577 data->band.ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
578 IEEE80211_HT_CAP_MCS_TX_DEFINED;
579 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &data->band; 578 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &data->band;
580 579
581 err = ieee80211_register_hw(hw); 580 err = ieee80211_register_hw(hw);
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 14126bc36641..64a4abce6d91 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -685,28 +685,88 @@ struct ieee80211_bar {
685#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 685#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
686#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 686#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
687 687
688
689#define IEEE80211_HT_MCS_MASK_LEN 10
690
691/**
692 * struct ieee80211_mcs_info - MCS information
693 * @rx_mask: RX mask
694 * @rx_highest: highest supported RX rate
695 * @tx_params: TX parameters
696 */
697struct ieee80211_mcs_info {
698 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
699 __le16 rx_highest;
700 u8 tx_params;
701 u8 reserved[3];
702} __attribute__((packed));
703
704/* 802.11n HT capability MSC set */
705#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
706#define IEEE80211_HT_MCS_TX_DEFINED 0x01
707#define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
708/* value 0 == 1 stream etc */
709#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
710#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
711#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
712#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
713
714/*
715 * 802.11n D5.0 20.3.5 / 20.6 says:
716 * - indices 0 to 7 and 32 are single spatial stream
717 * - 8 to 31 are multiple spatial streams using equal modulation
718 * [8..15 for two streams, 16..23 for three and 24..31 for four]
719 * - remainder are multiple spatial streams using unequal modulation
720 */
721#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
722#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
723 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
724
688/** 725/**
689 * struct ieee80211_ht_cap - HT capabilities 726 * struct ieee80211_ht_cap - HT capabilities
690 * 727 *
691 * This structure refers to "HT capabilities element" as 728 * This structure is the "HT capabilities element" as
692 * described in 802.11n draft section 7.3.2.52 729 * described in 802.11n D5.0 7.3.2.57
693 */ 730 */
694struct ieee80211_ht_cap { 731struct ieee80211_ht_cap {
695 __le16 cap_info; 732 __le16 cap_info;
696 u8 ampdu_params_info; 733 u8 ampdu_params_info;
697 u8 supp_mcs_set[16]; 734
735 /* 16 bytes MCS information */
736 struct ieee80211_mcs_info mcs;
737
698 __le16 extended_ht_cap_info; 738 __le16 extended_ht_cap_info;
699 __le32 tx_BF_cap_info; 739 __le32 tx_BF_cap_info;
700 u8 antenna_selection_info; 740 u8 antenna_selection_info;
701} __attribute__ ((packed)); 741} __attribute__ ((packed));
702 742
743/* 802.11n HT capabilities masks (for cap_info) */
744#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
745#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
746#define IEEE80211_HT_CAP_SM_PS 0x000C
747#define IEEE80211_HT_CAP_GRN_FLD 0x0010
748#define IEEE80211_HT_CAP_SGI_20 0x0020
749#define IEEE80211_HT_CAP_SGI_40 0x0040
750#define IEEE80211_HT_CAP_TX_STBC 0x0080
751#define IEEE80211_HT_CAP_RX_STBC 0x0300
752#define IEEE80211_HT_CAP_DELAY_BA 0x0400
753#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
754#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
755#define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000
756#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
757#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
758
759/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
760#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
761#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
762
703/** 763/**
704 * struct ieee80211_ht_cap - HT additional information 764 * struct ieee80211_ht_info - HT information
705 * 765 *
706 * This structure refers to "HT information element" as 766 * This structure is the "HT information element" as
707 * described in 802.11n draft section 7.3.2.53 767 * described in 802.11n D5.0 7.3.2.58
708 */ 768 */
709struct ieee80211_ht_addt_info { 769struct ieee80211_ht_info {
710 u8 control_chan; 770 u8 control_chan;
711 u8 ht_param; 771 u8 ht_param;
712 __le16 operation_mode; 772 __le16 operation_mode;
@@ -714,36 +774,33 @@ struct ieee80211_ht_addt_info {
714 u8 basic_set[16]; 774 u8 basic_set[16];
715} __attribute__ ((packed)); 775} __attribute__ ((packed));
716 776
717/* 802.11n HT capabilities masks */ 777/* for ht_param */
718#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 778#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
719#define IEEE80211_HT_CAP_SM_PS 0x000C 779#define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
720#define IEEE80211_HT_CAP_GRN_FLD 0x0010 780#define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
721#define IEEE80211_HT_CAP_SGI_20 0x0020 781#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
722#define IEEE80211_HT_CAP_SGI_40 0x0040 782#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
723#define IEEE80211_HT_CAP_DELAY_BA 0x0400 783#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
724#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 784#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
725#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 785#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
726/* 802.11n HT capability AMPDU settings */ 786
727#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 787/* for operation_mode */
728#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 788#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
729/* 802.11n HT capability MSC set */ 789#define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
730#define IEEE80211_SUPP_MCS_SET_UEQM 4 790#define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
731#define IEEE80211_HT_CAP_MAX_STREAMS 4 791#define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
732#define IEEE80211_SUPP_MCS_SET_LEN 10 792#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
733/* maximum streams the spec allows */ 793#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
734#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01 794#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
735#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02 795
736#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C 796/* for stbc_param */
737#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 797#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
738/* 802.11n HT IE masks */ 798#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
739#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 799#define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
740#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 800#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
741#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 801#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
742#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 802#define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
743#define IEEE80211_HT_IE_CHA_WIDTH 0x04 803
744#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
745#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
746#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
747 804
748/* block-ack parameters */ 805/* block-ack parameters */
749#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 806#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
@@ -949,7 +1006,7 @@ enum ieee80211_eid {
949 WLAN_EID_EXT_SUPP_RATES = 50, 1006 WLAN_EID_EXT_SUPP_RATES = 50,
950 /* 802.11n */ 1007 /* 802.11n */
951 WLAN_EID_HT_CAPABILITY = 45, 1008 WLAN_EID_HT_CAPABILITY = 45,
952 WLAN_EID_HT_EXTRA_INFO = 61, 1009 WLAN_EID_HT_INFORMATION = 61,
953 /* 802.11i */ 1010 /* 802.11i */
954 WLAN_EID_RSN = 48, 1011 WLAN_EID_RSN = 48,
955 WLAN_EID_WPA = 221, 1012 WLAN_EID_WPA = 221,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d1466e7a47b8..2870f3973f1a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -191,7 +191,7 @@ enum ieee80211_bss_change {
191 * @beacon_int: beacon interval 191 * @beacon_int: beacon interval
192 * @assoc_capability: capabilities taken from assoc resp 192 * @assoc_capability: capabilities taken from assoc resp
193 * @assoc_ht: association in HT mode 193 * @assoc_ht: association in HT mode
194 * @ht_conf: ht capabilities 194 * @ht_cap: ht capabilities
195 * @ht_bss_conf: ht extended capabilities 195 * @ht_bss_conf: ht extended capabilities
196 * @basic_rates: bitmap of basic rates, each bit stands for an 196 * @basic_rates: bitmap of basic rates, each bit stands for an
197 * index into the rate table configured by the driver in 197 * index into the rate table configured by the driver in
@@ -212,7 +212,7 @@ struct ieee80211_bss_conf {
212 u64 basic_rates; 212 u64 basic_rates;
213 /* ht related data */ 213 /* ht related data */
214 bool assoc_ht; 214 bool assoc_ht;
215 struct ieee80211_ht_info *ht_conf; 215 struct ieee80211_sta_ht_cap *ht_cap;
216 struct ieee80211_ht_bss_info *ht_bss_conf; 216 struct ieee80211_ht_bss_info *ht_bss_conf;
217}; 217};
218 218
@@ -477,7 +477,7 @@ static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
477 * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, 477 * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
478 * 1/2: antenna 0/1 478 * 1/2: antenna 0/1
479 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx 479 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
480 * @ht_conf: describes current self configuration of 802.11n HT capabilies 480 * @ht_cap: describes current self configuration of 802.11n HT capabilities
481 * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters 481 * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
482 * @channel: the channel to tune to 482 * @channel: the channel to tune to
483 */ 483 */
@@ -493,7 +493,7 @@ struct ieee80211_conf {
493 493
494 struct ieee80211_channel *channel; 494 struct ieee80211_channel *channel;
495 495
496 struct ieee80211_ht_info ht_conf; 496 struct ieee80211_sta_ht_cap ht_cap;
497 struct ieee80211_ht_bss_info ht_bss_conf; 497 struct ieee80211_ht_bss_info ht_bss_conf;
498}; 498};
499 499
@@ -687,7 +687,7 @@ enum set_key_cmd {
687 * @addr: MAC address 687 * @addr: MAC address
688 * @aid: AID we assigned to the station if we're an AP 688 * @aid: AID we assigned to the station if we're an AP
689 * @supp_rates: Bitmap of supported rates (per band) 689 * @supp_rates: Bitmap of supported rates (per band)
690 * @ht_info: HT capabilities of this STA 690 * @ht_cap: HT capabilities of this STA
691 * @drv_priv: data area for driver use, will always be aligned to 691 * @drv_priv: data area for driver use, will always be aligned to
692 * sizeof(void *), size is determined in hw information. 692 * sizeof(void *), size is determined in hw information.
693 */ 693 */
@@ -695,7 +695,7 @@ struct ieee80211_sta {
695 u64 supp_rates[IEEE80211_NUM_BANDS]; 695 u64 supp_rates[IEEE80211_NUM_BANDS];
696 u8 addr[ETH_ALEN]; 696 u8 addr[ETH_ALEN];
697 u16 aid; 697 u16 aid;
698 struct ieee80211_ht_info ht_info; 698 struct ieee80211_sta_ht_cap ht_cap;
699 699
700 /* must be last */ 700 /* must be last */
701 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 701 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 721efb363db7..c0aa0fb8db5e 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -10,6 +10,7 @@
10#include <linux/netdevice.h> 10#include <linux/netdevice.h>
11#include <linux/debugfs.h> 11#include <linux/debugfs.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/ieee80211.h>
13#include <net/cfg80211.h> 14#include <net/cfg80211.h>
14 15
15/** 16/**
@@ -133,23 +134,23 @@ struct ieee80211_rate {
133}; 134};
134 135
135/** 136/**
136 * struct ieee80211_ht_info - describing STA's HT capabilities 137 * struct ieee80211_sta_ht_cap - STA's HT capabilities
137 * 138 *
138 * This structure describes most essential parameters needed 139 * This structure describes most essential parameters needed
139 * to describe 802.11n HT capabilities for an STA. 140 * to describe 802.11n HT capabilities for an STA.
140 * 141 *
141 * @ht_supported: is HT supported by STA, 0: no, 1: yes 142 * @ht_supported: is HT supported by the STA
142 * @cap: HT capabilities map as described in 802.11n spec 143 * @cap: HT capabilities map as described in 802.11n spec
143 * @ampdu_factor: Maximum A-MPDU length factor 144 * @ampdu_factor: Maximum A-MPDU length factor
144 * @ampdu_density: Minimum A-MPDU spacing 145 * @ampdu_density: Minimum A-MPDU spacing
145 * @supp_mcs_set: Supported MCS set as described in 802.11n spec 146 * @mcs: Supported MCS rates
146 */ 147 */
147struct ieee80211_ht_info { 148struct ieee80211_sta_ht_cap {
148 u16 cap; /* use IEEE80211_HT_CAP_ */ 149 u16 cap; /* use IEEE80211_HT_CAP_ */
149 u8 ht_supported; 150 bool ht_supported;
150 u8 ampdu_factor; 151 u8 ampdu_factor;
151 u8 ampdu_density; 152 u8 ampdu_density;
152 u8 supp_mcs_set[16]; 153 struct ieee80211_mcs_info mcs;
153}; 154};
154 155
155/** 156/**
@@ -173,7 +174,7 @@ struct ieee80211_supported_band {
173 enum ieee80211_band band; 174 enum ieee80211_band band;
174 int n_channels; 175 int n_channels;
175 int n_bitrates; 176 int n_bitrates;
176 struct ieee80211_ht_info ht_info; 177 struct ieee80211_sta_ht_cap ht_cap;
177}; 178};
178 179
179/** 180/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index cf3fd5d60665..a5dea617aab3 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -633,10 +633,9 @@ static void sta_apply_parameters(struct ieee80211_local *local,
633 sta->sta.supp_rates[local->oper_channel->band] = rates; 633 sta->sta.supp_rates[local->oper_channel->band] = rates;
634 } 634 }
635 635
636 if (params->ht_capa) { 636 if (params->ht_capa)
637 ieee80211_ht_cap_ie_to_ht_info(params->ht_capa, 637 ieee80211_ht_cap_ie_to_sta_ht_cap(params->ht_capa,
638 &sta->sta.ht_info); 638 &sta->sta.ht_cap);
639 }
640 639
641 if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) { 640 if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) {
642 switch (params->plink_action) { 641 switch (params->plink_action) {
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index b854483cf23f..e2d121bf2745 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -20,37 +20,33 @@
20#include "sta_info.h" 20#include "sta_info.h"
21#include "wme.h" 21#include "wme.h"
22 22
23int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, 23void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_ht_cap *ht_cap_ie,
24 struct ieee80211_ht_info *ht_info) 24 struct ieee80211_sta_ht_cap *ht_cap)
25{ 25{
26 26
27 if (ht_info == NULL) 27 BUG_ON(!ht_cap);
28 return -EINVAL;
29 28
30 memset(ht_info, 0, sizeof(*ht_info)); 29 memset(ht_cap, 0, sizeof(*ht_cap));
31 30
32 if (ht_cap_ie) { 31 if (ht_cap_ie) {
33 u8 ampdu_info = ht_cap_ie->ampdu_params_info; 32 u8 ampdu_info = ht_cap_ie->ampdu_params_info;
34 33
35 ht_info->ht_supported = 1; 34 ht_cap->ht_supported = true;
36 ht_info->cap = le16_to_cpu(ht_cap_ie->cap_info); 35 ht_cap->cap = le16_to_cpu(ht_cap_ie->cap_info);
37 ht_info->ampdu_factor = 36 ht_cap->ampdu_factor =
38 ampdu_info & IEEE80211_HT_CAP_AMPDU_FACTOR; 37 ampdu_info & IEEE80211_HT_AMPDU_PARM_FACTOR;
39 ht_info->ampdu_density = 38 ht_cap->ampdu_density =
40 (ampdu_info & IEEE80211_HT_CAP_AMPDU_DENSITY) >> 2; 39 (ampdu_info & IEEE80211_HT_AMPDU_PARM_DENSITY) >> 2;
41 memcpy(ht_info->supp_mcs_set, ht_cap_ie->supp_mcs_set, 16); 40 memcpy(&ht_cap->mcs, &ht_cap_ie->mcs, sizeof(ht_cap->mcs));
42 } else 41 } else
43 ht_info->ht_supported = 0; 42 ht_cap->ht_supported = false;
44
45 return 0;
46} 43}
47 44
48int ieee80211_ht_addt_info_ie_to_ht_bss_info( 45void ieee80211_ht_info_ie_to_ht_bss_info(
49 struct ieee80211_ht_addt_info *ht_add_info_ie, 46 struct ieee80211_ht_info *ht_add_info_ie,
50 struct ieee80211_ht_bss_info *bss_info) 47 struct ieee80211_ht_bss_info *bss_info)
51{ 48{
52 if (bss_info == NULL) 49 BUG_ON(!bss_info);
53 return -EINVAL;
54 50
55 memset(bss_info, 0, sizeof(*bss_info)); 51 memset(bss_info, 0, sizeof(*bss_info));
56 52
@@ -62,8 +58,119 @@ int ieee80211_ht_addt_info_ie_to_ht_bss_info(
62 bss_info->bss_cap = ht_add_info_ie->ht_param; 58 bss_info->bss_cap = ht_add_info_ie->ht_param;
63 bss_info->bss_op_mode = (u8)(op_mode & 0xff); 59 bss_info->bss_op_mode = (u8)(op_mode & 0xff);
64 } 60 }
61}
62
63/*
64 * ieee80211_handle_ht should be called only after the operating band
65 * has been determined as ht configuration depends on the hw's
66 * HT abilities for a specific band.
67 */
68u32 ieee80211_handle_ht(struct ieee80211_local *local,
69 struct ieee80211_sta_ht_cap *req_ht_cap,
70 struct ieee80211_ht_bss_info *req_bss_cap)
71{
72 struct ieee80211_conf *conf = &local->hw.conf;
73 struct ieee80211_supported_band *sband;
74 struct ieee80211_sta_ht_cap ht_cap;
75 struct ieee80211_ht_bss_info ht_bss_conf;
76 u32 changed = 0;
77 int i;
78 u8 max_tx_streams;
79 u8 tx_mcs_set_cap;
80 bool enable_ht = true;
81
82 sband = local->hw.wiphy->bands[conf->channel->band];
83
84 memset(&ht_cap, 0, sizeof(ht_cap));
85 memset(&ht_bss_conf, 0, sizeof(struct ieee80211_ht_bss_info));
86
87 /* HT is not supported */
88 if (!sband->ht_cap.ht_supported)
89 enable_ht = false;
90
91 /* disable HT */
92 if (!enable_ht) {
93 if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)
94 changed |= BSS_CHANGED_HT;
95 conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
96 conf->ht_cap.ht_supported = false;
97 return changed;
98 }
99
100
101 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE))
102 changed |= BSS_CHANGED_HT;
103
104 conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE;
105 ht_cap.ht_supported = true;
106
107 ht_cap.cap = req_ht_cap->cap & sband->ht_cap.cap;
108 ht_cap.cap &= ~IEEE80211_HT_CAP_SM_PS;
109 ht_cap.cap |= sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS;
110
111 ht_bss_conf.primary_channel = req_bss_cap->primary_channel;
112 ht_bss_conf.bss_cap = req_bss_cap->bss_cap;
113 ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode;
114
115 ht_cap.ampdu_factor = req_ht_cap->ampdu_factor;
116 ht_cap.ampdu_density = req_ht_cap->ampdu_density;
117
118 /* own MCS TX capabilities */
119 tx_mcs_set_cap = sband->ht_cap.mcs.tx_params;
120
121 /*
122 * configure supported Tx MCS according to requested MCS
123 * (based in most cases on Rx capabilities of peer) and self
124 * Tx MCS capabilities (as defined by low level driver HW
125 * Tx capabilities)
126 */
127
128 /* can we TX with MCS rates? */
129 if (!(tx_mcs_set_cap & IEEE80211_HT_MCS_TX_DEFINED))
130 goto check_changed;
131
132 /* Counting from 0, therefore +1 */
133 if (tx_mcs_set_cap & IEEE80211_HT_MCS_TX_RX_DIFF)
134 max_tx_streams =
135 ((tx_mcs_set_cap & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
136 >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
137 else
138 max_tx_streams = IEEE80211_HT_MCS_TX_MAX_STREAMS;
139
140 /*
141 * 802.11n D5.0 20.3.5 / 20.6 says:
142 * - indices 0 to 7 and 32 are single spatial stream
143 * - 8 to 31 are multiple spatial streams using equal modulation
144 * [8..15 for two streams, 16..23 for three and 24..31 for four]
145 * - remainder are multiple spatial streams using unequal modulation
146 */
147 for (i = 0; i < max_tx_streams; i++)
148 ht_cap.mcs.rx_mask[i] =
149 sband->ht_cap.mcs.rx_mask[i] &
150 req_ht_cap->mcs.rx_mask[i];
151
152 if (tx_mcs_set_cap & IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION)
153 for (i = IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE;
154 i < IEEE80211_HT_MCS_MASK_LEN; i++)
155 ht_cap.mcs.rx_mask[i] =
156 sband->ht_cap.mcs.rx_mask[i] &
157 req_ht_cap->mcs.rx_mask[i];
158
159 /* handle MCS rate 32 too */
160 if (sband->ht_cap.mcs.rx_mask[32/8] &
161 req_ht_cap->mcs.rx_mask[32/8] & 1)
162 ht_cap.mcs.rx_mask[32/8] |= 1;
163
164 check_changed:
165 /* if bss configuration changed store the new one */
166 if (memcmp(&conf->ht_cap, &ht_cap, sizeof(ht_cap)) ||
167 memcmp(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf))) {
168 changed |= BSS_CHANGED_HT;
169 memcpy(&conf->ht_cap, &ht_cap, sizeof(ht_cap));
170 memcpy(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf));
171 }
65 172
66 return 0; 173 return changed;
67} 174}
68 175
69static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, 176static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata,
@@ -794,7 +901,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
794 * check if configuration can support the BA policy 901 * check if configuration can support the BA policy
795 * and if buffer size does not exceeds max value */ 902 * and if buffer size does not exceeds max value */
796 if (((ba_policy != 1) 903 if (((ba_policy != 1)
797 && (!(conf->ht_conf.cap & IEEE80211_HT_CAP_DELAY_BA))) 904 && (!(conf->ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA)))
798 || (buf_size > IEEE80211_MAX_AMPDU_BUF)) { 905 || (buf_size > IEEE80211_MAX_AMPDU_BUF)) {
799 status = WLAN_STATUS_INVALID_QOS_PARAM; 906 status = WLAN_STATUS_INVALID_QOS_PARAM;
800#ifdef CONFIG_MAC80211_HT_DEBUG 907#ifdef CONFIG_MAC80211_HT_DEBUG
@@ -812,7 +919,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
812 919
813 sband = local->hw.wiphy->bands[conf->channel->band]; 920 sband = local->hw.wiphy->bands[conf->channel->band];
814 buf_size = IEEE80211_MIN_AMPDU_BUF; 921 buf_size = IEEE80211_MIN_AMPDU_BUF;
815 buf_size = buf_size << sband->ht_info.ampdu_factor; 922 buf_size = buf_size << sband->ht_cap.ampdu_factor;
816 } 923 }
817 924
818 925
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index f49cb9e8bb42..ae4ca3e8b443 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -817,7 +817,7 @@ struct ieee802_11_elems {
817 u8 *wmm_info; 817 u8 *wmm_info;
818 u8 *wmm_param; 818 u8 *wmm_param;
819 struct ieee80211_ht_cap *ht_cap_elem; 819 struct ieee80211_ht_cap *ht_cap_elem;
820 struct ieee80211_ht_addt_info *ht_info_elem; 820 struct ieee80211_ht_info *ht_info_elem;
821 u8 *mesh_config; 821 u8 *mesh_config;
822 u8 *mesh_id; 822 u8 *mesh_id;
823 u8 *peer_link; 823 u8 *peer_link;
@@ -880,9 +880,6 @@ static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
880int ieee80211_hw_config(struct ieee80211_local *local); 880int ieee80211_hw_config(struct ieee80211_local *local);
881int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed); 881int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed);
882void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 882void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
883u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
884 struct ieee80211_ht_info *req_ht_cap,
885 struct ieee80211_ht_bss_info *req_bss_cap);
886void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 883void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
887 u32 changed); 884 u32 changed);
888void ieee80211_configure_filter(struct ieee80211_local *local); 885void ieee80211_configure_filter(struct ieee80211_local *local);
@@ -963,11 +960,14 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
963int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); 960int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
964 961
965/* HT */ 962/* HT */
966int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, 963void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_ht_cap *ht_cap_ie,
967 struct ieee80211_ht_info *ht_info); 964 struct ieee80211_sta_ht_cap *ht_cap);
968int ieee80211_ht_addt_info_ie_to_ht_bss_info( 965void ieee80211_ht_info_ie_to_ht_bss_info(
969 struct ieee80211_ht_addt_info *ht_add_info_ie, 966 struct ieee80211_ht_info *ht_add_info_ie,
970 struct ieee80211_ht_bss_info *bss_info); 967 struct ieee80211_ht_bss_info *bss_info);
968u32 ieee80211_handle_ht(struct ieee80211_local *local,
969 struct ieee80211_sta_ht_cap *req_ht_cap,
970 struct ieee80211_ht_bss_info *req_bss_cap);
971void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); 971void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn);
972 972
973void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, 973void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da,
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index c427954fe8e8..07f812755e55 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -232,100 +232,6 @@ int ieee80211_hw_config(struct ieee80211_local *local)
232 return ret; 232 return ret;
233} 233}
234 234
235/**
236 * ieee80211_handle_ht should be used only after legacy configuration
237 * has been determined namely band, as ht configuration depends upon
238 * the hardware's HT abilities for a _specific_ band.
239 */
240u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
241 struct ieee80211_ht_info *req_ht_cap,
242 struct ieee80211_ht_bss_info *req_bss_cap)
243{
244 struct ieee80211_conf *conf = &local->hw.conf;
245 struct ieee80211_supported_band *sband;
246 struct ieee80211_ht_info ht_conf;
247 struct ieee80211_ht_bss_info ht_bss_conf;
248 u32 changed = 0;
249 int i;
250 u8 max_tx_streams = IEEE80211_HT_CAP_MAX_STREAMS;
251 u8 tx_mcs_set_cap;
252
253 sband = local->hw.wiphy->bands[conf->channel->band];
254
255 memset(&ht_conf, 0, sizeof(struct ieee80211_ht_info));
256 memset(&ht_bss_conf, 0, sizeof(struct ieee80211_ht_bss_info));
257
258 /* HT is not supported */
259 if (!sband->ht_info.ht_supported) {
260 conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
261 goto out;
262 }
263
264 /* disable HT */
265 if (!enable_ht) {
266 if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)
267 changed |= BSS_CHANGED_HT;
268 conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
269 conf->ht_conf.ht_supported = 0;
270 goto out;
271 }
272
273
274 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE))
275 changed |= BSS_CHANGED_HT;
276
277 conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE;
278 ht_conf.ht_supported = 1;
279
280 ht_conf.cap = req_ht_cap->cap & sband->ht_info.cap;
281 ht_conf.cap &= ~(IEEE80211_HT_CAP_SM_PS);
282 ht_conf.cap |= sband->ht_info.cap & IEEE80211_HT_CAP_SM_PS;
283 ht_bss_conf.primary_channel = req_bss_cap->primary_channel;
284 ht_bss_conf.bss_cap = req_bss_cap->bss_cap;
285 ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode;
286
287 ht_conf.ampdu_factor = req_ht_cap->ampdu_factor;
288 ht_conf.ampdu_density = req_ht_cap->ampdu_density;
289
290 /* Bits 96-100 */
291 tx_mcs_set_cap = sband->ht_info.supp_mcs_set[12];
292
293 /* configure suppoerted Tx MCS according to requested MCS
294 * (based in most cases on Rx capabilities of peer) and self
295 * Tx MCS capabilities (as defined by low level driver HW
296 * Tx capabilities) */
297 if (!(tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_DEFINED))
298 goto check_changed;
299
300 /* Counting from 0 therfore + 1 */
301 if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_RX_DIFF)
302 max_tx_streams = ((tx_mcs_set_cap &
303 IEEE80211_HT_CAP_MCS_TX_STREAMS) >> 2) + 1;
304
305 for (i = 0; i < max_tx_streams; i++)
306 ht_conf.supp_mcs_set[i] =
307 sband->ht_info.supp_mcs_set[i] &
308 req_ht_cap->supp_mcs_set[i];
309
310 if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_UEQM)
311 for (i = IEEE80211_SUPP_MCS_SET_UEQM;
312 i < IEEE80211_SUPP_MCS_SET_LEN; i++)
313 ht_conf.supp_mcs_set[i] =
314 sband->ht_info.supp_mcs_set[i] &
315 req_ht_cap->supp_mcs_set[i];
316
317check_changed:
318 /* if bss configuration changed store the new one */
319 if (memcmp(&conf->ht_conf, &ht_conf, sizeof(ht_conf)) ||
320 memcmp(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf))) {
321 changed |= BSS_CHANGED_HT;
322 memcpy(&conf->ht_conf, &ht_conf, sizeof(ht_conf));
323 memcpy(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf));
324 }
325out:
326 return changed;
327}
328
329void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 235void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
330 u32 changed) 236 u32 changed)
331{ 237{
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 829995e740a7..196dd39f6286 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -236,7 +236,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
236 struct ieee80211_local *local = sdata->local; 236 struct ieee80211_local *local = sdata->local;
237 struct sk_buff *skb; 237 struct sk_buff *skb;
238 struct ieee80211_mgmt *mgmt; 238 struct ieee80211_mgmt *mgmt;
239 u8 *pos, *ies, *ht_add_ie; 239 u8 *pos, *ies, *ht_ie;
240 int i, len, count, rates_len, supp_rates_len; 240 int i, len, count, rates_len, supp_rates_len;
241 u16 capab; 241 u16 capab;
242 struct ieee80211_bss *bss; 242 struct ieee80211_bss *bss;
@@ -393,24 +393,25 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
393 393
394 /* wmm support is a must to HT */ 394 /* wmm support is a must to HT */
395 if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED) && 395 if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED) &&
396 sband->ht_info.ht_supported && 396 sband->ht_cap.ht_supported &&
397 (ht_add_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_EXTRA_INFO))) { 397 (ht_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_INFORMATION)) &&
398 struct ieee80211_ht_addt_info *ht_add_info = 398 ht_ie[1] >= sizeof(struct ieee80211_ht_info)) {
399 (struct ieee80211_ht_addt_info *)ht_add_ie; 399 struct ieee80211_ht_info *ht_info =
400 u16 cap = sband->ht_info.cap; 400 (struct ieee80211_ht_info *)(ht_ie + 2);
401 u16 cap = sband->ht_cap.cap;
401 __le16 tmp; 402 __le16 tmp;
402 u32 flags = local->hw.conf.channel->flags; 403 u32 flags = local->hw.conf.channel->flags;
403 404
404 switch (ht_add_info->ht_param & IEEE80211_HT_IE_CHA_SEC_OFFSET) { 405 switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
405 case IEEE80211_HT_IE_CHA_SEC_ABOVE: 406 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
406 if (flags & IEEE80211_CHAN_NO_FAT_ABOVE) { 407 if (flags & IEEE80211_CHAN_NO_FAT_ABOVE) {
407 cap &= ~IEEE80211_HT_CAP_SUP_WIDTH; 408 cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
408 cap &= ~IEEE80211_HT_CAP_SGI_40; 409 cap &= ~IEEE80211_HT_CAP_SGI_40;
409 } 410 }
410 break; 411 break;
411 case IEEE80211_HT_IE_CHA_SEC_BELOW: 412 case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
412 if (flags & IEEE80211_CHAN_NO_FAT_BELOW) { 413 if (flags & IEEE80211_CHAN_NO_FAT_BELOW) {
413 cap &= ~IEEE80211_HT_CAP_SUP_WIDTH; 414 cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
414 cap &= ~IEEE80211_HT_CAP_SGI_40; 415 cap &= ~IEEE80211_HT_CAP_SGI_40;
415 } 416 }
416 break; 417 break;
@@ -424,9 +425,9 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
424 memcpy(pos, &tmp, sizeof(u16)); 425 memcpy(pos, &tmp, sizeof(u16));
425 pos += sizeof(u16); 426 pos += sizeof(u16);
426 /* TODO: needs a define here for << 2 */ 427 /* TODO: needs a define here for << 2 */
427 *pos++ = sband->ht_info.ampdu_factor | 428 *pos++ = sband->ht_cap.ampdu_factor |
428 (sband->ht_info.ampdu_density << 2); 429 (sband->ht_cap.ampdu_density << 2);
429 memcpy(pos, sband->ht_info.supp_mcs_set, 16); 430 memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
430 } 431 }
431 432
432 kfree(ifsta->assocreq_ies); 433 kfree(ifsta->assocreq_ies);
@@ -730,7 +731,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
730 if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { 731 if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
731 changed |= BSS_CHANGED_HT; 732 changed |= BSS_CHANGED_HT;
732 sdata->bss_conf.assoc_ht = 1; 733 sdata->bss_conf.assoc_ht = 1;
733 sdata->bss_conf.ht_conf = &conf->ht_conf; 734 sdata->bss_conf.ht_cap = &conf->ht_cap;
734 sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf; 735 sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf;
735 } 736 }
736 737
@@ -850,7 +851,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
850 changed |= BSS_CHANGED_HT; 851 changed |= BSS_CHANGED_HT;
851 852
852 sdata->bss_conf.assoc_ht = 0; 853 sdata->bss_conf.assoc_ht = 0;
853 sdata->bss_conf.ht_conf = NULL; 854 sdata->bss_conf.ht_cap = NULL;
854 sdata->bss_conf.ht_bss_conf = NULL; 855 sdata->bss_conf.ht_bss_conf = NULL;
855 856
856 ieee80211_led_assoc(local, 0); 857 ieee80211_led_assoc(local, 0);
@@ -1335,11 +1336,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1335 if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param && 1336 if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param &&
1336 (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) { 1337 (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
1337 struct ieee80211_ht_bss_info bss_info; 1338 struct ieee80211_ht_bss_info bss_info;
1338 ieee80211_ht_cap_ie_to_ht_info( 1339 ieee80211_ht_cap_ie_to_sta_ht_cap(
1339 elems.ht_cap_elem, &sta->sta.ht_info); 1340 elems.ht_cap_elem, &sta->sta.ht_cap);
1340 ieee80211_ht_addt_info_ie_to_ht_bss_info( 1341 ieee80211_ht_info_ie_to_ht_bss_info(
1341 elems.ht_info_elem, &bss_info); 1342 elems.ht_info_elem, &bss_info);
1342 ieee80211_handle_ht(local, 1, &sta->sta.ht_info, &bss_info); 1343 ieee80211_handle_ht(local, &sta->sta.ht_cap, &bss_info);
1343 } 1344 }
1344 1345
1345 rate_control_rate_init(sta); 1346 rate_control_rate_init(sta);
@@ -1696,9 +1697,9 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
1696 elems.wmm_param && conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { 1697 elems.wmm_param && conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
1697 struct ieee80211_ht_bss_info bss_info; 1698 struct ieee80211_ht_bss_info bss_info;
1698 1699
1699 ieee80211_ht_addt_info_ie_to_ht_bss_info( 1700 ieee80211_ht_info_ie_to_ht_bss_info(
1700 elems.ht_info_elem, &bss_info); 1701 elems.ht_info_elem, &bss_info);
1701 changed |= ieee80211_handle_ht(local, 1, &conf->ht_conf, 1702 changed |= ieee80211_handle_ht(local, &conf->ht_cap,
1702 &bss_info); 1703 &bss_info);
1703 } 1704 }
1704 1705
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 1b605457017e..9941a60a2327 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -532,8 +532,8 @@ void ieee802_11_parse_elems(u8 *start, size_t len,
532 if (elen >= sizeof(struct ieee80211_ht_cap)) 532 if (elen >= sizeof(struct ieee80211_ht_cap))
533 elems->ht_cap_elem = (void *)pos; 533 elems->ht_cap_elem = (void *)pos;
534 break; 534 break;
535 case WLAN_EID_HT_EXTRA_INFO: 535 case WLAN_EID_HT_INFORMATION:
536 if (elen >= sizeof(struct ieee80211_ht_addt_info)) 536 if (elen >= sizeof(struct ieee80211_ht_info))
537 elems->ht_info_elem = (void *)pos; 537 elems->ht_info_elem = (void *)pos;
538 break; 538 break;
539 case WLAN_EID_MESH_ID: 539 case WLAN_EID_MESH_ID:
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 29c41040c8c9..a3af15141244 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -147,7 +147,7 @@ static int ieee80211_ioctl_giwname(struct net_device *dev,
147 sband = local->hw.wiphy->bands[IEEE80211_BAND_5GHZ]; 147 sband = local->hw.wiphy->bands[IEEE80211_BAND_5GHZ];
148 if (sband) { 148 if (sband) {
149 is_a = 1; 149 is_a = 1;
150 is_ht |= sband->ht_info.ht_supported; 150 is_ht |= sband->ht_cap.ht_supported;
151 } 151 }
152 152
153 sband = local->hw.wiphy->bands[IEEE80211_BAND_2GHZ]; 153 sband = local->hw.wiphy->bands[IEEE80211_BAND_2GHZ];
@@ -160,7 +160,7 @@ static int ieee80211_ioctl_giwname(struct net_device *dev,
160 if (sband->bitrates[i].bitrate == 60) 160 if (sband->bitrates[i].bitrate == 60)
161 is_g = 1; 161 is_g = 1;
162 } 162 }
163 is_ht |= sband->ht_info.ht_supported; 163 is_ht |= sband->ht_cap.ht_supported;
164 } 164 }
165 165
166 strcpy(name, "IEEE 802.11"); 166 strcpy(name, "IEEE 802.11");