Linux-libre 5.0.10-gnu
[librecmc/linux-libre.git] / drivers / staging / rtl8712 / wifi.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5  *
6  * Modifications for inclusion into the Linux staging tree are
7  * Copyright(c) 2010 Larry Finger. All rights reserved.
8  *
9  * Contact information:
10  * WLAN FAE <wlanfae@realtek.com>
11  * Larry Finger <Larry.Finger@lwfinger.net>
12  *
13  ******************************************************************************/
14 #ifndef _WIFI_H_
15 #define _WIFI_H_
16
17 #include <linux/compiler.h>
18
19 #define WLAN_IEEE_OUI_LEN       3
20 #define WLAN_CRC_LEN            4
21 #define WLAN_BSSID_LEN          6
22 #define WLAN_BSS_TS_LEN         8
23 #define WLAN_HDR_A3_LEN         24
24 #define WLAN_HDR_A4_LEN         30
25 #define WLAN_HDR_A3_QOS_LEN     26
26 #define WLAN_HDR_A4_QOS_LEN     32
27 #define WLAN_SSID_MAXLEN        32
28 #define WLAN_DATA_MAXLEN        2312
29
30 #define WLAN_A3_PN_OFFSET       24
31 #define WLAN_A4_PN_OFFSET       30
32
33 #define WLAN_MIN_ETHFRM_LEN     60
34 #define WLAN_MAX_ETHFRM_LEN     1514
35
36 #define P80211CAPTURE_VERSION   0x80211001
37
38 enum WIFI_FRAME_TYPE {
39         WIFI_MGT_TYPE  =        (0),
40         WIFI_CTRL_TYPE =        (BIT(2)),
41         WIFI_DATA_TYPE =        (BIT(3)),
42         WIFI_QOS_DATA_TYPE      = (BIT(7)|BIT(3)),      /*!< QoS Data */
43 };
44
45 enum WIFI_FRAME_SUBTYPE {
46         /* below is for mgt frame */
47         WIFI_ASSOCREQ       = (0 | WIFI_MGT_TYPE),
48         WIFI_ASSOCRSP       = (BIT(4) | WIFI_MGT_TYPE),
49         WIFI_REASSOCREQ     = (BIT(5) | WIFI_MGT_TYPE),
50         WIFI_REASSOCRSP     = (BIT(5) | BIT(4) | WIFI_MGT_TYPE),
51         WIFI_PROBEREQ       = (BIT(6) | WIFI_MGT_TYPE),
52         WIFI_PROBERSP       = (BIT(6) | BIT(4) | WIFI_MGT_TYPE),
53         WIFI_BEACON         = (BIT(7) | WIFI_MGT_TYPE),
54         WIFI_ATIM           = (BIT(7) | BIT(4) | WIFI_MGT_TYPE),
55         WIFI_DISASSOC       = (BIT(7) | BIT(5) | WIFI_MGT_TYPE),
56         WIFI_AUTH           = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE),
57         WIFI_DEAUTH         = (BIT(7) | BIT(6) | WIFI_MGT_TYPE),
58         WIFI_ACTION         = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE),
59         /* below is for control frame */
60         WIFI_PSPOLL         = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE),
61         WIFI_RTS            = (BIT(7) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
62         WIFI_CTS            = (BIT(7) | BIT(6) | WIFI_CTRL_TYPE),
63         WIFI_ACK            = (BIT(7) | BIT(6) | BIT(4) | WIFI_CTRL_TYPE),
64         WIFI_CFEND          = (BIT(7) | BIT(6) | BIT(5) | WIFI_CTRL_TYPE),
65         WIFI_CFEND_CFACK = (BIT(7) | BIT(6) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
66         /* below is for data frame */
67         WIFI_DATA           = (0 | WIFI_DATA_TYPE),
68         WIFI_DATA_CFACK     = (BIT(4) | WIFI_DATA_TYPE),
69         WIFI_DATA_CFPOLL    = (BIT(5) | WIFI_DATA_TYPE),
70         WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | WIFI_DATA_TYPE),
71         WIFI_DATA_NULL      = (BIT(6) | WIFI_DATA_TYPE),
72         WIFI_CF_ACK         = (BIT(6) | BIT(4) | WIFI_DATA_TYPE),
73         WIFI_CF_POLL        = (BIT(6) | BIT(5) | WIFI_DATA_TYPE),
74         WIFI_CF_ACKPOLL     = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE),
75 };
76
77 enum WIFI_REASON_CODE   {
78         _RSON_RESERVED_                 = 0,
79         _RSON_UNSPECIFIED_              = 1,
80         _RSON_AUTH_NO_LONGER_VALID_     = 2,
81         _RSON_DEAUTH_STA_LEAVING_       = 3,
82         _RSON_INACTIVITY_               = 4,
83         _RSON_UNABLE_HANDLE_            = 5,
84         _RSON_CLS2_                     = 6,
85         _RSON_CLS3_                     = 7,
86         _RSON_DISAOC_STA_LEAVING_       = 8,
87         _RSON_ASOC_NOT_AUTH_            = 9,
88         /* WPA reason */
89         _RSON_INVALID_IE_               = 13,
90         _RSON_MIC_FAILURE_              = 14,
91         _RSON_4WAY_HNDSHK_TIMEOUT_      = 15,
92         _RSON_GROUP_KEY_UPDATE_TIMEOUT_ = 16,
93         _RSON_DIFF_IE_                  = 17,
94         _RSON_MLTCST_CIPHER_NOT_VALID_  = 18,
95         _RSON_UNICST_CIPHER_NOT_VALID_  = 19,
96         _RSON_AKMP_NOT_VALID_           = 20,
97         _RSON_UNSUPPORT_RSNE_VER_       = 21,
98         _RSON_INVALID_RSNE_CAP_         = 22,
99         _RSON_IEEE_802DOT1X_AUTH_FAIL_  = 23,
100         /* below are Realtek definitions */
101         _RSON_PMK_NOT_AVAILABLE_        = 24,
102 };
103
104 enum WIFI_STATUS_CODE {
105         _STATS_SUCCESSFUL_              = 0,
106         _STATS_FAILURE_                 = 1,
107         _STATS_CAP_FAIL_                = 10,
108         _STATS_NO_ASOC_                 = 11,
109         _STATS_OTHER_                   = 12,
110         _STATS_NO_SUPP_ALG_             = 13,
111         _STATS_OUT_OF_AUTH_SEQ_         = 14,
112         _STATS_CHALLENGE_FAIL_          = 15,
113         _STATS_AUTH_TIMEOUT_            = 16,
114         _STATS_UNABLE_HANDLE_STA_       = 17,
115         _STATS_RATE_FAIL_               = 18,
116 };
117
118 enum WIFI_REG_DOMAIN {
119         DOMAIN_FCC      = 1,
120         DOMAIN_IC       = 2,
121         DOMAIN_ETSI     = 3,
122         DOMAIN_SPAIN    = 4,
123         DOMAIN_FRANCE   = 5,
124         DOMAIN_MKK      = 6,
125         DOMAIN_ISRAEL   = 7,
126         DOMAIN_MKK1     = 8,
127         DOMAIN_MKK2     = 9,
128         DOMAIN_MKK3     = 10,
129         DOMAIN_MAX
130 };
131
132 #define _TO_DS_         BIT(8)
133 #define _FROM_DS_       BIT(9)
134 #define _MORE_FRAG_     BIT(10)
135 #define _RETRY_         BIT(11)
136 #define _PWRMGT_        BIT(12)
137 #define _MORE_DATA_     BIT(13)
138 #define _PRIVACY_       BIT(14)
139 #define _ORDER_         BIT(15)
140
141 #define SetToDs(pbuf) ({ \
142         *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_); \
143 })
144
145 #define GetToDs(pbuf)   (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0)
146
147 #define ClearToDs(pbuf) ({ \
148         *(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_)); \
149 })
150
151 #define SetFrDs(pbuf) ({ \
152         *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_); \
153 })
154
155 #define GetFrDs(pbuf)   (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0)
156
157 #define ClearFrDs(pbuf) ({ \
158         *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)); \
159 })
160
161 static inline unsigned char get_tofr_ds(unsigned char *pframe)
162 {
163         return ((GetToDs(pframe) << 1) | GetFrDs(pframe));
164 }
165
166 #define SetMFrag(pbuf) ({ \
167         *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \
168 })
169
170 #define GetMFrag(pbuf)  (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0)
171
172 #define ClearMFrag(pbuf) ({ \
173         *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)); \
174 })
175
176 #define SetRetry(pbuf) ({ \
177         *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_); \
178 })
179
180 #define GetRetry(pbuf)  (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0)
181
182 #define ClearRetry(pbuf) ({ \
183         *(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_)); \
184 })
185
186 #define SetPwrMgt(pbuf) ({ \
187         *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_); \
188 })
189
190 #define GetPwrMgt(pbuf) (((*(__le16 *)(pbuf)) & \
191                         cpu_to_le16(_PWRMGT_)) != 0)
192
193 #define ClearPwrMgt(pbuf) ({ \
194         *(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)); \
195 })
196
197 #define SetMData(pbuf) ({ \
198         *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_); \
199 })
200
201 #define GetMData(pbuf)  (((*(__le16 *)(pbuf)) & \
202                         cpu_to_le16(_MORE_DATA_)) != 0)
203
204 #define ClearMData(pbuf) ({ \
205         *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)); \
206 })
207
208 #define SetPrivacy(pbuf) ({ \
209         *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_); \
210 })
211
212 #define GetPrivacy(pbuf)        (((*(__le16 *)(pbuf)) & \
213                                 cpu_to_le16(_PRIVACY_)) != 0)
214
215 #define GetOrder(pbuf)  (((*(__le16 *)(pbuf)) & \
216                         cpu_to_le16(_ORDER_)) != 0)
217
218 #define GetFrameType(pbuf)      (le16_to_cpu(*(__le16 *)(pbuf)) & \
219                                 (BIT(3) | BIT(2)))
220
221 #define SetFrameType(pbuf, type)        \
222         do {    \
223                 *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(3) | \
224                 BIT(2))); \
225                 *(__le16 *)(pbuf) |= cpu_to_le16(type); \
226         } while (0)
227
228 #define GetFrameSubType(pbuf)   (le16_to_cpu(*(__le16 *)(pbuf)) & \
229                                 (BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | \
230                                 BIT(2)))
231
232 #define SetFrameSubType(pbuf, type) \
233         do {    \
234                 *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | \
235                 BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
236                 *(__le16 *)(pbuf) |= cpu_to_le16(type); \
237         } while (0)
238
239 #define GetSequence(pbuf)       (le16_to_cpu(*(__le16 *)\
240                                 ((addr_t)(pbuf) + 22)) >> 4)
241
242 #define GetFragNum(pbuf)        (le16_to_cpu(*(__le16 *)((addr_t)\
243                                 (pbuf) + 22)) & 0x0f)
244
245 #define SetSeqNum(pbuf, num) ({ \
246         *(__le16 *)((addr_t)(pbuf) + 22) = \
247         cpu_to_le16((le16_to_cpu(*(__le16 *)((addr_t)(pbuf) + 22)) & \
248         0x000f) | (0xfff0 & (num << 4))); \
249 })
250
251 #define SetDuration(pbuf, dur) ({ \
252         *(__le16 *)((addr_t)(pbuf) + 2) |= \
253         cpu_to_le16(0xffff & (dur)); \
254 })
255
256 #define SetPriority(pbuf, tid) ({ \
257         *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf); \
258 })
259
260 #define GetPriority(pbuf)       ((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf)
261
262 #define SetAckpolicy(pbuf, ack) ({ \
263         *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5); \
264 })
265
266 #define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3)
267
268 #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1)
269
270 #define GetAid(pbuf)    (cpu_to_le16(*(__le16 *)((addr_t)(pbuf) + 2)) \
271                         & 0x3fff)
272
273 #define GetAddr1Ptr(pbuf)       ((unsigned char *)((addr_t)(pbuf) + 4))
274
275 #define GetAddr2Ptr(pbuf)       ((unsigned char *)((addr_t)(pbuf) + 10))
276
277 #define GetAddr3Ptr(pbuf)       ((unsigned char *)((addr_t)(pbuf) + 16))
278
279 #define GetAddr4Ptr(pbuf)       ((unsigned char *)((addr_t)(pbuf) + 24))
280
281
282
283 static inline int IS_MCAST(unsigned char *da)
284 {
285         if ((*da) & 0x01)
286                 return true;
287         else
288                 return false;
289 }
290
291
292 static inline unsigned char *get_da(unsigned char *pframe)
293 {
294         unsigned char   *da;
295         unsigned int    to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
296
297         switch (to_fr_ds) {
298         case 0x00:      /* ToDs=0, FromDs=0 */
299                 da = GetAddr1Ptr(pframe);
300                 break;
301         case 0x01:      /* ToDs=0, FromDs=1 */
302                 da = GetAddr1Ptr(pframe);
303                 break;
304         case 0x02:      /* ToDs=1, FromDs=0 */
305                 da = GetAddr3Ptr(pframe);
306                 break;
307         default:        /* ToDs=1, FromDs=1 */
308                 da = GetAddr3Ptr(pframe);
309                 break;
310         }
311         return da;
312 }
313
314
315 static inline unsigned char *get_sa(unsigned char *pframe)
316 {
317         unsigned char   *sa;
318         unsigned int    to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
319
320         switch (to_fr_ds) {
321         case 0x00:      /* ToDs=0, FromDs=0 */
322                 sa = GetAddr2Ptr(pframe);
323                 break;
324         case 0x01:      /* ToDs=0, FromDs=1 */
325                 sa = GetAddr3Ptr(pframe);
326                 break;
327         case 0x02:      /* ToDs=1, FromDs=0 */
328                 sa = GetAddr2Ptr(pframe);
329                 break;
330         default:        /* ToDs=1, FromDs=1 */
331                 sa = GetAddr4Ptr(pframe);
332                 break;
333         }
334
335         return sa;
336 }
337
338 static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
339 {
340         unsigned char   *sa;
341         unsigned int    to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
342
343         switch (to_fr_ds) {
344         case 0x00:      /* ToDs=0, FromDs=0 */
345                 sa = GetAddr3Ptr(pframe);
346                 break;
347         case 0x01:      /* ToDs=0, FromDs=1 */
348                 sa = GetAddr2Ptr(pframe);
349                 break;
350         case 0x02:      /* ToDs=1, FromDs=0 */
351                 sa = GetAddr1Ptr(pframe);
352                 break;
353         default:        /* ToDs=1, FromDs=1 */
354                 sa = NULL;
355                 break;
356         }
357         return sa;
358 }
359
360
361
362 /*-----------------------------------------------------------------------------
363  *              Below is for the security related definition
364  *-----------------------------------------------------------------------------
365  */
366 #define _RESERVED_FRAME_TYPE_   0
367 #define _SKB_FRAME_TYPE_        2
368 #define _PRE_ALLOCMEM_          1
369 #define _PRE_ALLOCHDR_          3
370 #define _PRE_ALLOCLLCHDR_       4
371 #define _PRE_ALLOCICVHDR_       5
372 #define _PRE_ALLOCMICHDR_       6
373
374 #define _SIFSTIME_              ((priv->pmib->BssType.net_work_type & \
375                                 WIRELESS_11A) ? 16 : 10)
376 #define _ACKCTSLNG_             14      /*14 bytes long, including crclng */
377 #define _CRCLNG_                4
378
379 #define _ASOCREQ_IE_OFFSET_     4       /* excluding wlan_hdr */
380 #define _ASOCRSP_IE_OFFSET_     6
381 #define _REASOCREQ_IE_OFFSET_   10
382 #define _REASOCRSP_IE_OFFSET_   6
383 #define _PROBEREQ_IE_OFFSET_    0
384 #define _PROBERSP_IE_OFFSET_    12
385 #define _AUTH_IE_OFFSET_        6
386 #define _DEAUTH_IE_OFFSET_      0
387 #define _BEACON_IE_OFFSET_      12
388
389 #define _FIXED_IE_LENGTH_       _BEACON_IE_OFFSET_
390
391 #define _SSID_IE_               0
392 #define _SUPPORTEDRATES_IE_     1
393 #define _DSSET_IE_              3
394 #define _IBSS_PARA_IE_          6
395 #define _ERPINFO_IE_            42
396 #define _EXT_SUPPORTEDRATES_IE_ 50
397
398 #define _HT_CAPABILITY_IE_      45
399 #define _HT_EXTRA_INFO_IE_      61
400 #define _HT_ADD_INFO_IE_        61 /* _HT_EXTRA_INFO_IE_ */
401
402 #define _VENDOR_SPECIFIC_IE_    221
403
404 #define _RESERVED47_            47
405
406
407 /* ---------------------------------------------------------------------------
408  *                      Below is the fixed elements...
409  * ---------------------------------------------------------------------------
410  */
411 #define _AUTH_ALGM_NUM_                 2
412 #define _AUTH_SEQ_NUM_                  2
413 #define _BEACON_ITERVAL_                2
414 #define _CAPABILITY_                    2
415 #define _CURRENT_APADDR_                6
416 #define _LISTEN_INTERVAL_               2
417 #define _RSON_CODE_                             2
418 #define _ASOC_ID_                               2
419 #define _STATUS_CODE_                   2
420 #define _TIMESTAMP_                             8
421
422 #define AUTH_ODD_TO                             0
423 #define AUTH_EVEN_TO                    1
424
425 #define WLAN_ETHCONV_ENCAP              1
426 #define WLAN_ETHCONV_RFC1042    2
427 #define WLAN_ETHCONV_8021h              3
428
429 #define cap_ESS BIT(0)
430 #define cap_IBSS BIT(1)
431 #define cap_CFPollable BIT(2)
432 #define cap_CFRequest BIT(3)
433 #define cap_Privacy BIT(4)
434 #define cap_ShortPremble BIT(5)
435
436 /*-----------------------------------------------------------------------------
437  *                      Below is the definition for 802.11i / 802.1x
438  *------------------------------------------------------------------------------
439  */
440 #define _IEEE8021X_MGT_                 1       /*WPA */
441 #define _IEEE8021X_PSK_                 2       /* WPA with pre-shared key */
442
443 /*-----------------------------------------------------------------------------
444  *                      Below is the definition for WMM
445  *------------------------------------------------------------------------------
446  */
447 #define _WMM_IE_Length_                         7  /* for WMM STA */
448 #define _WMM_Para_Element_Length_               24
449
450
451 /*-----------------------------------------------------------------------------
452  *                      Below is the definition for 802.11n
453  *------------------------------------------------------------------------------
454  */
455
456 /* block-ack parameters */
457 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
458 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
459 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
460 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
461 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
462
463 #define SetOrderBit(pbuf) ({ \
464         *(__le16 *)(pbuf) |= cpu_to_le16(_ORDER_); \
465 })
466
467 #define GetOrderBit(pbuf)       (((*(__le16 *)(pbuf)) & \
468                                 le16_to_cpu(_ORDER_)) != 0)
469
470
471 /**
472  * struct ieee80211_bar - HT Block Ack Request
473  *
474  * This structure refers to "HT BlockAckReq" as
475  * described in 802.11n draft section 7.2.1.7.1
476  */
477 struct ieee80211_bar {
478         __le16 frame_control;
479         __le16 duration;
480         unsigned char ra[6];
481         unsigned char ta[6];
482         __le16 control;
483         __le16 start_seq_num;
484 } __packed;
485
486 /* 802.11 BAR control masks */
487 #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL     0x0000
488 #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA  0x0004
489
490
491 /*
492  * struct ieee80211_ht_cap - HT capabilities
493  *
494  * This structure refers to "HT capabilities element" as
495  * described in 802.11n draft section 7.3.2.52
496  */
497
498 struct ieee80211_ht_cap {
499         __le16  cap_info;
500         unsigned char   ampdu_params_info;
501         unsigned char   supp_mcs_set[16];
502         __le16  extended_ht_cap_info;
503         __le32  tx_BF_cap_info;
504         unsigned char          antenna_selection_info;
505 } __packed;
506
507 /**
508  * struct ieee80211_ht_cap - HT additional information
509  *
510  * This structure refers to "HT information element" as
511  * described in 802.11n draft section 7.3.2.53
512  */
513 struct ieee80211_ht_addt_info {
514         unsigned char   control_chan;
515         unsigned char           ht_param;
516         __le16  operation_mode;
517         __le16  stbc_param;
518         unsigned char           basic_set[16];
519 } __packed;
520
521 /* 802.11n HT capabilities masks */
522 #define IEEE80211_HT_CAP_SUP_WIDTH              0x0002
523 #define IEEE80211_HT_CAP_SM_PS                  0x000C
524 #define IEEE80211_HT_CAP_GRN_FLD                0x0010
525 #define IEEE80211_HT_CAP_SGI_20                 0x0020
526 #define IEEE80211_HT_CAP_SGI_40                 0x0040
527 #define IEEE80211_HT_CAP_TX_STBC                        0x0080
528 #define IEEE80211_HT_CAP_DELAY_BA               0x0400
529 #define IEEE80211_HT_CAP_MAX_AMSDU              0x0800
530 #define IEEE80211_HT_CAP_DSSSCCK40              0x1000
531 /* 802.11n HT capability AMPDU settings */
532 #define IEEE80211_HT_CAP_AMPDU_FACTOR           0x03
533 #define IEEE80211_HT_CAP_AMPDU_DENSITY          0x1C
534 /* 802.11n HT capability MSC set */
535 #define IEEE80211_SUPP_MCS_SET_UEQM             4
536 #define IEEE80211_HT_CAP_MAX_STREAMS            4
537 #define IEEE80211_SUPP_MCS_SET_LEN              10
538 /* maximum streams the spec allows */
539 #define IEEE80211_HT_CAP_MCS_TX_DEFINED         0x01
540 #define IEEE80211_HT_CAP_MCS_TX_RX_DIFF         0x02
541 #define IEEE80211_HT_CAP_MCS_TX_STREAMS         0x0C
542 #define IEEE80211_HT_CAP_MCS_TX_UEQM            0x10
543 /* 802.11n HT IE masks */
544 #define IEEE80211_HT_IE_CHA_SEC_OFFSET          0x03
545 #define IEEE80211_HT_IE_CHA_SEC_NONE            0x00
546 #define IEEE80211_HT_IE_CHA_SEC_ABOVE           0x01
547 #define IEEE80211_HT_IE_CHA_SEC_BELOW           0x03
548 #define IEEE80211_HT_IE_CHA_WIDTH               0x04
549 #define IEEE80211_HT_IE_HT_PROTECTION           0x0003
550 #define IEEE80211_HT_IE_NON_GF_STA_PRSNT        0x0004
551 #define IEEE80211_HT_IE_NON_HT_STA_PRSNT        0x0010
552
553 /* block-ack parameters */
554 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
555 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
556 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
557 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
558 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
559
560 /*
561  * A-PMDU buffer sizes
562  * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
563  */
564 #define IEEE80211_MIN_AMPDU_BUF 0x8
565
566
567 /* Spatial Multiplexing Power Save Modes */
568 #define WLAN_HT_CAP_SM_PS_STATIC                0
569 #define WLAN_HT_CAP_SM_PS_DYNAMIC       1
570 #define WLAN_HT_CAP_SM_PS_INVALID       2
571 #define WLAN_HT_CAP_SM_PS_DISABLED      3
572
573 #endif /* _WIFI_H_ */
574