Fix common misspellings
[linux-2.6-block.git] / drivers / staging / rt2860 / mlme.h
CommitLineData
91980990
GKH
1/*
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
f751ffab 34 -------- ---------- ------------------------------
6ccb5d7c
JM
35 John Chang 2003-08-28 Created
36 John Chang 2004-09-06 modified for RT2600
37 Justin P. Mattock 11/07/2010 Fix typos in comments
91980990
GKH
38
39*/
40#ifndef __MLME_H__
41#define __MLME_H__
42
ca97b838
BZ
43#include "rtmp_dot11.h"
44
6ccb5d7c 45/* maximum supported capability information */
cc277069 46/* ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot */
91980990
GKH
47#define SUPPORTED_CAPABILITY_INFO 0x0533
48
49#define END_OF_ARGS -1
50#define LFSR_MASK 0x80000057
cc277069 51#define MLME_TASK_EXEC_INTV 100/*200*/ /* */
91980990 52#define LEAD_TIME 5
cc277069 53#define MLME_TASK_EXEC_MULTIPLE 10 /*5*/ /* MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec */
f751ffab 54#define REORDER_EXEC_INTV 100 /* 0.1 sec */
91980990 55
cc277069 56/* The definition of Radar detection duration region */
91980990
GKH
57#define CE 0
58#define FCC 1
59#define JAP 2
60#define JAP_W53 3
61#define JAP_W56 4
62#define MAX_RD_REGION 5
63
f751ffab 64#define BEACON_LOST_TIME (4 * OS_HZ) /* 2048 msec = 2 sec */
cc277069
BZ
65
66#define DLS_TIMEOUT 1200 /* unit: msec */
67#define AUTH_TIMEOUT 300 /* unit: msec */
68#define ASSOC_TIMEOUT 300 /* unit: msec */
69#define JOIN_TIMEOUT 2000 /* unit: msec */
70#define SHORT_CHANNEL_TIME 90 /* unit: msec */
71#define MIN_CHANNEL_TIME 110 /* unit: msec, for dual band scan */
72#define MAX_CHANNEL_TIME 140 /* unit: msec, for single band scan */
73#define FAST_ACTIVE_SCAN_TIME 30 /* Active scan waiting for probe response time */
74#define CW_MIN_IN_BITS 4 /* actual CwMin = 2^CW_MIN_IN_BITS - 1 */
75#define LINK_DOWN_TIMEOUT 20000 /* unit: msec */
76#define AUTO_WAKEUP_TIMEOUT 70 /*unit: msec */
77
78#define CW_MAX_IN_BITS 10 /* actual CwMax = 2^CW_MAX_IN_BITS - 1 */
79
80/* Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720). */
6ccb5d7c 81/* Should not refer to this constant anymore */
cc277069
BZ
82/*#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm */
83#define RSSI_FOR_MID_TX_POWER -55 /* -55 db is considered mid-distance */
84#define RSSI_FOR_LOW_TX_POWER -45 /* -45 db is considered very short distance and */
85 /* eligible to use a lower TX power */
91980990 86#define RSSI_FOR_LOWEST_TX_POWER -30
cc277069
BZ
87/*#define MID_TX_POWER_DELTA 0 // 0 db from full TX power upon mid-distance to AP */
88#define LOW_TX_POWER_DELTA 6 /* -3 db from full TX power upon very short distance. 1 grade is 0.5 db */
89#define LOWEST_TX_POWER_DELTA 16 /* -8 db from full TX power upon shortest distance. 1 grade is 0.5 db */
91980990
GKH
90
91#define RSSI_TRIGGERED_UPON_BELOW_THRESHOLD 0
92#define RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD 1
93#define RSSI_THRESHOLD_FOR_ROAMING 25
94#define RSSI_DELTA 5
95
cc277069 96/* Channel Quality Indication */
91980990 97#define CQI_IS_GOOD(cqi) ((cqi) >= 50)
cc277069
BZ
98/*#define CQI_IS_FAIR(cqi) (((cqi) >= 20) && ((cqi) < 50)) */
99#define CQI_IS_POOR(cqi) (cqi < 50) /*(((cqi) >= 5) && ((cqi) < 20)) */
91980990
GKH
100#define CQI_IS_BAD(cqi) (cqi < 5)
101#define CQI_IS_DEAD(cqi) (cqi == 0)
102
cc277069 103/* weighting factor to calculate Channel quality, total should be 100% */
91980990
GKH
104#define RSSI_WEIGHTING 50
105#define TX_WEIGHTING 30
106#define RX_WEIGHTING 20
107
108#define BSS_NOT_FOUND 0xFFFFFFFF
109
cc277069 110#define MAX_LEN_OF_MLME_QUEUE 40 /*10 */
91980990 111
cc277069
BZ
112#define SCAN_PASSIVE 18 /* scan with no probe request, only wait beacon and probe response */
113#define SCAN_ACTIVE 19 /* scan with probe request, and wait beacon and probe response */
114#define SCAN_CISCO_PASSIVE 20 /* Single channel passive scan */
115#define SCAN_CISCO_ACTIVE 21 /* Single channel active scan */
116#define SCAN_CISCO_NOISE 22 /* Single channel passive scan for noise histogram collection */
117#define SCAN_CISCO_CHANNEL_LOAD 23 /* Single channel passive scan for channel load collection */
118#define FAST_SCAN_ACTIVE 24 /* scan with probe request, and wait beacon and probe response */
91980990 119
91980990
GKH
120#define MAC_ADDR_IS_GROUP(Addr) (((Addr[0]) & 0x01))
121#define MAC_ADDR_HASH(Addr) (Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])
122#define MAC_ADDR_HASH_INDEX(Addr) (MAC_ADDR_HASH(Addr) % HASH_TABLE_SIZE)
f751ffab
N
123#define TID_MAC_HASH(Addr, TID) (TID^Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])
124#define TID_MAC_HASH_INDEX(Addr, TID) (TID_MAC_HASH(Addr, TID) % HASH_TABLE_SIZE)
91980990 125
cc277069 126/* LED Control */
6ccb5d7c 127/* association ON. one LED ON. another blinking when TX, OFF when idle */
cc277069 128/* no association, both LED off */
91980990
GKH
129#define ASIC_LED_ACT_ON(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00031e46)
130#define ASIC_LED_ACT_OFF(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00001e46)
131
cc277069 132/* bit definition of the 2-byte pBEACON->Capability field */
91980990
GKH
133#define CAP_IS_ESS_ON(x) (((x) & 0x0001) != 0)
134#define CAP_IS_IBSS_ON(x) (((x) & 0x0002) != 0)
135#define CAP_IS_CF_POLLABLE_ON(x) (((x) & 0x0004) != 0)
136#define CAP_IS_CF_POLL_REQ_ON(x) (((x) & 0x0008) != 0)
137#define CAP_IS_PRIVACY_ON(x) (((x) & 0x0010) != 0)
138#define CAP_IS_SHORT_PREAMBLE_ON(x) (((x) & 0x0020) != 0)
139#define CAP_IS_PBCC_ON(x) (((x) & 0x0040) != 0)
140#define CAP_IS_AGILITY_ON(x) (((x) & 0x0080) != 0)
cc277069
BZ
141#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) /* 802.11e d9 */
142#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) /* 802.11e d9 */
91980990 143#define CAP_IS_SHORT_SLOT(x) (((x) & 0x0400) != 0)
cc277069
BZ
144#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) /* 802.11e d9 */
145#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) /* 802.11e d9 */
91980990 146#define CAP_IS_DSSS_OFDM(x) (((x) & 0x2000) != 0)
cc277069 147#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) /* 802.11e d9 */
91980990 148
f751ffab 149#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))
91980990 150
cc277069
BZ
151#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) /* 802.11g */
152#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) /* 802.11g */
153#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) /* 802.11g */
91980990 154
cc277069 155#define DRS_TX_QUALITY_WORST_BOUND 8 /* 3 // just test by gary */
91980990
GKH
156#define DRS_PENALTY 8
157
f751ffab 158#define BA_NOTUSE 2
cc277069 159/*BA Policy subfiled value in ADDBA frame */
f751ffab 160#define IMMED_BA 1
91980990
GKH
161#define DELAY_BA 0
162
cc277069 163/* BA Initiator subfield in DELBA frame */
91980990
GKH
164#define ORIGINATOR 1
165#define RECIPIENT 0
166
cc277069 167/* ADDBA Status Code */
91980990
GKH
168#define ADDBA_RESULTCODE_SUCCESS 0
169#define ADDBA_RESULTCODE_REFUSED 37
170#define ADDBA_RESULTCODE_INVALID_PARAMETERS 38
171
cc277069 172/* DELBA Reason Code */
91980990
GKH
173#define DELBA_REASONCODE_QSTA_LEAVING 36
174#define DELBA_REASONCODE_END_BA 37
175#define DELBA_REASONCODE_UNKNOWN_BA 38
176#define DELBA_REASONCODE_TIMEOUT 39
177
cc277069 178/* reset all OneSecTx counters */
91980990 179#define RESET_ONE_SEC_TX_CNT(__pEntry) \
f751ffab 180if (((__pEntry)) != NULL) { \
91980990
GKH
181 (__pEntry)->OneSecTxRetryOkCount = 0; \
182 (__pEntry)->OneSecTxFailCount = 0; \
183 (__pEntry)->OneSecTxNoRetryOkCount = 0; \
184}
185
cc277069
BZ
186/* */
187/* 802.11 frame formats */
188/* */
189/* HT Capability INFO field in HT Cap IE . */
62eb734b 190struct PACKED rt_ht_cap_info {
51126deb
BZ
191 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;
62eb734b 205};
91980990 206
cc277069 207/* HT Capability INFO field in HT Cap IE . */
62eb734b 208struct PACKED rt_ht_cap_parm {
51126deb
BZ
209 u8 MaxRAmpduFactor:2;
210 u8 MpduDensity:3;
211 u8 rsv:3; /*momi power safe */
62eb734b 212};
91980990 213
cc277069 214/* HT Capability INFO field in HT Cap IE . */
62eb734b 215struct PACKED rt_ht_mcs_set {
51126deb
BZ
216 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];
62eb734b 224};
91980990 225
cc277069 226/* HT Capability INFO field in HT Cap IE . */
62eb734b 227struct PACKED rt_ext_ht_cap_info {
51126deb
BZ
228 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;
62eb734b 235};
91980990 236
cc277069 237/* HT Beamforming field in HT Cap IE . */
62eb734b 238struct PACKED rt_ht_bf_cap {
51126deb
BZ
239 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;
62eb734b 259};
91980990 260
cc277069 261/* HT antenna selection field in HT Cap IE . */
62eb734b 262struct PACKED rt_ht_as_cap {
51126deb
BZ
263 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;
62eb734b 271};
91980990 272
cc277069 273/* Draft 1.0 set IE length 26, but is extensible.. */
91980990 274#define SIZE_HT_CAP_IE 26
cc277069 275/* The structure for HT Capability IE. */
62eb734b
BZ
276struct PACKED rt_ht_capability_ie {
277 struct rt_ht_cap_info HtCapInfo;
278 struct rt_ht_cap_parm HtCapParm;
279/* struct rt_ht_mcs_set HtMCSSet; */
51126deb 280 u8 MCSSet[16];
62eb734b
BZ
281 struct rt_ext_ht_cap_info ExtHtCapInfo;
282 struct rt_ht_bf_cap TxBFCap; /* beamforming cap. rt2860c not support beamforming. */
283 struct rt_ht_as_cap ASCap; /*antenna selection. */
284};
91980990 285
cc277069
BZ
286/* 802.11n draft3 related structure definitions. */
287/* 7.3.2.60 */
6ccb5d7c
JM
288#define dot11OBSSScanPassiveDwell 20 /* in TU. min amount of time that the STA continuously scans each channel when performing an active OBSS scan. */
289#define dot11OBSSScanActiveDwell 10 /* in TU.min amount of time that the STA continuously scans each channel when performing an passive OBSS scan. */
cc277069
BZ
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%) */
52b81c89 298
62eb734b 299struct PACKED rt_overlap_bss_scan_ie {
51126deb
BZ
300 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 */
62eb734b 307};
91980990 308
cc277069 309/* 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXIST */
52b81c89
BZ
310typedef union PACKED _BSS_2040_COEXIST_IE {
311 struct PACKED {
51126deb
BZ
312 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;
52b81c89 316 } field;
51126deb 317 u8 word;
91980990
GKH
318} BSS_2040_COEXIST_IE, *PBSS_2040_COEXIST_IE;
319
62eb734b 320struct rt_trigger_eventa {
52b81c89 321 BOOLEAN bValid;
51126deb
BZ
322 u8 BSSID[6];
323 u8 RegClass; /* Regulatory Class */
324 u16 Channel;
935e99fb 325 unsigned long CDCounter; /* Maintain a separate count down counter for each Event A. */
62eb734b 326};
91980990 327
cc277069 328/* 20/40 trigger event table */
6ccb5d7c 329/* If one Event (A) is deleted or created, or if Event (B) is detected or not detected, STA should send 2040BSSCoexistence to AP. */
91980990 330#define MAX_TRIGGER_EVENT 64
62eb734b 331struct rt_trigger_event_tab {
51126deb 332 u8 EventANo;
62eb734b 333 struct rt_trigger_eventa EventA[MAX_TRIGGER_EVENT];
51126deb 334 unsigned long EventBCountDown; /* Count down counter for Event B. */
62eb734b 335};
91980990 336
cc277069
BZ
337/* 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 */
62eb734b 339struct PACKED rt_ext_cap_info_element {
51126deb
BZ
340 u8 BssCoexistMgmtSupport:1;
341 u8 rsv:1;
342 u8 ExtendChannelSwitch:1;
343 u8 rsv2:5;
62eb734b 344};
91980990 345
cc277069 346/* 802.11n 7.3.2.61 */
62eb734b 347struct PACKED rt_bss_2040_coexist_element {
51126deb
BZ
348 u8 ElementID; /* ID = IE_2040_BSS_COEXIST = 72 */
349 u8 Len;
52b81c89 350 BSS_2040_COEXIST_IE BssCoexistIe;
62eb734b 351};
91980990 352
cc277069 353/*802.11n 7.3.2.59 */
62eb734b 354struct PACKED rt_bss_2040_intolerant_ch_report {
51126deb
BZ
355 u8 ElementID; /* ID = IE_2040_BSS_INTOLERANT_REPORT = 73 */
356 u8 Len;
357 u8 RegulatoryClass;
358 u8 ChList[0];
62eb734b 359};
91980990 360
6ccb5d7c 361/* The structure for channel switch announcement IE. This is in 802.11n D3.03 */
62eb734b 362struct PACKED rt_cha_switch_announce_ie {
51126deb
BZ
363 u8 SwitchMode; /*channel switch mode */
364 u8 NewChannel; /* */
365 u8 SwitchCount; /* */
62eb734b 366};
91980990 367
6ccb5d7c 368/* The structure for channel switch announcement IE. This is in 802.11n D3.03 */
62eb734b 369struct PACKED rt_sec_cha_offset_ie {
51126deb 370 u8 SecondaryChannelOffset; /* 1: Secondary above, 3: Secondary below, 0: no Secondary */
62eb734b 371};
91980990 372
62eb734b
BZ
373/* This structure is extracted from struct struct rt_ht_capability */
374struct rt_ht_phy_info {
cc277069
BZ
375 BOOLEAN bHtEnable; /* If we should use ht rate. */
376 BOOLEAN bPreNHt; /* If we should use ht rate. */
25985edc 377 /*Subtract from HT Capability IE */
51126deb 378 u8 MCSSet[16];
62eb734b 379};
91980990 380
6ccb5d7c 381/*This structure subtracts ralink supports from all 802.11n-related features. */
cc277069 382/*Features not listed here but contained in 802.11n spec are not supported in rt2860. */
62eb734b 383struct rt_ht_capability {
51126deb
BZ
384 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 */
6ccb5d7c 391 u16 AmsduEnable:1; /* Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benefit of 802.11n */
51126deb
BZ
392 u16 AmsduSize:1; /* Max receiving A-MSDU size */
393 u16 rsv:5;
91980990 394
25985edc 395 /*Subtract from Addiont HT INFO IE */
51126deb
BZ
396 u8 MaxRAmpduFactor:2;
397 u8 MpduDensity:3;
6ccb5d7c 398 u8 ExtChanOffset:2; /* Please note the difference with following u8 NewExtChannelOffset; from 802.11n */
51126deb 399 u8 RecomWidth:1;
91980990 400
51126deb
BZ
401 u16 OperaionMode:2;
402 u16 NonGfPresent:1;
403 u16 rsv3:1;
404 u16 OBSS_NonHTExist:1;
405 u16 rsv2:11;
91980990 406
cc277069 407 /* New Extension Channel Offset IE */
51126deb 408 u8 NewExtChannelOffset;
cc277069 409 /* Extension Capability IE = 127 */
51126deb 410 u8 BSSCoexist2040;
62eb734b 411};
91980990 412
25985edc 413/* field in Additional HT Information IE . */
62eb734b 414struct PACKED rt_add_htinfo {
51126deb
BZ
415 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 */
62eb734b 420};
91980990 421
62eb734b 422struct PACKED rt_add_htinfo2 {
51126deb
BZ
423 u16 OperaionMode:2;
424 u16 NonGfPresent:1;
425 u16 rsv:1;
426 u16 OBSS_NonHTExist:1;
427 u16 rsv2:11;
62eb734b 428};
91980990 429
cc277069 430/* TODO: Need sync with spec about the definition of StbcMcs. In Draft 3.03, it's reserved. */
62eb734b 431struct PACKED rt_add_htinfo3 {
51126deb
BZ
432 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;
62eb734b 440};
91980990
GKH
441
442#define SIZE_ADD_HT_INFO_IE 22
62eb734b 443struct PACKED rt_add_ht_info_ie {
51126deb 444 u8 ControlChan;
62eb734b
BZ
445 struct rt_add_htinfo AddHtInfo;
446 struct rt_add_htinfo2 AddHtInfo2;
447 struct rt_add_htinfo3 AddHtInfo3;
51126deb 448 u8 MCSSet[16]; /* Basic MCS set */
62eb734b 449};
91980990 450
62eb734b 451struct PACKED rt_new_ext_chan_ie {
51126deb 452 u8 NewExtChanOffset;
62eb734b 453};
91980990 454
62eb734b
BZ
455struct PACKED rt_frame_802_11 {
456 struct rt_header_802_11 Hdr;
51126deb 457 u8 Octet[1];
62eb734b 458};
91980990 459
cc277069 460/* QoSNull embedding of management action. When HT Control MA field set to 1. */
62eb734b 461struct PACKED rt_ma_body {
51126deb
BZ
462 u8 Category;
463 u8 Action;
464 u8 Octet[1];
62eb734b 465};
52b81c89 466
62eb734b 467struct PACKED rt_header_802_3 {
51126deb
BZ
468 u8 DAAddr1[MAC_ADDR_LEN];
469 u8 SAAddr2[MAC_ADDR_LEN];
470 u8 Octet[2];
62eb734b 471};
cc277069
BZ
472/*//Block ACK related format */
473/* 2-byte BA Parameter field in DELBA frames to terminate an already set up bA */
62eb734b 474struct PACKED rt_delba_parm {
51126deb
BZ
475 u16 Rsv:11; /* always set to 0 */
476 u16 Initiator:1; /* 1: originator 0:recipient */
477 u16 TID:4; /* value of TC os TS */
62eb734b 478};
91980990 479
cc277069 480/* 2-byte BA Parameter Set field in ADDBA frames to signal parm for setting up a BA */
62eb734b 481struct PACKED rt_ba_parm {
51126deb
BZ
482 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 */
6ccb5d7c 485 u16 BufSize:10; /* number of buffer of size 2304 octetsr */
62eb734b 486};
91980990 487
cc277069 488/* 2-byte BA Starting Seq CONTROL field */
62eb734b 489typedef union PACKED _BASEQ_CONTROL {
52b81c89 490 struct PACKED {
51126deb
BZ
491 u16 FragNum:4; /* always set to 0 */
492 u16 StartSeq:12; /* sequence number of the 1st MSDU for which this BAR is sent */
52b81c89 493 } field;
51126deb 494 u16 word;
91980990
GKH
495} BASEQ_CONTROL, *PBASEQ_CONTROL;
496
cc277069
BZ
497/*BAControl and BARControl are the same */
498/* 2-byte BA CONTROL field in BA frame */
62eb734b 499struct PACKED rt_ba_control {
51126deb
BZ
500 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;
62eb734b 505};
91980990 506
cc277069 507/* 2-byte BAR CONTROL field in BAR frame */
62eb734b 508struct PACKED rt_bar_control {
51126deb 509 u16 ACKPolicy:1; /* 0:normal ack, 1:no ack. */
62eb734b 510 u16 MTID:1; /*if this bit1, use struct rt_frame_mtba_req, if 0, use struct rt_frame_ba_req */
51126deb
BZ
511 u16 Compressed:1;
512 u16 Rsv1:9;
513 u16 TID:4;
62eb734b 514};
91980990 515
cc277069 516/* BARControl in MTBAR frame */
62eb734b 517struct PACKED rt_mtbar_control {
51126deb
BZ
518 u16 ACKPolicy:1;
519 u16 MTID:1;
520 u16 Compressed:1;
521 u16 Rsv1:9;
522 u16 NumTID:4;
62eb734b 523};
91980990 524
62eb734b 525struct PACKED rt_per_tid_info {
51126deb
BZ
526 u16 Rsv1:12;
527 u16 TID:4;
62eb734b 528};
91980990 529
62eb734b
BZ
530struct rt_each_tid {
531 struct rt_per_tid_info PerTID;
52b81c89 532 BASEQ_CONTROL BAStartingSeq;
62eb734b 533};
91980990 534
cc277069 535/* BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap. */
62eb734b
BZ
536struct PACKED rt_frame_ba_req {
537 struct rt_frame_control FC;
51126deb
BZ
538 u16 Duration;
539 u8 Addr1[MAC_ADDR_LEN];
540 u8 Addr2[MAC_ADDR_LEN];
62eb734b 541 struct rt_bar_control BARControl;
52b81c89 542 BASEQ_CONTROL BAStartingSeq;
62eb734b 543};
91980990 544
62eb734b
BZ
545struct PACKED rt_frame_mtba_req {
546 struct rt_frame_control FC;
51126deb
BZ
547 u16 Duration;
548 u8 Addr1[MAC_ADDR_LEN];
549 u8 Addr2[MAC_ADDR_LEN];
62eb734b
BZ
550 struct rt_mtbar_control MTBARControl;
551 struct rt_per_tid_info PerTIDInfo;
52b81c89 552 BASEQ_CONTROL BAStartingSeq;
62eb734b 553};
91980990 554
6ccb5d7c 555/* Compressed format is mandatory in HT STA */
62eb734b
BZ
556struct PACKED rt_frame_mtba {
557 struct rt_frame_control FC;
51126deb
BZ
558 u16 Duration;
559 u8 Addr1[MAC_ADDR_LEN];
560 u8 Addr2[MAC_ADDR_LEN];
62eb734b 561 struct rt_ba_control BAControl;
52b81c89 562 BASEQ_CONTROL BAStartingSeq;
51126deb 563 u8 BitMap[8];
62eb734b 564};
91980990 565
62eb734b
BZ
566struct PACKED rt_frame_psmp_action {
567 struct rt_header_802_11 Hdr;
51126deb
BZ
568 u8 Category;
569 u8 Action;
570 u8 Psmp; /* 7.3.1.25 */
62eb734b 571};
91980990 572
62eb734b
BZ
573struct PACKED rt_frame_action_hdr {
574 struct rt_header_802_11 Hdr;
51126deb
BZ
575 u8 Category;
576 u8 Action;
62eb734b 577};
91980990 578
cc277069
BZ
579/*Action Frame */
580/*Action Frame Category:Spectrum, Action:Channel Switch. 7.3.2.20 */
62eb734b 581struct PACKED rt_chan_switch_announce {
51126deb
BZ
582 u8 ElementID; /* ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 */
583 u8 Len;
62eb734b
BZ
584 struct rt_cha_switch_announce_ie CSAnnounceIe;
585};
91980990 586
cc277069 587/*802.11n : 7.3.2.20a */
62eb734b 588struct PACKED rt_second_chan_offset {
51126deb
BZ
589 u8 ElementID; /* ID = IE_SECONDARY_CH_OFFSET = 62 */
590 u8 Len;
62eb734b
BZ
591 struct rt_sec_cha_offset_ie SecChOffsetIe;
592};
91980990 593
62eb734b
BZ
594struct PACKED rt_frame_spetrum_cs {
595 struct rt_header_802_11 Hdr;
51126deb
BZ
596 u8 Category;
597 u8 Action;
62eb734b
BZ
598 struct rt_chan_switch_announce CSAnnounce;
599 struct rt_second_chan_offset SecondChannel;
600};
91980990 601
62eb734b
BZ
602struct PACKED rt_frame_addba_req {
603 struct rt_header_802_11 Hdr;
51126deb
BZ
604 u8 Category;
605 u8 Action;
606 u8 Token; /* 1 */
62eb734b 607 struct rt_ba_parm BaParm; /* 2 - 10 */
51126deb 608 u16 TimeOutValue; /* 0 - 0 */
cc277069 609 BASEQ_CONTROL BaStartSeq; /* 0-0 */
62eb734b 610};
91980990 611
62eb734b
BZ
612struct PACKED rt_frame_addba_rsp {
613 struct rt_header_802_11 Hdr;
51126deb
BZ
614 u8 Category;
615 u8 Action;
616 u8 Token;
617 u16 StatusCode;
62eb734b 618 struct rt_ba_parm BaParm; /*0 - 2 */
51126deb 619 u16 TimeOutValue;
62eb734b 620};
91980990 621
62eb734b
BZ
622struct PACKED rt_frame_delba_req {
623 struct rt_header_802_11 Hdr;
51126deb
BZ
624 u8 Category;
625 u8 Action;
62eb734b 626 struct rt_delba_parm DelbaParm;
51126deb 627 u16 ReasonCode;
62eb734b 628};
91980990 629
cc277069 630/*7.2.1.7 */
62eb734b
BZ
631struct PACKED rt_frame_bar {
632 struct rt_frame_control FC;
51126deb
BZ
633 u16 Duration;
634 u8 Addr1[MAC_ADDR_LEN];
635 u8 Addr2[MAC_ADDR_LEN];
62eb734b 636 struct rt_bar_control BarControl;
52b81c89 637 BASEQ_CONTROL StartingSeq;
62eb734b 638};
91980990 639
cc277069 640/*7.2.1.7 */
62eb734b
BZ
641struct PACKED rt_frame_ba {
642 struct rt_frame_control FC;
51126deb
BZ
643 u16 Duration;
644 u8 Addr1[MAC_ADDR_LEN];
645 u8 Addr2[MAC_ADDR_LEN];
62eb734b 646 struct rt_bar_control BarControl;
52b81c89 647 BASEQ_CONTROL StartingSeq;
51126deb 648 u8 bitmask[8];
62eb734b 649};
91980990 650
6ccb5d7c 651/* Radio Measurement Request Frame Format */
62eb734b
BZ
652struct PACKED rt_frame_rm_req_action {
653 struct rt_header_802_11 Hdr;
51126deb
BZ
654 u8 Category;
655 u8 Action;
656 u8 Token;
657 u16 Repetition;
658 u8 data[0];
62eb734b 659};
91980990 660
62eb734b 661struct PACKED rt_ht_ext_channel_switch_announcement_ie {
51126deb
BZ
662 u8 ID;
663 u8 Length;
664 u8 ChannelSwitchMode;
665 u8 NewRegClass;
666 u8 NewChannelNum;
667 u8 ChannelSwitchCount;
62eb734b 668};
91980990 669
cc277069
BZ
670/* */
671/* _Limit must be the 2**n - 1 */
672/* _SEQ1 , _SEQ2 must be within 0 ~ _Limit */
673/* */
91980990
GKH
674#define SEQ_STEPONE(_SEQ1, _SEQ2, _Limit) ((_SEQ1 == ((_SEQ2+1) & _Limit)))
675#define SEQ_SMALLER(_SEQ1, _SEQ2, _Limit) (((_SEQ1-_SEQ2) & ((_Limit+1)>>1)))
676#define SEQ_LARGER(_SEQ1, _SEQ2, _Limit) ((_SEQ1 != _SEQ2) && !(((_SEQ1-_SEQ2) & ((_Limit+1)>>1))))
677#define SEQ_WITHIN_WIN(_SEQ1, _SEQ2, _WIN, _Limit) (SEQ_LARGER(_SEQ1, _SEQ2, _Limit) && \
678 SEQ_SMALLER(_SEQ1, ((_SEQ2+_WIN+1)&_Limit), _Limit))
679
cc277069
BZ
680/* */
681/* Contention-free parameter (without ID and Length) */
682/* */
62eb734b 683struct PACKED rt_cf_parm {
cc277069 684 BOOLEAN bValid; /* 1: variable contains valid value */
51126deb
BZ
685 u8 CfpCount;
686 u8 CfpPeriod;
687 u16 CfpMaxDuration;
688 u16 CfpDurRemaining;
62eb734b 689};
91980990 690
62eb734b 691struct rt_cipher_suite {
cc277069
BZ
692 NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher 1, this one has more secured cipher suite */
693 NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; /* Unicast cipher 2 if AP announce two unicast cipher suite */
694 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Group cipher */
51126deb 695 u16 RsnCapability; /* RSN capability from beacon */
cc277069 696 BOOLEAN bMixMode; /* Indicate Pair & Group cipher might be different */
62eb734b 697};
91980990 698
cc277069 699/* EDCA configuration from AP's BEACON/ProbeRsp */
62eb734b 700struct rt_edca_parm {
cc277069
BZ
701 BOOLEAN bValid; /* 1: variable contains valid value */
702 BOOLEAN bAdd; /* 1: variable contains valid value */
52b81c89
BZ
703 BOOLEAN bQAck;
704 BOOLEAN bQueueRequest;
705 BOOLEAN bTxopRequest;
706 BOOLEAN bAPSDCapable;
cc277069 707/* BOOLEAN bMoreDataAck; */
51126deb
BZ
708 u8 EdcaUpdateCount;
709 u8 Aifsn[4]; /* 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO */
710 u8 Cwmin[4];
711 u8 Cwmax[4];
712 u16 Txop[4]; /* in unit of 32-us */
6ccb5d7c 713 BOOLEAN bACM[4]; /* 1: Admission Control of AC_BK is mandatory */
62eb734b 714};
91980990 715
cc277069 716/* QBSS LOAD information from QAP's BEACON/ProbeRsp */
62eb734b 717struct rt_qbss_load_parm {
cc277069 718 BOOLEAN bValid; /* 1: variable contains valid value */
51126deb
BZ
719 u16 StaNum;
720 u8 ChannelUtilization;
721 u16 RemainingAdmissionControl; /* in unit of 32-us */
62eb734b 722};
91980990 723
cc277069 724/* QBSS Info field in QSTA's assoc req */
62eb734b 725struct PACKED rt_qbss_sta_info_parm {
51126deb
BZ
726 u8 UAPSD_AC_VO:1;
727 u8 UAPSD_AC_VI:1;
728 u8 UAPSD_AC_BK:1;
729 u8 UAPSD_AC_BE:1;
730 u8 Rsv1:1;
731 u8 MaxSPLength:2;
732 u8 Rsv2:1;
62eb734b 733};
91980990 734
cc277069 735/* QBSS Info field in QAP's Beacon/ProbeRsp */
62eb734b 736struct PACKED rt_qbss_ap_info_parm {
51126deb
BZ
737 u8 ParamSetCount:4;
738 u8 Rsv:3;
739 u8 UAPSD:1;
62eb734b 740};
91980990 741
cc277069
BZ
742/* QOS Capability reported in QAP's BEACON/ProbeRsp */
743/* QOS Capability sent out in QSTA's AssociateReq/ReAssociateReq */
62eb734b 744struct rt_qos_capability_parm {
cc277069 745 BOOLEAN bValid; /* 1: variable contains valid value */
52b81c89
BZ
746 BOOLEAN bQAck;
747 BOOLEAN bQueueRequest;
748 BOOLEAN bTxopRequest;
cc277069 749/* BOOLEAN bMoreDataAck; */
51126deb 750 u8 EdcaUpdateCount;
62eb734b 751};
91980990 752
62eb734b 753struct rt_wpa_ie {
51126deb
BZ
754 u8 IELen;
755 u8 IE[MAX_CUSTOM_LEN];
62eb734b 756};
91980990 757
62eb734b 758struct rt_bss_entry {
51126deb
BZ
759 u8 Bssid[MAC_ADDR_LEN];
760 u8 Channel;
6ccb5d7c 761 u8 CentralChannel; /*Store the wide-band central channel for 40MHz. used in 40MHz AP. Or this is the same as Channel. */
51126deb
BZ
762 u8 BssType;
763 u16 AtimWin;
764 u16 BeaconPeriod;
765
766 u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES];
767 u8 SupRateLen;
768 u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
769 u8 ExtRateLen;
62eb734b 770 struct rt_ht_capability_ie HtCapability;
51126deb 771 u8 HtCapabilityLen;
62eb734b 772 struct rt_add_ht_info_ie AddHtInfo; /* AP might use this additional ht info IE */
51126deb
BZ
773 u8 AddHtInfoLen;
774 u8 NewExtChanOffset;
775 char Rssi;
776 u8 Privacy; /* Indicate security function ON/OFF. Don't mess up with auth mode. */
777 u8 Hidden;
91980990 778
51126deb
BZ
779 u16 DtimPeriod;
780 u16 CapabilityInfo;
91980990 781
51126deb
BZ
782 u16 CfpCount;
783 u16 CfpPeriod;
784 u16 CfpMaxDuration;
785 u16 CfpDurRemaining;
786 u8 SsidLen;
787 char Ssid[MAX_LEN_OF_SSID];
91980990 788
51126deb 789 unsigned long LastBeaconRxTime; /* OS's timestamp */
91980990 790
52b81c89 791 BOOLEAN bSES;
91980990 792
cc277069 793 /* New for WPA2 */
62eb734b
BZ
794 struct rt_cipher_suite WPA; /* AP announced WPA cipher suite */
795 struct rt_cipher_suite WPA2; /* AP announced WPA2 cipher suite */
91980990 796
cc277069 797 /* New for microsoft WPA support */
62eb734b 798 struct rt_ndis_802_11_fixed_ies FixIEs;
cc277069 799 NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; /* Addition mode for WPA2 / WPA capable AP */
52b81c89 800 NDIS_802_11_AUTHENTICATION_MODE AuthMode;
cc277069 801 NDIS_802_11_WEP_STATUS WepStatus; /* Unicast Encryption Algorithm extract from VAR_IE */
51126deb
BZ
802 u16 VarIELen; /* Length of next VIE include EID & Length */
803 u8 VarIEs[MAX_VIE_LEN];
91980990 804
cc277069 805 /* CCX Ckip information */
51126deb 806 u8 CkipFlag;
91980990 807
cc277069 808 /* CCX 2 TSF */
51126deb
BZ
809 u8 PTSF[4]; /* Parent TSF */
810 u8 TTSF[8]; /* Target TSF */
91980990 811
cc277069 812 /* 802.11e d9, and WMM */
62eb734b
BZ
813 struct rt_edca_parm EdcaParm;
814 struct rt_qos_capability_parm QosCapability;
815 struct rt_qbss_load_parm QbssLoad;
816 struct rt_wpa_ie WpaIE;
817 struct rt_wpa_ie RsnIE;
818};
819
820struct rt_bss_table {
51126deb
BZ
821 u8 BssNr;
822 u8 BssOverlapNr;
62eb734b
BZ
823 struct rt_bss_entry BssEntry[MAX_LEN_OF_BSS_TABLE];
824};
91980990 825
62eb734b 826struct rt_mlme_queue_elem {
51126deb
BZ
827 unsigned long Machine;
828 unsigned long MsgType;
829 unsigned long MsgLen;
830 u8 Msg[MGMT_DMA_BUFFER_SIZE];
52b81c89 831 LARGE_INTEGER TimeStamp;
51126deb
BZ
832 u8 Rssi0;
833 u8 Rssi1;
834 u8 Rssi2;
835 u8 Signal;
836 u8 Channel;
837 u8 Wcid;
52b81c89 838 BOOLEAN Occupied;
62eb734b 839};
91980990 840
62eb734b 841struct rt_mlme_queue {
51126deb
BZ
842 unsigned long Num;
843 unsigned long Head;
844 unsigned long Tail;
8a10a546 845 spinlock_t Lock;
62eb734b
BZ
846 struct rt_mlme_queue_elem Entry[MAX_LEN_OF_MLME_QUEUE];
847};
91980990 848
f751ffab 849typedef void(*STATE_MACHINE_FUNC) (void *Adaptor, struct rt_mlme_queue_elem *Elem);
91980990 850
62eb734b 851struct rt_state_machine {
51126deb
BZ
852 unsigned long Base;
853 unsigned long NrState;
854 unsigned long NrMsg;
855 unsigned long CurrState;
52b81c89 856 STATE_MACHINE_FUNC *TransFunc;
62eb734b 857};
91980990 858
6ccb5d7c 859/* MLME AUX data structure that holds temporarliy settings during a connection attempt. */
25985edc 860/* Once this attempt succeeds, all settings will be copy to pAd->StaActive. */
cc277069
BZ
861/* A connection attempt (user set OID, roaming, CCX fast roaming,..) consists of */
862/* several steps (JOIN, AUTH, ASSOC or REASSOC) and may fail at any step. We purposely */
863/* separate this under-trial settings away from pAd->StaActive so that once */
864/* this new attempt failed, driver can auto-recover back to the active settings. */
62eb734b 865struct rt_mlme_aux {
51126deb
BZ
866 u8 BssType;
867 u8 Ssid[MAX_LEN_OF_SSID];
868 u8 SsidLen;
869 u8 Bssid[MAC_ADDR_LEN];
870 u8 AutoReconnectSsid[MAX_LEN_OF_SSID];
871 u8 AutoReconnectSsidLen;
872 u16 Alg;
873 u8 ScanType;
874 u8 Channel;
875 u8 CentralChannel;
876 u16 Aid;
877 u16 CapabilityInfo;
878 u16 BeaconPeriod;
879 u16 CfpMaxDuration;
880 u16 CfpPeriod;
881 u16 AtimWin;
91980990 882
cc277069
BZ
883 /* Copy supported rate from desired AP's beacon. We are trying to match */
884 /* AP's supported and extended rate settings. */
51126deb
BZ
885 u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES];
886 u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
887 u8 SupRateLen;
888 u8 ExtRateLen;
62eb734b 889 struct rt_ht_capability_ie HtCapability;
51126deb 890 u8 HtCapabilityLen;
62eb734b 891 struct rt_add_ht_info_ie AddHtInfo; /* AP might use this additional ht info IE */
51126deb 892 u8 NewExtChannelOffset;
62eb734b 893 /*struct rt_ht_capability SupportedHtPhy; */
52b81c89 894
cc277069 895 /* new for QOS */
62eb734b
BZ
896 struct rt_qos_capability_parm APQosCapability; /* QOS capability of the current associated AP */
897 struct rt_edca_parm APEdcaParm; /* EDCA parameters of the current associated AP */
898 struct rt_qbss_load_parm APQbssLoad; /* QBSS load of the current associated AP */
52b81c89 899
cc277069 900 /* new to keep Ralink specific feature */
51126deb 901 unsigned long APRalinkIe;
52b81c89 902
62eb734b
BZ
903 struct rt_bss_table SsidBssTab; /* AP list for the same SSID */
904 struct rt_bss_table RoamTab; /* AP list eligible for roaming */
51126deb
BZ
905 unsigned long BssIdx;
906 unsigned long RoamIdx;
52b81c89
BZ
907
908 BOOLEAN CurrReqIsFromNdis;
909
62eb734b
BZ
910 struct rt_ralink_timer BeaconTimer, ScanTimer;
911 struct rt_ralink_timer AuthTimer;
912 struct rt_ralink_timer AssocTimer, ReassocTimer, DisassocTimer;
913};
91980990 914
62eb734b 915struct rt_mlme_addba_req {
51126deb
BZ
916 u8 Wcid; /* */
917 u8 pAddr[MAC_ADDR_LEN];
918 u8 BaBufSize;
919 u16 TimeOutValue;
920 u8 TID;
921 u8 Token;
922 u16 BaStartSeq;
62eb734b 923};
91980990 924
62eb734b 925struct rt_mlme_delba_req {
51126deb
BZ
926 u8 Wcid; /* */
927 u8 Addr[MAC_ADDR_LEN];
928 u8 TID;
929 u8 Initiator;
62eb734b 930};
91980990 931
cc277069 932/* assoc struct is equal to reassoc */
62eb734b 933struct rt_mlme_assoc_req {
51126deb
BZ
934 u8 Addr[MAC_ADDR_LEN];
935 u16 CapabilityInfo;
936 u16 ListenIntv;
937 unsigned long Timeout;
62eb734b 938};
52b81c89 939
62eb734b 940struct rt_mlme_disassoc_req {
51126deb
BZ
941 u8 Addr[MAC_ADDR_LEN];
942 u16 Reason;
62eb734b 943};
91980990 944
62eb734b 945struct rt_mlme_auth_req {
51126deb
BZ
946 u8 Addr[MAC_ADDR_LEN];
947 u16 Alg;
948 unsigned long Timeout;
62eb734b 949};
91980990 950
62eb734b 951struct rt_mlme_deauth_req {
51126deb
BZ
952 u8 Addr[MAC_ADDR_LEN];
953 u16 Reason;
62eb734b 954};
91980990 955
62eb734b 956struct rt_mlme_join_req {
51126deb 957 unsigned long BssIdx;
62eb734b 958};
91980990 959
62eb734b 960struct rt_mlme_scan_req {
51126deb
BZ
961 u8 Bssid[MAC_ADDR_LEN];
962 u8 BssType;
963 u8 ScanType;
964 u8 SsidLen;
965 char Ssid[MAX_LEN_OF_SSID];
62eb734b 966};
91980990 967
62eb734b 968struct rt_mlme_start_req {
51126deb
BZ
969 char Ssid[MAX_LEN_OF_SSID];
970 u8 SsidLen;
62eb734b 971};
91980990 972
62eb734b 973struct PACKED rt_eid {
51126deb
BZ
974 u8 Eid;
975 u8 Len;
976 u8 Octet[1];
62eb734b 977};
52b81c89 978
62eb734b 979struct PACKED rt_rtmp_tx_rate_switch {
51126deb
BZ
980 u8 ItemNo;
981 u8 STBC:1;
982 u8 ShortGI:1;
983 u8 BW:1;
984 u8 Rsv1:1;
985 u8 Mode:2;
986 u8 Rsv2:2;
987 u8 CurrMCS;
988 u8 TrainUp;
989 u8 TrainDown;
62eb734b 990};
91980990 991
cc277069
BZ
992/* ========================== AP mlme.h =============================== */
993#define TBTT_PRELOAD_TIME 384 /* usec. LomgPreamble + 24-byte at 1Mbps */
91980990
GKH
994#define DEFAULT_DTIM_PERIOD 1
995
cc277069
BZ
996#define MAC_TABLE_AGEOUT_TIME 300 /* unit: sec */
997#define MAC_TABLE_ASSOC_TIMEOUT 5 /* unit: sec */
91980990
GKH
998#define MAC_TABLE_FULL(Tab) ((Tab).size == MAX_LEN_OF_MAC_TABLE)
999
6ccb5d7c 1000/* AP shall drop the sta if continue Tx fail count reach it. */
cc277069 1001#define MAC_ENTRY_LIFE_CHECK_CNT 20 /* packet cnt. */
91980990 1002
cc277069 1003/* Value domain of pMacEntry->Sst */
91980990 1004typedef enum _Sst {
cc277069
BZ
1005 SST_NOT_AUTH, /* 0: equivalent to IEEE 802.11/1999 state 1 */
1006 SST_AUTH, /* 1: equivalent to IEEE 802.11/1999 state 2 */
1007 SST_ASSOC /* 2: equivalent to IEEE 802.11/1999 state 3 */
91980990
GKH
1008} SST;
1009
cc277069 1010/* value domain of pMacEntry->AuthState */
91980990 1011typedef enum _AuthState {
52b81c89 1012 AS_NOT_AUTH,
cc277069
BZ
1013 AS_AUTH_OPEN, /* STA has been authenticated using OPEN SYSTEM */
1014 AS_AUTH_KEY, /* STA has been authenticated using SHARED KEY */
1015 AS_AUTHENTICATING /* STA is waiting for AUTH seq#3 using SHARED KEY */
91980990
GKH
1016} AUTH_STATE;
1017
cc277069 1018/*for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 */
91980990 1019typedef enum _ApWpaState {
cc277069
BZ
1020 AS_NOTUSE, /* 0 */
1021 AS_DISCONNECT, /* 1 */
1022 AS_DISCONNECTED, /* 2 */
1023 AS_INITIALIZE, /* 3 */
1024 AS_AUTHENTICATION, /* 4 */
1025 AS_AUTHENTICATION2, /* 5 */
1026 AS_INITPMK, /* 6 */
1027 AS_INITPSK, /* 7 */
1028 AS_PTKSTART, /* 8 */
1029 AS_PTKINIT_NEGOTIATING, /* 9 */
1030 AS_PTKINITDONE, /* 10 */
1031 AS_UPDATEKEYS, /* 11 */
1032 AS_INTEGRITY_FAILURE, /* 12 */
1033 AS_KEYUPDATE, /* 13 */
91980990
GKH
1034} AP_WPA_STATE;
1035
cc277069 1036/* for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 */
91980990 1037typedef enum _GTKState {
52b81c89
BZ
1038 REKEY_NEGOTIATING,
1039 REKEY_ESTABLISHED,
1040 KEYERROR,
91980990
GKH
1041} GTK_STATE;
1042
cc277069 1043/* for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 */
91980990 1044typedef enum _WpaGTKState {
52b81c89
BZ
1045 SETKEYS,
1046 SETKEYS_DONE,
91980990 1047} WPA_GTK_STATE;
cc277069 1048/* ====================== end of AP mlme.h ============================ */
91980990 1049
cc277069 1050#endif /* MLME_H__ */