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