Enable more PCMCIA specific options, thanks sn9
[librecmc/librecmc.git] / package / mac80211 / patches / 418-ieee80211-cleanup-ht-terminology.patch
1 Subject: 802.11: clean up/fix HT support
2
3 This patch cleans up a number of things:
4  * the unusable definition of the HT capabilities/HT information
5    information elements
6  * variable names that are hard to understand
7  * mac80211: move ieee80211_handle_ht to ht.c and remove the unused
8              enable_ht parameter
9  * mac80211: fix bug with MCS rate 32 in ieee80211_handle_ht
10  * mac80211: fix bug with casting the result of ieee80211_bss_get_ie
11              to an information element _contents_ rather than the
12              whole element, add size checking (another out-of-bounds
13              access bug fixed!)
14  * mac80211: remove some unused return values in favour of BUG_ON
15              checking
16  * a few minor other things
17
18 Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
19 ---
20  drivers/net/wireless/ath9k/main.c         |   57 +++++------
21  drivers/net/wireless/ath9k/rc.c           |   10 -
22  drivers/net/wireless/ath9k/rc.h           |    1 
23  drivers/net/wireless/ath9k/recv.c         |    2 
24  drivers/net/wireless/ath9k/xmit.c         |    2 
25  drivers/net/wireless/iwlwifi/iwl-agn-rs.c |   18 +--
26  drivers/net/wireless/iwlwifi/iwl-agn.c    |   20 +--
27  drivers/net/wireless/iwlwifi/iwl-core.c   |   71 +++++++-------
28  drivers/net/wireless/iwlwifi/iwl-core.h   |    2 
29  drivers/net/wireless/iwlwifi/iwl-dev.h    |    4 
30  drivers/net/wireless/iwlwifi/iwl-scan.c   |   12 +-
31  drivers/net/wireless/iwlwifi/iwl-sta.c    |    6 -
32  drivers/net/wireless/mac80211_hwsim.c     |   19 +--
33  include/linux/ieee80211.h                 |  133 ++++++++++++++++++--------
34  include/net/mac80211.h                    |   12 +-
35  include/net/wireless.h                    |   15 +-
36  net/mac80211/cfg.c                        |    7 -
37  net/mac80211/ht.c                         |  151 +++++++++++++++++++++++++-----
38  net/mac80211/ieee80211_i.h                |   16 +--
39  net/mac80211/main.c                       |   94 ------------------
40  net/mac80211/mlme.c                       |   45 ++++----
41  net/mac80211/util.c                       |    4 
42  net/mac80211/wext.c                       |    4 
43  23 files changed, 386 insertions(+), 319 deletions(-)
44
45 --- everything.orig/include/linux/ieee80211.h   2008-10-08 20:44:47.000000000 +0200
46 +++ everything/include/linux/ieee80211.h        2008-10-09 02:16:21.000000000 +0200
47 @@ -685,28 +685,88 @@ struct ieee80211_bar {
48  #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL     0x0000
49  #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA  0x0004
50  
51 +
52 +#define IEEE80211_HT_MCS_MASK_LEN              10
53 +
54 +/**
55 + * struct ieee80211_mcs_info - MCS information
56 + * @rx_mask: RX mask
57 + * @rx_highest: highest supported RX rate
58 + * @tx_params: TX parameters
59 + */
60 +struct ieee80211_mcs_info {
61 +       u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
62 +       __le16 rx_highest;
63 +       u8 tx_params;
64 +       u8 reserved[3];
65 +} __attribute__((packed));
66 +
67 +/* 802.11n HT capability MSC set */
68 +#define IEEE80211_HT_MCS_RX_HIGHEST_MASK       0x3ff
69 +#define IEEE80211_HT_MCS_TX_DEFINED            0x01
70 +#define IEEE80211_HT_MCS_TX_RX_DIFF            0x02
71 +/* value 0 == 1 stream etc */
72 +#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK   0x0C
73 +#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT  2
74 +#define                IEEE80211_HT_MCS_TX_MAX_STREAMS 4
75 +#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
76 +
77 +/*
78 + * 802.11n D5.0 20.3.5 / 20.6 says:
79 + * - indices 0 to 7 and 32 are single spatial stream
80 + * - 8 to 31 are multiple spatial streams using equal modulation
81 + *   [8..15 for two streams, 16..23 for three and 24..31 for four]
82 + * - remainder are multiple spatial streams using unequal modulation
83 + */
84 +#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
85 +#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
86 +       (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
87 +
88  /**
89   * struct ieee80211_ht_cap - HT capabilities
90   *
91 - * This structure refers to "HT capabilities element" as
92 - * described in 802.11n draft section 7.3.2.52
93 + * This structure is the "HT capabilities element" as
94 + * described in 802.11n D5.0 7.3.2.57
95   */
96  struct ieee80211_ht_cap {
97         __le16 cap_info;
98         u8 ampdu_params_info;
99 -       u8 supp_mcs_set[16];
100 +
101 +       /* 16 bytes MCS information */
102 +       struct ieee80211_mcs_info mcs;
103 +
104         __le16 extended_ht_cap_info;
105         __le32 tx_BF_cap_info;
106         u8 antenna_selection_info;
107  } __attribute__ ((packed));
108  
109 +/* 802.11n HT capabilities masks (for cap_info) */
110 +#define IEEE80211_HT_CAP_LDPC_CODING           0x0001
111 +#define IEEE80211_HT_CAP_SUP_WIDTH_20_40       0x0002
112 +#define IEEE80211_HT_CAP_SM_PS                 0x000C
113 +#define IEEE80211_HT_CAP_GRN_FLD               0x0010
114 +#define IEEE80211_HT_CAP_SGI_20                        0x0020
115 +#define IEEE80211_HT_CAP_SGI_40                        0x0040
116 +#define IEEE80211_HT_CAP_TX_STBC               0x0080
117 +#define IEEE80211_HT_CAP_RX_STBC               0x0300
118 +#define IEEE80211_HT_CAP_DELAY_BA              0x0400
119 +#define IEEE80211_HT_CAP_MAX_AMSDU             0x0800
120 +#define IEEE80211_HT_CAP_DSSSCCK40             0x1000
121 +#define IEEE80211_HT_CAP_PSMP_SUPPORT          0x2000
122 +#define IEEE80211_HT_CAP_40MHZ_INTOLERANT      0x4000
123 +#define IEEE80211_HT_CAP_LSIG_TXOP_PROT                0x8000
124 +
125 +/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
126 +#define IEEE80211_HT_AMPDU_PARM_FACTOR         0x03
127 +#define IEEE80211_HT_AMPDU_PARM_DENSITY                0x1C
128 +
129  /**
130 - * struct ieee80211_ht_cap - HT additional information
131 + * struct ieee80211_ht_info - HT information
132   *
133 - * This structure refers to "HT information element" as
134 - * described in 802.11n draft section 7.3.2.53
135 + * This structure is the "HT information element" as
136 + * described in 802.11n D5.0 7.3.2.58
137   */
138 -struct ieee80211_ht_addt_info {
139 +struct ieee80211_ht_info {
140         u8 control_chan;
141         u8 ht_param;
142         __le16 operation_mode;
143 @@ -714,36 +774,33 @@ struct ieee80211_ht_addt_info {
144         u8 basic_set[16];
145  } __attribute__ ((packed));
146  
147 -/* 802.11n HT capabilities masks */
148 -#define IEEE80211_HT_CAP_SUP_WIDTH             0x0002
149 -#define IEEE80211_HT_CAP_SM_PS                 0x000C
150 -#define IEEE80211_HT_CAP_GRN_FLD               0x0010
151 -#define IEEE80211_HT_CAP_SGI_20                        0x0020
152 -#define IEEE80211_HT_CAP_SGI_40                        0x0040
153 -#define IEEE80211_HT_CAP_DELAY_BA              0x0400
154 -#define IEEE80211_HT_CAP_MAX_AMSDU             0x0800
155 -#define IEEE80211_HT_CAP_DSSSCCK40             0x1000
156 -/* 802.11n HT capability AMPDU settings */
157 -#define IEEE80211_HT_CAP_AMPDU_FACTOR          0x03
158 -#define IEEE80211_HT_CAP_AMPDU_DENSITY         0x1C
159 -/* 802.11n HT capability MSC set */
160 -#define IEEE80211_SUPP_MCS_SET_UEQM            4
161 -#define IEEE80211_HT_CAP_MAX_STREAMS           4
162 -#define IEEE80211_SUPP_MCS_SET_LEN             10
163 -/* maximum streams the spec allows */
164 -#define IEEE80211_HT_CAP_MCS_TX_DEFINED                0x01
165 -#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF                0x02
166 -#define IEEE80211_HT_CAP_MCS_TX_STREAMS                0x0C
167 -#define IEEE80211_HT_CAP_MCS_TX_UEQM           0x10
168 -/* 802.11n HT IE masks */
169 -#define IEEE80211_HT_IE_CHA_SEC_OFFSET         0x03
170 -#define IEEE80211_HT_IE_CHA_SEC_NONE           0x00
171 -#define IEEE80211_HT_IE_CHA_SEC_ABOVE          0x01
172 -#define IEEE80211_HT_IE_CHA_SEC_BELOW          0x03
173 -#define IEEE80211_HT_IE_CHA_WIDTH              0x04
174 -#define IEEE80211_HT_IE_HT_PROTECTION          0x0003
175 -#define IEEE80211_HT_IE_NON_GF_STA_PRSNT       0x0004
176 -#define IEEE80211_HT_IE_NON_HT_STA_PRSNT       0x0010
177 +/* for ht_param */
178 +#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET              0x03
179 +#define                IEEE80211_HT_PARAM_CHA_SEC_NONE         0x00
180 +#define                IEEE80211_HT_PARAM_CHA_SEC_ABOVE        0x01
181 +#define                IEEE80211_HT_PARAM_CHA_SEC_BELOW        0x03
182 +#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY              0x04
183 +#define IEEE80211_HT_PARAM_RIFS_MODE                   0x08
184 +#define IEEE80211_HT_PARAM_SPSMP_SUPPORT               0x10
185 +#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN          0xE0
186 +
187 +/* for operation_mode */
188 +#define IEEE80211_HT_OP_MODE_PROTECTION                        0x0003
189 +#define                IEEE80211_HT_OP_MODE_PROTECTION_NONE            0
190 +#define                IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER       1
191 +#define                IEEE80211_HT_OP_MODE_PROTECTION_20MHZ           2
192 +#define                IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED     3
193 +#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT          0x0004
194 +#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT          0x0010
195 +
196 +/* for stbc_param */
197 +#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON            0x0040
198 +#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT          0x0080
199 +#define IEEE80211_HT_STBC_PARAM_STBC_BEACON            0x0100
200 +#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT     0x0200
201 +#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE             0x0400
202 +#define IEEE80211_HT_STBC_PARAM_PCO_PHASE              0x0800
203 +
204  
205  /* block-ack parameters */
206  #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
207 @@ -949,7 +1006,7 @@ enum ieee80211_eid {
208         WLAN_EID_EXT_SUPP_RATES = 50,
209         /* 802.11n */
210         WLAN_EID_HT_CAPABILITY = 45,
211 -       WLAN_EID_HT_EXTRA_INFO = 61,
212 +       WLAN_EID_HT_INFORMATION = 61,
213         /* 802.11i */
214         WLAN_EID_RSN = 48,
215         WLAN_EID_WPA = 221,
216 --- everything.orig/include/net/wireless.h      2008-10-08 20:44:46.000000000 +0200
217 +++ everything/include/net/wireless.h   2008-10-09 02:16:20.000000000 +0200
218 @@ -10,6 +10,7 @@
219  #include <linux/netdevice.h>
220  #include <linux/debugfs.h>
221  #include <linux/list.h>
222 +#include <linux/ieee80211.h>
223  #include <net/cfg80211.h>
224  
225  /**
226 @@ -133,23 +134,23 @@ struct ieee80211_rate {
227  };
228  
229  /**
230 - * struct ieee80211_ht_info - describing STA's HT capabilities
231 + * struct ieee80211_sta_ht_cap - STA's HT capabilities
232   *
233   * This structure describes most essential parameters needed
234   * to describe 802.11n HT capabilities for an STA.
235   *
236 - * @ht_supported: is HT supported by STA, 0: no, 1: yes
237 + * @ht_supported: is HT supported by the STA
238   * @cap: HT capabilities map as described in 802.11n spec
239   * @ampdu_factor: Maximum A-MPDU length factor
240   * @ampdu_density: Minimum A-MPDU spacing
241 - * @supp_mcs_set: Supported MCS set as described in 802.11n spec
242 + * @mcs: Supported MCS rates
243   */
244 -struct ieee80211_ht_info {
245 +struct ieee80211_sta_ht_cap {
246         u16 cap; /* use IEEE80211_HT_CAP_ */
247 -       u8 ht_supported;
248 +       bool ht_supported;
249         u8 ampdu_factor;
250         u8 ampdu_density;
251 -       u8 supp_mcs_set[16];
252 +       struct ieee80211_mcs_info mcs;
253  };
254  
255  /**
256 @@ -173,7 +174,7 @@ struct ieee80211_supported_band {
257         enum ieee80211_band band;
258         int n_channels;
259         int n_bitrates;
260 -       struct ieee80211_ht_info ht_info;
261 +       struct ieee80211_sta_ht_cap ht_cap;
262  };
263  
264  /**
265 --- everything.orig/net/mac80211/main.c 2008-10-08 20:45:06.000000000 +0200
266 +++ everything/net/mac80211/main.c      2008-10-09 02:16:29.000000000 +0200
267 @@ -232,100 +232,6 @@ int ieee80211_hw_config(struct ieee80211
268         return ret;
269  }
270  
271 -/**
272 - * ieee80211_handle_ht should be used only after legacy configuration
273 - * has been determined namely band, as ht configuration depends upon
274 - * the hardware's HT abilities for a _specific_ band.
275 - */
276 -u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
277 -                          struct ieee80211_ht_info *req_ht_cap,
278 -                          struct ieee80211_ht_bss_info *req_bss_cap)
279 -{
280 -       struct ieee80211_conf *conf = &local->hw.conf;
281 -       struct ieee80211_supported_band *sband;
282 -       struct ieee80211_ht_info ht_conf;
283 -       struct ieee80211_ht_bss_info ht_bss_conf;
284 -       u32 changed = 0;
285 -       int i;
286 -       u8 max_tx_streams = IEEE80211_HT_CAP_MAX_STREAMS;
287 -       u8 tx_mcs_set_cap;
288 -
289 -       sband = local->hw.wiphy->bands[conf->channel->band];
290 -
291 -       memset(&ht_conf, 0, sizeof(struct ieee80211_ht_info));
292 -       memset(&ht_bss_conf, 0, sizeof(struct ieee80211_ht_bss_info));
293 -
294 -       /* HT is not supported */
295 -       if (!sband->ht_info.ht_supported) {
296 -               conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
297 -               goto out;
298 -       }
299 -
300 -       /* disable HT */
301 -       if (!enable_ht) {
302 -               if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)
303 -                       changed |= BSS_CHANGED_HT;
304 -               conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
305 -               conf->ht_conf.ht_supported = 0;
306 -               goto out;
307 -       }
308 -
309 -
310 -       if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE))
311 -               changed |= BSS_CHANGED_HT;
312 -
313 -       conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE;
314 -       ht_conf.ht_supported = 1;
315 -
316 -       ht_conf.cap = req_ht_cap->cap & sband->ht_info.cap;
317 -       ht_conf.cap &= ~(IEEE80211_HT_CAP_SM_PS);
318 -       ht_conf.cap |= sband->ht_info.cap & IEEE80211_HT_CAP_SM_PS;
319 -       ht_bss_conf.primary_channel = req_bss_cap->primary_channel;
320 -       ht_bss_conf.bss_cap = req_bss_cap->bss_cap;
321 -       ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode;
322 -
323 -       ht_conf.ampdu_factor = req_ht_cap->ampdu_factor;
324 -       ht_conf.ampdu_density = req_ht_cap->ampdu_density;
325 -
326 -       /* Bits 96-100 */
327 -       tx_mcs_set_cap = sband->ht_info.supp_mcs_set[12];
328 -
329 -       /* configure suppoerted Tx MCS according to requested MCS
330 -        * (based in most cases on Rx capabilities of peer) and self
331 -        * Tx MCS capabilities (as defined by low level driver HW
332 -        * Tx capabilities) */
333 -       if (!(tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_DEFINED))
334 -               goto check_changed;
335 -
336 -       /* Counting from 0 therfore + 1 */
337 -       if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_RX_DIFF)
338 -               max_tx_streams = ((tx_mcs_set_cap &
339 -                               IEEE80211_HT_CAP_MCS_TX_STREAMS) >> 2) + 1;
340 -
341 -       for (i = 0; i < max_tx_streams; i++)
342 -               ht_conf.supp_mcs_set[i] =
343 -                       sband->ht_info.supp_mcs_set[i] &
344 -                                       req_ht_cap->supp_mcs_set[i];
345 -
346 -       if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_UEQM)
347 -               for (i = IEEE80211_SUPP_MCS_SET_UEQM;
348 -                    i < IEEE80211_SUPP_MCS_SET_LEN; i++)
349 -                       ht_conf.supp_mcs_set[i] =
350 -                               sband->ht_info.supp_mcs_set[i] &
351 -                                       req_ht_cap->supp_mcs_set[i];
352 -
353 -check_changed:
354 -       /* if bss configuration changed store the new one */
355 -       if (memcmp(&conf->ht_conf, &ht_conf, sizeof(ht_conf)) ||
356 -           memcmp(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf))) {
357 -               changed |= BSS_CHANGED_HT;
358 -               memcpy(&conf->ht_conf, &ht_conf, sizeof(ht_conf));
359 -               memcpy(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf));
360 -       }
361 -out:
362 -       return changed;
363 -}
364 -
365  void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
366                                       u32 changed)
367  {
368 --- everything.orig/include/net/mac80211.h      2008-10-08 20:45:06.000000000 +0200
369 +++ everything/include/net/mac80211.h   2008-10-09 02:16:30.000000000 +0200
370 @@ -191,7 +191,7 @@ enum ieee80211_bss_change {
371   * @beacon_int: beacon interval
372   * @assoc_capability: capabilities taken from assoc resp
373   * @assoc_ht: association in HT mode
374 - * @ht_conf: ht capabilities
375 + * @ht_cap: ht capabilities
376   * @ht_bss_conf: ht extended capabilities
377   * @basic_rates: bitmap of basic rates, each bit stands for an
378   *     index into the rate table configured by the driver in
379 @@ -212,7 +212,7 @@ struct ieee80211_bss_conf {
380         u64 basic_rates;
381         /* ht related data */
382         bool assoc_ht;
383 -       struct ieee80211_ht_info *ht_conf;
384 +       struct ieee80211_sta_ht_cap *ht_cap;
385         struct ieee80211_ht_bss_info *ht_bss_conf;
386  };
387  
388 @@ -477,7 +477,7 @@ static inline int __deprecated __IEEE802
389   * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
390   *     1/2: antenna 0/1
391   * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
392 - * @ht_conf: describes current self configuration of 802.11n HT capabilies
393 + * @ht_cap: describes current self configuration of 802.11n HT capabilities
394   * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
395   * @channel: the channel to tune to
396   */
397 @@ -493,7 +493,7 @@ struct ieee80211_conf {
398  
399         struct ieee80211_channel *channel;
400  
401 -       struct ieee80211_ht_info ht_conf;
402 +       struct ieee80211_sta_ht_cap ht_cap;
403         struct ieee80211_ht_bss_info ht_bss_conf;
404  };
405  
406 @@ -686,7 +686,7 @@ enum set_key_cmd {
407   * @addr: MAC address
408   * @aid: AID we assigned to the station if we're an AP
409   * @supp_rates: Bitmap of supported rates (per band)
410 - * @ht_info: HT capabilities of this STA
411 + * @ht_cap: HT capabilities of this STA
412   * @drv_priv: data area for driver use, will always be aligned to
413   *     sizeof(void *), size is determined in hw information.
414   */
415 @@ -694,7 +694,7 @@ struct ieee80211_sta {
416         u64 supp_rates[IEEE80211_NUM_BANDS];
417         u8 addr[ETH_ALEN];
418         u16 aid;
419 -       struct ieee80211_ht_info ht_info;
420 +       struct ieee80211_sta_ht_cap ht_cap;
421  
422         /* must be last */
423         u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
424 --- everything.orig/net/mac80211/ieee80211_i.h  2008-10-08 20:45:06.000000000 +0200
425 +++ everything/net/mac80211/ieee80211_i.h       2008-10-09 02:16:30.000000000 +0200
426 @@ -817,7 +817,7 @@ struct ieee802_11_elems {
427         u8 *wmm_info;
428         u8 *wmm_param;
429         struct ieee80211_ht_cap *ht_cap_elem;
430 -       struct ieee80211_ht_addt_info *ht_info_elem;
431 +       struct ieee80211_ht_info *ht_info_elem;
432         u8 *mesh_config;
433         u8 *mesh_id;
434         u8 *peer_link;
435 @@ -885,9 +885,6 @@ static inline int ieee80211_bssid_match(
436  int ieee80211_hw_config(struct ieee80211_local *local);
437  int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed);
438  void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
439 -u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
440 -                       struct ieee80211_ht_info *req_ht_cap,
441 -                       struct ieee80211_ht_bss_info *req_bss_cap);
442  void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
443                                       u32 changed);
444  void ieee80211_configure_filter(struct ieee80211_local *local);
445 @@ -968,11 +965,14 @@ int ieee80211_monitor_start_xmit(struct 
446  int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
447  
448  /* HT */
449 -int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
450 -                                  struct ieee80211_ht_info *ht_info);
451 -int ieee80211_ht_addt_info_ie_to_ht_bss_info(
452 -                       struct ieee80211_ht_addt_info *ht_add_info_ie,
453 +void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_ht_cap *ht_cap_ie,
454 +                                      struct ieee80211_sta_ht_cap *ht_cap);
455 +void ieee80211_ht_info_ie_to_ht_bss_info(
456 +                       struct ieee80211_ht_info *ht_add_info_ie,
457                         struct ieee80211_ht_bss_info *bss_info);
458 +u32 ieee80211_handle_ht(struct ieee80211_local *local,
459 +                       struct ieee80211_sta_ht_cap *req_ht_cap,
460 +                       struct ieee80211_ht_bss_info *req_bss_cap);
461  void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn);
462  
463  void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da,
464 --- everything.orig/net/mac80211/wext.c 2008-10-08 20:45:06.000000000 +0200
465 +++ everything/net/mac80211/wext.c      2008-10-09 02:16:28.000000000 +0200
466 @@ -147,7 +147,7 @@ static int ieee80211_ioctl_giwname(struc
467         sband = local->hw.wiphy->bands[IEEE80211_BAND_5GHZ];
468         if (sband) {
469                 is_a = 1;
470 -               is_ht |= sband->ht_info.ht_supported;
471 +               is_ht |= sband->ht_cap.ht_supported;
472         }
473  
474         sband = local->hw.wiphy->bands[IEEE80211_BAND_2GHZ];
475 @@ -160,7 +160,7 @@ static int ieee80211_ioctl_giwname(struc
476                         if (sband->bitrates[i].bitrate == 60)
477                                 is_g = 1;
478                 }
479 -               is_ht |= sband->ht_info.ht_supported;
480 +               is_ht |= sband->ht_cap.ht_supported;
481         }
482  
483         strcpy(name, "IEEE 802.11");
484 --- everything.orig/net/mac80211/ht.c   2008-10-08 20:44:47.000000000 +0200
485 +++ everything/net/mac80211/ht.c        2008-10-09 02:16:26.000000000 +0200
486 @@ -20,37 +20,33 @@
487  #include "sta_info.h"
488  #include "wme.h"
489  
490 -int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
491 -                                  struct ieee80211_ht_info *ht_info)
492 +void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_ht_cap *ht_cap_ie,
493 +                                      struct ieee80211_sta_ht_cap *ht_cap)
494  {
495  
496 -       if (ht_info == NULL)
497 -               return -EINVAL;
498 +       BUG_ON(!ht_cap);
499  
500 -       memset(ht_info, 0, sizeof(*ht_info));
501 +       memset(ht_cap, 0, sizeof(*ht_cap));
502  
503         if (ht_cap_ie) {
504                 u8 ampdu_info = ht_cap_ie->ampdu_params_info;
505  
506 -               ht_info->ht_supported = 1;
507 -               ht_info->cap = le16_to_cpu(ht_cap_ie->cap_info);
508 -               ht_info->ampdu_factor =
509 -                       ampdu_info & IEEE80211_HT_CAP_AMPDU_FACTOR;
510 -               ht_info->ampdu_density =
511 -                       (ampdu_info & IEEE80211_HT_CAP_AMPDU_DENSITY) >> 2;
512 -               memcpy(ht_info->supp_mcs_set, ht_cap_ie->supp_mcs_set, 16);
513 +               ht_cap->ht_supported = true;
514 +               ht_cap->cap = le16_to_cpu(ht_cap_ie->cap_info);
515 +               ht_cap->ampdu_factor =
516 +                       ampdu_info & IEEE80211_HT_AMPDU_PARM_FACTOR;
517 +               ht_cap->ampdu_density =
518 +                       (ampdu_info & IEEE80211_HT_AMPDU_PARM_DENSITY) >> 2;
519 +               memcpy(&ht_cap->mcs, &ht_cap_ie->mcs, sizeof(ht_cap->mcs));
520         } else
521 -               ht_info->ht_supported = 0;
522 -
523 -       return 0;
524 +               ht_cap->ht_supported = false;
525  }
526  
527 -int ieee80211_ht_addt_info_ie_to_ht_bss_info(
528 -                       struct ieee80211_ht_addt_info *ht_add_info_ie,
529 +void ieee80211_ht_info_ie_to_ht_bss_info(
530 +                       struct ieee80211_ht_info *ht_add_info_ie,
531                         struct ieee80211_ht_bss_info *bss_info)
532  {
533 -       if (bss_info == NULL)
534 -               return -EINVAL;
535 +       BUG_ON(!bss_info);
536  
537         memset(bss_info, 0, sizeof(*bss_info));
538  
539 @@ -62,8 +58,119 @@ int ieee80211_ht_addt_info_ie_to_ht_bss_
540                 bss_info->bss_cap = ht_add_info_ie->ht_param;
541                 bss_info->bss_op_mode = (u8)(op_mode & 0xff);
542         }
543 +}
544 +
545 +/*
546 + * ieee80211_handle_ht should be called only after the operating band
547 + * has been determined as ht configuration depends on the hw's
548 + * HT abilities for a specific band.
549 + */
550 +u32 ieee80211_handle_ht(struct ieee80211_local *local,
551 +                       struct ieee80211_sta_ht_cap *req_ht_cap,
552 +                       struct ieee80211_ht_bss_info *req_bss_cap)
553 +{
554 +       struct ieee80211_conf *conf = &local->hw.conf;
555 +       struct ieee80211_supported_band *sband;
556 +       struct ieee80211_sta_ht_cap ht_cap;
557 +       struct ieee80211_ht_bss_info ht_bss_conf;
558 +       u32 changed = 0;
559 +       int i;
560 +       u8 max_tx_streams;
561 +       u8 tx_mcs_set_cap;
562 +       bool enable_ht = true;
563 +
564 +       sband = local->hw.wiphy->bands[conf->channel->band];
565 +
566 +       memset(&ht_cap, 0, sizeof(ht_cap));
567 +       memset(&ht_bss_conf, 0, sizeof(struct ieee80211_ht_bss_info));
568 +
569 +       /* HT is not supported */
570 +       if (!sband->ht_cap.ht_supported)
571 +               enable_ht = false;
572 +
573 +       /* disable HT */
574 +       if (!enable_ht) {
575 +               if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)
576 +                       changed |= BSS_CHANGED_HT;
577 +               conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
578 +               conf->ht_cap.ht_supported = false;
579 +               return changed;
580 +       }
581 +
582 +
583 +       if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE))
584 +               changed |= BSS_CHANGED_HT;
585 +
586 +       conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE;
587 +       ht_cap.ht_supported = true;
588 +
589 +       ht_cap.cap = req_ht_cap->cap & sband->ht_cap.cap;
590 +       ht_cap.cap &= ~IEEE80211_HT_CAP_SM_PS;
591 +       ht_cap.cap |= sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS;
592 +
593 +       ht_bss_conf.primary_channel = req_bss_cap->primary_channel;
594 +       ht_bss_conf.bss_cap = req_bss_cap->bss_cap;
595 +       ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode;
596 +
597 +       ht_cap.ampdu_factor = req_ht_cap->ampdu_factor;
598 +       ht_cap.ampdu_density = req_ht_cap->ampdu_density;
599 +
600 +       /* own MCS TX capabilities */
601 +       tx_mcs_set_cap = sband->ht_cap.mcs.tx_params;
602 +
603 +       /*
604 +        * configure supported Tx MCS according to requested MCS
605 +        * (based in most cases on Rx capabilities of peer) and self
606 +        * Tx MCS capabilities (as defined by low level driver HW
607 +        * Tx capabilities)
608 +        */
609 +
610 +       /* can we TX with MCS rates? */
611 +       if (!(tx_mcs_set_cap & IEEE80211_HT_MCS_TX_DEFINED))
612 +               goto check_changed;
613 +
614 +       /* Counting from 0, therefore +1 */
615 +       if (tx_mcs_set_cap & IEEE80211_HT_MCS_TX_RX_DIFF)
616 +               max_tx_streams =
617 +                       ((tx_mcs_set_cap & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
618 +                               >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
619 +       else
620 +               max_tx_streams = IEEE80211_HT_MCS_TX_MAX_STREAMS;
621 +
622 +       /*
623 +        * 802.11n D5.0 20.3.5 / 20.6 says:
624 +        * - indices 0 to 7 and 32 are single spatial stream
625 +        * - 8 to 31 are multiple spatial streams using equal modulation
626 +        *   [8..15 for two streams, 16..23 for three and 24..31 for four]
627 +        * - remainder are multiple spatial streams using unequal modulation
628 +        */
629 +       for (i = 0; i < max_tx_streams; i++)
630 +               ht_cap.mcs.rx_mask[i] =
631 +                       sband->ht_cap.mcs.rx_mask[i] &
632 +                                       req_ht_cap->mcs.rx_mask[i];
633 +
634 +       if (tx_mcs_set_cap & IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION)
635 +               for (i = IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE;
636 +                    i < IEEE80211_HT_MCS_MASK_LEN; i++)
637 +                       ht_cap.mcs.rx_mask[i] =
638 +                               sband->ht_cap.mcs.rx_mask[i] &
639 +                                       req_ht_cap->mcs.rx_mask[i];
640 +
641 +       /* handle MCS rate 32 too */
642 +       if (sband->ht_cap.mcs.rx_mask[32/8] &
643 +           req_ht_cap->mcs.rx_mask[32/8] & 1)
644 +               ht_cap.mcs.rx_mask[32/8] |= 1;
645 +
646 + check_changed:
647 +       /* if bss configuration changed store the new one */
648 +       if (memcmp(&conf->ht_cap, &ht_cap, sizeof(ht_cap)) ||
649 +           memcmp(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf))) {
650 +               changed |= BSS_CHANGED_HT;
651 +               memcpy(&conf->ht_cap, &ht_cap, sizeof(ht_cap));
652 +               memcpy(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf));
653 +       }
654  
655 -       return 0;
656 +       return changed;
657  }
658  
659  static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata,
660 @@ -802,7 +909,7 @@ void ieee80211_process_addba_request(str
661          * check if configuration can support the BA policy
662          * and if buffer size does not exceeds max value */
663         if (((ba_policy != 1)
664 -               && (!(conf->ht_conf.cap & IEEE80211_HT_CAP_DELAY_BA)))
665 +               && (!(conf->ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA)))
666                 || (buf_size > IEEE80211_MAX_AMPDU_BUF)) {
667                 status = WLAN_STATUS_INVALID_QOS_PARAM;
668  #ifdef CONFIG_MAC80211_HT_DEBUG
669 @@ -820,7 +927,7 @@ void ieee80211_process_addba_request(str
670  
671                 sband = local->hw.wiphy->bands[conf->channel->band];
672                 buf_size = IEEE80211_MIN_AMPDU_BUF;
673 -               buf_size = buf_size << sband->ht_info.ampdu_factor;
674 +               buf_size = buf_size << sband->ht_cap.ampdu_factor;
675         }
676  
677  
678 --- everything.orig/net/mac80211/mlme.c 2008-10-08 20:45:06.000000000 +0200
679 +++ everything/net/mac80211/mlme.c      2008-10-09 02:16:26.000000000 +0200
680 @@ -236,7 +236,7 @@ static void ieee80211_send_assoc(struct 
681         struct ieee80211_local *local = sdata->local;
682         struct sk_buff *skb;
683         struct ieee80211_mgmt *mgmt;
684 -       u8 *pos, *ies, *ht_add_ie;
685 +       u8 *pos, *ies, *ht_ie;
686         int i, len, count, rates_len, supp_rates_len;
687         u16 capab;
688         struct ieee80211_bss *bss;
689 @@ -393,24 +393,25 @@ static void ieee80211_send_assoc(struct 
690  
691         /* wmm support is a must to HT */
692         if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED) &&
693 -           sband->ht_info.ht_supported &&
694 -           (ht_add_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_EXTRA_INFO))) {
695 -               struct ieee80211_ht_addt_info *ht_add_info =
696 -                       (struct ieee80211_ht_addt_info *)ht_add_ie;
697 -               u16 cap = sband->ht_info.cap;
698 +           sband->ht_cap.ht_supported &&
699 +           (ht_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_INFORMATION)) &&
700 +           ht_ie[1] >= sizeof(struct ieee80211_ht_info)) {
701 +               struct ieee80211_ht_info *ht_info =
702 +                       (struct ieee80211_ht_info *)(ht_ie + 2);
703 +               u16 cap = sband->ht_cap.cap;
704                 __le16 tmp;
705                 u32 flags = local->hw.conf.channel->flags;
706  
707 -               switch (ht_add_info->ht_param & IEEE80211_HT_IE_CHA_SEC_OFFSET) {
708 -               case IEEE80211_HT_IE_CHA_SEC_ABOVE:
709 +               switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
710 +               case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
711                         if (flags & IEEE80211_CHAN_NO_FAT_ABOVE) {
712 -                               cap &= ~IEEE80211_HT_CAP_SUP_WIDTH;
713 +                               cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
714                                 cap &= ~IEEE80211_HT_CAP_SGI_40;
715                         }
716                         break;
717 -               case IEEE80211_HT_IE_CHA_SEC_BELOW:
718 +               case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
719                         if (flags & IEEE80211_CHAN_NO_FAT_BELOW) {
720 -                               cap &= ~IEEE80211_HT_CAP_SUP_WIDTH;
721 +                               cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
722                                 cap &= ~IEEE80211_HT_CAP_SGI_40;
723                         }
724                         break;
725 @@ -424,9 +425,9 @@ static void ieee80211_send_assoc(struct 
726                 memcpy(pos, &tmp, sizeof(u16));
727                 pos += sizeof(u16);
728                 /* TODO: needs a define here for << 2 */
729 -               *pos++ = sband->ht_info.ampdu_factor |
730 -                        (sband->ht_info.ampdu_density << 2);
731 -               memcpy(pos, sband->ht_info.supp_mcs_set, 16);
732 +               *pos++ = sband->ht_cap.ampdu_factor |
733 +                        (sband->ht_cap.ampdu_density << 2);
734 +               memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
735         }
736  
737         kfree(ifsta->assocreq_ies);
738 @@ -732,7 +733,7 @@ static void ieee80211_set_associated(str
739         if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
740                 changed |= BSS_CHANGED_HT;
741                 sdata->bss_conf.assoc_ht = 1;
742 -               sdata->bss_conf.ht_conf = &conf->ht_conf;
743 +               sdata->bss_conf.ht_cap = &conf->ht_cap;
744                 sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf;
745         }
746  
747 @@ -856,7 +857,7 @@ static void ieee80211_set_disassoc(struc
748                 changed |= BSS_CHANGED_HT;
749  
750         sdata->bss_conf.assoc_ht = 0;
751 -       sdata->bss_conf.ht_conf = NULL;
752 +       sdata->bss_conf.ht_cap = NULL;
753         sdata->bss_conf.ht_bss_conf = NULL;
754  
755         ieee80211_led_assoc(local, 0);
756 @@ -1348,11 +1349,11 @@ static void ieee80211_rx_mgmt_assoc_resp
757         if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param &&
758             (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
759                 struct ieee80211_ht_bss_info bss_info;
760 -               ieee80211_ht_cap_ie_to_ht_info(
761 -                               elems.ht_cap_elem, &sta->sta.ht_info);
762 -               ieee80211_ht_addt_info_ie_to_ht_bss_info(
763 +               ieee80211_ht_cap_ie_to_sta_ht_cap(
764 +                               elems.ht_cap_elem, &sta->sta.ht_cap);
765 +               ieee80211_ht_info_ie_to_ht_bss_info(
766                                 elems.ht_info_elem, &bss_info);
767 -               ieee80211_handle_ht(local, 1, &sta->sta.ht_info, &bss_info);
768 +               ieee80211_handle_ht(local, &sta->sta.ht_cap, &bss_info);
769         }
770  
771         rate_control_rate_init(sta);
772 @@ -1712,9 +1713,9 @@ static void ieee80211_rx_mgmt_beacon(str
773             elems.wmm_param && conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
774                 struct ieee80211_ht_bss_info bss_info;
775  
776 -               ieee80211_ht_addt_info_ie_to_ht_bss_info(
777 +               ieee80211_ht_info_ie_to_ht_bss_info(
778                                 elems.ht_info_elem, &bss_info);
779 -               changed |= ieee80211_handle_ht(local, 1, &conf->ht_conf,
780 +               changed |= ieee80211_handle_ht(local, &conf->ht_cap,
781                                                &bss_info);
782         }
783  
784 --- everything.orig/net/mac80211/util.c 2008-10-08 20:45:06.000000000 +0200
785 +++ everything/net/mac80211/util.c      2008-10-09 02:16:28.000000000 +0200
786 @@ -532,8 +532,8 @@ void ieee802_11_parse_elems(u8 *start, s
787                         if (elen >= sizeof(struct ieee80211_ht_cap))
788                                 elems->ht_cap_elem = (void *)pos;
789                         break;
790 -               case WLAN_EID_HT_EXTRA_INFO:
791 -                       if (elen >= sizeof(struct ieee80211_ht_addt_info))
792 +               case WLAN_EID_HT_INFORMATION:
793 +                       if (elen >= sizeof(struct ieee80211_ht_info))
794                                 elems->ht_info_elem = (void *)pos;
795                         break;
796                 case WLAN_EID_MESH_ID:
797 --- everything.orig/net/mac80211/cfg.c  2008-10-08 20:45:06.000000000 +0200
798 +++ everything/net/mac80211/cfg.c       2008-10-09 02:16:29.000000000 +0200
799 @@ -635,10 +635,9 @@ static void sta_apply_parameters(struct 
800                 sta->sta.supp_rates[local->oper_channel->band] = rates;
801         }
802  
803 -       if (params->ht_capa) {
804 -               ieee80211_ht_cap_ie_to_ht_info(params->ht_capa,
805 -                                              &sta->sta.ht_info);
806 -       }
807 +       if (params->ht_capa)
808 +               ieee80211_ht_cap_ie_to_sta_ht_cap(params->ht_capa,
809 +                                                 &sta->sta.ht_cap);
810  
811         if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) {
812                 switch (params->plink_action) {
813 --- everything.orig/drivers/net/wireless/iwlwifi/iwl-agn-rs.c   2008-10-08 20:44:47.000000000 +0200
814 +++ everything/drivers/net/wireless/iwlwifi/iwl-agn-rs.c        2008-10-09 02:16:27.000000000 +0200
815 @@ -1136,10 +1136,10 @@ static int rs_switch_to_mimo2(struct iwl
816         s8 is_green = lq_sta->is_green;
817  
818         if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
819 -           !sta->ht_info.ht_supported)
820 +           !sta->ht_cap.ht_supported)
821                 return -1;
822  
823 -       if (((sta->ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2)
824 +       if (((sta->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >> 2)
825                                                 == WLAN_HT_CAP_SM_PS_STATIC)
826                 return -1;
827  
828 @@ -1204,7 +1204,7 @@ static int rs_switch_to_siso(struct iwl_
829         s32 rate;
830  
831         if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
832 -           !sta->ht_info.ht_supported)
833 +           !sta->ht_cap.ht_supported)
834                 return -1;
835  
836         IWL_DEBUG_RATE("LQ: try to switch to SISO\n");
837 @@ -2244,19 +2244,19 @@ static void rs_rate_init(void *priv_r, s
838          * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3),
839          * supp_rates[] does not; shift to convert format, force 9 MBits off.
840          */
841 -       lq_sta->active_siso_rate = conf->ht_conf.supp_mcs_set[0] << 1;
842 -       lq_sta->active_siso_rate |= conf->ht_conf.supp_mcs_set[0] & 0x1;
843 +       lq_sta->active_siso_rate = conf->ht_cap.mcs.rx_mask[0] << 1;
844 +       lq_sta->active_siso_rate |= conf->ht_cap.mcs.rx_mask[0] & 0x1;
845         lq_sta->active_siso_rate &= ~((u16)0x2);
846         lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE;
847  
848         /* Same here */
849 -       lq_sta->active_mimo2_rate = conf->ht_conf.supp_mcs_set[1] << 1;
850 -       lq_sta->active_mimo2_rate |= conf->ht_conf.supp_mcs_set[1] & 0x1;
851 +       lq_sta->active_mimo2_rate = conf->ht_cap.mcs.rx_mask[1] << 1;
852 +       lq_sta->active_mimo2_rate |= conf->ht_cap.mcs.rx_mask[1] & 0x1;
853         lq_sta->active_mimo2_rate &= ~((u16)0x2);
854         lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE;
855  
856 -       lq_sta->active_mimo3_rate = conf->ht_conf.supp_mcs_set[2] << 1;
857 -       lq_sta->active_mimo3_rate |= conf->ht_conf.supp_mcs_set[2] & 0x1;
858 +       lq_sta->active_mimo3_rate = conf->ht_cap.mcs.rx_mask[2] << 1;
859 +       lq_sta->active_mimo3_rate |= conf->ht_cap.mcs.rx_mask[2] & 0x1;
860         lq_sta->active_mimo3_rate &= ~((u16)0x2);
861         lq_sta->active_mimo3_rate <<= IWL_FIRST_OFDM_RATE;
862  
863 --- everything.orig/drivers/net/wireless/iwlwifi/iwl-agn.c      2008-10-08 20:44:48.000000000 +0200
864 +++ everything/drivers/net/wireless/iwlwifi/iwl-agn.c   2008-10-09 02:16:29.000000000 +0200
865 @@ -553,7 +553,7 @@ static int iwl4965_send_beacon_cmd(struc
866  static void iwl4965_ht_conf(struct iwl_priv *priv,
867                             struct ieee80211_bss_conf *bss_conf)
868  {
869 -       struct ieee80211_ht_info *ht_conf = bss_conf->ht_conf;
870 +       struct ieee80211_sta_ht_cap *ht_conf = bss_conf->ht_cap;
871         struct ieee80211_ht_bss_info *ht_bss_conf = bss_conf->ht_bss_conf;
872         struct iwl_ht_info *iwl_conf = &priv->current_ht_config;
873  
874 @@ -574,27 +574,27 @@ static void iwl4965_ht_conf(struct iwl_p
875                 !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU);
876  
877         iwl_conf->supported_chan_width =
878 -               !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH);
879 +               !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40);
880         iwl_conf->extension_chan_offset =
881 -               ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_SEC_OFFSET;
882 +               ht_bss_conf->bss_cap & IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
883         /* If no above or below channel supplied disable FAT channel */
884 -       if (iwl_conf->extension_chan_offset != IEEE80211_HT_IE_CHA_SEC_ABOVE &&
885 -           iwl_conf->extension_chan_offset != IEEE80211_HT_IE_CHA_SEC_BELOW) {
886 -               iwl_conf->extension_chan_offset = IEEE80211_HT_IE_CHA_SEC_NONE;
887 +       if (iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_ABOVE &&
888 +           iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_BELOW) {
889 +               iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
890                 iwl_conf->supported_chan_width = 0;
891         }
892  
893         iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2);
894  
895 -       memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16);
896 +       memcpy(&iwl_conf->mcs, &ht_conf->mcs, 16);
897  
898         iwl_conf->control_channel = ht_bss_conf->primary_channel;
899         iwl_conf->tx_chan_width =
900 -               !!(ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_WIDTH);
901 +               !!(ht_bss_conf->bss_cap & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY);
902         iwl_conf->ht_protection =
903 -               ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_HT_PROTECTION;
904 +               ht_bss_conf->bss_op_mode & IEEE80211_HT_OP_MODE_PROTECTION;
905         iwl_conf->non_GF_STA_present =
906 -               !!(ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_NON_GF_STA_PRSNT);
907 +               !!(ht_bss_conf->bss_op_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
908  
909         IWL_DEBUG_MAC80211("control channel %d\n", iwl_conf->control_channel);
910         IWL_DEBUG_MAC80211("leave\n");
911 --- everything.orig/drivers/net/wireless/iwlwifi/iwl-core.c     2008-10-08 20:44:47.000000000 +0200
912 +++ everything/drivers/net/wireless/iwlwifi/iwl-core.c  2008-10-09 02:16:26.000000000 +0200
913 @@ -382,10 +382,10 @@ void iwl_reset_qos(struct iwl_priv *priv
914  }
915  EXPORT_SYMBOL(iwl_reset_qos);
916  
917 -#define MAX_BIT_RATE_40_MHZ 0x96 /* 150 Mbps */
918 -#define MAX_BIT_RATE_20_MHZ 0x48 /* 72 Mbps */
919 +#define MAX_BIT_RATE_40_MHZ 150 /* Mbps */
920 +#define MAX_BIT_RATE_20_MHZ 72 /* Mbps */
921  static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv,
922 -                             struct ieee80211_ht_info *ht_info,
923 +                             struct ieee80211_sta_ht_cap *ht_info,
924                               enum ieee80211_band band)
925  {
926         u16 max_bit_rate = 0;
927 @@ -393,45 +393,46 @@ static void iwlcore_init_ht_hw_capab(con
928         u8 tx_chains_num = priv->hw_params.tx_chains_num;
929  
930         ht_info->cap = 0;
931 -       memset(ht_info->supp_mcs_set, 0, 16);
932 +       memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
933  
934 -       ht_info->ht_supported = 1;
935 +       ht_info->ht_supported = true;
936  
937 -       ht_info->cap |= (u16)IEEE80211_HT_CAP_GRN_FLD;
938 -       ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20;
939 -       ht_info->cap |= (u16)(IEEE80211_HT_CAP_SM_PS &
940 +       ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD;
941 +       ht_info->cap |= IEEE80211_HT_CAP_SGI_20;
942 +       ht_info->cap |= (IEEE80211_HT_CAP_SM_PS &
943                              (WLAN_HT_CAP_SM_PS_DISABLED << 2));
944  
945         max_bit_rate = MAX_BIT_RATE_20_MHZ;
946         if (priv->hw_params.fat_channel & BIT(band)) {
947 -               ht_info->cap |= (u16)IEEE80211_HT_CAP_SUP_WIDTH;
948 -               ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_40;
949 -               ht_info->supp_mcs_set[4] = 0x01;
950 +               ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
951 +               ht_info->cap |= IEEE80211_HT_CAP_SGI_40;
952 +               ht_info->mcs.rx_mask[4] = 0x01;
953                 max_bit_rate = MAX_BIT_RATE_40_MHZ;
954         }
955  
956         if (priv->cfg->mod_params->amsdu_size_8K)
957 -               ht_info->cap |= (u16)IEEE80211_HT_CAP_MAX_AMSDU;
958 +               ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU;
959  
960         ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF;
961         ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF;
962  
963 -       ht_info->supp_mcs_set[0] = 0xFF;
964 +       ht_info->mcs.rx_mask[0] = 0xFF;
965         if (rx_chains_num >= 2)
966 -               ht_info->supp_mcs_set[1] = 0xFF;
967 +               ht_info->mcs.rx_mask[1] = 0xFF;
968         if (rx_chains_num >= 3)
969 -               ht_info->supp_mcs_set[2] = 0xFF;
970 +               ht_info->mcs.rx_mask[2] = 0xFF;
971  
972         /* Highest supported Rx data rate */
973         max_bit_rate *= rx_chains_num;
974 -       ht_info->supp_mcs_set[10] = (u8)(max_bit_rate & 0x00FF);
975 -       ht_info->supp_mcs_set[11] = (u8)((max_bit_rate & 0xFF00) >> 8);
976 +       WARN_ON(max_bit_rate & ~IEEE80211_HT_MCS_RX_HIGHEST_MASK);
977 +       ht_info->mcs.rx_highest = cpu_to_le16(max_bit_rate);
978  
979         /* Tx MCS capabilities */
980 -       ht_info->supp_mcs_set[12] = IEEE80211_HT_CAP_MCS_TX_DEFINED;
981 +       ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
982         if (tx_chains_num != rx_chains_num) {
983 -               ht_info->supp_mcs_set[12] |= IEEE80211_HT_CAP_MCS_TX_RX_DIFF;
984 -               ht_info->supp_mcs_set[12] |= ((tx_chains_num - 1) << 2);
985 +               ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF;
986 +               ht_info->mcs.tx_params |= ((tx_chains_num - 1) <<
987 +                               IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
988         }
989  }
990  
991 @@ -495,7 +496,7 @@ static int iwlcore_init_geos(struct iwl_
992         sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE;
993  
994         if (priv->cfg->sku & IWL_SKU_N)
995 -               iwlcore_init_ht_hw_capab(priv, &sband->ht_info,
996 +               iwlcore_init_ht_hw_capab(priv, &sband->ht_cap,
997                                          IEEE80211_BAND_5GHZ);
998  
999         sband = &priv->bands[IEEE80211_BAND_2GHZ];
1000 @@ -505,7 +506,7 @@ static int iwlcore_init_geos(struct iwl_
1001         sband->n_bitrates = IWL_RATE_COUNT;
1002  
1003         if (priv->cfg->sku & IWL_SKU_N)
1004 -               iwlcore_init_ht_hw_capab(priv, &sband->ht_info,
1005 +               iwlcore_init_ht_hw_capab(priv, &sband->ht_cap,
1006                                          IEEE80211_BAND_2GHZ);
1007  
1008         priv->ieee_channels = channels;
1009 @@ -595,8 +596,8 @@ static void iwlcore_free_geos(struct iwl
1010  static bool is_single_rx_stream(struct iwl_priv *priv)
1011  {
1012         return !priv->current_ht_config.is_ht ||
1013 -              ((priv->current_ht_config.supp_mcs_set[1] == 0) &&
1014 -               (priv->current_ht_config.supp_mcs_set[2] == 0));
1015 +              ((priv->current_ht_config.mcs.rx_mask[1] == 0) &&
1016 +               (priv->current_ht_config.mcs.rx_mask[2] == 0));
1017  }
1018  
1019  static u8 iwl_is_channel_extension(struct iwl_priv *priv,
1020 @@ -609,10 +610,10 @@ static u8 iwl_is_channel_extension(struc
1021         if (!is_channel_valid(ch_info))
1022                 return 0;
1023  
1024 -       if (extension_chan_offset == IEEE80211_HT_IE_CHA_SEC_ABOVE)
1025 +       if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE)
1026                 return !(ch_info->fat_extension_channel &
1027                                         IEEE80211_CHAN_NO_FAT_ABOVE);
1028 -       else if (extension_chan_offset == IEEE80211_HT_IE_CHA_SEC_BELOW)
1029 +       else if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW)
1030                 return !(ch_info->fat_extension_channel &
1031                                         IEEE80211_CHAN_NO_FAT_BELOW);
1032  
1033 @@ -620,18 +621,18 @@ static u8 iwl_is_channel_extension(struc
1034  }
1035  
1036  u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
1037 -                            struct ieee80211_ht_info *sta_ht_inf)
1038 +                        struct ieee80211_sta_ht_cap *sta_ht_inf)
1039  {
1040         struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config;
1041  
1042         if ((!iwl_ht_conf->is_ht) ||
1043            (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) ||
1044 -          (iwl_ht_conf->extension_chan_offset == IEEE80211_HT_IE_CHA_SEC_NONE))
1045 +          (iwl_ht_conf->extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_NONE))
1046                 return 0;
1047  
1048         if (sta_ht_inf) {
1049                 if ((!sta_ht_inf->ht_supported) ||
1050 -                  (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH)))
1051 +                  (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)))
1052                         return 0;
1053         }
1054  
1055 @@ -671,13 +672,13 @@ void iwl_set_rxon_ht(struct iwl_priv *pr
1056  
1057         /* Note: control channel is opposite of extension channel */
1058         switch (ht_info->extension_chan_offset) {
1059 -       case IEEE80211_HT_IE_CHA_SEC_ABOVE:
1060 +       case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
1061                 rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
1062                 break;
1063 -       case IEEE80211_HT_IE_CHA_SEC_BELOW:
1064 +       case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
1065                 rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK;
1066                 break;
1067 -       case IEEE80211_HT_IE_CHA_SEC_NONE:
1068 +       case IEEE80211_HT_PARAM_CHA_SEC_NONE:
1069         default:
1070                 rxon->flags &= ~RXON_FLG_CHANNEL_MODE_MIXED_MSK;
1071                 break;
1072 @@ -693,9 +694,9 @@ void iwl_set_rxon_ht(struct iwl_priv *pr
1073                         "rxon flags 0x%X operation mode :0x%X "
1074                         "extension channel offset 0x%x "
1075                         "control chan %d\n",
1076 -                       ht_info->supp_mcs_set[0],
1077 -                       ht_info->supp_mcs_set[1],
1078 -                       ht_info->supp_mcs_set[2],
1079 +                       ht_info->mcs.rx_mask[0],
1080 +                       ht_info->mcs.rx_mask[1],
1081 +                       ht_info->mcs.rx_mask[2],
1082                         le32_to_cpu(rxon->flags), ht_info->ht_protection,
1083                         ht_info->extension_chan_offset,
1084                         ht_info->control_channel);
1085 --- everything.orig/drivers/net/wireless/iwlwifi/iwl-core.h     2008-10-08 20:44:47.000000000 +0200
1086 +++ everything/drivers/net/wireless/iwlwifi/iwl-core.h  2008-10-08 20:45:06.000000000 +0200
1087 @@ -190,7 +190,7 @@ void iwl_set_rxon_chain(struct iwl_priv 
1088  int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch);
1089  void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info);
1090  u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
1091 -                        struct ieee80211_ht_info *sta_ht_inf);
1092 +                        struct ieee80211_sta_ht_cap *sta_ht_inf);
1093  int iwl_hw_nic_init(struct iwl_priv *priv);
1094  int iwl_setup_mac(struct iwl_priv *priv);
1095  int iwl_set_hw_params(struct iwl_priv *priv);
1096 --- everything.orig/drivers/net/wireless/iwlwifi/iwl-dev.h      2008-10-08 20:44:47.000000000 +0200
1097 +++ everything/drivers/net/wireless/iwlwifi/iwl-dev.h   2008-10-09 02:16:27.000000000 +0200
1098 @@ -412,7 +412,7 @@ struct iwl_ht_info {
1099         u8 max_amsdu_size;
1100         u8 ampdu_factor;
1101         u8 mpdu_density;
1102 -       u8 supp_mcs_set[16];
1103 +       struct ieee80211_mcs_info mcs;
1104         /* BSS related data */
1105         u8 control_channel;
1106         u8 extension_chan_offset;
1107 @@ -584,7 +584,7 @@ struct iwl_addsta_cmd;
1108  extern int iwl_send_add_sta(struct iwl_priv *priv,
1109                             struct iwl_addsta_cmd *sta, u8 flags);
1110  extern u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr,
1111 -                       int is_ap, u8 flags, struct ieee80211_ht_info *ht_info);
1112 +                       int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info);
1113  extern void iwl4965_update_chain_flags(struct iwl_priv *priv);
1114  extern int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
1115  extern const u8 iwl_bcast_addr[ETH_ALEN];
1116 --- everything.orig/drivers/net/wireless/iwlwifi/iwl-sta.c      2008-10-08 20:44:47.000000000 +0200
1117 +++ everything/drivers/net/wireless/iwlwifi/iwl-sta.c   2008-10-09 02:16:29.000000000 +0200
1118 @@ -183,7 +183,7 @@ int iwl_send_add_sta(struct iwl_priv *pr
1119  EXPORT_SYMBOL(iwl_send_add_sta);
1120  
1121  static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
1122 -                                  struct ieee80211_ht_info *sta_ht_inf)
1123 +                                  struct ieee80211_sta_ht_cap *sta_ht_inf)
1124  {
1125         __le32 sta_flags;
1126         u8 mimo_ps_mode;
1127 @@ -231,7 +231,7 @@ static void iwl_set_ht_add_station(struc
1128   * iwl_add_station_flags - Add station to tables in driver and device
1129   */
1130  u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap,
1131 -                        u8 flags, struct ieee80211_ht_info *ht_info)
1132 +                        u8 flags, struct ieee80211_sta_ht_cap *ht_info)
1133  {
1134         int i;
1135         int sta_id = IWL_INVALID_STATION;
1136 @@ -900,7 +900,7 @@ int iwl_rxon_add_station(struct iwl_priv
1137  
1138         /* Add station to device's station table */
1139         struct ieee80211_conf *conf = &priv->hw->conf;
1140 -       struct ieee80211_ht_info *cur_ht_config = &conf->ht_conf;
1141 +       struct ieee80211_sta_ht_cap *cur_ht_config = &conf->ht_cap;
1142  
1143         if ((is_ap) &&
1144             (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) &&
1145 --- everything.orig/drivers/net/wireless/iwlwifi/iwl-scan.c     2008-10-08 20:44:47.000000000 +0200
1146 +++ everything/drivers/net/wireless/iwlwifi/iwl-scan.c  2008-10-08 20:45:06.000000000 +0200
1147 @@ -550,7 +550,7 @@ static void iwl_ht_cap_to_ie(const struc
1148  {
1149         struct ieee80211_ht_cap *ht_cap;
1150  
1151 -       if (!sband || !sband->ht_info.ht_supported)
1152 +       if (!sband || !sband->ht_cap.ht_supported)
1153                 return;
1154  
1155         if (*left < sizeof(struct ieee80211_ht_cap))
1156 @@ -559,12 +559,12 @@ static void iwl_ht_cap_to_ie(const struc
1157         *pos++ = sizeof(struct ieee80211_ht_cap);
1158         ht_cap = (struct ieee80211_ht_cap *) pos;
1159  
1160 -       ht_cap->cap_info = cpu_to_le16(sband->ht_info.cap);
1161 -       memcpy(ht_cap->supp_mcs_set, sband->ht_info.supp_mcs_set, 16);
1162 +       ht_cap->cap_info = cpu_to_le16(sband->ht_cap.cap);
1163 +       memcpy(&ht_cap->mcs, &sband->ht_cap.mcs, 16);
1164         ht_cap->ampdu_params_info =
1165 -               (sband->ht_info.ampdu_factor & IEEE80211_HT_CAP_AMPDU_FACTOR) |
1166 -               ((sband->ht_info.ampdu_density << 2) &
1167 -                       IEEE80211_HT_CAP_AMPDU_DENSITY);
1168 +               (sband->ht_cap.ampdu_factor & IEEE80211_HT_AMPDU_PARM_FACTOR) |
1169 +               ((sband->ht_cap.ampdu_density << 2) &
1170 +                       IEEE80211_HT_AMPDU_PARM_DENSITY);
1171         *left -= sizeof(struct ieee80211_ht_cap);
1172  }
1173  
1174 --- everything.orig/drivers/net/wireless/ath9k/main.c   2008-10-08 20:44:48.000000000 +0200
1175 +++ everything/drivers/net/wireless/ath9k/main.c        2008-10-09 02:16:30.000000000 +0200
1176 @@ -61,24 +61,24 @@ static u32 ath_get_extchanmode(struct at
1177  
1178         switch (chan->band) {
1179         case IEEE80211_BAND_2GHZ:
1180 -               if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_NONE) &&
1181 +               if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_NONE) &&
1182                     (tx_chan_width == ATH9K_HT_MACMODE_20))
1183                         chanmode = CHANNEL_G_HT20;
1184 -               if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_ABOVE) &&
1185 +               if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) &&
1186                     (tx_chan_width == ATH9K_HT_MACMODE_2040))
1187                         chanmode = CHANNEL_G_HT40PLUS;
1188 -               if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_BELOW) &&
1189 +               if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW) &&
1190                     (tx_chan_width == ATH9K_HT_MACMODE_2040))
1191                         chanmode = CHANNEL_G_HT40MINUS;
1192                 break;
1193         case IEEE80211_BAND_5GHZ:
1194 -               if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_NONE) &&
1195 +               if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_NONE) &&
1196                     (tx_chan_width == ATH9K_HT_MACMODE_20))
1197                         chanmode = CHANNEL_A_HT20;
1198 -               if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_ABOVE) &&
1199 +               if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) &&
1200                     (tx_chan_width == ATH9K_HT_MACMODE_2040))
1201                         chanmode = CHANNEL_A_HT40PLUS;
1202 -               if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_BELOW) &&
1203 +               if ((ext_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW) &&
1204                     (tx_chan_width == ATH9K_HT_MACMODE_2040))
1205                         chanmode = CHANNEL_A_HT40MINUS;
1206                 break;
1207 @@ -215,24 +215,24 @@ static void ath_key_delete(struct ath_so
1208         ath_key_reset(sc, key->keyidx, freeslot);
1209  }
1210  
1211 -static void setup_ht_cap(struct ieee80211_ht_info *ht_info)
1212 +static void setup_ht_cap(struct ieee80211_sta_ht_cap *ht_info)
1213  {
1214  #define        ATH9K_HT_CAP_MAXRXAMPDU_65536 0x3       /* 2 ^ 16 */
1215  #define        ATH9K_HT_CAP_MPDUDENSITY_8 0x6          /* 8 usec */
1216  
1217 -       ht_info->ht_supported = 1;
1218 -       ht_info->cap = (u16)IEEE80211_HT_CAP_SUP_WIDTH
1219 -                       |(u16)IEEE80211_HT_CAP_SM_PS
1220 -                       |(u16)IEEE80211_HT_CAP_SGI_40
1221 -                       |(u16)IEEE80211_HT_CAP_DSSSCCK40;
1222 +       ht_info->ht_supported = true;
1223 +       ht_info->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
1224 +                      IEEE80211_HT_CAP_SM_PS |
1225 +                      IEEE80211_HT_CAP_SGI_40 |
1226 +                      IEEE80211_HT_CAP_DSSSCCK40;
1227  
1228         ht_info->ampdu_factor = ATH9K_HT_CAP_MAXRXAMPDU_65536;
1229         ht_info->ampdu_density = ATH9K_HT_CAP_MPDUDENSITY_8;
1230 -       /* setup supported mcs set */
1231 -       memset(ht_info->supp_mcs_set, 0, 16);
1232 -       ht_info->supp_mcs_set[0] = 0xff;
1233 -       ht_info->supp_mcs_set[1] = 0xff;
1234 -       ht_info->supp_mcs_set[12] = IEEE80211_HT_CAP_MCS_TX_DEFINED;
1235 +       /* set up supported mcs set */
1236 +       memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
1237 +       ht_info->mcs.rx_mask[0] = 0xff;
1238 +       ht_info->mcs.rx_mask[1] = 0xff;
1239 +       ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
1240  }
1241  
1242  static int ath_rate2idx(struct ath_softc *sc, int rate)
1243 @@ -328,31 +328,28 @@ static u8 parse_mpdudensity(u8 mpdudensi
1244  static void ath9k_ht_conf(struct ath_softc *sc,
1245                           struct ieee80211_bss_conf *bss_conf)
1246  {
1247 -#define IEEE80211_HT_CAP_40MHZ_INTOLERANT BIT(14)
1248         struct ath_ht_info *ht_info = &sc->sc_ht_info;
1249  
1250         if (bss_conf->assoc_ht) {
1251                 ht_info->ext_chan_offset =
1252                         bss_conf->ht_bss_conf->bss_cap &
1253 -                               IEEE80211_HT_IE_CHA_SEC_OFFSET;
1254 +                               IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
1255  
1256 -               if (!(bss_conf->ht_conf->cap &
1257 +               if (!(bss_conf->ht_cap->cap &
1258                         IEEE80211_HT_CAP_40MHZ_INTOLERANT) &&
1259                             (bss_conf->ht_bss_conf->bss_cap &
1260 -                               IEEE80211_HT_IE_CHA_WIDTH))
1261 +                               IEEE80211_HT_PARAM_CHAN_WIDTH_ANY))
1262                         ht_info->tx_chan_width = ATH9K_HT_MACMODE_2040;
1263                 else
1264                         ht_info->tx_chan_width = ATH9K_HT_MACMODE_20;
1265  
1266                 ath9k_hw_set11nmac2040(sc->sc_ah, ht_info->tx_chan_width);
1267                 ht_info->maxampdu = 1 << (IEEE80211_HTCAP_MAXRXAMPDU_FACTOR +
1268 -                                       bss_conf->ht_conf->ampdu_factor);
1269 +                                       bss_conf->ht_cap->ampdu_factor);
1270                 ht_info->mpdudensity =
1271 -                       parse_mpdudensity(bss_conf->ht_conf->ampdu_density);
1272 +                       parse_mpdudensity(bss_conf->ht_cap->ampdu_density);
1273  
1274         }
1275 -
1276 -#undef IEEE80211_HT_CAP_40MHZ_INTOLERANT
1277  }
1278  
1279  static void ath9k_bss_assoc_info(struct ath_softc *sc,
1280 @@ -412,7 +409,7 @@ static void ath9k_bss_assoc_info(struct 
1281                         return;
1282                 }
1283  
1284 -               if (hw->conf.ht_conf.ht_supported)
1285 +               if (hw->conf.ht_cap.ht_supported)
1286                         sc->sc_ah->ah_channels[pos].chanmode =
1287                                 ath_get_extchanmode(sc, curchan);
1288                 else
1289 @@ -535,7 +532,7 @@ int _ath_rx_indicate(struct ath_softc *s
1290  
1291         if (an) {
1292                 ath_rx_input(sc, an,
1293 -                            hw->conf.ht_conf.ht_supported,
1294 +                            hw->conf.ht_cap.ht_supported,
1295                              skb, status, &st);
1296         }
1297         if (!an || (st != ATH_RX_CONSUMED))
1298 @@ -944,7 +941,7 @@ static int ath_attach(u16 devid,
1299  
1300         if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT)
1301                 /* Setup HT capabilities for 2.4Ghz*/
1302 -               setup_ht_cap(&sc->sbands[IEEE80211_BAND_2GHZ].ht_info);
1303 +               setup_ht_cap(&sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
1304  
1305         hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
1306                 &sc->sbands[IEEE80211_BAND_2GHZ];
1307 @@ -959,7 +956,7 @@ static int ath_attach(u16 devid,
1308  
1309                 if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT)
1310                         /* Setup HT capabilities for 5Ghz*/
1311 -                       setup_ht_cap(&sc->sbands[IEEE80211_BAND_5GHZ].ht_info);
1312 +                       setup_ht_cap(&sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
1313  
1314                 hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
1315                         &sc->sbands[IEEE80211_BAND_5GHZ];
1316 @@ -1255,7 +1252,7 @@ static int ath9k_config(struct ieee80211
1317                 (curchan->band == IEEE80211_BAND_2GHZ) ?
1318                 CHANNEL_G : CHANNEL_A;
1319  
1320 -       if (sc->sc_curaid && hw->conf.ht_conf.ht_supported)
1321 +       if (sc->sc_curaid && hw->conf.ht_cap.ht_supported)
1322                 sc->sc_ah->ah_channels[pos].chanmode =
1323                         ath_get_extchanmode(sc, curchan);
1324  
1325 --- everything.orig/drivers/net/wireless/ath9k/rc.c     2008-10-08 20:44:48.000000000 +0200
1326 +++ everything/drivers/net/wireless/ath9k/rc.c  2008-10-09 02:16:27.000000000 +0200
1327 @@ -1838,7 +1838,7 @@ void ath_rc_node_update(struct ieee80211
1328         struct ath_softc *sc = hw->priv;
1329         u32 capflag = 0;
1330  
1331 -       if (hw->conf.ht_conf.ht_supported) {
1332 +       if (hw->conf.ht_cap.ht_supported) {
1333                 capflag |= ATH_RC_HT_FLAG | ATH_RC_DS_FLAG;
1334                 if (sc->sc_ht_info.tx_chan_width == ATH9K_HT_MACMODE_2040)
1335                         capflag |= ATH_RC_CW40_FLAG;
1336 @@ -1910,7 +1910,7 @@ static void ath_tx_aggr_resp(struct ath_
1337          */
1338         si = container_of(sta, struct sta_info, sta);
1339         buffersize = IEEE80211_MIN_AMPDU_BUF <<
1340 -               sband->ht_info.ampdu_factor; /* FIXME */
1341 +               sband->ht_cap.ampdu_factor; /* FIXME */
1342         state = si->ampdu_mlme.tid_state_tx[tidno];
1343  
1344         if (state & HT_ADDBA_RECEIVED_MSK) {
1345 @@ -1980,7 +1980,7 @@ static void ath_get_rate(void *priv, str
1346  
1347         /* Check if aggregation has to be enabled for this tid */
1348  
1349 -       if (hw->conf.ht_conf.ht_supported) {
1350 +       if (hw->conf.ht_cap.ht_supported) {
1351                 if (ieee80211_is_data_qos(fc)) {
1352                         qc = ieee80211_get_qos_ctl(hdr);
1353                         tid = qc[0] & 0xf;
1354 @@ -2028,8 +2028,8 @@ static void ath_rate_init(void *priv, st
1355  
1356         ath_setup_rates(sc, sband, sta, ath_rc_priv);
1357         if (sc->hw->conf.flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
1358 -               for (i = 0; i < MCS_SET_SIZE; i++) {
1359 -                       if (sc->hw->conf.ht_conf.supp_mcs_set[i/8] & (1<<(i%8)))
1360 +               for (i = 0; i < 77; i++) {
1361 +                       if (sc->hw->conf.ht_cap.mcs.rx_mask[i/8] & (1<<(i%8)))
1362                                 ath_rc_priv->neg_ht_rates.rs_rates[j++] = i;
1363                         if (j == ATH_RATE_MAX)
1364                                 break;
1365 --- everything.orig/drivers/net/wireless/ath9k/recv.c   2008-10-08 20:44:48.000000000 +0200
1366 +++ everything/drivers/net/wireless/ath9k/recv.c        2008-10-09 02:16:27.000000000 +0200
1367 @@ -1119,7 +1119,7 @@ int ath_rx_aggr_start(struct ath_softc *
1368  
1369         sband = hw->wiphy->bands[hw->conf.channel->band];
1370         buffersize = IEEE80211_MIN_AMPDU_BUF <<
1371 -               sband->ht_info.ampdu_factor; /* FIXME */
1372 +               sband->ht_cap.ampdu_factor; /* FIXME */
1373  
1374         rxtid = &an->an_aggr.rx.tid[tid];
1375  
1376 --- everything.orig/drivers/net/wireless/ath9k/xmit.c   2008-10-08 20:44:48.000000000 +0200
1377 +++ everything/drivers/net/wireless/ath9k/xmit.c        2008-10-09 02:16:27.000000000 +0200
1378 @@ -300,7 +300,7 @@ static int ath_tx_prepare(struct ath_sof
1379         if (ieee80211_is_data(fc) && !txctl->use_minrate) {
1380  
1381                 /* Enable HT only for DATA frames and not for EAPOL */
1382 -               txctl->ht = (hw->conf.ht_conf.ht_supported &&
1383 +               txctl->ht = (hw->conf.ht_cap.ht_supported &&
1384                             (tx_info->flags & IEEE80211_TX_CTL_AMPDU));
1385  
1386                 if (is_multicast_ether_addr(hdr->addr1)) {
1387 --- everything.orig/drivers/net/wireless/ath9k/rc.h     2008-10-08 20:44:48.000000000 +0200
1388 +++ everything/drivers/net/wireless/ath9k/rc.h  2008-10-08 20:45:06.000000000 +0200
1389 @@ -59,7 +59,6 @@ struct ath_softc;
1390  #define FALSE 0
1391  
1392  #define ATH_RATE_MAX   30
1393 -#define MCS_SET_SIZE   128
1394  
1395  enum ieee80211_fixed_rate_mode {
1396         IEEE80211_FIXED_RATE_NONE  = 0,
1397 --- everything.orig/drivers/net/wireless/mac80211_hwsim.c       2008-10-08 20:44:48.000000000 +0200
1398 +++ everything/drivers/net/wireless/mac80211_hwsim.c    2008-10-09 02:16:30.000000000 +0200
1399 @@ -566,19 +566,18 @@ static int __init init_mac80211_hwsim(vo
1400                 data->band.n_channels = ARRAY_SIZE(hwsim_channels);
1401                 data->band.bitrates = data->rates;
1402                 data->band.n_bitrates = ARRAY_SIZE(hwsim_rates);
1403 -               data->band.ht_info.ht_supported = 1;
1404 -               data->band.ht_info.cap = IEEE80211_HT_CAP_SUP_WIDTH |
1405 +               data->band.ht_cap.ht_supported = true;
1406 +               data->band.ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
1407                         IEEE80211_HT_CAP_GRN_FLD |
1408                         IEEE80211_HT_CAP_SGI_40 |
1409                         IEEE80211_HT_CAP_DSSSCCK40;
1410 -               data->band.ht_info.ampdu_factor = 0x3;
1411 -               data->band.ht_info.ampdu_density = 0x6;
1412 -               memset(data->band.ht_info.supp_mcs_set, 0,
1413 -                      sizeof(data->band.ht_info.supp_mcs_set));
1414 -               data->band.ht_info.supp_mcs_set[0] = 0xff;
1415 -               data->band.ht_info.supp_mcs_set[1] = 0xff;
1416 -               data->band.ht_info.supp_mcs_set[12] =
1417 -                       IEEE80211_HT_CAP_MCS_TX_DEFINED;
1418 +               data->band.ht_cap.ampdu_factor = 0x3;
1419 +               data->band.ht_cap.ampdu_density = 0x6;
1420 +               memset(&data->band.ht_cap.mcs, 0,
1421 +                      sizeof(data->band.ht_cap.mcs));
1422 +               data->band.ht_cap.mcs.rx_mask[0] = 0xff;
1423 +               data->band.ht_cap.mcs.rx_mask[1] = 0xff;
1424 +               data->band.ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
1425                 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &data->band;
1426  
1427                 err = ieee80211_register_hw(hw);