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