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