i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / staging / rtl8712 / wifi.h
blob277398cff0a79013af0ba1ba6764b36ef83a43fb
1 /******************************************************************************
3 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 * Modifications for inclusion into the Linux staging tree are
19 * Copyright(c) 2010 Larry Finger. All rights reserved.
21 * Contact information:
22 * WLAN FAE <wlanfae@realtek.com>
23 * Larry Finger <Larry.Finger@lwfinger.net>
25 ******************************************************************************/
26 #ifndef _WIFI_H_
27 #define _WIFI_H_
29 #include "rtl871x_byteorder.h"
30 #include <linux/compiler.h>
32 #ifdef BIT
33 #undef BIT
34 #endif
35 #define BIT(x) (1 << (x))
37 #define WLAN_ETHHDR_LEN 14
38 #define WLAN_ETHADDR_LEN 6
39 #define WLAN_IEEE_OUI_LEN 3
40 #define WLAN_ADDR_LEN 6
41 #define WLAN_CRC_LEN 4
42 #define WLAN_BSSID_LEN 6
43 #define WLAN_BSS_TS_LEN 8
44 #define WLAN_HDR_A3_LEN 24
45 #define WLAN_HDR_A4_LEN 30
46 #define WLAN_HDR_A3_QOS_LEN 26
47 #define WLAN_HDR_A4_QOS_LEN 32
48 #define WLAN_SSID_MAXLEN 32
49 #define WLAN_DATA_MAXLEN 2312
51 #define WLAN_A3_PN_OFFSET 24
52 #define WLAN_A4_PN_OFFSET 30
54 #define WLAN_MIN_ETHFRM_LEN 60
55 #define WLAN_MAX_ETHFRM_LEN 1514
56 #define WLAN_ETHHDR_LEN 14
58 #define P80211CAPTURE_VERSION 0x80211001
60 enum WIFI_FRAME_TYPE {
61 WIFI_MGT_TYPE = (0),
62 WIFI_CTRL_TYPE = (BIT(2)),
63 WIFI_DATA_TYPE = (BIT(3)),
64 WIFI_QOS_DATA_TYPE = (BIT(7)|BIT(3)), /*!< QoS Data */
67 enum WIFI_FRAME_SUBTYPE {
68 /* below is for mgt frame */
69 WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE),
70 WIFI_ASSOCRSP = (BIT(4) | WIFI_MGT_TYPE),
71 WIFI_REASSOCREQ = (BIT(5) | WIFI_MGT_TYPE),
72 WIFI_REASSOCRSP = (BIT(5) | BIT(4) | WIFI_MGT_TYPE),
73 WIFI_PROBEREQ = (BIT(6) | WIFI_MGT_TYPE),
74 WIFI_PROBERSP = (BIT(6) | BIT(4) | WIFI_MGT_TYPE),
75 WIFI_BEACON = (BIT(7) | WIFI_MGT_TYPE),
76 WIFI_ATIM = (BIT(7) | BIT(4) | WIFI_MGT_TYPE),
77 WIFI_DISASSOC = (BIT(7) | BIT(5) | WIFI_MGT_TYPE),
78 WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE),
79 WIFI_DEAUTH = (BIT(7) | BIT(6) | WIFI_MGT_TYPE),
80 WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE),
81 /* below is for control frame */
82 WIFI_PSPOLL = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE),
83 WIFI_RTS = (BIT(7) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
84 WIFI_CTS = (BIT(7) | BIT(6) | WIFI_CTRL_TYPE),
85 WIFI_ACK = (BIT(7) | BIT(6) | BIT(4) | WIFI_CTRL_TYPE),
86 WIFI_CFEND = (BIT(7) | BIT(6) | BIT(5) | WIFI_CTRL_TYPE),
87 WIFI_CFEND_CFACK = (BIT(7) | BIT(6) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
88 /* below is for data frame */
89 WIFI_DATA = (0 | WIFI_DATA_TYPE),
90 WIFI_DATA_CFACK = (BIT(4) | WIFI_DATA_TYPE),
91 WIFI_DATA_CFPOLL = (BIT(5) | WIFI_DATA_TYPE),
92 WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | WIFI_DATA_TYPE),
93 WIFI_DATA_NULL = (BIT(6) | WIFI_DATA_TYPE),
94 WIFI_CF_ACK = (BIT(6) | BIT(4) | WIFI_DATA_TYPE),
95 WIFI_CF_POLL = (BIT(6) | BIT(5) | WIFI_DATA_TYPE),
96 WIFI_CF_ACKPOLL = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE),
99 enum WIFI_REASON_CODE {
100 _RSON_RESERVED_ = 0,
101 _RSON_UNSPECIFIED_ = 1,
102 _RSON_AUTH_NO_LONGER_VALID_ = 2,
103 _RSON_DEAUTH_STA_LEAVING_ = 3,
104 _RSON_INACTIVITY_ = 4,
105 _RSON_UNABLE_HANDLE_ = 5,
106 _RSON_CLS2_ = 6,
107 _RSON_CLS3_ = 7,
108 _RSON_DISAOC_STA_LEAVING_ = 8,
109 _RSON_ASOC_NOT_AUTH_ = 9,
110 /* WPA reason */
111 _RSON_INVALID_IE_ = 13,
112 _RSON_MIC_FAILURE_ = 14,
113 _RSON_4WAY_HNDSHK_TIMEOUT_ = 15,
114 _RSON_GROUP_KEY_UPDATE_TIMEOUT_ = 16,
115 _RSON_DIFF_IE_ = 17,
116 _RSON_MLTCST_CIPHER_NOT_VALID_ = 18,
117 _RSON_UNICST_CIPHER_NOT_VALID_ = 19,
118 _RSON_AKMP_NOT_VALID_ = 20,
119 _RSON_UNSUPPORT_RSNE_VER_ = 21,
120 _RSON_INVALID_RSNE_CAP_ = 22,
121 _RSON_IEEE_802DOT1X_AUTH_FAIL_ = 23,
122 /* below are Realtek definitions */
123 _RSON_PMK_NOT_AVAILABLE_ = 24,
126 enum WIFI_STATUS_CODE {
127 _STATS_SUCCESSFUL_ = 0,
128 _STATS_FAILURE_ = 1,
129 _STATS_CAP_FAIL_ = 10,
130 _STATS_NO_ASOC_ = 11,
131 _STATS_OTHER_ = 12,
132 _STATS_NO_SUPP_ALG_ = 13,
133 _STATS_OUT_OF_AUTH_SEQ_ = 14,
134 _STATS_CHALLENGE_FAIL_ = 15,
135 _STATS_AUTH_TIMEOUT_ = 16,
136 _STATS_UNABLE_HANDLE_STA_ = 17,
137 _STATS_RATE_FAIL_ = 18,
140 enum WIFI_REG_DOMAIN {
141 DOMAIN_FCC = 1,
142 DOMAIN_IC = 2,
143 DOMAIN_ETSI = 3,
144 DOMAIN_SPAIN = 4,
145 DOMAIN_FRANCE = 5,
146 DOMAIN_MKK = 6,
147 DOMAIN_ISRAEL = 7,
148 DOMAIN_MKK1 = 8,
149 DOMAIN_MKK2 = 9,
150 DOMAIN_MKK3 = 10,
151 DOMAIN_MAX
154 #define _TO_DS_ BIT(8)
155 #define _FROM_DS_ BIT(9)
156 #define _MORE_FRAG_ BIT(10)
157 #define _RETRY_ BIT(11)
158 #define _PWRMGT_ BIT(12)
159 #define _MORE_DATA_ BIT(13)
160 #define _PRIVACY_ BIT(14)
161 #define _ORDER_ BIT(15)
163 #define SetToDs(pbuf) \
164 do { \
165 *(unsigned short *)(pbuf) |= cpu_to_le16(_TO_DS_); \
166 } while (0)
168 #define GetToDs(pbuf) (((*(unsigned short *)(pbuf)) & \
169 le16_to_cpu(_TO_DS_)) != 0)
171 #define ClearToDs(pbuf) \
172 do { \
173 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_TO_DS_)); \
174 } while (0)
176 #define SetFrDs(pbuf) \
177 do { \
178 *(unsigned short *)(pbuf) |= cpu_to_le16(_FROM_DS_); \
179 } while (0)
181 #define GetFrDs(pbuf) (((*(unsigned short *)(pbuf)) & \
182 le16_to_cpu(_FROM_DS_)) != 0)
184 #define ClearFrDs(pbuf) \
185 do { \
186 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)); \
187 } while (0)
189 #define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe))
192 #define SetMFrag(pbuf) \
193 do { \
194 *(unsigned short *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \
195 } while (0)
197 #define GetMFrag(pbuf) (((*(unsigned short *)(pbuf)) & \
198 le16_to_cpu(_MORE_FRAG_)) != 0)
200 #define ClearMFrag(pbuf) \
201 do { \
202 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)); \
203 } while (0)
205 #define SetRetry(pbuf) \
206 do { \
207 *(unsigned short *)(pbuf) |= cpu_to_le16(_RETRY_); \
208 } while (0)
210 #define GetRetry(pbuf) (((*(unsigned short *)(pbuf)) & \
211 le16_to_cpu(_RETRY_)) != 0)
213 #define ClearRetry(pbuf) \
214 do { \
215 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_RETRY_)); \
216 } while (0)
218 #define SetPwrMgt(pbuf) \
219 do { \
220 *(unsigned short *)(pbuf) |= cpu_to_le16(_PWRMGT_); \
221 } while (0)
223 #define GetPwrMgt(pbuf) (((*(unsigned short *)(pbuf)) & \
224 le16_to_cpu(_PWRMGT_)) != 0)
226 #define ClearPwrMgt(pbuf) \
227 do { \
228 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)); \
229 } while (0)
231 #define SetMData(pbuf) \
232 do { \
233 *(unsigned short *)(pbuf) |= cpu_to_le16(_MORE_DATA_); \
234 } while (0)
236 #define GetMData(pbuf) (((*(unsigned short *)(pbuf)) & \
237 le16_to_cpu(_MORE_DATA_)) != 0)
239 #define ClearMData(pbuf) \
240 do { \
241 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)); \
242 } while (0)
244 #define SetPrivacy(pbuf) \
245 do { \
246 *(unsigned short *)(pbuf) |= cpu_to_le16(_PRIVACY_); \
247 } while (0)
249 #define GetPrivacy(pbuf) (((*(unsigned short *)(pbuf)) & \
250 le16_to_cpu(_PRIVACY_)) != 0)
252 #define ClearPrivacy(pbuf) \
253 do { \
254 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_PRIVACY_)); \
255 } while (0)
258 #define GetOrder(pbuf) (((*(unsigned short *)(pbuf)) & \
259 le16_to_cpu(_ORDER_)) != 0)
261 #define GetFrameType(pbuf) (le16_to_cpu(*(unsigned short *)(pbuf)) & \
262 (BIT(3) | BIT(2)))
264 #define SetFrameType(pbuf, type) \
265 do { \
266 *(unsigned short *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | \
267 BIT(2))); \
268 *(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \
269 } while (0)
271 #define GetFrameSubType(pbuf) (cpu_to_le16(*(unsigned short *)(pbuf)) & \
272 (BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | \
273 BIT(2)))
275 #define SetFrameSubType(pbuf, type) \
276 do { \
277 *(unsigned short *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | \
278 BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
279 *(unsigned short *)(pbuf) |= cpu_to_le16(type); \
280 } while (0)
282 #define GetSequence(pbuf) (cpu_to_le16(*(unsigned short *)\
283 ((addr_t)(pbuf) + 22)) >> 4)
285 #define GetFragNum(pbuf) (cpu_to_le16(*(unsigned short *)((addr_t)\
286 (pbuf) + 22)) & 0x0f)
288 #define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)\
289 ((addr_t)(pbuf) + 22)))
291 #define SetFragNum(pbuf, num) \
292 do { \
293 *(unsigned short *)((addr_t)(pbuf) + 22) = \
294 ((*(unsigned short *)((addr_t)(pbuf) + 22)) & \
295 le16_to_cpu(~(0x000f))) | \
296 cpu_to_le16(0x0f & (num)); \
297 } while (0)
299 #define SetSeqNum(pbuf, num) \
300 do { \
301 *(unsigned short *)((addr_t)(pbuf) + 22) = \
302 ((*(unsigned short *)((addr_t)(pbuf) + 22)) & \
303 le16_to_cpu((unsigned short)0x000f)) | \
304 le16_to_cpu((unsigned short)(0xfff0 & (num << 4))); \
305 } while (0)
307 #define SetDuration(pbuf, dur) \
308 do { \
309 *(unsigned short *)((addr_t)(pbuf) + 2) |= \
310 cpu_to_le16(0xffff & (dur)); \
311 } while (0)
313 #define SetPriority(pbuf, tid) \
314 do { \
315 *(unsigned short *)(pbuf) |= cpu_to_le16(tid & 0xf); \
316 } while (0)
318 #define GetPriority(pbuf) ((le16_to_cpu(*(unsigned short *)(pbuf))) & 0xf)
320 #define SetAckpolicy(pbuf, ack) \
321 do { \
322 *(unsigned short *)(pbuf) |= cpu_to_le16((ack & 3) << 5); \
323 } while (0)
325 #define GetAckpolicy(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 5) & 0x3)
327 #define GetAMsdu(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 7) & 0x1)
329 #define SetAMsdu(pbuf, amsdu) \
330 do { \
331 *(unsigned short *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7); \
332 } while (0)
334 #define GetAid(pbuf) (cpu_to_le16(*(unsigned short *)((addr_t)(pbuf) + 2)) \
335 & 0x3fff)
337 #define GetTid(pbuf) (cpu_to_le16(*(unsigned short *)((addr_t)(pbuf) + \
338 (((GetToDs(pbuf) << 1)|GetFrDs(pbuf)) == 3 ? \
339 30 : 24))) & 0x000f)
341 #define GetAddr1Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 4))
343 #define GetAddr2Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 10))
345 #define GetAddr3Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 16))
347 #define GetAddr4Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 24))
351 static inline int IS_MCAST(unsigned char *da)
353 if ((*da) & 0x01)
354 return true;
355 else
356 return false;
360 static inline unsigned char *get_da(unsigned char *pframe)
362 unsigned char *da;
363 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
365 switch (to_fr_ds) {
366 case 0x00: /* ToDs=0, FromDs=0 */
367 da = GetAddr1Ptr(pframe);
368 break;
369 case 0x01: /* ToDs=0, FromDs=1 */
370 da = GetAddr1Ptr(pframe);
371 break;
372 case 0x02: /* ToDs=1, FromDs=0 */
373 da = GetAddr3Ptr(pframe);
374 break;
375 default: /* ToDs=1, FromDs=1 */
376 da = GetAddr3Ptr(pframe);
377 break;
379 return da;
383 static inline unsigned char *get_sa(unsigned char *pframe)
385 unsigned char *sa;
386 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
388 switch (to_fr_ds) {
389 case 0x00: /* ToDs=0, FromDs=0 */
390 sa = GetAddr2Ptr(pframe);
391 break;
392 case 0x01: /* ToDs=0, FromDs=1 */
393 sa = GetAddr3Ptr(pframe);
394 break;
395 case 0x02: /* ToDs=1, FromDs=0 */
396 sa = GetAddr2Ptr(pframe);
397 break;
398 default: /* ToDs=1, FromDs=1 */
399 sa = GetAddr4Ptr(pframe);
400 break;
403 return sa;
406 static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
408 unsigned char *sa;
409 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
411 switch (to_fr_ds) {
412 case 0x00: /* ToDs=0, FromDs=0 */
413 sa = GetAddr3Ptr(pframe);
414 break;
415 case 0x01: /* ToDs=0, FromDs=1 */
416 sa = GetAddr2Ptr(pframe);
417 break;
418 case 0x02: /* ToDs=1, FromDs=0 */
419 sa = GetAddr1Ptr(pframe);
420 break;
421 default: /* ToDs=1, FromDs=1 */
422 sa = NULL;
423 break;
425 return sa;
430 /*-----------------------------------------------------------------------------
431 Below is for the security related definition
432 ------------------------------------------------------------------------------*/
433 #define _RESERVED_FRAME_TYPE_ 0
434 #define _SKB_FRAME_TYPE_ 2
435 #define _PRE_ALLOCMEM_ 1
436 #define _PRE_ALLOCHDR_ 3
437 #define _PRE_ALLOCLLCHDR_ 4
438 #define _PRE_ALLOCICVHDR_ 5
439 #define _PRE_ALLOCMICHDR_ 6
441 #define _SIFSTIME_ ((priv->pmib->BssType.net_work_type & \
442 WIRELESS_11A) ? 16 : 10)
443 #define _ACKCTSLNG_ 14 /*14 bytes long, including crclng */
444 #define _CRCLNG_ 4
446 #define _ASOCREQ_IE_OFFSET_ 4 /* excluding wlan_hdr */
447 #define _ASOCRSP_IE_OFFSET_ 6
448 #define _REASOCREQ_IE_OFFSET_ 10
449 #define _REASOCRSP_IE_OFFSET_ 6
450 #define _PROBEREQ_IE_OFFSET_ 0
451 #define _PROBERSP_IE_OFFSET_ 12
452 #define _AUTH_IE_OFFSET_ 6
453 #define _DEAUTH_IE_OFFSET_ 0
454 #define _BEACON_IE_OFFSET_ 12
456 #define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
458 #define _SSID_IE_ 0
459 #define _SUPPORTEDRATES_IE_ 1
460 #define _DSSET_IE_ 3
461 #define _TIM_IE_ 5
462 #define _IBSS_PARA_IE_ 6
463 #define _CHLGETXT_IE_ 16
464 #define _RSN_IE_2_ 48`
465 #define _SSN_IE_1_ 221
466 #define _ERPINFO_IE_ 42
467 #define _EXT_SUPPORTEDRATES_IE_ 50
469 #define _HT_CAPABILITY_IE_ 45
470 #define _HT_EXTRA_INFO_IE_ 61
471 #define _HT_ADD_INFO_IE_ 61 /* _HT_EXTRA_INFO_IE_ */
473 #define _VENDOR_SPECIFIC_IE_ 221
475 #define _RESERVED47_ 47
478 /* ---------------------------------------------------------------------------
479 Below is the fixed elements...
480 -----------------------------------------------------------------------------*/
481 #define _AUTH_ALGM_NUM_ 2
482 #define _AUTH_SEQ_NUM_ 2
483 #define _BEACON_ITERVAL_ 2
484 #define _CAPABILITY_ 2
485 #define _CURRENT_APADDR_ 6
486 #define _LISTEN_INTERVAL_ 2
487 #define _RSON_CODE_ 2
488 #define _ASOC_ID_ 2
489 #define _STATUS_CODE_ 2
490 #define _TIMESTAMP_ 8
492 #define AUTH_ODD_TO 0
493 #define AUTH_EVEN_TO 1
495 #define WLAN_ETHCONV_ENCAP 1
496 #define WLAN_ETHCONV_RFC1042 2
497 #define WLAN_ETHCONV_8021h 3
499 #define cap_ESS BIT(0)
500 #define cap_IBSS BIT(1)
501 #define cap_CFPollable BIT(2)
502 #define cap_CFRequest BIT(3)
503 #define cap_Privacy BIT(4)
504 #define cap_ShortPremble BIT(5)
506 /*-----------------------------------------------------------------------------
507 Below is the definition for 802.11i / 802.1x
508 ------------------------------------------------------------------------------*/
509 #define _IEEE8021X_MGT_ 1 /*WPA */
510 #define _IEEE8021X_PSK_ 2 /* WPA with pre-shared key */
512 /*-----------------------------------------------------------------------------
513 Below is the definition for WMM
514 ------------------------------------------------------------------------------*/
515 #define _WMM_IE_Length_ 7 /* for WMM STA */
516 #define _WMM_Para_Element_Length_ 24
519 /*-----------------------------------------------------------------------------
520 Below is the definition for 802.11n
521 ------------------------------------------------------------------------------*/
523 /* block-ack parameters */
524 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
525 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
526 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
527 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
528 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
530 #define SetOrderBit(pbuf) \
531 do { \
532 *(unsigned short *)(pbuf) |= cpu_to_le16(_ORDER_); \
533 } while (0)
535 #define GetOrderBit(pbuf) (((*(unsigned short *)(pbuf)) & \
536 le16_to_cpu(_ORDER_)) != 0)
540 * struct ieee80211_bar - HT Block Ack Request
542 * This structure refers to "HT BlockAckReq" as
543 * described in 802.11n draft section 7.2.1.7.1
545 struct ieee80211_bar {
546 unsigned short frame_control;
547 unsigned short duration;
548 unsigned char ra[6];
549 unsigned char ta[6];
550 unsigned short control;
551 unsigned short start_seq_num;
552 } __packed;
554 /* 802.11 BAR control masks */
555 #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
556 #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
560 * struct ieee80211_ht_cap - HT capabilities
562 * This structure refers to "HT capabilities element" as
563 * described in 802.11n draft section 7.3.2.52
566 struct ieee80211_ht_cap {
567 unsigned short cap_info;
568 unsigned char ampdu_params_info;
569 unsigned char supp_mcs_set[16];
570 unsigned short extended_ht_cap_info;
571 unsigned int tx_BF_cap_info;
572 unsigned char antenna_selection_info;
573 } __packed;
576 * struct ieee80211_ht_cap - HT additional information
578 * This structure refers to "HT information element" as
579 * described in 802.11n draft section 7.3.2.53
581 struct ieee80211_ht_addt_info {
582 unsigned char control_chan;
583 unsigned char ht_param;
584 unsigned short operation_mode;
585 unsigned short stbc_param;
586 unsigned char basic_set[16];
587 } __packed;
589 /* 802.11n HT capabilities masks */
590 #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
591 #define IEEE80211_HT_CAP_SM_PS 0x000C
592 #define IEEE80211_HT_CAP_GRN_FLD 0x0010
593 #define IEEE80211_HT_CAP_SGI_20 0x0020
594 #define IEEE80211_HT_CAP_SGI_40 0x0040
595 #define IEEE80211_HT_CAP_TX_STBC 0x0080
596 #define IEEE80211_HT_CAP_DELAY_BA 0x0400
597 #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
598 #define IEEE80211_HT_CAP_DSSSCCK40 0x1000
599 /* 802.11n HT capability AMPDU settings */
600 #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
601 #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
602 /* 802.11n HT capability MSC set */
603 #define IEEE80211_SUPP_MCS_SET_UEQM 4
604 #define IEEE80211_HT_CAP_MAX_STREAMS 4
605 #define IEEE80211_SUPP_MCS_SET_LEN 10
606 /* maximum streams the spec allows */
607 #define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01
608 #define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02
609 #define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C
610 #define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10
611 /* 802.11n HT IE masks */
612 #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
613 #define IEEE80211_HT_IE_CHA_SEC_NONE 0x00
614 #define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01
615 #define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03
616 #define IEEE80211_HT_IE_CHA_WIDTH 0x04
617 #define IEEE80211_HT_IE_HT_PROTECTION 0x0003
618 #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
619 #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
621 /* block-ack parameters */
622 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
623 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
624 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
625 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
626 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
629 * A-PMDU buffer sizes
630 * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
632 #define IEEE80211_MIN_AMPDU_BUF 0x8
633 #define IEEE80211_MAX_AMPDU_BUF 0x40
636 /* Spatial Multiplexing Power Save Modes */
637 #define WLAN_HT_CAP_SM_PS_STATIC 0
638 #define WLAN_HT_CAP_SM_PS_DYNAMIC 1
639 #define WLAN_HT_CAP_SM_PS_INVALID 2
640 #define WLAN_HT_CAP_SM_PS_DISABLED 3
642 #endif /* _WIFI_H_ */