blob: 3be1bc89095cbe7c4897a75d24a2d3d47328e267 [file] [log] [blame]
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001/*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
7 *
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 * *
25 *************************************************************************
26
27 Module Name:
28 mlme.h
29
30 Abstract:
31
32 Revision History:
33 Who When What
34 -------- ---------- ----------------------------------------------
35 John Chang 2003-08-28 Created
36 John Chang 2004-09-06 modified for RT2600
37
38*/
39#ifndef __MLME_H__
40#define __MLME_H__
41
Bartlomiej Zolnierkiewiczca97b832009-09-22 20:44:07 +020042#include "rtmp_dot11.h"
43
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080044/* maximum supported capability information - */
45/* ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -070046#define SUPPORTED_CAPABILITY_INFO 0x0533
47
48#define END_OF_ARGS -1
49#define LFSR_MASK 0x80000057
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080050#define MLME_TASK_EXEC_INTV 100/*200*/ /* */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -070051#define LEAD_TIME 5
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080052#define MLME_TASK_EXEC_MULTIPLE 10 /*5*/ /* MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec */
53#define REORDER_EXEC_INTV 100 /* 0.1 sec */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -070054
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080055/* The definition of Radar detection duration region */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -070056#define CE 0
57#define FCC 1
58#define JAP 2
59#define JAP_W53 3
60#define JAP_W56 4
61#define MAX_RD_REGION 5
62
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080063#define BEACON_LOST_TIME 4 * OS_HZ /* 2048 msec = 2 sec */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -070064
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080065#define DLS_TIMEOUT 1200 /* unit: msec */
66#define AUTH_TIMEOUT 300 /* unit: msec */
67#define ASSOC_TIMEOUT 300 /* unit: msec */
68#define JOIN_TIMEOUT 2000 /* unit: msec */
69#define SHORT_CHANNEL_TIME 90 /* unit: msec */
70#define MIN_CHANNEL_TIME 110 /* unit: msec, for dual band scan */
71#define MAX_CHANNEL_TIME 140 /* unit: msec, for single band scan */
72#define FAST_ACTIVE_SCAN_TIME 30 /* Active scan waiting for probe response time */
73#define CW_MIN_IN_BITS 4 /* actual CwMin = 2^CW_MIN_IN_BITS - 1 */
74#define LINK_DOWN_TIMEOUT 20000 /* unit: msec */
75#define AUTO_WAKEUP_TIMEOUT 70 /*unit: msec */
Bartlomiej Zolnierkiewiczca97b832009-09-22 20:44:07 +020076
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080077#define CW_MAX_IN_BITS 10 /* actual CwMax = 2^CW_MAX_IN_BITS - 1 */
Bartlomiej Zolnierkiewiczca97b832009-09-22 20:44:07 +020078
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080079/* Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720). */
80/* SHould not refer to this constant anymore */
81/*#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm */
82#define RSSI_FOR_MID_TX_POWER -55 /* -55 db is considered mid-distance */
83#define RSSI_FOR_LOW_TX_POWER -45 /* -45 db is considered very short distance and */
84 /* eligible to use a lower TX power */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -070085#define RSSI_FOR_LOWEST_TX_POWER -30
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080086/*#define MID_TX_POWER_DELTA 0 // 0 db from full TX power upon mid-distance to AP */
87#define LOW_TX_POWER_DELTA 6 /* -3 db from full TX power upon very short distance. 1 grade is 0.5 db */
88#define LOWEST_TX_POWER_DELTA 16 /* -8 db from full TX power upon shortest distance. 1 grade is 0.5 db */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -070089
90#define RSSI_TRIGGERED_UPON_BELOW_THRESHOLD 0
91#define RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD 1
92#define RSSI_THRESHOLD_FOR_ROAMING 25
93#define RSSI_DELTA 5
94
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080095/* Channel Quality Indication */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -070096#define CQI_IS_GOOD(cqi) ((cqi) >= 50)
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -080097/*#define CQI_IS_FAIR(cqi) (((cqi) >= 20) && ((cqi) < 50)) */
98#define CQI_IS_POOR(cqi) (cqi < 50) /*(((cqi) >= 5) && ((cqi) < 20)) */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -070099#define CQI_IS_BAD(cqi) (cqi < 5)
100#define CQI_IS_DEAD(cqi) (cqi == 0)
101
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800102/* weighting factor to calculate Channel quality, total should be 100% */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700103#define RSSI_WEIGHTING 50
104#define TX_WEIGHTING 30
105#define RX_WEIGHTING 20
106
107#define BSS_NOT_FOUND 0xFFFFFFFF
108
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800109#define MAX_LEN_OF_MLME_QUEUE 40 /*10 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700110
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800111#define SCAN_PASSIVE 18 /* scan with no probe request, only wait beacon and probe response */
112#define SCAN_ACTIVE 19 /* scan with probe request, and wait beacon and probe response */
113#define SCAN_CISCO_PASSIVE 20 /* Single channel passive scan */
114#define SCAN_CISCO_ACTIVE 21 /* Single channel active scan */
115#define SCAN_CISCO_NOISE 22 /* Single channel passive scan for noise histogram collection */
116#define SCAN_CISCO_CHANNEL_LOAD 23 /* Single channel passive scan for channel load collection */
117#define FAST_SCAN_ACTIVE 24 /* scan with probe request, and wait beacon and probe response */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700118
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700119#define MAC_ADDR_IS_GROUP(Addr) (((Addr[0]) & 0x01))
120#define MAC_ADDR_HASH(Addr) (Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])
121#define MAC_ADDR_HASH_INDEX(Addr) (MAC_ADDR_HASH(Addr) % HASH_TABLE_SIZE)
122#define TID_MAC_HASH(Addr,TID) (TID^Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])
123#define TID_MAC_HASH_INDEX(Addr,TID) (TID_MAC_HASH(Addr,TID) % HASH_TABLE_SIZE)
124
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800125/* LED Control */
126/* assoiation ON. one LED ON. another blinking when TX, OFF when idle */
127/* no association, both LED off */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700128#define ASIC_LED_ACT_ON(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00031e46)
129#define ASIC_LED_ACT_OFF(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00001e46)
130
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800131/* bit definition of the 2-byte pBEACON->Capability field */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700132#define CAP_IS_ESS_ON(x) (((x) & 0x0001) != 0)
133#define CAP_IS_IBSS_ON(x) (((x) & 0x0002) != 0)
134#define CAP_IS_CF_POLLABLE_ON(x) (((x) & 0x0004) != 0)
135#define CAP_IS_CF_POLL_REQ_ON(x) (((x) & 0x0008) != 0)
136#define CAP_IS_PRIVACY_ON(x) (((x) & 0x0010) != 0)
137#define CAP_IS_SHORT_PREAMBLE_ON(x) (((x) & 0x0020) != 0)
138#define CAP_IS_PBCC_ON(x) (((x) & 0x0040) != 0)
139#define CAP_IS_AGILITY_ON(x) (((x) & 0x0080) != 0)
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800140#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) /* 802.11e d9 */
141#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) /* 802.11e d9 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700142#define CAP_IS_SHORT_SLOT(x) (((x) & 0x0400) != 0)
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800143#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) /* 802.11e d9 */
144#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) /* 802.11e d9 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700145#define CAP_IS_DSSS_OFDM(x) (((x) & 0x2000) != 0)
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800146#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) /* 802.11e d9 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700147
148#define CAP_GENERATE(ess,ibss,priv,s_pre,s_slot,spectrum) (((ess) ? 0x0001 : 0x0000) | ((ibss) ? 0x0002 : 0x0000) | ((priv) ? 0x0010 : 0x0000) | ((s_pre) ? 0x0020 : 0x0000) | ((s_slot) ? 0x0400 : 0x0000) | ((spectrum) ? 0x0100 : 0x0000))
149
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800150#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) /* 802.11g */
151#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) /* 802.11g */
152#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) /* 802.11g */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700153
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800154#define DRS_TX_QUALITY_WORST_BOUND 8 /* 3 // just test by gary */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700155#define DRS_PENALTY 8
156
157#define BA_NOTUSE 2
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800158/*BA Policy subfiled value in ADDBA frame */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700159#define IMMED_BA 1
160#define DELAY_BA 0
161
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800162/* BA Initiator subfield in DELBA frame */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700163#define ORIGINATOR 1
164#define RECIPIENT 0
165
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800166/* ADDBA Status Code */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700167#define ADDBA_RESULTCODE_SUCCESS 0
168#define ADDBA_RESULTCODE_REFUSED 37
169#define ADDBA_RESULTCODE_INVALID_PARAMETERS 38
170
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800171/* DELBA Reason Code */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700172#define DELBA_REASONCODE_QSTA_LEAVING 36
173#define DELBA_REASONCODE_END_BA 37
174#define DELBA_REASONCODE_UNKNOWN_BA 38
175#define DELBA_REASONCODE_TIMEOUT 39
176
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800177/* reset all OneSecTx counters */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700178#define RESET_ONE_SEC_TX_CNT(__pEntry) \
179if (((__pEntry)) != NULL) \
180{ \
181 (__pEntry)->OneSecTxRetryOkCount = 0; \
182 (__pEntry)->OneSecTxFailCount = 0; \
183 (__pEntry)->OneSecTxNoRetryOkCount = 0; \
184}
185
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800186/* */
187/* 802.11 frame formats */
188/* */
189/* HT Capability INFO field in HT Cap IE . */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700190typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800191 u16 AdvCoding:1;
192 u16 ChannelWidth:1;
193 u16 MimoPs:2; /*momi power safe */
194 u16 GF:1; /*green field */
195 u16 ShortGIfor20:1;
196 u16 ShortGIfor40:1; /*for40MHz */
197 u16 TxSTBC:1;
198 u16 RxSTBC:2;
199 u16 DelayedBA:1; /*rt2860c not support */
200 u16 AMsduSize:1; /* only support as zero */
201 u16 CCKmodein40:1;
202 u16 PSMP:1;
203 u16 Forty_Mhz_Intolerant:1;
204 u16 LSIGTxopProSup:1;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700205} HT_CAP_INFO, *PHT_CAP_INFO;
206
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800207/* HT Capability INFO field in HT Cap IE . */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700208typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800209 u8 MaxRAmpduFactor:2;
210 u8 MpduDensity:3;
211 u8 rsv:3; /*momi power safe */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700212} HT_CAP_PARM, *PHT_CAP_PARM;
213
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800214/* HT Capability INFO field in HT Cap IE . */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700215typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800216 u8 MCSSet[10];
217 u8 SupRate[2]; /* unit : 1Mbps */
218 u8 TxMCSSetDefined:1;
219 u8 TxRxNotEqual:1;
220 u8 TxStream:2;
221 u8 MpduDensity:1;
222 u8 rsv:3;
223 u8 rsv3[3];
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700224} HT_MCS_SET, *PHT_MCS_SET;
225
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800226/* HT Capability INFO field in HT Cap IE . */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700227typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800228 u16 Pco:1;
229 u16 TranTime:2;
230 u16 rsv:5; /*momi power safe */
231 u16 MCSFeedback:2; /*0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. */
232 u16 PlusHTC:1; /*+HTC control field support */
233 u16 RDGSupport:1; /*reverse Direction Grant support */
234 u16 rsv2:4;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700235} EXT_HT_CAP_INFO, *PEXT_HT_CAP_INFO;
236
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800237/* HT Beamforming field in HT Cap IE . */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800238typedef struct PACKED _HT_BF_CAP {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800239 unsigned long TxBFRecCapable:1;
240 unsigned long RxSoundCapable:1;
241 unsigned long TxSoundCapable:1;
242 unsigned long RxNDPCapable:1;
243 unsigned long TxNDPCapable:1;
244 unsigned long ImpTxBFCapable:1;
245 unsigned long Calibration:2;
246 unsigned long ExpCSICapable:1;
247 unsigned long ExpNoComSteerCapable:1;
248 unsigned long ExpComSteerCapable:1;
249 unsigned long ExpCSIFbk:2;
250 unsigned long ExpNoComBF:2;
251 unsigned long ExpComBF:2;
252 unsigned long MinGrouping:2;
253 unsigned long CSIBFAntSup:2;
254 unsigned long NoComSteerBFAntSup:2;
255 unsigned long ComSteerBFAntSup:2;
256 unsigned long CSIRowBFSup:2;
257 unsigned long ChanEstimation:2;
258 unsigned long rsv:3;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700259} HT_BF_CAP, *PHT_BF_CAP;
260
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800261/* HT antenna selection field in HT Cap IE . */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800262typedef struct PACKED _HT_AS_CAP {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800263 u8 AntSelect:1;
264 u8 ExpCSIFbkTxASEL:1;
265 u8 AntIndFbkTxASEL:1;
266 u8 ExpCSIFbk:1;
267 u8 AntIndFbk:1;
268 u8 RxASel:1;
269 u8 TxSoundPPDU:1;
270 u8 rsv:1;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700271} HT_AS_CAP, *PHT_AS_CAP;
272
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800273/* Draft 1.0 set IE length 26, but is extensible.. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700274#define SIZE_HT_CAP_IE 26
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800275/* The structure for HT Capability IE. */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800276typedef struct PACKED _HT_CAPABILITY_IE {
277 HT_CAP_INFO HtCapInfo;
278 HT_CAP_PARM HtCapParm;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800279/* HT_MCS_SET HtMCSSet; */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800280 u8 MCSSet[16];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800281 EXT_HT_CAP_INFO ExtHtCapInfo;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800282 HT_BF_CAP TxBFCap; /* beamforming cap. rt2860c not support beamforming. */
283 HT_AS_CAP ASCap; /*antenna selection. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700284} HT_CAPABILITY_IE, *PHT_CAPABILITY_IE;
285
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800286/* 802.11n draft3 related structure definitions. */
287/* 7.3.2.60 */
288#define dot11OBSSScanPassiveDwell 20 /* in TU. min amount of time that the STA continously scans each channel when performing an active OBSS scan. */
289#define dot11OBSSScanActiveDwell 10 /* in TU.min amount of time that the STA continously scans each channel when performing an passive OBSS scan. */
290#define dot11BSSWidthTriggerScanInterval 300 /* in sec. max interval between scan operations to be performed to detect BSS channel width trigger events. */
291#define dot11OBSSScanPassiveTotalPerChannel 200 /* in TU. min total amount of time that the STA scans each channel when performing a passive OBSS scan. */
292#define dot11OBSSScanActiveTotalPerChannel 20 /*in TU. min total amount of time that the STA scans each channel when performing a active OBSS scan */
293#define dot11BSSWidthChannelTransactionDelayFactor 5 /* min ratio between the delay time in performing a switch from 20MHz BSS to 20/40 BSS operation and the maximum */
294 /* interval between overlapping BSS scan operations. */
295#define dot11BSSScanActivityThreshold 25 /* in %%, max total time that a STA may be active on the medium during a period of */
296 /* (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without */
297 /* being obligated to perform OBSS Scan operations. default is 25(== 0.25%) */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700298
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800299typedef struct PACKED _OVERLAP_BSS_SCAN_IE {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800300 u16 ScanPassiveDwell;
301 u16 ScanActiveDwell;
302 u16 TriggerScanInt; /* Trigger scan interval */
303 u16 PassiveTalPerChannel; /* passive total per channel */
304 u16 ActiveTalPerChannel; /* active total per channel */
305 u16 DelayFactor; /* BSS width channel transition delay factor */
306 u16 ScanActThre; /* Scan Activity threshold */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800307} OVERLAP_BSS_SCAN_IE, *POVERLAP_BSS_SCAN_IE;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700308
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800309/* 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXIST */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800310typedef union PACKED _BSS_2040_COEXIST_IE {
311 struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800312 u8 InfoReq:1;
313 u8 Intolerant40:1; /* Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS. */
314 u8 BSS20WidthReq:1; /* Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS. */
315 u8 rsv:5;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800316 } field;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800317 u8 word;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700318} BSS_2040_COEXIST_IE, *PBSS_2040_COEXIST_IE;
319
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800320typedef struct _TRIGGER_EVENTA {
321 BOOLEAN bValid;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800322 u8 BSSID[6];
323 u8 RegClass; /* Regulatory Class */
324 u16 Channel;
325 unsigned long CDCounter; /* Maintain a seperate count down counter for each Event A. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700326} TRIGGER_EVENTA, *PTRIGGER_EVENTA;
327
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800328/* 20/40 trigger event table */
329/* If one Event A delete or created, or if Event B is detected or not detected, STA should send 2040BSSCoexistence to AP. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700330#define MAX_TRIGGER_EVENT 64
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800331typedef struct _TRIGGER_EVENT_TAB {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800332 u8 EventANo;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800333 TRIGGER_EVENTA EventA[MAX_TRIGGER_EVENT];
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800334 unsigned long EventBCountDown; /* Count down counter for Event B. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700335} TRIGGER_EVENT_TAB, *PTRIGGER_EVENT_TAB;
336
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800337/* 7.3.27 20/40 Bss Coexistence Mgmt capability used in extended capabilities information IE( ID = 127 = IE_EXT_CAPABILITY). */
338/* This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0 */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800339typedef struct PACKED _EXT_CAP_INFO_ELEMENT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800340 u8 BssCoexistMgmtSupport:1;
341 u8 rsv:1;
342 u8 ExtendChannelSwitch:1;
343 u8 rsv2:5;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800344} EXT_CAP_INFO_ELEMENT, *PEXT_CAP_INFO_ELEMENT;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700345
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800346/* 802.11n 7.3.2.61 */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800347typedef struct PACKED _BSS_2040_COEXIST_ELEMENT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800348 u8 ElementID; /* ID = IE_2040_BSS_COEXIST = 72 */
349 u8 Len;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800350 BSS_2040_COEXIST_IE BssCoexistIe;
351} BSS_2040_COEXIST_ELEMENT, *PBSS_2040_COEXIST_ELEMENT;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700352
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800353/*802.11n 7.3.2.59 */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800354typedef struct PACKED _BSS_2040_INTOLERANT_CH_REPORT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800355 u8 ElementID; /* ID = IE_2040_BSS_INTOLERANT_REPORT = 73 */
356 u8 Len;
357 u8 RegulatoryClass;
358 u8 ChList[0];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800359} BSS_2040_INTOLERANT_CH_REPORT, *PBSS_2040_INTOLERANT_CH_REPORT;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700360
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800361/* The structure for channel switch annoucement IE. This is in 802.11n D3.03 */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800362typedef struct PACKED _CHA_SWITCH_ANNOUNCE_IE {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800363 u8 SwitchMode; /*channel switch mode */
364 u8 NewChannel; /* */
365 u8 SwitchCount; /* */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700366} CHA_SWITCH_ANNOUNCE_IE, *PCHA_SWITCH_ANNOUNCE_IE;
367
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800368/* The structure for channel switch annoucement IE. This is in 802.11n D3.03 */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800369typedef struct PACKED _SEC_CHA_OFFSET_IE {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800370 u8 SecondaryChannelOffset; /* 1: Secondary above, 3: Secondary below, 0: no Secondary */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700371} SEC_CHA_OFFSET_IE, *PSEC_CHA_OFFSET_IE;
372
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800373/* This structure is extracted from struct RT_HT_CAPABILITY */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700374typedef struct {
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800375 BOOLEAN bHtEnable; /* If we should use ht rate. */
376 BOOLEAN bPreNHt; /* If we should use ht rate. */
377 /*Substract from HT Capability IE */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800378 u8 MCSSet[16];
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700379} RT_HT_PHY_INFO, *PRT_HT_PHY_INFO;
380
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800381/*This structure substracts ralink supports from all 802.11n-related features. */
382/*Features not listed here but contained in 802.11n spec are not supported in rt2860. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700383typedef struct {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800384 u16 ChannelWidth:1;
385 u16 MimoPs:2; /*mimo power safe MMPS_ */
386 u16 GF:1; /*green field */
387 u16 ShortGIfor20:1;
388 u16 ShortGIfor40:1; /*for40MHz */
389 u16 TxSTBC:1;
390 u16 RxSTBC:2; /* 2 bits */
391 u16 AmsduEnable:1; /* Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n */
392 u16 AmsduSize:1; /* Max receiving A-MSDU size */
393 u16 rsv:5;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700394
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800395 /*Substract from Addiont HT INFO IE */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800396 u8 MaxRAmpduFactor:2;
397 u8 MpduDensity:3;
398 u8 ExtChanOffset:2; /* Please not the difference with following u8 NewExtChannelOffset; from 802.11n */
399 u8 RecomWidth:1;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700400
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800401 u16 OperaionMode:2;
402 u16 NonGfPresent:1;
403 u16 rsv3:1;
404 u16 OBSS_NonHTExist:1;
405 u16 rsv2:11;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700406
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800407 /* New Extension Channel Offset IE */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800408 u8 NewExtChannelOffset;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800409 /* Extension Capability IE = 127 */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800410 u8 BSSCoexist2040;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700411} RT_HT_CAPABILITY, *PRT_HT_CAPABILITY;
412
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800413/* field in Addtional HT Information IE . */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700414typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800415 u8 ExtChanOffset:2;
416 u8 RecomWidth:1;
417 u8 RifsMode:1;
418 u8 S_PSMPSup:1; /*Indicate support for scheduled PSMP */
419 u8 SerInterGranu:3; /*service interval granularity */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700420} ADD_HTINFO, *PADD_HTINFO;
421
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800422typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800423 u16 OperaionMode:2;
424 u16 NonGfPresent:1;
425 u16 rsv:1;
426 u16 OBSS_NonHTExist:1;
427 u16 rsv2:11;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700428} ADD_HTINFO2, *PADD_HTINFO2;
429
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800430/* TODO: Need sync with spec about the definition of StbcMcs. In Draft 3.03, it's reserved. */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800431typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800432 u16 StbcMcs:6;
433 u16 DualBeacon:1;
434 u16 DualCTSProtect:1;
435 u16 STBCBeacon:1;
436 u16 LsigTxopProt:1; /* L-SIG TXOP protection full support */
437 u16 PcoActive:1;
438 u16 PcoPhase:1;
439 u16 rsv:4;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700440} ADD_HTINFO3, *PADD_HTINFO3;
441
442#define SIZE_ADD_HT_INFO_IE 22
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800443typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800444 u8 ControlChan;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800445 ADD_HTINFO AddHtInfo;
446 ADD_HTINFO2 AddHtInfo2;
447 ADD_HTINFO3 AddHtInfo3;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800448 u8 MCSSet[16]; /* Basic MCS set */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700449} ADD_HT_INFO_IE, *PADD_HT_INFO_IE;
450
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800451typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800452 u8 NewExtChanOffset;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700453} NEW_EXT_CHAN_IE, *PNEW_EXT_CHAN_IE;
454
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700455typedef struct PACKED _FRAME_802_11 {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800456 HEADER_802_11 Hdr;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800457 u8 Octet[1];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800458} FRAME_802_11, *PFRAME_802_11;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700459
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800460/* QoSNull embedding of management action. When HT Control MA field set to 1. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700461typedef struct PACKED _MA_BODY {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800462 u8 Category;
463 u8 Action;
464 u8 Octet[1];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800465} MA_BODY, *PMA_BODY;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700466
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800467typedef struct PACKED _HEADER_802_3 {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800468 u8 DAAddr1[MAC_ADDR_LEN];
469 u8 SAAddr2[MAC_ADDR_LEN];
470 u8 Octet[2];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800471} HEADER_802_3, *PHEADER_802_3;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800472/*//Block ACK related format */
473/* 2-byte BA Parameter field in DELBA frames to terminate an already set up bA */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800474typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800475 u16 Rsv:11; /* always set to 0 */
476 u16 Initiator:1; /* 1: originator 0:recipient */
477 u16 TID:4; /* value of TC os TS */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700478} DELBA_PARM, *PDELBA_PARM;
479
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800480/* 2-byte BA Parameter Set field in ADDBA frames to signal parm for setting up a BA */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700481typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800482 u16 AMSDUSupported:1; /* 0: not permitted 1: permitted */
483 u16 BAPolicy:1; /* 1: immediately BA 0:delayed BA */
484 u16 TID:4; /* value of TC os TS */
485 u16 BufSize:10; /* number of buffe of size 2304 octetsr */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700486} BA_PARM, *PBA_PARM;
487
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800488/* 2-byte BA Starting Seq CONTROL field */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700489typedef union PACKED {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800490 struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800491 u16 FragNum:4; /* always set to 0 */
492 u16 StartSeq:12; /* sequence number of the 1st MSDU for which this BAR is sent */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800493 } field;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800494 u16 word;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700495} BASEQ_CONTROL, *PBASEQ_CONTROL;
496
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800497/*BAControl and BARControl are the same */
498/* 2-byte BA CONTROL field in BA frame */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700499typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800500 u16 ACKPolicy:1; /* only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK */
501 u16 MTID:1; /*EWC V1.24 */
502 u16 Compressed:1;
503 u16 Rsv:9;
504 u16 TID:4;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700505} BA_CONTROL, *PBA_CONTROL;
506
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800507/* 2-byte BAR CONTROL field in BAR frame */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700508typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800509 u16 ACKPolicy:1; /* 0:normal ack, 1:no ack. */
510 u16 MTID:1; /*if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ */
511 u16 Compressed:1;
512 u16 Rsv1:9;
513 u16 TID:4;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700514} BAR_CONTROL, *PBAR_CONTROL;
515
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800516/* BARControl in MTBAR frame */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700517typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800518 u16 ACKPolicy:1;
519 u16 MTID:1;
520 u16 Compressed:1;
521 u16 Rsv1:9;
522 u16 NumTID:4;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700523} MTBAR_CONTROL, *PMTBAR_CONTROL;
524
525typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800526 u16 Rsv1:12;
527 u16 TID:4;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700528} PER_TID_INFO, *PPER_TID_INFO;
529
530typedef struct {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800531 PER_TID_INFO PerTID;
532 BASEQ_CONTROL BAStartingSeq;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700533} EACH_TID, *PEACH_TID;
534
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800535/* BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700536typedef struct PACKED _FRAME_BA_REQ {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800537 FRAME_CONTROL FC;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800538 u16 Duration;
539 u8 Addr1[MAC_ADDR_LEN];
540 u8 Addr2[MAC_ADDR_LEN];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800541 BAR_CONTROL BARControl;
542 BASEQ_CONTROL BAStartingSeq;
543} FRAME_BA_REQ, *PFRAME_BA_REQ;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700544
545typedef struct PACKED _FRAME_MTBA_REQ {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800546 FRAME_CONTROL FC;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800547 u16 Duration;
548 u8 Addr1[MAC_ADDR_LEN];
549 u8 Addr2[MAC_ADDR_LEN];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800550 MTBAR_CONTROL MTBARControl;
551 PER_TID_INFO PerTIDInfo;
552 BASEQ_CONTROL BAStartingSeq;
553} FRAME_MTBA_REQ, *PFRAME_MTBA_REQ;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700554
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800555/* Compressed format is mandantory in HT STA */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700556typedef struct PACKED _FRAME_MTBA {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800557 FRAME_CONTROL FC;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800558 u16 Duration;
559 u8 Addr1[MAC_ADDR_LEN];
560 u8 Addr2[MAC_ADDR_LEN];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800561 BA_CONTROL BAControl;
562 BASEQ_CONTROL BAStartingSeq;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800563 u8 BitMap[8];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800564} FRAME_MTBA, *PFRAME_MTBA;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700565
566typedef struct PACKED _FRAME_PSMP_ACTION {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800567 HEADER_802_11 Hdr;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800568 u8 Category;
569 u8 Action;
570 u8 Psmp; /* 7.3.1.25 */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800571} FRAME_PSMP_ACTION, *PFRAME_PSMP_ACTION;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700572
573typedef struct PACKED _FRAME_ACTION_HDR {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800574 HEADER_802_11 Hdr;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800575 u8 Category;
576 u8 Action;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800577} FRAME_ACTION_HDR, *PFRAME_ACTION_HDR;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700578
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800579/*Action Frame */
580/*Action Frame Category:Spectrum, Action:Channel Switch. 7.3.2.20 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700581typedef struct PACKED _CHAN_SWITCH_ANNOUNCE {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800582 u8 ElementID; /* ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 */
583 u8 Len;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800584 CHA_SWITCH_ANNOUNCE_IE CSAnnounceIe;
585} CHAN_SWITCH_ANNOUNCE, *PCHAN_SWITCH_ANNOUNCE;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700586
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800587/*802.11n : 7.3.2.20a */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700588typedef struct PACKED _SECOND_CHAN_OFFSET {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800589 u8 ElementID; /* ID = IE_SECONDARY_CH_OFFSET = 62 */
590 u8 Len;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800591 SEC_CHA_OFFSET_IE SecChOffsetIe;
592} SECOND_CHAN_OFFSET, *PSECOND_CHAN_OFFSET;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700593
594typedef struct PACKED _FRAME_SPETRUM_CS {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800595 HEADER_802_11 Hdr;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800596 u8 Category;
597 u8 Action;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800598 CHAN_SWITCH_ANNOUNCE CSAnnounce;
599 SECOND_CHAN_OFFSET SecondChannel;
600} FRAME_SPETRUM_CS, *PFRAME_SPETRUM_CS;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700601
602typedef struct PACKED _FRAME_ADDBA_REQ {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800603 HEADER_802_11 Hdr;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800604 u8 Category;
605 u8 Action;
606 u8 Token; /* 1 */
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800607 BA_PARM BaParm; /* 2 - 10 */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800608 u16 TimeOutValue; /* 0 - 0 */
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800609 BASEQ_CONTROL BaStartSeq; /* 0-0 */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800610} FRAME_ADDBA_REQ, *PFRAME_ADDBA_REQ;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700611
612typedef struct PACKED _FRAME_ADDBA_RSP {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800613 HEADER_802_11 Hdr;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800614 u8 Category;
615 u8 Action;
616 u8 Token;
617 u16 StatusCode;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800618 BA_PARM BaParm; /*0 - 2 */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800619 u16 TimeOutValue;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800620} FRAME_ADDBA_RSP, *PFRAME_ADDBA_RSP;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700621
622typedef struct PACKED _FRAME_DELBA_REQ {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800623 HEADER_802_11 Hdr;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800624 u8 Category;
625 u8 Action;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800626 DELBA_PARM DelbaParm;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800627 u16 ReasonCode;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800628} FRAME_DELBA_REQ, *PFRAME_DELBA_REQ;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700629
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800630/*7.2.1.7 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700631typedef struct PACKED _FRAME_BAR {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800632 FRAME_CONTROL FC;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800633 u16 Duration;
634 u8 Addr1[MAC_ADDR_LEN];
635 u8 Addr2[MAC_ADDR_LEN];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800636 BAR_CONTROL BarControl;
637 BASEQ_CONTROL StartingSeq;
638} FRAME_BAR, *PFRAME_BAR;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700639
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800640/*7.2.1.7 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700641typedef struct PACKED _FRAME_BA {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800642 FRAME_CONTROL FC;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800643 u16 Duration;
644 u8 Addr1[MAC_ADDR_LEN];
645 u8 Addr2[MAC_ADDR_LEN];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800646 BAR_CONTROL BarControl;
647 BASEQ_CONTROL StartingSeq;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800648 u8 bitmask[8];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800649} FRAME_BA, *PFRAME_BA;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700650
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800651/* Radio Measuement Request Frame Format */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700652typedef struct PACKED _FRAME_RM_REQ_ACTION {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800653 HEADER_802_11 Hdr;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800654 u8 Category;
655 u8 Action;
656 u8 Token;
657 u16 Repetition;
658 u8 data[0];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800659} FRAME_RM_REQ_ACTION, *PFRAME_RM_REQ_ACTION;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700660
661typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800662 u8 ID;
663 u8 Length;
664 u8 ChannelSwitchMode;
665 u8 NewRegClass;
666 u8 NewChannelNum;
667 u8 ChannelSwitchCount;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800668} HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE,
669 *PHT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700670
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800671/* */
672/* _Limit must be the 2**n - 1 */
673/* _SEQ1 , _SEQ2 must be within 0 ~ _Limit */
674/* */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700675#define SEQ_STEPONE(_SEQ1, _SEQ2, _Limit) ((_SEQ1 == ((_SEQ2+1) & _Limit)))
676#define SEQ_SMALLER(_SEQ1, _SEQ2, _Limit) (((_SEQ1-_SEQ2) & ((_Limit+1)>>1)))
677#define SEQ_LARGER(_SEQ1, _SEQ2, _Limit) ((_SEQ1 != _SEQ2) && !(((_SEQ1-_SEQ2) & ((_Limit+1)>>1))))
678#define SEQ_WITHIN_WIN(_SEQ1, _SEQ2, _WIN, _Limit) (SEQ_LARGER(_SEQ1, _SEQ2, _Limit) && \
679 SEQ_SMALLER(_SEQ1, ((_SEQ2+_WIN+1)&_Limit), _Limit))
680
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800681/* */
682/* Contention-free parameter (without ID and Length) */
683/* */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700684typedef struct PACKED {
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800685 BOOLEAN bValid; /* 1: variable contains valid value */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800686 u8 CfpCount;
687 u8 CfpPeriod;
688 u16 CfpMaxDuration;
689 u16 CfpDurRemaining;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700690} CF_PARM, *PCF_PARM;
691
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800692typedef struct _CIPHER_SUITE {
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800693 NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher 1, this one has more secured cipher suite */
694 NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; /* Unicast cipher 2 if AP announce two unicast cipher suite */
695 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Group cipher */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800696 u16 RsnCapability; /* RSN capability from beacon */
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800697 BOOLEAN bMixMode; /* Indicate Pair & Group cipher might be different */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800698} CIPHER_SUITE, *PCIPHER_SUITE;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700699
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800700/* EDCA configuration from AP's BEACON/ProbeRsp */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700701typedef struct {
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800702 BOOLEAN bValid; /* 1: variable contains valid value */
703 BOOLEAN bAdd; /* 1: variable contains valid value */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800704 BOOLEAN bQAck;
705 BOOLEAN bQueueRequest;
706 BOOLEAN bTxopRequest;
707 BOOLEAN bAPSDCapable;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800708/* BOOLEAN bMoreDataAck; */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800709 u8 EdcaUpdateCount;
710 u8 Aifsn[4]; /* 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO */
711 u8 Cwmin[4];
712 u8 Cwmax[4];
713 u16 Txop[4]; /* in unit of 32-us */
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800714 BOOLEAN bACM[4]; /* 1: Admission Control of AC_BK is mandattory */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700715} EDCA_PARM, *PEDCA_PARM;
716
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800717/* QBSS LOAD information from QAP's BEACON/ProbeRsp */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700718typedef struct {
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800719 BOOLEAN bValid; /* 1: variable contains valid value */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800720 u16 StaNum;
721 u8 ChannelUtilization;
722 u16 RemainingAdmissionControl; /* in unit of 32-us */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700723} QBSS_LOAD_PARM, *PQBSS_LOAD_PARM;
724
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800725/* QBSS Info field in QSTA's assoc req */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700726typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800727 u8 UAPSD_AC_VO:1;
728 u8 UAPSD_AC_VI:1;
729 u8 UAPSD_AC_BK:1;
730 u8 UAPSD_AC_BE:1;
731 u8 Rsv1:1;
732 u8 MaxSPLength:2;
733 u8 Rsv2:1;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700734} QBSS_STA_INFO_PARM, *PQBSS_STA_INFO_PARM;
735
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800736/* QBSS Info field in QAP's Beacon/ProbeRsp */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700737typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800738 u8 ParamSetCount:4;
739 u8 Rsv:3;
740 u8 UAPSD:1;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700741} QBSS_AP_INFO_PARM, *PQBSS_AP_INFO_PARM;
742
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800743/* QOS Capability reported in QAP's BEACON/ProbeRsp */
744/* QOS Capability sent out in QSTA's AssociateReq/ReAssociateReq */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700745typedef struct {
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800746 BOOLEAN bValid; /* 1: variable contains valid value */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800747 BOOLEAN bQAck;
748 BOOLEAN bQueueRequest;
749 BOOLEAN bTxopRequest;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800750/* BOOLEAN bMoreDataAck; */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800751 u8 EdcaUpdateCount;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700752} QOS_CAPABILITY_PARM, *PQOS_CAPABILITY_PARM;
753
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700754typedef struct {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800755 u8 IELen;
756 u8 IE[MAX_CUSTOM_LEN];
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700757} WPA_IE_;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700758
759typedef struct {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800760 u8 Bssid[MAC_ADDR_LEN];
761 u8 Channel;
762 u8 CentralChannel; /*Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel. */
763 u8 BssType;
764 u16 AtimWin;
765 u16 BeaconPeriod;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700766
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800767 u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES];
768 u8 SupRateLen;
769 u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
770 u8 ExtRateLen;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700771 HT_CAPABILITY_IE HtCapability;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800772 u8 HtCapabilityLen;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800773 ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800774 u8 AddHtInfoLen;
775 u8 NewExtChanOffset;
776 char Rssi;
777 u8 Privacy; /* Indicate security function ON/OFF. Don't mess up with auth mode. */
778 u8 Hidden;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700779
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800780 u16 DtimPeriod;
781 u16 CapabilityInfo;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700782
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800783 u16 CfpCount;
784 u16 CfpPeriod;
785 u16 CfpMaxDuration;
786 u16 CfpDurRemaining;
787 u8 SsidLen;
788 char Ssid[MAX_LEN_OF_SSID];
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700789
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800790 unsigned long LastBeaconRxTime; /* OS's timestamp */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700791
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800792 BOOLEAN bSES;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700793
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800794 /* New for WPA2 */
795 CIPHER_SUITE WPA; /* AP announced WPA cipher suite */
796 CIPHER_SUITE WPA2; /* AP announced WPA2 cipher suite */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700797
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800798 /* New for microsoft WPA support */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800799 NDIS_802_11_FIXED_IEs FixIEs;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800800 NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; /* Addition mode for WPA2 / WPA capable AP */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800801 NDIS_802_11_AUTHENTICATION_MODE AuthMode;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800802 NDIS_802_11_WEP_STATUS WepStatus; /* Unicast Encryption Algorithm extract from VAR_IE */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800803 u16 VarIELen; /* Length of next VIE include EID & Length */
804 u8 VarIEs[MAX_VIE_LEN];
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700805
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800806 /* CCX Ckip information */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800807 u8 CkipFlag;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700808
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800809 /* CCX 2 TSF */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800810 u8 PTSF[4]; /* Parent TSF */
811 u8 TTSF[8]; /* Target TSF */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700812
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800813 /* 802.11e d9, and WMM */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800814 EDCA_PARM EdcaParm;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700815 QOS_CAPABILITY_PARM QosCapability;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800816 QBSS_LOAD_PARM QbssLoad;
817 WPA_IE_ WpaIE;
818 WPA_IE_ RsnIE;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700819} BSS_ENTRY, *PBSS_ENTRY;
820
821typedef struct {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800822 u8 BssNr;
823 u8 BssOverlapNr;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800824 BSS_ENTRY BssEntry[MAX_LEN_OF_BSS_TABLE];
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700825} BSS_TABLE, *PBSS_TABLE;
826
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700827typedef struct _MLME_QUEUE_ELEM {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800828 unsigned long Machine;
829 unsigned long MsgType;
830 unsigned long MsgLen;
831 u8 Msg[MGMT_DMA_BUFFER_SIZE];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800832 LARGE_INTEGER TimeStamp;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800833 u8 Rssi0;
834 u8 Rssi1;
835 u8 Rssi2;
836 u8 Signal;
837 u8 Channel;
838 u8 Wcid;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800839 BOOLEAN Occupied;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700840} MLME_QUEUE_ELEM, *PMLME_QUEUE_ELEM;
841
842typedef struct _MLME_QUEUE {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800843 unsigned long Num;
844 unsigned long Head;
845 unsigned long Tail;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800846 NDIS_SPIN_LOCK Lock;
847 MLME_QUEUE_ELEM Entry[MAX_LEN_OF_MLME_QUEUE];
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700848} MLME_QUEUE, *PMLME_QUEUE;
849
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800850typedef void(*STATE_MACHINE_FUNC) (void * Adaptor, MLME_QUEUE_ELEM * Elem);
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700851
852typedef struct _STATE_MACHINE {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800853 unsigned long Base;
854 unsigned long NrState;
855 unsigned long NrMsg;
856 unsigned long CurrState;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800857 STATE_MACHINE_FUNC *TransFunc;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700858} STATE_MACHINE, *PSTATE_MACHINE;
859
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800860/* MLME AUX data structure that hold temporarliy settings during a connection attempt. */
861/* Once this attemp succeeds, all settings will be copy to pAd->StaActive. */
862/* A connection attempt (user set OID, roaming, CCX fast roaming,..) consists of */
863/* several steps (JOIN, AUTH, ASSOC or REASSOC) and may fail at any step. We purposely */
864/* separate this under-trial settings away from pAd->StaActive so that once */
865/* this new attempt failed, driver can auto-recover back to the active settings. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700866typedef struct _MLME_AUX {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800867 u8 BssType;
868 u8 Ssid[MAX_LEN_OF_SSID];
869 u8 SsidLen;
870 u8 Bssid[MAC_ADDR_LEN];
871 u8 AutoReconnectSsid[MAX_LEN_OF_SSID];
872 u8 AutoReconnectSsidLen;
873 u16 Alg;
874 u8 ScanType;
875 u8 Channel;
876 u8 CentralChannel;
877 u16 Aid;
878 u16 CapabilityInfo;
879 u16 BeaconPeriod;
880 u16 CfpMaxDuration;
881 u16 CfpPeriod;
882 u16 AtimWin;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700883
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800884 /* Copy supported rate from desired AP's beacon. We are trying to match */
885 /* AP's supported and extended rate settings. */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800886 u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES];
887 u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
888 u8 SupRateLen;
889 u8 ExtRateLen;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800890 HT_CAPABILITY_IE HtCapability;
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800891 u8 HtCapabilityLen;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800892 ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800893 u8 NewExtChannelOffset;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800894 /*RT_HT_CAPABILITY SupportedHtPhy; */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700895
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800896 /* new for QOS */
897 QOS_CAPABILITY_PARM APQosCapability; /* QOS capability of the current associated AP */
898 EDCA_PARM APEdcaParm; /* EDCA parameters of the current associated AP */
899 QBSS_LOAD_PARM APQbssLoad; /* QBSS load of the current associated AP */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700900
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800901 /* new to keep Ralink specific feature */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800902 unsigned long APRalinkIe;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700903
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800904 BSS_TABLE SsidBssTab; /* AP list for the same SSID */
905 BSS_TABLE RoamTab; /* AP list eligible for roaming */
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800906 unsigned long BssIdx;
907 unsigned long RoamIdx;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700908
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800909 BOOLEAN CurrReqIsFromNdis;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700910
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800911 RALINK_TIMER_STRUCT BeaconTimer, ScanTimer;
912 RALINK_TIMER_STRUCT AuthTimer;
913 RALINK_TIMER_STRUCT AssocTimer, ReassocTimer, DisassocTimer;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700914} MLME_AUX, *PMLME_AUX;
915
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800916typedef struct _MLME_ADDBA_REQ_STRUCT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800917 u8 Wcid; /* */
918 u8 pAddr[MAC_ADDR_LEN];
919 u8 BaBufSize;
920 u16 TimeOutValue;
921 u8 TID;
922 u8 Token;
923 u16 BaStartSeq;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700924} MLME_ADDBA_REQ_STRUCT, *PMLME_ADDBA_REQ_STRUCT;
925
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800926typedef struct _MLME_DELBA_REQ_STRUCT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800927 u8 Wcid; /* */
928 u8 Addr[MAC_ADDR_LEN];
929 u8 TID;
930 u8 Initiator;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700931} MLME_DELBA_REQ_STRUCT, *PMLME_DELBA_REQ_STRUCT;
932
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800933/* assoc struct is equal to reassoc */
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800934typedef struct _MLME_ASSOC_REQ_STRUCT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800935 u8 Addr[MAC_ADDR_LEN];
936 u16 CapabilityInfo;
937 u16 ListenIntv;
938 unsigned long Timeout;
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800939} MLME_ASSOC_REQ_STRUCT, *PMLME_ASSOC_REQ_STRUCT, MLME_REASSOC_REQ_STRUCT,
940 *PMLME_REASSOC_REQ_STRUCT;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700941
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800942typedef struct _MLME_DISASSOC_REQ_STRUCT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800943 u8 Addr[MAC_ADDR_LEN];
944 u16 Reason;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700945} MLME_DISASSOC_REQ_STRUCT, *PMLME_DISASSOC_REQ_STRUCT;
946
947typedef struct _MLME_AUTH_REQ_STRUCT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800948 u8 Addr[MAC_ADDR_LEN];
949 u16 Alg;
950 unsigned long Timeout;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700951} MLME_AUTH_REQ_STRUCT, *PMLME_AUTH_REQ_STRUCT;
952
953typedef struct _MLME_DEAUTH_REQ_STRUCT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800954 u8 Addr[MAC_ADDR_LEN];
955 u16 Reason;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700956} MLME_DEAUTH_REQ_STRUCT, *PMLME_DEAUTH_REQ_STRUCT;
957
958typedef struct {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800959 unsigned long BssIdx;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700960} MLME_JOIN_REQ_STRUCT;
961
962typedef struct _MLME_SCAN_REQ_STRUCT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800963 u8 Bssid[MAC_ADDR_LEN];
964 u8 BssType;
965 u8 ScanType;
966 u8 SsidLen;
967 char Ssid[MAX_LEN_OF_SSID];
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700968} MLME_SCAN_REQ_STRUCT, *PMLME_SCAN_REQ_STRUCT;
969
970typedef struct _MLME_START_REQ_STRUCT {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800971 char Ssid[MAX_LEN_OF_SSID];
972 u8 SsidLen;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700973} MLME_START_REQ_STRUCT, *PMLME_START_REQ_STRUCT;
974
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700975typedef struct PACKED {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800976 u8 Eid;
977 u8 Len;
978 u8 Octet[1];
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800979} EID_STRUCT, *PEID_STRUCT, BEACON_EID_STRUCT, *PBEACON_EID_STRUCT;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700980
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -0800981typedef struct PACKED _RTMP_TX_RATE_SWITCH {
Bartlomiej Zolnierkiewicz51126de2009-12-11 12:23:15 -0800982 u8 ItemNo;
983 u8 STBC:1;
984 u8 ShortGI:1;
985 u8 BW:1;
986 u8 Rsv1:1;
987 u8 Mode:2;
988 u8 Rsv2:2;
989 u8 CurrMCS;
990 u8 TrainUp;
991 u8 TrainDown;
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700992} RRTMP_TX_RATE_SWITCH, *PRTMP_TX_RATE_SWITCH;
993
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800994/* ========================== AP mlme.h =============================== */
995#define TBTT_PRELOAD_TIME 384 /* usec. LomgPreamble + 24-byte at 1Mbps */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -0700996#define DEFAULT_DTIM_PERIOD 1
997
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -0800998#define MAC_TABLE_AGEOUT_TIME 300 /* unit: sec */
999#define MAC_TABLE_ASSOC_TIMEOUT 5 /* unit: sec */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001000#define MAC_TABLE_FULL(Tab) ((Tab).size == MAX_LEN_OF_MAC_TABLE)
1001
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001002/* AP shall drop the sta if contine Tx fail count reach it. */
1003#define MAC_ENTRY_LIFE_CHECK_CNT 20 /* packet cnt. */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001004
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001005/* Value domain of pMacEntry->Sst */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001006typedef enum _Sst {
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001007 SST_NOT_AUTH, /* 0: equivalent to IEEE 802.11/1999 state 1 */
1008 SST_AUTH, /* 1: equivalent to IEEE 802.11/1999 state 2 */
1009 SST_ASSOC /* 2: equivalent to IEEE 802.11/1999 state 3 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001010} SST;
1011
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001012/* value domain of pMacEntry->AuthState */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001013typedef enum _AuthState {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -08001014 AS_NOT_AUTH,
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001015 AS_AUTH_OPEN, /* STA has been authenticated using OPEN SYSTEM */
1016 AS_AUTH_KEY, /* STA has been authenticated using SHARED KEY */
1017 AS_AUTHENTICATING /* STA is waiting for AUTH seq#3 using SHARED KEY */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001018} AUTH_STATE;
1019
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001020/*for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001021typedef enum _ApWpaState {
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001022 AS_NOTUSE, /* 0 */
1023 AS_DISCONNECT, /* 1 */
1024 AS_DISCONNECTED, /* 2 */
1025 AS_INITIALIZE, /* 3 */
1026 AS_AUTHENTICATION, /* 4 */
1027 AS_AUTHENTICATION2, /* 5 */
1028 AS_INITPMK, /* 6 */
1029 AS_INITPSK, /* 7 */
1030 AS_PTKSTART, /* 8 */
1031 AS_PTKINIT_NEGOTIATING, /* 9 */
1032 AS_PTKINITDONE, /* 10 */
1033 AS_UPDATEKEYS, /* 11 */
1034 AS_INTEGRITY_FAILURE, /* 12 */
1035 AS_KEYUPDATE, /* 13 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001036} AP_WPA_STATE;
1037
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001038/* for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001039typedef enum _GTKState {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -08001040 REKEY_NEGOTIATING,
1041 REKEY_ESTABLISHED,
1042 KEYERROR,
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001043} GTK_STATE;
1044
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001045/* for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001046typedef enum _WpaGTKState {
Bartlomiej Zolnierkiewicz52b81c82009-12-11 12:23:14 -08001047 SETKEYS,
1048 SETKEYS_DONE,
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001049} WPA_GTK_STATE;
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001050/* ====================== end of AP mlme.h ============================ */
Greg Kroah-Hartman91980992008-10-28 14:48:09 -07001051
Bartlomiej Zolnierkiewiczcc277062009-12-11 12:23:15 -08001052#endif /* MLME_H__ */