[ARM] pxa: Gumstix Verdex PCMCIA support
[linux-2.6/verdex.git] / drivers / staging / rt3090 / rtmp.h
blob8ef6d0bfdee68bef15d372c6c499e30d6c7ce5f1
1 /*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
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 *************************************************************************
27 Module Name:
28 rtmp.h
30 Abstract:
31 Miniport generic portion header file
33 Revision History:
34 Who When What
35 -------- ---------- ----------------------------------------------
36 Paul Lin 2002-08-01 created
37 James Tan 2002-09-06 modified (Revise NTCRegTable)
38 John Chang 2004-09-06 modified for RT2600
40 #ifndef __RTMP_H__
41 #define __RTMP_H__
43 #include "link_list.h"
44 #include "spectrum_def.h"
46 #include "rtmp_dot11.h"
48 #ifdef MLME_EX
49 #include "mlme_ex_def.h"
50 #endif // MLME_EX //
52 #ifdef CONFIG_STA_SUPPORT
53 #endif // CONFIG_STA_SUPPORT //
55 #undef AP_WSC_INCLUDED
56 #undef STA_WSC_INCLUDED
57 #undef WSC_INCLUDED
60 #ifdef CONFIG_STA_SUPPORT
61 #endif // CONFIG_STA_SUPPORT //
63 #if defined(AP_WSC_INCLUDED) || defined(STA_WSC_INCLUDED)
64 #define WSC_INCLUDED
65 #endif
71 #include "rtmp_chip.h"
75 typedef struct _RTMP_ADAPTER RTMP_ADAPTER;
76 typedef struct _RTMP_ADAPTER *PRTMP_ADAPTER;
78 typedef struct _RTMP_CHIP_OP_ RTMP_CHIP_OP;
81 //#define DBG 1
83 //#define DBG_DIAGNOSE 1
86 //+++Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function
87 #define MAX_DATAMM_RETRY 3
88 #define MGMT_USE_QUEUE_FLAG 0x80
89 //---Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function
91 #define MAXSEQ (0xFFF)
94 #if defined(CONFIG_AP_SUPPORT) && defined(CONFIG_STA_SUPPORT)
95 #define IF_DEV_CONFIG_OPMODE_ON_AP(_pAd) if(_pAd->OpMode == OPMODE_AP)
96 #define IF_DEV_CONFIG_OPMODE_ON_STA(_pAd) if(_pAd->OpMode == OPMODE_STA)
97 #else
98 #define IF_DEV_CONFIG_OPMODE_ON_AP(_pAd)
99 #define IF_DEV_CONFIG_OPMODE_ON_STA(_pAd)
100 #endif
102 extern unsigned char SNAP_AIRONET[];
103 extern unsigned char CISCO_OUI[];
104 extern UCHAR BaSizeArray[4];
106 extern UCHAR BROADCAST_ADDR[MAC_ADDR_LEN];
107 extern UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN];
108 extern ULONG BIT32[32];
109 extern UCHAR BIT8[8];
110 extern char* CipherName[];
111 extern char* MCSToMbps[];
112 extern UCHAR RxwiMCSToOfdmRate[12];
113 extern UCHAR SNAP_802_1H[6];
114 extern UCHAR SNAP_BRIDGE_TUNNEL[6];
115 extern UCHAR SNAP_AIRONET[8];
116 extern UCHAR CKIP_LLC_SNAP[8];
117 extern UCHAR EAPOL_LLC_SNAP[8];
118 extern UCHAR EAPOL[2];
119 extern UCHAR IPX[2];
120 extern UCHAR APPLE_TALK[2];
121 extern UCHAR RateIdToPlcpSignal[12]; // see IEEE802.11a-1999 p.14
122 extern UCHAR OfdmRateToRxwiMCS[];
123 extern UCHAR OfdmSignalToRateId[16] ;
124 extern UCHAR default_cwmin[4];
125 extern UCHAR default_cwmax[4];
126 extern UCHAR default_sta_aifsn[4];
127 extern UCHAR MapUserPriorityToAccessCategory[8];
129 extern USHORT RateUpPER[];
130 extern USHORT RateDownPER[];
131 extern UCHAR Phy11BNextRateDownward[];
132 extern UCHAR Phy11BNextRateUpward[];
133 extern UCHAR Phy11BGNextRateDownward[];
134 extern UCHAR Phy11BGNextRateUpward[];
135 extern UCHAR Phy11ANextRateDownward[];
136 extern UCHAR Phy11ANextRateUpward[];
137 extern CHAR RssiSafeLevelForTxRate[];
138 extern UCHAR RateIdToMbps[];
139 extern USHORT RateIdTo500Kbps[];
141 extern UCHAR CipherSuiteWpaNoneTkip[];
142 extern UCHAR CipherSuiteWpaNoneTkipLen;
144 extern UCHAR CipherSuiteWpaNoneAes[];
145 extern UCHAR CipherSuiteWpaNoneAesLen;
147 extern UCHAR SsidIe;
148 extern UCHAR SupRateIe;
149 extern UCHAR ExtRateIe;
151 #ifdef DOT11_N_SUPPORT
152 extern UCHAR HtCapIe;
153 extern UCHAR AddHtInfoIe;
154 extern UCHAR NewExtChanIe;
155 #ifdef DOT11N_DRAFT3
156 extern UCHAR ExtHtCapIe;
157 #endif // DOT11N_DRAFT3 //
158 #endif // DOT11_N_SUPPORT //
160 extern UCHAR ErpIe;
161 extern UCHAR DsIe;
162 extern UCHAR TimIe;
163 extern UCHAR WpaIe;
164 extern UCHAR Wpa2Ie;
165 extern UCHAR IbssIe;
166 extern UCHAR Ccx2Ie;
167 extern UCHAR WapiIe;
169 extern UCHAR WPA_OUI[];
170 extern UCHAR RSN_OUI[];
171 extern UCHAR WAPI_OUI[];
172 extern UCHAR WME_INFO_ELEM[];
173 extern UCHAR WME_PARM_ELEM[];
174 extern UCHAR Ccx2QosInfo[];
175 extern UCHAR Ccx2IeInfo[];
176 extern UCHAR RALINK_OUI[];
177 extern UCHAR PowerConstraintIE[];
180 extern UCHAR RateSwitchTable[];
181 extern UCHAR RateSwitchTable11B[];
182 extern UCHAR RateSwitchTable11G[];
183 extern UCHAR RateSwitchTable11BG[];
185 #ifdef DOT11_N_SUPPORT
186 extern UCHAR RateSwitchTable11BGN1S[];
187 extern UCHAR RateSwitchTable11BGN2S[];
188 extern UCHAR RateSwitchTable11BGN2SForABand[];
189 extern UCHAR RateSwitchTable11N1S[];
190 extern UCHAR RateSwitchTable11N2S[];
191 extern UCHAR RateSwitchTable11N2SForABand[];
193 #ifdef CONFIG_STA_SUPPORT
194 extern UCHAR PRE_N_HT_OUI[];
195 #endif // CONFIG_STA_SUPPORT //
196 #endif // DOT11_N_SUPPORT //
199 #ifdef RALINK_ATE
200 typedef struct _ATE_INFO {
201 UCHAR Mode;
202 CHAR TxPower0;
203 CHAR TxPower1;
204 CHAR TxAntennaSel;
205 CHAR RxAntennaSel;
206 TXWI_STRUC TxWI; // TXWI
207 USHORT QID;
208 UCHAR Addr1[MAC_ADDR_LEN];
209 UCHAR Addr2[MAC_ADDR_LEN];
210 UCHAR Addr3[MAC_ADDR_LEN];
211 UCHAR Channel;
212 UINT32 TxLength;
213 UINT32 TxCount;
214 UINT32 TxDoneCount; // Tx DMA Done
215 UINT32 RFFreqOffset;
216 BOOLEAN bRxFER; // Show Rx Frame Error Rate
217 BOOLEAN bQATxStart; // Have compiled QA in and use it to ATE tx.
218 BOOLEAN bQARxStart; // Have compiled QA in and use it to ATE rx.
219 #ifdef RTMP_MAC_PCI
220 BOOLEAN bFWLoading; // Reload firmware when ATE is done.
221 #endif // RTMP_MAC_PCI //
222 UINT32 RxTotalCnt;
223 UINT32 RxCntPerSec;
225 CHAR LastSNR0; // last received SNR
226 CHAR LastSNR1; // last received SNR for 2nd antenna
227 CHAR LastRssi0; // last received RSSI
228 CHAR LastRssi1; // last received RSSI for 2nd antenna
229 CHAR LastRssi2; // last received RSSI for 3rd antenna
230 CHAR AvgRssi0; // last 8 frames' average RSSI
231 CHAR AvgRssi1; // last 8 frames' average RSSI
232 CHAR AvgRssi2; // last 8 frames' average RSSI
233 SHORT AvgRssi0X8; // sum of last 8 frames' RSSI
234 SHORT AvgRssi1X8; // sum of last 8 frames' RSSI
235 SHORT AvgRssi2X8; // sum of last 8 frames' RSSI
237 UINT32 NumOfAvgRssiSample;
240 #ifdef RALINK_28xx_QA
241 // Tx frame
242 USHORT HLen; // Header Length
243 USHORT PLen; // Pattern Length
244 UCHAR Header[32]; // Header buffer
245 UCHAR Pattern[32]; // Pattern buffer
246 USHORT DLen; // Data Length
247 USHORT seq;
248 UINT32 CID;
249 RTMP_OS_PID AtePid;
250 // counters
251 UINT32 U2M;
252 UINT32 OtherData;
253 UINT32 Beacon;
254 UINT32 OtherCount;
255 UINT32 TxAc0;
256 UINT32 TxAc1;
257 UINT32 TxAc2;
258 UINT32 TxAc3;
259 /*UINT32 TxHCCA;*/
260 UINT32 TxMgmt;
261 UINT32 RSSI0;
262 UINT32 RSSI1;
263 UINT32 RSSI2;
264 UINT32 SNR0;
265 UINT32 SNR1;
266 // TxStatus : 0 --> task is idle, 1 --> task is running
267 UCHAR TxStatus;
268 #endif // RALINK_28xx_QA //
269 } ATE_INFO, *PATE_INFO;
271 #ifdef RALINK_28xx_QA
272 struct ate_racfghdr {
273 UINT32 magic_no;
274 USHORT command_type;
275 USHORT command_id;
276 USHORT length;
277 USHORT sequence;
278 USHORT status;
279 UCHAR data[2046];
280 } __attribute__((packed));
281 #endif // RALINK_28xx_QA //
282 #endif // RALINK_ATE //
285 typedef struct _RSSI_SAMPLE {
286 CHAR LastRssi0; // last received RSSI
287 CHAR LastRssi1; // last received RSSI
288 CHAR LastRssi2; // last received RSSI
289 CHAR AvgRssi0;
290 CHAR AvgRssi1;
291 CHAR AvgRssi2;
292 SHORT AvgRssi0X8;
293 SHORT AvgRssi1X8;
294 SHORT AvgRssi2X8;
295 } RSSI_SAMPLE;
298 // Queue structure and macros
300 typedef struct _QUEUE_ENTRY {
301 struct _QUEUE_ENTRY *Next;
302 } QUEUE_ENTRY, *PQUEUE_ENTRY;
304 // Queue structure
305 typedef struct _QUEUE_HEADER {
306 PQUEUE_ENTRY Head;
307 PQUEUE_ENTRY Tail;
308 ULONG Number;
309 } QUEUE_HEADER, *PQUEUE_HEADER;
311 #define InitializeQueueHeader(QueueHeader) \
313 (QueueHeader)->Head = (QueueHeader)->Tail = NULL; \
314 (QueueHeader)->Number = 0; \
317 #define RemoveHeadQueue(QueueHeader) \
318 (QueueHeader)->Head; \
320 PQUEUE_ENTRY pNext; \
321 if ((QueueHeader)->Head != NULL) \
323 pNext = (QueueHeader)->Head->Next; \
324 (QueueHeader)->Head->Next = NULL; \
325 (QueueHeader)->Head = pNext; \
326 if (pNext == NULL) \
327 (QueueHeader)->Tail = NULL; \
328 (QueueHeader)->Number--; \
332 #define InsertHeadQueue(QueueHeader, QueueEntry) \
334 ((PQUEUE_ENTRY)QueueEntry)->Next = (QueueHeader)->Head; \
335 (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \
336 if ((QueueHeader)->Tail == NULL) \
337 (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \
338 (QueueHeader)->Number++; \
341 #define InsertTailQueue(QueueHeader, QueueEntry) \
343 ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \
344 if ((QueueHeader)->Tail) \
345 (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \
346 else \
347 (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \
348 (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \
349 (QueueHeader)->Number++; \
352 #define InsertTailQueueAc(pAd, pEntry, QueueHeader, QueueEntry) \
354 ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \
355 if ((QueueHeader)->Tail) \
356 (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \
357 else \
358 (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \
359 (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \
360 (QueueHeader)->Number++; \
366 // Macros for flag and ref count operations
368 #define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
369 #define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
370 #define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0)
371 #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
372 #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
373 // Macro for power save flag.
374 #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F))
375 #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F))
376 #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0)
377 #define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0)
378 #define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F))
380 #define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F))
381 #define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F))
382 #define OPSTATUS_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.OpStatusFlags & (_F)) != 0)
384 #define CLIENT_STATUS_SET_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags |= (_F))
385 #define CLIENT_STATUS_CLEAR_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags &= ~(_F))
386 #define CLIENT_STATUS_TEST_FLAG(_pEntry,_F) (((_pEntry)->ClientStatusFlags & (_F)) != 0)
388 #define RX_FILTER_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter |= (_F))
389 #define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F))
390 #define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0)
392 #ifdef CONFIG_STA_SUPPORT
393 #define STA_NO_SECURITY_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11EncryptionDisabled)
394 #define STA_WEP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption1Enabled)
395 #define STA_TKIP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption2Enabled)
396 #define STA_AES_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)
398 #define STA_TGN_WIFI_ON(_p) (_p->StaCfg.bTGnWifiTest == TRUE)
399 #endif // CONFIG_STA_SUPPORT //
401 #define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
402 #define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
405 #define INC_RING_INDEX(_idx, _RingSize) \
407 (_idx) = (_idx+1) % (_RingSize); \
411 #ifdef DOT11_N_SUPPORT
412 // StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here.
413 #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \
415 _pAd->StaActive.SupportedHtPhy.ChannelWidth = _pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth; \
416 _pAd->StaActive.SupportedHtPhy.MimoPs = _pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs; \
417 _pAd->StaActive.SupportedHtPhy.GF = _pAd->MlmeAux.HtCapability.HtCapInfo.GF; \
418 _pAd->StaActive.SupportedHtPhy.ShortGIfor20 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20; \
419 _pAd->StaActive.SupportedHtPhy.ShortGIfor40 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40; \
420 _pAd->StaActive.SupportedHtPhy.TxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC; \
421 _pAd->StaActive.SupportedHtPhy.RxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC; \
422 _pAd->StaActive.SupportedHtPhy.ExtChanOffset = _pAd->MlmeAux.AddHtInfo.AddHtInfo.ExtChanOffset; \
423 _pAd->StaActive.SupportedHtPhy.RecomWidth = _pAd->MlmeAux.AddHtInfo.AddHtInfo.RecomWidth; \
424 _pAd->StaActive.SupportedHtPhy.OperaionMode = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode; \
425 _pAd->StaActive.SupportedHtPhy.NonGfPresent = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent; \
426 NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(UCHAR) * 16);\
429 #define COPY_AP_HTSETTINGS_FROM_BEACON(_pAd, _pHtCapability) \
431 _pAd->MacTab.Content[BSSID_WCID].AMsduSize = (UCHAR)(_pHtCapability->HtCapInfo.AMsduSize); \
432 _pAd->MacTab.Content[BSSID_WCID].MmpsMode= (UCHAR)(_pHtCapability->HtCapInfo.MimoPs); \
433 _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (UCHAR)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \
435 #endif // DOT11_N_SUPPORT //
438 // MACRO for 32-bit PCI register read / write
440 // Usage : RTMP_IO_READ32(
441 // PRTMP_ADAPTER pAd,
442 // ULONG Register_Offset,
443 // PULONG pValue)
445 // RTMP_IO_WRITE32(
446 // PRTMP_ADAPTER pAd,
447 // ULONG Register_Offset,
448 // ULONG Value)
453 // Common fragment list structure - Identical to the scatter gather frag list structure
455 //#define RTMP_SCATTER_GATHER_ELEMENT SCATTER_GATHER_ELEMENT
456 //#define PRTMP_SCATTER_GATHER_ELEMENT PSCATTER_GATHER_ELEMENT
457 #define NIC_MAX_PHYS_BUF_COUNT 8
459 typedef struct _RTMP_SCATTER_GATHER_ELEMENT {
460 PVOID Address;
461 ULONG Length;
462 PULONG Reserved;
463 } RTMP_SCATTER_GATHER_ELEMENT, *PRTMP_SCATTER_GATHER_ELEMENT;
466 typedef struct _RTMP_SCATTER_GATHER_LIST {
467 ULONG NumberOfElements;
468 PULONG Reserved;
469 RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT];
470 } RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST;
474 // Some utility macros
476 #ifndef min
477 #define min(_a, _b) (((_a) < (_b)) ? (_a) : (_b))
478 #endif
480 #ifndef max
481 #define max(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
482 #endif
484 #define GET_LNA_GAIN(_pAd) ((_pAd->LatchRfRegs.Channel <= 14) ? (_pAd->BLNAGain) : ((_pAd->LatchRfRegs.Channel <= 64) ? (_pAd->ALNAGain0) : ((_pAd->LatchRfRegs.Channel <= 128) ? (_pAd->ALNAGain1) : (_pAd->ALNAGain2))))
486 #define INC_COUNTER64(Val) (Val.QuadPart++)
488 #define INFRA_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_INFRA_ON))
489 #define ADHOC_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_ADHOC_ON))
490 #define MONITOR_ON(_p) (((_p)->StaCfg.BssType) == BSS_MONITOR)
491 #define IDLE_ON(_p) (!INFRA_ON(_p) && !ADHOC_ON(_p))
493 // Check LEAP & CCKM flags
494 #define LEAP_ON(_p) (((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP)
495 #define LEAP_CCKM_ON(_p) ((((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg.LeapAuthInfo.CCKM == TRUE))
497 // if orginal Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required
498 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \
500 if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) \
502 _pExtraLlcSnapEncap = SNAP_802_1H; \
503 if (NdisEqualMemory(IPX, _pBufVA + 12, 2) || \
504 NdisEqualMemory(APPLE_TALK, _pBufVA + 12, 2)) \
506 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
509 else \
511 _pExtraLlcSnapEncap = NULL; \
515 // New Define for new Tx Path.
516 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \
518 if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) \
520 _pExtraLlcSnapEncap = SNAP_802_1H; \
521 if (NdisEqualMemory(IPX, _pBufVA, 2) || \
522 NdisEqualMemory(APPLE_TALK, _pBufVA, 2)) \
524 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
527 else \
529 _pExtraLlcSnapEncap = NULL; \
534 #define MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType) \
536 NdisMoveMemory(_p, _pMac1, MAC_ADDR_LEN); \
537 NdisMoveMemory((_p + MAC_ADDR_LEN), _pMac2, MAC_ADDR_LEN); \
538 NdisMoveMemory((_p + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \
541 // if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way.
542 // else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field
543 // else remove the LLC/SNAP field from the result Ethernet frame
544 // Patch for WHQL only, which did not turn on Netbios but use IPX within its payload
545 // Note:
546 // _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO
547 // _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed
548 #define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \
550 char LLC_Len[2]; \
552 _pRemovedLLCSNAP = NULL; \
553 if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \
554 NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) \
556 PUCHAR pProto = _pData + 6; \
558 if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \
559 NdisEqualMemory(SNAP_802_1H, _pData, 6)) \
561 LLC_Len[0] = (UCHAR)(_DataSize / 256); \
562 LLC_Len[1] = (UCHAR)(_DataSize % 256); \
563 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
565 else \
567 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \
568 _pRemovedLLCSNAP = _pData; \
569 _DataSize -= LENGTH_802_1_H; \
570 _pData += LENGTH_802_1_H; \
573 else \
575 LLC_Len[0] = (UCHAR)(_DataSize / 256); \
576 LLC_Len[1] = (UCHAR)(_DataSize % 256); \
577 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
582 // Enqueue this frame to MLME engine
583 // We need to enqueue the whole frame because MLME need to pass data type
584 // information from 802.11 header
585 #ifdef RTMP_MAC_PCI
586 #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
588 UINT32 High32TSF, Low32TSF; \
589 RTMP_IO_READ32(_pAd, TSF_TIMER_DW1, &High32TSF); \
590 RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \
591 MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \
593 #endif // RTMP_MAC_PCI //
595 #define MAC_ADDR_EQUAL(pAddr1,pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), MAC_ADDR_LEN)
596 #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1==len2) && (RTMPEqualMemory(ssid1, ssid2, len1)))
599 // Check if it is Japan W53(ch52,56,60,64) channel.
601 #define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64))
603 #ifdef CONFIG_STA_SUPPORT
604 #define STA_EXTRA_SETTING(_pAd)
606 #define STA_PORT_SECURED(_pAd) \
608 BOOLEAN Cancelled; \
609 (_pAd)->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \
610 NdisAcquireSpinLock(&((_pAd)->MacTabLock)); \
611 (_pAd)->MacTab.Content[BSSID_WCID].PortSecured = (_pAd)->StaCfg.PortSecured; \
612 (_pAd)->MacTab.Content[BSSID_WCID].PrivacyFilter = Ndis802_11PrivFilterAcceptAll;\
613 NdisReleaseSpinLock(&(_pAd)->MacTabLock); \
614 RTMPCancelTimer(&((_pAd)->Mlme.LinkDownTimer), &Cancelled);\
615 STA_EXTRA_SETTING(_pAd); \
617 #endif // CONFIG_STA_SUPPORT //
622 // Data buffer for DMA operation, the buffer must be contiguous physical memory
623 // Both DMA to / from CPU use the same structure.
625 typedef struct _RTMP_DMABUF
627 ULONG AllocSize;
628 PVOID AllocVa; // TxBuf virtual address
629 NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address
630 } RTMP_DMABUF, *PRTMP_DMABUF;
634 // Control block (Descriptor) for all ring descriptor DMA operation, buffer must be
635 // contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor
636 // which won't be released, driver has to wait until upper layer return the packet
637 // before giveing up this rx ring descriptor to ASIC. NDIS_BUFFER is assocaited pair
638 // to describe the packet buffer. For Tx, NDIS_PACKET stored the tx packet descriptor
639 // which driver should ACK upper layer when the tx is physically done or failed.
641 typedef struct _RTMP_DMACB
643 ULONG AllocSize; // Control block size
644 PVOID AllocVa; // Control block virtual address
645 NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address
646 PNDIS_PACKET pNdisPacket;
647 PNDIS_PACKET pNextNdisPacket;
649 RTMP_DMABUF DmaBuf; // Associated DMA buffer structure
650 } RTMP_DMACB, *PRTMP_DMACB;
653 typedef struct _RTMP_TX_RING
655 RTMP_DMACB Cell[TX_RING_SIZE];
656 UINT32 TxCpuIdx;
657 UINT32 TxDmaIdx;
658 UINT32 TxSwFreeIdx; // software next free tx index
659 } RTMP_TX_RING, *PRTMP_TX_RING;
661 typedef struct _RTMP_RX_RING
663 RTMP_DMACB Cell[RX_RING_SIZE];
664 UINT32 RxCpuIdx;
665 UINT32 RxDmaIdx;
666 INT32 RxSwReadIdx; // software next read index
667 } RTMP_RX_RING, *PRTMP_RX_RING;
669 typedef struct _RTMP_MGMT_RING
671 RTMP_DMACB Cell[MGMT_RING_SIZE];
672 UINT32 TxCpuIdx;
673 UINT32 TxDmaIdx;
674 UINT32 TxSwFreeIdx; // software next free tx index
675 } RTMP_MGMT_RING, *PRTMP_MGMT_RING;
679 // Statistic counter structure
681 typedef struct _COUNTER_802_3
683 // General Stats
684 ULONG GoodTransmits;
685 ULONG GoodReceives;
686 ULONG TxErrors;
687 ULONG RxErrors;
688 ULONG RxNoBuffer;
690 // Ethernet Stats
691 ULONG RcvAlignmentErrors;
692 ULONG OneCollision;
693 ULONG MoreCollisions;
695 } COUNTER_802_3, *PCOUNTER_802_3;
697 typedef struct _COUNTER_802_11 {
698 ULONG Length;
699 LARGE_INTEGER LastTransmittedFragmentCount;
700 LARGE_INTEGER TransmittedFragmentCount;
701 LARGE_INTEGER MulticastTransmittedFrameCount;
702 LARGE_INTEGER FailedCount;
703 LARGE_INTEGER RetryCount;
704 LARGE_INTEGER MultipleRetryCount;
705 LARGE_INTEGER RTSSuccessCount;
706 LARGE_INTEGER RTSFailureCount;
707 LARGE_INTEGER ACKFailureCount;
708 LARGE_INTEGER FrameDuplicateCount;
709 LARGE_INTEGER ReceivedFragmentCount;
710 LARGE_INTEGER MulticastReceivedFrameCount;
711 LARGE_INTEGER FCSErrorCount;
712 } COUNTER_802_11, *PCOUNTER_802_11;
714 typedef struct _COUNTER_RALINK {
715 ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput
716 ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput
717 ULONG BeenDisassociatedCount;
718 ULONG BadCQIAutoRecoveryCount;
719 ULONG PoorCQIRoamingCount;
720 ULONG MgmtRingFullCount;
721 ULONG RxCountSinceLastNULL;
722 ULONG RxCount;
723 ULONG RxRingErrCount;
724 ULONG KickTxCount;
725 ULONG TxRingErrCount;
726 LARGE_INTEGER RealFcsErrCount;
727 ULONG PendingNdisPacketCount;
729 ULONG OneSecOsTxCount[NUM_OF_TX_RING];
730 ULONG OneSecDmaDoneCount[NUM_OF_TX_RING];
731 UINT32 OneSecTxDoneCount;
732 ULONG OneSecRxCount;
733 UINT32 OneSecTxAggregationCount;
734 UINT32 OneSecRxAggregationCount;
735 UINT32 OneSecReceivedByteCount;
736 UINT32 OneSecFrameDuplicateCount;
738 UINT32 OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput
739 UINT32 OneSecTxNoRetryOkCount;
740 UINT32 OneSecTxRetryOkCount;
741 UINT32 OneSecTxFailCount;
742 UINT32 OneSecFalseCCACnt; // CCA error count, for debug purpose, might move to global counter
743 UINT32 OneSecRxOkCnt; // RX without error
744 UINT32 OneSecRxOkDataCnt; // unicast-to-me DATA frame count
745 UINT32 OneSecRxFcsErrCnt; // CRC error
746 UINT32 OneSecBeaconSentCnt;
747 UINT32 LastOneSecTotalTxCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount
748 UINT32 LastOneSecRxOkDataCnt; // OneSecRxOkDataCnt
749 ULONG DuplicateRcv;
750 ULONG TxAggCount;
751 ULONG TxNonAggCount;
752 ULONG TxAgg1MPDUCount;
753 ULONG TxAgg2MPDUCount;
754 ULONG TxAgg3MPDUCount;
755 ULONG TxAgg4MPDUCount;
756 ULONG TxAgg5MPDUCount;
757 ULONG TxAgg6MPDUCount;
758 ULONG TxAgg7MPDUCount;
759 ULONG TxAgg8MPDUCount;
760 ULONG TxAgg9MPDUCount;
761 ULONG TxAgg10MPDUCount;
762 ULONG TxAgg11MPDUCount;
763 ULONG TxAgg12MPDUCount;
764 ULONG TxAgg13MPDUCount;
765 ULONG TxAgg14MPDUCount;
766 ULONG TxAgg15MPDUCount;
767 ULONG TxAgg16MPDUCount;
769 LARGE_INTEGER TransmittedOctetsInAMSDU;
770 LARGE_INTEGER TransmittedAMSDUCount;
771 LARGE_INTEGER ReceivedOctesInAMSDUCount;
772 LARGE_INTEGER ReceivedAMSDUCount;
773 LARGE_INTEGER TransmittedAMPDUCount;
774 LARGE_INTEGER TransmittedMPDUsInAMPDUCount;
775 LARGE_INTEGER TransmittedOctetsInAMPDUCount;
776 LARGE_INTEGER MPDUInReceivedAMPDUCount;
777 } COUNTER_RALINK, *PCOUNTER_RALINK;
780 typedef struct _COUNTER_DRS {
781 // to record the each TX rate's quality. 0 is best, the bigger the worse.
782 USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
783 UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH];
784 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
785 ULONG CurrTxRateStableTime; // # of second in current TX rate
786 BOOLEAN fNoisyEnvironment;
787 BOOLEAN fLastSecAccordingRSSI;
788 UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down
789 UCHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction
790 ULONG LastTxOkCount;
791 } COUNTER_DRS, *PCOUNTER_DRS;
796 /***************************************************************************
797 * security key related data structure
798 **************************************************************************/
799 typedef struct _CIPHER_KEY {
800 UCHAR Key[16]; // right now we implement 4 keys, 128 bits max
801 UCHAR RxMic[8]; // make alignment
802 UCHAR TxMic[8];
803 UCHAR TxTsc[6]; // 48bit TSC value
804 UCHAR RxTsc[6]; // 48bit TSC value
805 UCHAR CipherAlg; // 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128
806 UCHAR KeyLen;
807 #ifdef CONFIG_STA_SUPPORT
808 UCHAR BssId[6];
809 #endif // CONFIG_STA_SUPPORT //
810 // Key length for each key, 0: entry is invalid
811 UCHAR Type; // Indicate Pairwise/Group when reporting MIC error
812 } CIPHER_KEY, *PCIPHER_KEY;
815 // structure to define WPA Group Key Rekey Interval
816 typedef struct PACKED _RT_802_11_WPA_REKEY {
817 ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
818 ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets
819 } RT_WPA_REKEY,*PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY;
823 typedef struct {
824 UCHAR Addr[MAC_ADDR_LEN];
825 UCHAR ErrorCode[2]; //00 01-Invalid authentication type
826 //00 02-Authentication timeout
827 //00 03-Challenge from AP failed
828 //00 04-Challenge to AP failed
829 BOOLEAN Reported;
830 } ROGUEAP_ENTRY, *PROGUEAP_ENTRY;
832 typedef struct {
833 UCHAR RogueApNr;
834 ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE];
835 } ROGUEAP_TABLE, *PROGUEAP_TABLE;
838 // Cisco IAPP format
840 typedef struct _CISCO_IAPP_CONTENT_
842 USHORT Length; //IAPP Length
843 UCHAR MessageType; //IAPP type
844 UCHAR FunctionCode; //IAPP function type
845 UCHAR DestinaionMAC[MAC_ADDR_LEN];
846 UCHAR SourceMAC[MAC_ADDR_LEN];
847 USHORT Tag; //Tag(element IE) - Adjacent AP report
848 USHORT TagLength; //Length of element not including 4 byte header
849 UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00
850 UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point
851 USHORT Channel;
852 USHORT SsidLen;
853 UCHAR Ssid[MAX_LEN_OF_SSID];
854 USHORT Seconds; //Seconds that the client has been disassociated.
855 } CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT;
859 * Fragment Frame structure
861 typedef struct _FRAGMENT_FRAME {
862 PNDIS_PACKET pFragPacket;
863 ULONG RxSize;
864 USHORT Sequence;
865 USHORT LastFrag;
866 ULONG Flags; // Some extra frame information. bit 0: LLC presented
867 } FRAGMENT_FRAME, *PFRAGMENT_FRAME;
871 // Packet information for NdisQueryPacket
873 typedef struct _PACKET_INFO {
874 UINT PhysicalBufferCount; // Physical breaks of buffer descripor chained
875 UINT BufferCount ; // Number of Buffer descriptor chained
876 UINT TotalPacketLength ; // Self explained
877 PNDIS_BUFFER pFirstBuffer; // Pointer to first buffer descriptor
878 } PACKET_INFO, *PPACKET_INFO;
882 // Arcfour Structure Added by PaulWu
884 typedef struct _ARCFOUR
886 UINT X;
887 UINT Y;
888 UCHAR STATE[256];
889 } ARCFOURCONTEXT, *PARCFOURCONTEXT;
893 // Tkip Key structure which RC4 key & MIC calculation
895 typedef struct _TKIP_KEY_INFO {
896 UINT nBytesInM; // # bytes in M for MICKEY
897 ULONG IV16;
898 ULONG IV32;
899 ULONG K0; // for MICKEY Low
900 ULONG K1; // for MICKEY Hig
901 ULONG L; // Current state for MICKEY
902 ULONG R; // Current state for MICKEY
903 ULONG M; // Message accumulator for MICKEY
904 UCHAR RC4KEY[16];
905 UCHAR MIC[8];
906 } TKIP_KEY_INFO, *PTKIP_KEY_INFO;
910 // Private / Misc data, counters for driver internal use
912 typedef struct __PRIVATE_STRUC {
913 UINT SystemResetCnt; // System reset counter
914 UINT TxRingFullCnt; // Tx ring full occurrance number
915 UINT PhyRxErrCnt; // PHY Rx error count, for debug purpose, might move to global counter
916 // Variables for WEP encryption / decryption in rtmp_wep.c
917 UINT FCSCRC32;
918 ARCFOURCONTEXT WEPCONTEXT;
919 // Tkip stuff
920 TKIP_KEY_INFO Tx;
921 TKIP_KEY_INFO Rx;
922 } PRIVATE_STRUC, *PPRIVATE_STRUC;
925 /***************************************************************************
926 * Channel and BBP related data structures
927 **************************************************************************/
928 // structure to tune BBP R66 (BBP TUNING)
929 typedef struct _BBP_R66_TUNING {
930 BOOLEAN bEnable;
931 USHORT FalseCcaLowerThreshold; // default 100
932 USHORT FalseCcaUpperThreshold; // default 512
933 UCHAR R66Delta;
934 UCHAR R66CurrentValue;
935 BOOLEAN R66LowerUpperSelect; //Before LinkUp, Used LowerBound or UpperBound as R66 value.
936 } BBP_R66_TUNING, *PBBP_R66_TUNING;
938 // structure to store channel TX power
939 typedef struct _CHANNEL_TX_POWER {
940 USHORT RemainingTimeForUse; //unit: sec
941 UCHAR Channel;
942 #ifdef DOT11N_DRAFT3
943 BOOLEAN bEffectedChannel; // For BW 40 operating in 2.4GHz , the "effected channel" is the channel that is covered in 40Mhz.
944 #endif // DOT11N_DRAFT3 //
945 CHAR Power;
946 CHAR Power2;
947 UCHAR MaxTxPwr;
948 UCHAR DfsReq;
949 } CHANNEL_TX_POWER, *PCHANNEL_TX_POWER;
951 // structure to store 802.11j channel TX power
952 typedef struct _CHANNEL_11J_TX_POWER {
953 UCHAR Channel;
954 UCHAR BW; // BW_10 or BW_20
955 CHAR Power;
956 CHAR Power2;
957 USHORT RemainingTimeForUse; //unit: sec
958 } CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER;
960 typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT {
961 UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status
962 UCHAR EvaluateStableCnt;
963 UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2
964 UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2
965 UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4
966 UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4
967 #ifdef CONFIG_STA_SUPPORT
968 SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2
969 SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4
970 #endif // CONFIG_STA_SUPPORT //
971 SHORT Pair1LastAvgRssi; //
972 SHORT Pair2LastAvgRssi; //
973 ULONG RcvPktNumWhenEvaluate;
974 BOOLEAN FirstPktArrivedWhenEvaluate;
975 RALINK_TIMER_STRUCT RxAntDiversityTimer;
976 } SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY;
979 /***************************************************************************
980 * structure for radar detection and channel switch
981 **************************************************************************/
982 typedef struct _RADAR_DETECT_STRUCT {
983 //BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h
984 UCHAR CSCount; //Channel switch counter
985 UCHAR CSPeriod; //Channel switch period (beacon count)
986 UCHAR RDCount; //Radar detection counter
987 UCHAR RDMode; //Radar Detection mode
988 UCHAR RDDurRegion; //Radar detection duration region
989 UCHAR BBPR16;
990 UCHAR BBPR17;
991 UCHAR BBPR18;
992 UCHAR BBPR21;
993 UCHAR BBPR22;
994 UCHAR BBPR64;
995 ULONG InServiceMonitorCount; // unit: sec
996 UINT8 DfsSessionTime;
997 #ifdef DFS_FCC_BW40_FIX
998 CHAR DfsSessionFccOff;
999 #endif
1000 BOOLEAN bFastDfs;
1001 UINT8 ChMovingTime;
1002 UINT8 LongPulseRadarTh;
1003 #ifdef MERGE_ARCH_TEAM
1004 CHAR AvgRssiReq;
1005 ULONG DfsLowerLimit;
1006 ULONG DfsUpperLimit;
1007 UINT8 FixDfsLimit;
1008 ULONG upperlimit;
1009 ULONG lowerlimit;
1010 #endif // MERGE_ARCH_TEAM //
1011 } RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT;
1013 #ifdef CARRIER_DETECTION_SUPPORT
1014 typedef enum CD_STATE_n
1016 CD_NORMAL,
1017 CD_SILENCE,
1018 CD_MAX_STATE
1019 } CD_STATE;
1021 #ifdef TONE_RADAR_DETECT_SUPPORT
1022 #define CARRIER_DETECT_RECHECK_TIME 3
1025 #ifdef CARRIER_SENSE_NEW_ALGO
1026 #define CARRIER_DETECT_CRITIRIA 400
1027 #define CARRIER_DETECT_STOP_RATIO 0x11
1028 #define CARRIER_DETECT_STOP_RATIO_OLD_3090 2
1029 #endif // CARRIER_SENSE_NEW_ALGO //
1032 #define CARRIER_DETECT_STOP_RECHECK_TIME 4
1033 #define CARRIER_DETECT_CRITIRIA_A 230
1034 #define CARRIER_DETECT_DELTA 7
1035 #define CARRIER_DETECT_DIV_FLAG 0
1036 #ifdef RT3090
1037 #define CARRIER_DETECT_THRESHOLD_3090A 0x1fffffff
1038 #endif // RT3090 //
1039 #ifdef RT3390
1040 #define CARRIER_DETECT_THRESHOLD 0x0fffffff
1041 #endif // RT3390 //
1042 #ifndef RT3390
1043 #define CARRIER_DETECT_THRESHOLD 0x0fffffff
1044 #endif // RT3390 //
1045 #endif // TONE_RADAR_DETECT_SUPPORT //
1047 typedef struct CARRIER_DETECTION_s
1049 BOOLEAN Enable;
1050 UINT8 CDSessionTime;
1051 UINT8 CDPeriod;
1052 CD_STATE CD_State;
1053 #ifdef TONE_RADAR_DETECT_SUPPORT
1054 UINT8 delta;
1055 UINT8 div_flag;
1056 UINT32 threshold;
1057 UINT8 recheck;
1058 UINT8 recheck1;
1059 UINT8 recheck2;
1060 UINT32 TimeStamp;
1061 UINT32 criteria;
1062 UINT32 CarrierDebug;
1063 ULONG idle_time;
1064 ULONG busy_time;
1065 ULONG Debug;
1066 #endif // TONE_RADAR_DETECT_SUPPORT //
1067 }CARRIER_DETECTION_STRUCT, *PCARRIER_DETECTION_STRUCT;
1068 #endif // CARRIER_DETECTION_SUPPORT //
1071 #ifdef NEW_DFS
1072 typedef struct _NewDFSDebug
1074 UCHAR channel;
1075 ULONG wait_time;
1076 UCHAR delta_delay_range;
1077 UCHAR delta_delay_step;
1078 UCHAR EL_range;
1079 UCHAR EL_step;
1080 UCHAR EH_range;
1081 UCHAR EH_step;
1082 UCHAR WL_range;
1083 UCHAR WL_step;
1084 UCHAR WH_range;
1085 UCHAR WH_step;
1086 ULONG T_expected;
1087 ULONG T_margin;
1088 UCHAR start;
1089 ULONG count;
1090 ULONG idx;
1092 }NewDFSDebug, *pNewDFSDebug;
1094 #define NEW_DFS_FCC_5_ENT_NUM 5
1095 #define NEW_DFS_DBG_PORT_ENT_NUM_POWER 8
1096 #define NEW_DFS_DBG_PORT_ENT_NUM (1 << NEW_DFS_DBG_PORT_ENT_NUM_POWER) // CE Debug Port entry number, 256
1097 #define NEW_DFS_DBG_PORT_MASK 0xff
1099 // Matched Period definition
1100 #define NEW_DFS_MPERIOD_ENT_NUM_POWER 8
1101 #define NEW_DFS_MPERIOD_ENT_NUM (1 << NEW_DFS_MPERIOD_ENT_NUM_POWER) // CE Period Table entry number, 512
1102 #define NEW_DFS_MAX_CHANNEL 4
1104 typedef struct _NewDFSDebugPort{
1105 ULONG counter;
1106 ULONG timestamp;
1107 USHORT width;
1108 USHORT start_idx; // start index to period table
1109 USHORT end_idx; // end index to period table
1110 }NewDFSDebugPort, *pNewDFSDebugPort;
1112 // Matched Period Table
1113 typedef struct _NewDFSMPeriod{
1114 USHORT idx;
1115 USHORT width;
1116 USHORT idx2;
1117 USHORT width2;
1118 ULONG period;
1119 }NewDFSMPeriod, *pNewDFSMPeriod;
1121 #endif // NEW_DFS //
1124 typedef enum _ABGBAND_STATE_ {
1125 UNKNOWN_BAND,
1126 BG_BAND,
1127 A_BAND,
1128 } ABGBAND_STATE;
1130 #ifdef RTMP_MAC_PCI
1131 #ifdef CONFIG_STA_SUPPORT
1132 // Power save method control
1133 typedef union _PS_CONTROL {
1134 struct {
1135 ULONG EnablePSinIdle:1; // Enable radio off when not connect to AP. radio on only when sitesurvey,
1136 ULONG EnableNewPS:1; // Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe.
1137 ULONG rt30xxPowerMode:2; // Power Level Mode for rt30xx chip
1138 ULONG rt30xxFollowHostASPM:1; // Card Follows Host's setting for rt30xx chip.
1139 ULONG rt30xxForceASPMTest:1; // Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode.
1140 ULONG rsv:26; // Radio Measurement Enable
1141 } field;
1142 ULONG word;
1143 } PS_CONTROL, *PPS_CONTROL;
1144 #endif // CONFIG_STA_SUPPORT //
1145 #endif // RTMP_MAC_PCI //
1146 /***************************************************************************
1147 * structure for MLME state machine
1148 **************************************************************************/
1149 typedef struct _MLME_STRUCT {
1150 #ifdef CONFIG_STA_SUPPORT
1151 // STA state machines
1152 STATE_MACHINE CntlMachine;
1153 STATE_MACHINE AssocMachine;
1154 STATE_MACHINE AuthMachine;
1155 STATE_MACHINE AuthRspMachine;
1156 STATE_MACHINE SyncMachine;
1157 STATE_MACHINE WpaPskMachine;
1158 STATE_MACHINE LeapMachine;
1159 STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE];
1160 STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE];
1161 STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE];
1162 STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE];
1163 #endif // CONFIG_STA_SUPPORT //
1164 STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE];
1165 // Action
1166 STATE_MACHINE ActMachine;
1169 #ifdef QOS_DLS_SUPPORT
1170 STATE_MACHINE DlsMachine;
1171 STATE_MACHINE_FUNC DlsFunc[DLS_FUNC_SIZE];
1172 #endif // QOS_DLS_SUPPORT //
1175 // common WPA state machine
1176 STATE_MACHINE WpaMachine;
1177 STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE];
1181 ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming
1182 ULONG Now32; // latch the value of NdisGetSystemUpTime()
1183 ULONG LastSendNULLpsmTime;
1185 BOOLEAN bRunning;
1186 NDIS_SPIN_LOCK TaskLock;
1187 MLME_QUEUE Queue;
1189 UINT ShiftReg;
1191 RALINK_TIMER_STRUCT PeriodicTimer;
1192 RALINK_TIMER_STRUCT APSDPeriodicTimer;
1193 RALINK_TIMER_STRUCT LinkDownTimer;
1194 RALINK_TIMER_STRUCT LinkUpTimer;
1195 #ifdef RTMP_MAC_PCI
1196 UCHAR bPsPollTimerRunning;
1197 RALINK_TIMER_STRUCT PsPollTimer;
1198 RALINK_TIMER_STRUCT RadioOnOffTimer;
1199 #endif // RTMP_MAC_PCI //
1200 ULONG PeriodicRound;
1201 ULONG OneSecPeriodicRound;
1203 UCHAR RealRxPath;
1204 BOOLEAN bLowThroughput;
1205 BOOLEAN bEnableAutoAntennaCheck;
1206 RALINK_TIMER_STRUCT RxAntEvalTimer;
1208 #ifdef RT30xx
1209 UCHAR CaliBW40RfR24;
1210 UCHAR CaliBW20RfR24;
1211 #endif // RT30xx //
1213 } MLME_STRUCT, *PMLME_STRUCT;
1216 #ifdef DOT11_N_SUPPORT
1217 /***************************************************************************
1218 * 802.11 N related data structures
1219 **************************************************************************/
1220 struct reordering_mpdu
1222 struct reordering_mpdu *next;
1223 PNDIS_PACKET pPacket; /* coverted to 802.3 frame */
1224 int Sequence; /* sequence number of MPDU */
1225 BOOLEAN bAMSDU;
1228 struct reordering_list
1230 struct reordering_mpdu *next;
1231 int qlen;
1234 struct reordering_mpdu_pool
1236 PVOID mem;
1237 NDIS_SPIN_LOCK lock;
1238 struct reordering_list freelist;
1241 typedef enum _REC_BLOCKACK_STATUS
1243 Recipient_NONE=0,
1244 Recipient_USED,
1245 Recipient_HandleRes,
1246 Recipient_Accept
1247 } REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS;
1249 typedef enum _ORI_BLOCKACK_STATUS
1251 Originator_NONE=0,
1252 Originator_USED,
1253 Originator_WaitRes,
1254 Originator_Done
1255 } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS;
1257 typedef struct _BA_ORI_ENTRY{
1258 UCHAR Wcid;
1259 UCHAR TID;
1260 UCHAR BAWinSize;
1261 UCHAR Token;
1262 // Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header.
1263 USHORT Sequence;
1264 USHORT TimeOutValue;
1265 ORI_BLOCKACK_STATUS ORI_BA_Status;
1266 RALINK_TIMER_STRUCT ORIBATimer;
1267 PVOID pAdapter;
1268 } BA_ORI_ENTRY, *PBA_ORI_ENTRY;
1270 typedef struct _BA_REC_ENTRY {
1271 UCHAR Wcid;
1272 UCHAR TID;
1273 UCHAR BAWinSize; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU.
1274 //UCHAR NumOfRxPkt;
1275 //UCHAR Curindidx; // the head in the RX reordering buffer
1276 USHORT LastIndSeq;
1277 // USHORT LastIndSeqAtTimer;
1278 USHORT TimeOutValue;
1279 RALINK_TIMER_STRUCT RECBATimer;
1280 ULONG LastIndSeqAtTimer;
1281 ULONG nDropPacket;
1282 ULONG rcvSeq;
1283 REC_BLOCKACK_STATUS REC_BA_Status;
1284 // UCHAR RxBufIdxUsed;
1285 // corresponding virtual address for RX reordering packet storage.
1286 //RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF];
1287 NDIS_SPIN_LOCK RxReRingLock; // Rx Ring spinlock
1288 // struct _BA_REC_ENTRY *pNext;
1289 PVOID pAdapter;
1290 struct reordering_list list;
1291 } BA_REC_ENTRY, *PBA_REC_ENTRY;
1294 typedef struct {
1295 ULONG numAsRecipient; // I am recipient of numAsRecipient clients. These client are in the BARecEntry[]
1296 ULONG numAsOriginator; // I am originator of numAsOriginator clients. These clients are in the BAOriEntry[]
1297 ULONG numDoneOriginator; // count Done Originator sessions
1298 BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE];
1299 BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE];
1300 } BA_TABLE, *PBA_TABLE;
1302 //For QureyBATableOID use;
1303 typedef struct PACKED _OID_BA_REC_ENTRY{
1304 UCHAR MACAddr[MAC_ADDR_LEN];
1305 UCHAR BaBitmap; // if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize
1306 UCHAR rsv;
1307 UCHAR BufSize[8];
1308 REC_BLOCKACK_STATUS REC_BA_Status[8];
1309 } OID_BA_REC_ENTRY, *POID_BA_REC_ENTRY;
1311 //For QureyBATableOID use;
1312 typedef struct PACKED _OID_BA_ORI_ENTRY{
1313 UCHAR MACAddr[MAC_ADDR_LEN];
1314 UCHAR BaBitmap; // if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize, read ORI_BA_Status[TID] for status
1315 UCHAR rsv;
1316 UCHAR BufSize[8];
1317 ORI_BLOCKACK_STATUS ORI_BA_Status[8];
1318 } OID_BA_ORI_ENTRY, *POID_BA_ORI_ENTRY;
1320 typedef struct _QUERYBA_TABLE{
1321 OID_BA_ORI_ENTRY BAOriEntry[32];
1322 OID_BA_REC_ENTRY BARecEntry[32];
1323 UCHAR OriNum;// Number of below BAOriEntry
1324 UCHAR RecNum;// Number of below BARecEntry
1325 } QUERYBA_TABLE, *PQUERYBA_TABLE;
1327 typedef union _BACAP_STRUC {
1328 #ifdef RT_BIG_ENDIAN
1329 struct {
1330 UINT32 :4;
1331 UINT32 b2040CoexistScanSup:1; //As Sta, support do 2040 coexistence scan for AP. As Ap, support monitor trigger event to check if can use BW 40MHz.
1332 UINT32 bHtAdhoc:1; // adhoc can use ht rate.
1333 UINT32 MMPSmode:2; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable
1334 UINT32 AmsduSize:1; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935};
1335 UINT32 AmsduEnable:1; //Enable AMSDU transmisstion
1336 UINT32 MpduDensity:3;
1337 UINT32 Policy:2; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use
1338 UINT32 AutoBA:1; // automatically BA
1339 UINT32 TxBAWinLimit:8;
1340 UINT32 RxBAWinLimit:8;
1341 } field;
1342 #else
1343 struct {
1344 UINT32 RxBAWinLimit:8;
1345 UINT32 TxBAWinLimit:8;
1346 UINT32 AutoBA:1; // automatically BA
1347 UINT32 Policy:2; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use
1348 UINT32 MpduDensity:3;
1349 UINT32 AmsduEnable:1; //Enable AMSDU transmisstion
1350 UINT32 AmsduSize:1; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935};
1351 UINT32 MMPSmode:2; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable
1352 UINT32 bHtAdhoc:1; // adhoc can use ht rate.
1353 UINT32 b2040CoexistScanSup:1; //As Sta, support do 2040 coexistence scan for AP. As Ap, support monitor trigger event to check if can use BW 40MHz.
1354 UINT32 :4;
1355 } field;
1356 #endif
1357 UINT32 word;
1358 } BACAP_STRUC, *PBACAP_STRUC;
1361 typedef struct {
1362 BOOLEAN IsRecipient;
1363 UCHAR MACAddr[MAC_ADDR_LEN];
1364 UCHAR TID;
1365 UCHAR nMSDU;
1366 USHORT TimeOut;
1367 BOOLEAN bAllTid; // If True, delete all TID for BA sessions with this MACaddr.
1368 } OID_ADD_BA_ENTRY, *POID_ADD_BA_ENTRY;
1371 #ifdef DOT11N_DRAFT3
1372 typedef enum _BSS2040COEXIST_FLAG{
1373 BSS_2040_COEXIST_DISABLE = 0,
1374 BSS_2040_COEXIST_TIMER_FIRED = 1,
1375 BSS_2040_COEXIST_INFO_SYNC = 2,
1376 BSS_2040_COEXIST_INFO_NOTIFY = 4,
1377 }BSS2040COEXIST_FLAG;
1378 #endif // DOT11N_DRAFT3 //
1380 #define IS_HT_STA(_pMacEntry) \
1381 (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX)
1383 #define IS_HT_RATE(_pMacEntry) \
1384 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
1386 #define PEER_IS_HT_RATE(_pMacEntry) \
1387 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
1389 #endif // DOT11_N_SUPPORT //
1392 //This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic)
1393 typedef struct _IOT_STRUC {
1394 UCHAR Threshold[2];
1395 UCHAR ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[0]
1396 UCHAR RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[1]
1397 ULONG OneSecInWindowCount;
1398 ULONG OneSecFrameDuplicateCount;
1399 ULONG OneSecOutWindowCount;
1400 UCHAR DelOriAct;
1401 UCHAR DelRecAct;
1402 UCHAR RTSShortProt;
1403 UCHAR RTSLongProt;
1404 BOOLEAN bRTSLongProtOn;
1405 #ifdef CONFIG_STA_SUPPORT
1406 BOOLEAN bLastAtheros;
1407 BOOLEAN bCurrentAtheros;
1408 BOOLEAN bNowAtherosBurstOn;
1409 BOOLEAN bNextDisableRxBA;
1410 BOOLEAN bToggle;
1411 #endif // CONFIG_STA_SUPPORT //
1412 } IOT_STRUC, *PIOT_STRUC;
1415 // This is the registry setting for 802.11n transmit setting. Used in advanced page.
1416 typedef union _REG_TRANSMIT_SETTING {
1417 #ifdef RT_BIG_ENDIAN
1418 struct {
1419 UINT32 rsv:13;
1420 UINT32 EXTCHA:2;
1421 UINT32 HTMODE:1;
1422 UINT32 TRANSNO:2;
1423 UINT32 STBC:1; //SPACE
1424 UINT32 ShortGI:1;
1425 UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz
1426 UINT32 TxBF:1; // 3*3
1427 UINT32 rsv0:10;
1428 //UINT32 MCS:7; // MCS
1429 //UINT32 PhyMode:4;
1430 } field;
1431 #else
1432 struct {
1433 //UINT32 PhyMode:4;
1434 //UINT32 MCS:7; // MCS
1435 UINT32 rsv0:10;
1436 UINT32 TxBF:1;
1437 UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz
1438 UINT32 ShortGI:1;
1439 UINT32 STBC:1; //SPACE
1440 UINT32 TRANSNO:2;
1441 UINT32 HTMODE:1;
1442 UINT32 EXTCHA:2;
1443 UINT32 rsv:13;
1444 } field;
1445 #endif
1446 UINT32 word;
1447 } REG_TRANSMIT_SETTING, *PREG_TRANSMIT_SETTING;
1450 typedef union _DESIRED_TRANSMIT_SETTING {
1451 #ifdef RT_BIG_ENDIAN
1452 struct {
1453 USHORT rsv:3;
1454 USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode.
1455 USHORT PhyMode:4;
1456 USHORT MCS:7; // MCS
1457 } field;
1458 #else
1459 struct {
1460 USHORT MCS:7; // MCS
1461 USHORT PhyMode:4;
1462 USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode.
1463 USHORT rsv:3;
1464 } field;
1465 #endif
1466 USHORT word;
1467 } DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING;
1472 /***************************************************************************
1473 * Multiple SSID related data structures
1474 **************************************************************************/
1475 #define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */
1476 #define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */
1478 /* clear bcmc TIM bit */
1479 #define WLAN_MR_TIM_BCMC_CLEAR(apidx) \
1480 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] &= ~BIT8[0];
1482 /* set bcmc TIM bit */
1483 #define WLAN_MR_TIM_BCMC_SET(apidx) \
1484 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] |= BIT8[0];
1486 /* clear a station PS TIM bit */
1487 #define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, wcid) \
1488 { UCHAR tim_offset = wcid >> 3; \
1489 UCHAR bit_offset = wcid & 0x7; \
1490 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); }
1492 /* set a station PS TIM bit */
1493 #define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \
1494 { UCHAR tim_offset = wcid >> 3; \
1495 UCHAR bit_offset = wcid & 0x7; \
1496 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; }
1499 // configuration common to OPMODE_AP as well as OPMODE_STA
1500 typedef struct _COMMON_CONFIG {
1502 BOOLEAN bCountryFlag;
1503 UCHAR CountryCode[3];
1504 UCHAR Geography;
1505 UCHAR CountryRegion; // Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel
1506 UCHAR CountryRegionForABand; // Enum of country region for A band
1507 UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED
1508 UCHAR DesiredPhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED
1509 USHORT Dsifs; // in units of usec
1510 ULONG PacketFilter; // Packet filter for receiving
1511 UINT8 RegulatoryClass[MAX_NUM_OF_REGULATORY_CLASS];
1513 CHAR Ssid[MAX_LEN_OF_SSID]; // NOT NULL-terminated
1514 UCHAR SsidLen; // the actual ssid length in used
1515 UCHAR LastSsidLen; // the actual ssid length in used
1516 CHAR LastSsid[MAX_LEN_OF_SSID]; // NOT NULL-terminated
1517 UCHAR LastBssid[MAC_ADDR_LEN];
1519 UCHAR Bssid[MAC_ADDR_LEN];
1520 USHORT BeaconPeriod;
1521 UCHAR Channel;
1522 UCHAR CentralChannel; // Central Channel when using 40MHz is indicating. not real channel.
1524 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
1525 UCHAR SupRateLen;
1526 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
1527 UCHAR ExtRateLen;
1528 UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; // OID_802_11_DESIRED_RATES
1529 UCHAR MaxDesiredRate;
1530 UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES];
1532 ULONG BasicRateBitmap; // backup basic ratebitmap
1534 BOOLEAN bAPSDCapable;
1535 BOOLEAN bInServicePeriod;
1536 BOOLEAN bAPSDAC_BE;
1537 BOOLEAN bAPSDAC_BK;
1538 BOOLEAN bAPSDAC_VI;
1539 BOOLEAN bAPSDAC_VO;
1541 /* because TSPEC can modify the APSD flag, we need to keep the APSD flag
1542 requested in association stage from the station;
1543 we need to recover the APSD flag after the TSPEC is deleted. */
1544 BOOLEAN bACMAPSDBackup[4]; /* for delivery-enabled & trigger-enabled both */
1545 BOOLEAN bACMAPSDTr[4]; /* no use */
1547 BOOLEAN bNeedSendTriggerFrame;
1548 BOOLEAN bAPSDForcePowerSave; // Force power save mode, should only use in APSD-STAUT
1549 ULONG TriggerTimerCount;
1550 UCHAR MaxSPLength;
1551 UCHAR BBPCurrentBW; // BW_10, BW_20, BW_40
1552 // move to MULTISSID_STRUCT for MBSS
1553 //HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
1554 REG_TRANSMIT_SETTING RegTransmitSetting; //registry transmit setting. this is for reading registry setting only. not useful.
1555 //UCHAR FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode
1556 UCHAR TxRate; // Same value to fill in TXD. TxRate is 6-bit
1557 UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1558 UCHAR TxRateIndex; // Tx rate index in RateSwitchTable
1559 UCHAR TxRateTableSize; // Valid Tx rate table size in RateSwitchTable
1560 //BOOLEAN bAutoTxRateSwitch;
1561 UCHAR MinTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1562 UCHAR RtsRate; // RATE_xxx
1563 HTTRANSMIT_SETTING MlmeTransmit; // MGMT frame PHY rate setting when operatin at Ht rate.
1564 UCHAR MlmeRate; // RATE_xxx, used to send MLME frames
1565 UCHAR BasicMlmeRate; // Default Rate for sending MLME frames
1567 USHORT RtsThreshold; // in unit of BYTE
1568 USHORT FragmentThreshold; // in unit of BYTE
1570 UCHAR TxPower; // in unit of mW
1571 ULONG TxPowerPercentage; // 0~100 %
1572 ULONG TxPowerDefault; // keep for TxPowerPercentage
1573 UINT8 PwrConstraint;
1575 #ifdef DOT11_N_SUPPORT
1576 BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0
1577 BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0
1578 #endif // DOT11_N_SUPPORT //
1579 IOT_STRUC IOTestParm; // 802.11n InterOpbility Test Parameter;
1580 ULONG TxPreamble; // Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto
1581 BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable
1582 ULONG UseBGProtection; // 0: auto, 1: always use, 2: always not use
1583 BOOLEAN bUseShortSlotTime; // 0: disable, 1 - use short slot (9us)
1584 BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST
1585 BOOLEAN bAggregationCapable; // 1: enable TX aggregation when the peer supports it
1586 BOOLEAN bPiggyBackCapable; // 1: enable TX piggy-back according MAC's version
1587 BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec.
1588 ULONG DisableOLBCDetect; // 0: enable OLBC detect; 1 disable OLBC detect
1590 #ifdef DOT11_N_SUPPORT
1591 BOOLEAN bRdg;
1592 #endif // DOT11_N_SUPPORT //
1593 BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM
1594 QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP
1595 EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP
1596 QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP
1597 UCHAR AckPolicy[4]; // ACK policy of the specified AC. see ACK_xxx
1598 #ifdef CONFIG_STA_SUPPORT
1599 BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS
1600 #endif // CONFIG_STA_SUPPORT //
1601 // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular
1602 // BOOLEAN control, either ON or OFF. These flags should always be accessed via
1603 // OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros.
1604 // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition
1605 ULONG OpStatusFlags;
1607 BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff.
1608 ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode.
1609 #ifdef ANT_DIVERSITY_SUPPORT
1610 UCHAR bRxAntDiversity; // 0:disable, 1:enable Software Rx Antenna Diversity.
1611 #endif // ANT_DIVERSITY_SUPPORT //
1613 // IEEE802.11H--DFS.
1614 RADAR_DETECT_STRUCT RadarDetect;
1616 #ifdef CARRIER_DETECTION_SUPPORT
1617 CARRIER_DETECTION_STRUCT CarrierDetect;
1618 #endif // CARRIER_DETECTION_SUPPORT //
1620 #ifdef DOT11_N_SUPPORT
1621 // HT
1622 UCHAR BASize; // USer desired BAWindowSize. Should not exceed our max capability
1623 //RT_HT_CAPABILITY SupportedHtPhy;
1624 RT_HT_CAPABILITY DesiredHtPhy;
1625 HT_CAPABILITY_IE HtCapability;
1626 ADD_HT_INFO_IE AddHTInfo; // Useful as AP.
1627 //This IE is used with channel switch announcement element when changing to a new 40MHz.
1628 //This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp.
1629 NEW_EXT_CHAN_IE NewExtChanOffset; //7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present
1631 #ifdef DOT11N_DRAFT3
1632 UCHAR Bss2040CoexistFlag; // bit 0: bBssCoexistTimerRunning, bit 1: NeedSyncAddHtInfo.
1633 RALINK_TIMER_STRUCT Bss2040CoexistTimer;
1635 //This IE is used for 20/40 BSS Coexistence.
1636 BSS_2040_COEXIST_IE BSS2040CoexistInfo;
1637 // ====== 11n D3.0 =======================>
1638 USHORT Dot11OBssScanPassiveDwell; // Unit : TU. 5~1000
1639 USHORT Dot11OBssScanActiveDwell; // Unit : TU. 10~1000
1640 USHORT Dot11BssWidthTriggerScanInt; // Unit : Second
1641 USHORT Dot11OBssScanPassiveTotalPerChannel; // Unit : TU. 200~10000
1642 USHORT Dot11OBssScanActiveTotalPerChannel; // Unit : TU. 20~10000
1643 USHORT Dot11BssWidthChanTranDelayFactor;
1644 USHORT Dot11OBssScanActivityThre; // Unit : percentage
1646 ULONG Dot11BssWidthChanTranDelay; // multiple of (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor)
1647 ULONG CountDownCtr; // CountDown Counter from (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor)
1649 NDIS_SPIN_LOCK TriggerEventTabLock;
1650 BSS_2040_COEXIST_IE LastBSSCoexist2040;
1651 BSS_2040_COEXIST_IE BSSCoexist2040;
1652 TRIGGER_EVENT_TAB TriggerEventTab;
1653 UCHAR ChannelListIdx;
1654 // <====== 11n D3.0 =======================
1655 BOOLEAN bOverlapScanning;
1656 #endif // DOT11N_DRAFT3 //
1658 BOOLEAN bHTProtect;
1659 BOOLEAN bMIMOPSEnable;
1660 BOOLEAN bBADecline;
1661 //2008/11/05: KH add to support Antenna power-saving of AP<--
1662 BOOLEAN bGreenAPEnable;
1663 BOOLEAN bBlockAntDivforGreenAP;
1664 //2008/11/05: KH add to support Antenna power-saving of AP-->
1665 BOOLEAN bDisableReordering;
1666 BOOLEAN bForty_Mhz_Intolerant;
1667 BOOLEAN bExtChannelSwitchAnnouncement;
1668 BOOLEAN bRcvBSSWidthTriggerEvents;
1669 ULONG LastRcvBSSWidthTriggerEventsTime;
1671 UCHAR TxBASize;
1672 #endif // DOT11_N_SUPPORT //
1674 // Enable wireless event
1675 BOOLEAN bWirelessEvent;
1676 BOOLEAN bWiFiTest; // Enable this parameter for WiFi test
1678 // Tx & Rx Stream number selection
1679 UCHAR TxStream;
1680 UCHAR RxStream;
1682 // transmit phy mode, trasmit rate for Multicast.
1683 #ifdef MCAST_RATE_SPECIFIC
1684 UCHAR McastTransmitMcs;
1685 UCHAR McastTransmitPhyMode;
1686 #endif // MCAST_RATE_SPECIFIC //
1688 BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled
1692 NDIS_SPIN_LOCK MeasureReqTabLock;
1693 PMEASURE_REQ_TAB pMeasureReqTab;
1695 NDIS_SPIN_LOCK TpcReqTabLock;
1696 PTPC_REQ_TAB pTpcReqTab;
1698 // transmit phy mode, trasmit rate for Multicast.
1699 #ifdef MCAST_RATE_SPECIFIC
1700 HTTRANSMIT_SETTING MCastPhyMode;
1701 #endif // MCAST_RATE_SPECIFIC //
1703 #ifdef SINGLE_SKU
1704 UINT16 DefineMaxTxPwr;
1705 #endif // SINGLE_SKU //
1708 BOOLEAN PSPXlink; // 0: Disable. 1: Enable
1711 #if defined(RT305x)||defined(RT30xx)
1712 // request by Gary, for High Power issue
1713 UCHAR HighPowerPatchDisabled;
1714 #endif
1716 BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */
1717 } COMMON_CONFIG, *PCOMMON_CONFIG;
1720 #ifdef CONFIG_STA_SUPPORT
1721 /* Modified by Wu Xi-Kun 4/21/2006 */
1722 // STA configuration and status
1723 typedef struct _STA_ADMIN_CONFIG {
1724 // GROUP 1 -
1725 // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe
1726 // the user intended configuration, but not necessary fully equal to the final
1727 // settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either
1728 // AP or IBSS holder).
1729 // Once initialized, user configuration can only be changed via OID_xxx
1730 UCHAR BssType; // BSS_INFRA or BSS_ADHOC
1731 USHORT AtimWin; // used when starting a new IBSS
1733 // GROUP 2 -
1734 // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe
1735 // the user intended configuration, and should be always applied to the final
1736 // settings in ACTIVE BSS without compromising with the BSS holder.
1737 // Once initialized, user configuration can only be changed via OID_xxx
1738 UCHAR RssiTrigger;
1739 UCHAR RssiTriggerMode; // RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD
1740 USHORT DefaultListenCount; // default listen count;
1741 ULONG WindowsPowerMode; // Power mode for AC power
1742 ULONG WindowsBatteryPowerMode; // Power mode for battery if exists
1743 BOOLEAN bWindowsACCAMEnable; // Enable CAM power mode when AC on
1744 BOOLEAN bAutoReconnect; // Set to TRUE when setting OID_802_11_SSID with no matching BSSID
1745 ULONG WindowsPowerProfile; // Windows power profile, for NDIS5.1 PnP
1747 // MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1)
1748 USHORT Psm; // power management mode (PWR_ACTIVE|PWR_SAVE)
1749 USHORT DisassocReason;
1750 UCHAR DisassocSta[MAC_ADDR_LEN];
1751 USHORT DeauthReason;
1752 UCHAR DeauthSta[MAC_ADDR_LEN];
1753 USHORT AuthFailReason;
1754 UCHAR AuthFailSta[MAC_ADDR_LEN];
1756 NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X
1757 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
1758 NDIS_802_11_WEP_STATUS WepStatus;
1759 NDIS_802_11_WEP_STATUS OrigWepStatus; // Original wep status set from OID
1761 // Add to support different cipher suite for WPA2/WPA mode
1762 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite
1763 NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite
1764 BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites
1765 USHORT RsnCapability;
1767 NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
1769 UCHAR WpaPassPhrase[64]; // WPA PSK pass phrase
1770 UINT WpaPassPhraseLen; // the length of WPA PSK pass phrase
1771 UCHAR PMK[32]; // WPA PSK mode PMK
1772 UCHAR PTK[64]; // WPA PSK mode PTK
1773 UCHAR GTK[32]; // GTK from authenticator
1774 BSSID_INFO SavedPMK[PMKID_NO];
1775 UINT SavedPMKNum; // Saved PMKID number
1777 UCHAR DefaultKeyId;
1780 // WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED
1781 UCHAR PortSecured;
1783 // For WPA countermeasures
1784 ULONG LastMicErrorTime; // record last MIC error time
1785 ULONG MicErrCnt; // Should be 0, 1, 2, then reset to zero (after disassoiciation).
1786 BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred.
1787 // For WPA-PSK supplicant state
1788 WPA_STATE WpaState; // Default is SS_NOTUSE and handled by microsoft 802.1x
1789 UCHAR ReplayCounter[8];
1790 UCHAR ANonce[32]; // ANonce for WPA-PSK from aurhenticator
1791 UCHAR SNonce[32]; // SNonce for WPA-PSK
1793 UCHAR LastSNR0; // last received BEACON's SNR
1794 UCHAR LastSNR1; // last received BEACON's SNR for 2nd antenna
1795 RSSI_SAMPLE RssiSample;
1796 ULONG NumOfAvgRssiSample;
1798 ULONG LastBeaconRxTime; // OS's timestamp of the last BEACON RX time
1799 ULONG Last11bBeaconRxTime; // OS's timestamp of the last 11B BEACON RX time
1800 ULONG Last11gBeaconRxTime; // OS's timestamp of the last 11G BEACON RX time
1801 ULONG Last20NBeaconRxTime; // OS's timestamp of the last 20MHz N BEACON RX time
1803 ULONG LastScanTime; // Record last scan time for issue BSSID_SCAN_LIST
1804 ULONG ScanCnt; // Scan counts since most recent SSID, BSSID, SCAN OID request
1805 BOOLEAN bSwRadio; // Software controlled Radio On/Off, TRUE: On
1806 BOOLEAN bHwRadio; // Hardware controlled Radio On/Off, TRUE: On
1807 BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state
1808 BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled
1809 BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation
1811 // New for WPA, windows want us to to keep association information and
1812 // Fixed IEs from last association response
1813 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
1814 USHORT ReqVarIELen; // Length of next VIE include EID & Length
1815 UCHAR ReqVarIEs[MAX_VIE_LEN]; // The content saved here should be little-endian format.
1816 USHORT ResVarIELen; // Length of next VIE include EID & Length
1817 UCHAR ResVarIEs[MAX_VIE_LEN];
1819 UCHAR RSNIE_Len;
1820 UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be little-endian format.
1822 ULONG CLBusyBytes; // Save the total bytes received durning channel load scan time
1823 USHORT RPIDensity[8]; // Array for RPI density collection
1825 UCHAR RMReqCnt; // Number of measurement request saved.
1826 UCHAR CurrentRMReqIdx; // Number of measurement request saved.
1827 BOOLEAN ParallelReq; // Parallel measurement, only one request performed,
1828 // It must be the same channel with maximum duration
1829 USHORT ParallelDuration; // Maximum duration for parallel measurement
1830 UCHAR ParallelChannel; // Only one channel with parallel measurement
1831 USHORT IAPPToken; // IAPP dialog token
1832 // Hack for channel load and noise histogram parameters
1833 UCHAR NHFactor; // Parameter for Noise histogram
1834 UCHAR CLFactor; // Parameter for channel load
1836 RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer;
1837 BOOLEAN StaQuickResponeForRateUpTimerRunning;
1839 UCHAR DtimCount; // 0.. DtimPeriod-1
1840 UCHAR DtimPeriod; // default = 3
1842 #ifdef QOS_DLS_SUPPORT
1843 RT_802_11_DLS DLSEntry[MAX_NUM_OF_DLS_ENTRY];
1844 UCHAR DlsReplayCounter[8];
1845 #endif // QOS_DLS_SUPPORT //
1846 ////////////////////////////////////////////////////////////////////////////////////////
1847 // This is only for WHQL test.
1848 BOOLEAN WhqlTest;
1849 ////////////////////////////////////////////////////////////////////////////////////////
1851 RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer;
1852 // Fast Roaming
1853 BOOLEAN bAutoRoaming; // 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI
1854 CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value.
1856 #ifdef WPA_SUPPLICANT_SUPPORT
1857 BOOLEAN IEEE8021X;
1858 BOOLEAN IEEE8021x_required_keys;
1859 CIPHER_KEY DesireSharedKey[4]; // Record user desired WEP keys
1860 UCHAR DesireSharedKeyId;
1862 // 0: driver ignores wpa_supplicant
1863 // 1: wpa_supplicant initiates scanning and AP selection
1864 // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters
1865 UCHAR WpaSupplicantUP;
1866 UCHAR WpaSupplicantScanCount;
1867 BOOLEAN bRSN_IE_FromWpaSupplicant;
1868 #endif // WPA_SUPPLICANT_SUPPORT //
1870 CHAR dev_name[16];
1871 USHORT OriDevType;
1873 BOOLEAN bTGnWifiTest;
1874 BOOLEAN bScanReqIsFromWebUI;
1876 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
1877 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting;
1878 RT_HT_PHY_INFO DesiredHtPhyInfo;
1879 BOOLEAN bAutoTxRateSwitch;
1881 #ifdef RTMP_MAC_PCI
1882 UCHAR BBPR3;
1883 // PS Control has 2 meanings for advanced power save function.
1884 // 1. EnablePSinIdle : When no connection, always radio off except need to do site survey.
1885 // 2. EnableNewPS : will save more current in sleep or radio off mode.
1886 PS_CONTROL PSControl;
1887 #endif // RTMP_MAC_PCI //
1889 #ifdef EXT_BUILD_CHANNEL_LIST
1890 UCHAR IEEE80211dClientMode;
1891 UCHAR StaOriCountryCode[3];
1892 UCHAR StaOriGeography;
1893 #endif // EXT_BUILD_CHANNEL_LIST //
1897 BOOLEAN bAutoConnectByBssid;
1898 ULONG BeaconLostTime; // seconds
1899 BOOLEAN bForceTxBurst; // 1: force enble TX PACKET BURST, 0: disable
1900 } STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG;
1902 // This data structure keep the current active BSS/IBSS's configuration that this STA
1903 // had agreed upon joining the network. Which means these parameters are usually decided
1904 // by the BSS/IBSS creator instead of user configuration. Data in this data structurre
1905 // is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE.
1906 // Normally, after SCAN or failed roaming attempts, we need to recover back to
1907 // the current active settings.
1908 typedef struct _STA_ACTIVE_CONFIG {
1909 USHORT Aid;
1910 USHORT AtimWin; // in kusec; IBSS parameter set element
1911 USHORT CapabilityInfo;
1912 USHORT CfpMaxDuration;
1913 USHORT CfpPeriod;
1915 // Copy supported rate from desired AP's beacon. We are trying to match
1916 // AP's supported and extended rate settings.
1917 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
1918 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
1919 UCHAR SupRateLen;
1920 UCHAR ExtRateLen;
1921 // Copy supported ht from desired AP's beacon. We are trying to match
1922 RT_HT_PHY_INFO SupportedPhyInfo;
1923 RT_HT_CAPABILITY SupportedHtPhy;
1924 } STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG;
1928 #endif // CONFIG_STA_SUPPORT //
1932 typedef struct _MAC_TABLE_ENTRY {
1933 //Choose 1 from ValidAsWDS and ValidAsCLI to validize.
1934 BOOLEAN ValidAsCLI; // Sta mode, set this TRUE after Linkup,too.
1935 BOOLEAN ValidAsWDS; // This is WDS Entry. only for AP mode.
1936 BOOLEAN ValidAsApCli; //This is a AP-Client entry, only for AP mode which enable AP-Client functions.
1937 BOOLEAN ValidAsMesh;
1938 BOOLEAN ValidAsDls; // This is DLS Entry. only for STA mode.
1939 BOOLEAN isCached;
1940 BOOLEAN bIAmBadAtheros; // Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection.
1942 UCHAR EnqueueEapolStartTimerRunning; // Enqueue EAPoL-Start for triggering EAP SM
1943 //jan for wpa
1944 // record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB
1945 UCHAR CMTimerRunning;
1946 UCHAR apidx; // MBSS number
1947 UCHAR RSNIE_Len;
1948 UCHAR RSN_IE[MAX_LEN_OF_RSNIE];
1949 UCHAR ANonce[LEN_KEY_DESC_NONCE];
1950 UCHAR SNonce[LEN_KEY_DESC_NONCE];
1951 UCHAR R_Counter[LEN_KEY_DESC_REPLAY];
1952 UCHAR PTK[64];
1953 UCHAR ReTryCounter;
1954 RALINK_TIMER_STRUCT RetryTimer;
1955 RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; // A timer which enqueue EAPoL-Start for triggering PSK SM
1956 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
1957 NDIS_802_11_WEP_STATUS WepStatus;
1958 NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
1959 AP_WPA_STATE WpaState;
1960 GTK_STATE GTKState;
1961 USHORT PortSecured;
1962 NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X
1963 CIPHER_KEY PairwiseKey;
1964 PVOID pAd;
1965 INT PMKID_CacheIdx;
1966 UCHAR PMKID[LEN_PMKID];
1969 UCHAR Addr[MAC_ADDR_LEN];
1970 UCHAR PsMode;
1971 SST Sst;
1972 AUTH_STATE AuthState; // for SHARED KEY authentication state machine used only
1973 BOOLEAN IsReassocSta; // Indicate whether this is a reassociation procedure
1974 USHORT Aid;
1975 USHORT CapabilityInfo;
1976 UCHAR LastRssi;
1977 ULONG NoDataIdleCount;
1978 UINT16 StationKeepAliveCount; // unit: second
1979 ULONG PsQIdleCount;
1980 QUEUE_HEADER PsQueue;
1982 UINT32 StaConnectTime; // the live time of this station since associated with AP
1985 #ifdef DOT11_N_SUPPORT
1986 BOOLEAN bSendBAR;
1987 USHORT NoBADataCountDown;
1989 UINT32 CachedBuf[16]; // UINT (4 bytes) for alignment
1990 UINT TxBFCount; // 3*3
1991 #endif // DOT11_N_SUPPORT //
1992 UINT FIFOCount;
1993 UINT DebugFIFOCount;
1994 UINT DebugTxCount;
1995 BOOLEAN bDlsInit;
1998 //====================================================
1999 //WDS entry needs these
2000 // if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab
2001 UINT MatchWDSTabIdx;
2002 UCHAR MaxSupportedRate;
2003 UCHAR CurrTxRate;
2004 UCHAR CurrTxRateIndex;
2005 // to record the each TX rate's quality. 0 is best, the bigger the worse.
2006 USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
2007 // USHORT OneSecTxOkCount;
2008 UINT32 OneSecTxNoRetryOkCount;
2009 UINT32 OneSecTxRetryOkCount;
2010 UINT32 OneSecTxFailCount;
2011 UINT32 ContinueTxFailCnt;
2012 UINT32 CurrTxRateStableTime; // # of second in current TX rate
2013 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
2014 #ifdef WDS_SUPPORT
2015 BOOLEAN LockEntryTx; // TRUE = block to WDS Entry traffic, FALSE = not.
2016 UINT32 TimeStamp_toTxRing;
2017 #endif // WDS_SUPPORT //
2019 //====================================================
2023 #ifdef CONFIG_STA_SUPPORT
2024 #ifdef QOS_DLS_SUPPORT
2025 UINT MatchDlsEntryIdx; // indicate the index in pAd->StaCfg.DLSEntry
2026 #endif // QOS_DLS_SUPPORT //
2027 #endif // CONFIG_STA_SUPPORT //
2029 BOOLEAN fNoisyEnvironment;
2030 BOOLEAN fLastSecAccordingRSSI;
2031 UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down
2032 CHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction
2033 ULONG LastTxOkCount;
2034 UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH];
2036 // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular
2037 // BOOLEAN control, either ON or OFF. These flags should always be accessed via
2038 // CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros.
2039 // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED
2040 ULONG ClientStatusFlags;
2042 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
2044 #ifdef DOT11_N_SUPPORT
2045 // HT EWC MIMO-N used parameters
2046 USHORT RXBAbitmap; // fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format
2047 USHORT TXBAbitmap; // This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI
2048 USHORT TXAutoBAbitmap;
2049 USHORT BADeclineBitmap;
2050 USHORT BARecWcidArray[NUM_OF_TID]; // The mapping wcid of recipient session. if RXBAbitmap bit is masked
2051 USHORT BAOriWcidArray[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked
2052 USHORT BAOriSequence[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked
2054 // 802.11n features.
2055 UCHAR MpduDensity;
2056 UCHAR MaxRAmpduFactor;
2057 UCHAR AMsduSize;
2058 UCHAR MmpsMode; // MIMO power save more.
2060 HT_CAPABILITY_IE HTCapability;
2062 #ifdef DOT11N_DRAFT3
2063 UCHAR BSS2040CoexistenceMgmtSupport;
2064 #endif // DOT11N_DRAFT3 //
2065 #endif // DOT11_N_SUPPORT //
2067 BOOLEAN bAutoTxRateSwitch;
2069 UCHAR RateLen;
2070 struct _MAC_TABLE_ENTRY *pNext;
2071 USHORT TxSeq[NUM_OF_TID];
2072 USHORT NonQosDataSeq;
2074 RSSI_SAMPLE RssiSample;
2076 UINT32 TXMCSExpected[16];
2077 UINT32 TXMCSSuccessful[16];
2078 UINT32 TXMCSFailed[16];
2079 UINT32 TXMCSAutoFallBack[16][16];
2081 #ifdef CONFIG_STA_SUPPORT
2082 ULONG LastBeaconRxTime;
2083 #endif // CONFIG_STA_SUPPORT //
2087 ULONG AssocDeadLine;
2091 ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming
2093 } MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY;
2095 typedef struct _MAC_TABLE {
2096 USHORT Size;
2097 MAC_TABLE_ENTRY *Hash[HASH_TABLE_SIZE];
2098 MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE];
2099 QUEUE_HEADER McastPsQueue;
2100 ULONG PsQIdleCount;
2101 BOOLEAN fAnyStationInPsm;
2102 BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip.
2103 BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP
2104 BOOLEAN fAllStationAsRalink; // Check if all stations are ralink-chipset
2105 #ifdef DOT11_N_SUPPORT
2106 BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/
2107 BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF.
2108 BOOLEAN fAnyStation20Only; // Check if any Station can't support GF.
2109 BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic
2110 BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS
2111 //2008/10/28: KH add to support Antenna power-saving of AP<--
2112 //2008/10/28: KH add to support Antenna power-saving of AP-->
2113 #endif // DOT11_N_SUPPORT //
2114 } MAC_TABLE, *PMAC_TABLE;
2119 #ifdef BLOCK_NET_IF
2120 typedef struct _BLOCK_QUEUE_ENTRY
2122 BOOLEAN SwTxQueueBlockFlag;
2123 LIST_HEADER NetIfList;
2124 } BLOCK_QUEUE_ENTRY, *PBLOCK_QUEUE_ENTRY;
2125 #endif // BLOCK_NET_IF //
2128 struct wificonf
2130 BOOLEAN bShortGI;
2131 BOOLEAN bGreenField;
2135 typedef struct _RTMP_DEV_INFO_
2137 UCHAR chipName[16];
2138 RTMP_INF_TYPE infType;
2139 }RTMP_DEV_INFO;
2142 #ifdef DBG_DIAGNOSE
2143 #define DIAGNOSE_TIME 10 // 10 sec
2144 typedef struct _RtmpDiagStrcut_
2145 { // Diagnosis Related element
2146 unsigned char inited;
2147 unsigned char qIdx;
2148 unsigned char ArrayStartIdx;
2149 unsigned char ArrayCurIdx;
2150 // Tx Related Count
2151 USHORT TxDataCnt[DIAGNOSE_TIME];
2152 USHORT TxFailCnt[DIAGNOSE_TIME];
2153 // USHORT TxDescCnt[DIAGNOSE_TIME][16]; // TxDesc queue length in scale of 0~14, >=15
2154 USHORT TxDescCnt[DIAGNOSE_TIME][24]; // 3*3 // TxDesc queue length in scale of 0~14, >=15
2155 // USHORT TxMcsCnt[DIAGNOSE_TIME][16]; // TxDate MCS Count in range from 0 to 15, step in 1.
2156 USHORT TxMcsCnt[DIAGNOSE_TIME][24]; // 3*3
2157 USHORT TxSWQueCnt[DIAGNOSE_TIME][9]; // TxSwQueue length in scale of 0, 1, 2, 3, 4, 5, 6, 7, >=8
2159 USHORT TxAggCnt[DIAGNOSE_TIME];
2160 USHORT TxNonAggCnt[DIAGNOSE_TIME];
2161 // USHORT TxAMPDUCnt[DIAGNOSE_TIME][16]; // 10 sec, TxDMA APMDU Aggregation count in range from 0 to 15, in setp of 1.
2162 USHORT TxAMPDUCnt[DIAGNOSE_TIME][24]; // 3*3 // 10 sec, TxDMA APMDU Aggregation count in range from 0 to 15, in setp of 1.
2163 USHORT TxRalinkCnt[DIAGNOSE_TIME]; // TxRalink Aggregation Count in 1 sec scale.
2164 USHORT TxAMSDUCnt[DIAGNOSE_TIME]; // TxAMSUD Aggregation Count in 1 sec scale.
2166 // Rx Related Count
2167 USHORT RxDataCnt[DIAGNOSE_TIME]; // Rx Total Data count.
2168 USHORT RxCrcErrCnt[DIAGNOSE_TIME];
2169 // USHORT RxMcsCnt[DIAGNOSE_TIME][16]; // Rx MCS Count in range from 0 to 15, step in 1.
2170 USHORT RxMcsCnt[DIAGNOSE_TIME][24]; // 3*3
2171 }RtmpDiagStruct;
2172 #endif // DBG_DIAGNOSE //
2175 struct _RTMP_CHIP_OP_
2177 /* Calibration access related callback functions */
2178 int (*eeinit)(RTMP_ADAPTER *pAd); /* int (*eeinit)(RTMP_ADAPTER *pAd); */
2179 int (*eeread)(RTMP_ADAPTER *pAd, USHORT offset, PUSHORT pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, PUSHORT pValue); */
2180 int (*eewrite)(RTMP_ADAPTER *pAd, USHORT offset, USHORT value);; /* int (*eewrite)(RTMP_ADAPTER *pAd, int offset, USHORT value); */
2182 /* MCU related callback functions */
2183 int (*loadFirmware)(RTMP_ADAPTER *pAd); /* int (*loadFirmware)(RTMP_ADAPTER *pAd); */
2184 int (*eraseFirmware)(RTMP_ADAPTER *pAd); /* int (*eraseFirmware)(RTMP_ADAPTER *pAd); */
2185 int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1);; /* int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1); */
2187 /* RF access related callback functions */
2188 REG_PAIR *pRFRegTable;
2189 void (*AsicRfInit)(RTMP_ADAPTER *pAd);
2190 void (*AsicRfTurnOn)(RTMP_ADAPTER *pAd);
2191 void (*AsicRfTurnOff)(RTMP_ADAPTER *pAd);
2192 void (*AsicReverseRfFromSleepMode)(RTMP_ADAPTER *pAd);
2193 void (*AsicHaltAction)(RTMP_ADAPTER *pAd);
2198 // The miniport adapter structure
2200 struct _RTMP_ADAPTER
2202 PVOID OS_Cookie; // save specific structure relative to OS
2203 PNET_DEV net_dev;
2204 ULONG VirtualIfCnt;
2206 RTMP_CHIP_OP chipOps;
2207 USHORT ThisTbttNumToNextWakeUp;
2209 #ifdef INF_AMAZON_PPA
2210 UINT32 g_if_id;
2211 BOOLEAN PPAEnable;
2212 PPA_DIRECTPATH_CB *pDirectpathCb;
2213 #endif // INF_AMAZON_PPA //
2215 #ifdef RTMP_MAC_PCI
2216 /*****************************************************************************************/
2217 /* PCI related parameters */
2218 /*****************************************************************************************/
2219 PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use
2220 unsigned int irq_num;
2222 USHORT LnkCtrlBitMask;
2223 USHORT RLnkCtrlConfiguration;
2224 USHORT RLnkCtrlOffset;
2225 USHORT HostLnkCtrlConfiguration;
2226 USHORT HostLnkCtrlOffset;
2227 USHORT PCIePowerSaveLevel;
2228 ULONG Rt3xxHostLinkCtrl; // USed for 3090F chip
2229 ULONG Rt3xxRalinkLinkCtrl; // USed for 3090F chip
2230 USHORT DeviceID; // Read from PCI config
2231 ULONG AccessBBPFailCount;
2232 BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace..
2233 BOOLEAN bPCIclkOffDisableTx; //
2235 BOOLEAN brt30xxBanMcuCmd; //when = 0xff means all commands are ok to set .
2236 BOOLEAN b3090ESpecialChip; //3090E special chip that write EEPROM 0x24=0x9280.
2237 ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count.
2239 UINT int_enable_reg;
2240 UINT int_disable_mask;
2241 UINT int_pending;
2244 RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; // Shared memory of all 1st pre-allocated TxBuf associated with each TXD
2245 RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors
2246 RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors
2247 RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA
2248 #endif // RTMP_MAC_PCI //
2251 NDIS_SPIN_LOCK irq_lock;
2252 UCHAR irq_disabled;
2255 /*****************************************************************************************/
2256 /* RBUS related parameters */
2257 /*****************************************************************************************/
2260 /*****************************************************************************************/
2261 /* Both PCI/USB related parameters */
2262 /*****************************************************************************************/
2263 //RTMP_DEV_INFO chipInfo;
2264 RTMP_INF_TYPE infType;
2266 /*****************************************************************************************/
2267 /* Driver Mgmt related parameters */
2268 /*****************************************************************************************/
2269 RTMP_OS_TASK mlmeTask;
2270 #ifdef RTMP_TIMER_TASK_SUPPORT
2271 // If you want use timer task to handle the timer related jobs, enable this.
2272 RTMP_TIMER_TASK_QUEUE TimerQ;
2273 NDIS_SPIN_LOCK TimerQLock;
2274 RTMP_OS_TASK timerTask;
2275 #endif // RTMP_TIMER_TASK_SUPPORT //
2278 /*****************************************************************************************/
2279 /* Tx related parameters */
2280 /*****************************************************************************************/
2281 BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once
2282 NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING];
2285 // resource for software backlog queues
2286 QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA
2287 NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; // TxSwQueue spinlock
2289 RTMP_DMABUF MgmtDescRing; // Shared memory for MGMT descriptors
2290 RTMP_MGMT_RING MgmtRing;
2291 NDIS_SPIN_LOCK MgmtRingLock; // Prio Ring spinlock
2294 /*****************************************************************************************/
2295 /* Rx related parameters */
2296 /*****************************************************************************************/
2298 #ifdef RTMP_MAC_PCI
2299 RTMP_RX_RING RxRing;
2300 NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock
2301 #ifdef RT3090
2302 NDIS_SPIN_LOCK McuCmdLock; //MCU Command Queue spinlock
2303 #endif // RT3090 //
2304 #endif // RTMP_MAC_PCI //
2308 /*****************************************************************************************/
2309 /* ASIC related parameters */
2310 /*****************************************************************************************/
2311 UINT32 MACVersion; // MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101)..
2313 // ---------------------------
2314 // E2PROM
2315 // ---------------------------
2316 ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused
2317 ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused.
2318 USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS];
2319 UCHAR EEPROMAddressNum; // 93c46=6 93c66=8
2320 BOOLEAN EepromAccess;
2321 UCHAR EFuseTag;
2324 // ---------------------------
2325 // BBP Control
2326 // ---------------------------
2327 #ifdef MERGE_ARCH_TEAM
2328 UCHAR BbpWriteLatch[256]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID
2329 #else
2330 UCHAR BbpWriteLatch[140]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID
2331 #endif // MERGE_ARCH_TEAM //
2332 CHAR BbpRssiToDbmDelta; // change from UCHAR to CHAR for high power
2333 BBP_R66_TUNING BbpTuning;
2335 // ----------------------------
2336 // RFIC control
2337 // ----------------------------
2338 UCHAR RfIcType; // RFIC_xxx
2339 ULONG RfFreqOffset; // Frequency offset for channel switching
2340 RTMP_RF_REGS LatchRfRegs; // latch th latest RF programming value since RF IC doesn't support READ
2342 EEPROM_ANTENNA_STRUC Antenna; // Since ANtenna definition is different for a & g. We need to save it for future reference.
2343 EEPROM_NIC_CONFIG2_STRUC NicConfig2;
2345 // This soft Rx Antenna Diversity mechanism is used only when user set
2346 // RX Antenna = DIVERSITY ON
2347 SOFT_RX_ANT_DIVERSITY RxAnt;
2349 UCHAR RFProgSeq;
2350 CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; // Store Tx power value for all channels.
2351 CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; // list all supported channels for site survey
2352 CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; // 802.11j channel and bw
2353 CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; // list all supported channels for site survey
2355 UCHAR ChannelListNum; // number of channel in ChannelList[]
2356 UCHAR Bbp94;
2357 BOOLEAN BbpForCCK;
2358 ULONG Tx20MPwrCfgABand[5];
2359 ULONG Tx20MPwrCfgGBand[5];
2360 ULONG Tx40MPwrCfgABand[5];
2361 ULONG Tx40MPwrCfgGBand[5];
2363 BOOLEAN bAutoTxAgcA; // Enable driver auto Tx Agc control
2364 UCHAR TssiRefA; // Store Tssi reference value as 25 temperature.
2365 UCHAR TssiPlusBoundaryA[5]; // Tssi boundary for increase Tx power to compensate.
2366 UCHAR TssiMinusBoundaryA[5]; // Tssi boundary for decrease Tx power to compensate.
2367 UCHAR TxAgcStepA; // Store Tx TSSI delta increment / decrement value
2368 CHAR TxAgcCompensateA; // Store the compensation (TxAgcStep * (idx-1))
2370 BOOLEAN bAutoTxAgcG; // Enable driver auto Tx Agc control
2371 UCHAR TssiRefG; // Store Tssi reference value as 25 temperature.
2372 UCHAR TssiPlusBoundaryG[5]; // Tssi boundary for increase Tx power to compensate.
2373 UCHAR TssiMinusBoundaryG[5]; // Tssi boundary for decrease Tx power to compensate.
2374 UCHAR TxAgcStepG; // Store Tx TSSI delta increment / decrement value
2375 CHAR TxAgcCompensateG; // Store the compensation (TxAgcStep * (idx-1))
2377 CHAR BGRssiOffset0; // Store B/G RSSI#0 Offset value on EEPROM 0x46h
2378 CHAR BGRssiOffset1; // Store B/G RSSI#1 Offset value
2379 CHAR BGRssiOffset2; // Store B/G RSSI#2 Offset value
2381 CHAR ARssiOffset0; // Store A RSSI#0 Offset value on EEPROM 0x4Ah
2382 CHAR ARssiOffset1; // Store A RSSI#1 Offset value
2383 CHAR ARssiOffset2; // Store A RSSI#2 Offset value
2385 CHAR BLNAGain; // Store B/G external LNA#0 value on EEPROM 0x44h
2386 CHAR ALNAGain0; // Store A external LNA#0 value for ch36~64
2387 CHAR ALNAGain1; // Store A external LNA#1 value for ch100~128
2388 CHAR ALNAGain2; // Store A external LNA#2 value for ch132~165
2389 #ifdef RT30xx
2390 // for 3572
2391 UCHAR Bbp25;
2392 UCHAR Bbp26;
2394 UCHAR TxMixerGain24G; // Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G
2395 UCHAR TxMixerGain5G;
2396 #endif // RT30xx //
2397 // ----------------------------
2398 // LED control
2399 // ----------------------------
2400 MCU_LEDCS_STRUC LedCntl;
2401 USHORT Led1; // read from EEPROM 0x3c
2402 USHORT Led2; // EEPROM 0x3e
2403 USHORT Led3; // EEPROM 0x40
2404 UCHAR LedIndicatorStrength;
2405 UCHAR RssiSingalstrengthOffet;
2406 BOOLEAN bLedOnScanning;
2407 UCHAR LedStatus;
2409 /*****************************************************************************************/
2410 /* 802.11 related parameters */
2411 /*****************************************************************************************/
2412 // outgoing BEACON frame buffer and corresponding TXD
2413 TXWI_STRUC BeaconTxWI;
2414 PUCHAR BeaconBuf;
2415 USHORT BeaconOffset[HW_BEACON_MAX_COUNT];
2417 // pre-build PS-POLL and NULL frame upon link up. for efficiency purpose.
2418 PSPOLL_FRAME PsPollFrame;
2419 HEADER_802_11 NullFrame;
2424 //=========AP===========
2427 //=======STA===========
2428 #ifdef CONFIG_STA_SUPPORT
2429 // -----------------------------------------------
2430 // STA specific configuration & operation status
2431 // used only when pAd->OpMode == OPMODE_STA
2432 // -----------------------------------------------
2433 STA_ADMIN_CONFIG StaCfg; // user desired settings
2434 STA_ACTIVE_CONFIG StaActive; // valid only when ADHOC_ON(pAd) || INFRA_ON(pAd)
2435 CHAR nickname[IW_ESSID_MAX_SIZE+1]; // nickname, only used in the iwconfig i/f
2436 NDIS_MEDIA_STATE PreMediaState;
2437 #endif // CONFIG_STA_SUPPORT //
2439 //=======Common===========
2440 // OP mode: either AP or STA
2441 UCHAR OpMode; // OPMODE_STA, OPMODE_AP
2443 NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected
2446 /* MAT related parameters */
2448 // configuration: read from Registry & E2PROM
2449 BOOLEAN bLocalAdminMAC; // Use user changed MAC
2450 UCHAR PermanentAddress[MAC_ADDR_LEN]; // Factory default MAC address
2451 UCHAR CurrentAddress[MAC_ADDR_LEN]; // User changed MAC address
2453 // ------------------------------------------------------
2454 // common configuration to both OPMODE_STA and OPMODE_AP
2455 // ------------------------------------------------------
2456 COMMON_CONFIG CommonCfg;
2457 MLME_STRUCT Mlme;
2459 // AP needs those vaiables for site survey feature.
2460 MLME_AUX MlmeAux; // temporary settings used during MLME state machine
2461 BSS_TABLE ScanTab; // store the latest SCAN result
2463 //About MacTab, the sta driver will use #0 and #1 for multicast and AP.
2464 MAC_TABLE MacTab; // ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table.
2465 NDIS_SPIN_LOCK MacTabLock;
2467 #ifdef DOT11_N_SUPPORT
2468 BA_TABLE BATable;
2469 NDIS_SPIN_LOCK BATabLock;
2470 RALINK_TIMER_STRUCT RECBATimer;
2471 #endif // DOT11_N_SUPPORT //
2473 // encryption/decryption KEY tables
2474 CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; // STA always use SharedKey[BSS0][0..3]
2476 // RX re-assembly buffer for fragmentation
2477 FRAGMENT_FRAME FragFrame; // Frame storage for fragment frame
2479 // various Counters
2480 COUNTER_802_3 Counters8023; // 802.3 counters
2481 COUNTER_802_11 WlanCounters; // 802.11 MIB counters
2482 COUNTER_RALINK RalinkCounters; // Ralink propriety counters
2483 COUNTER_DRS DrsCounters; // counters for Dynamic TX Rate Switching
2484 PRIVATE_STRUC PrivateInfo; // Private information & counters
2486 // flags, see fRTMP_ADAPTER_xxx flags
2487 ULONG Flags; // Represent current device status
2488 ULONG PSFlags; // Power Save operation flag.
2490 // current TX sequence #
2491 USHORT Sequence;
2493 // Control disconnect / connect event generation
2494 //+++Didn't used anymore
2495 ULONG LinkDownTime;
2496 //---
2497 ULONG LastRxRate;
2498 ULONG LastTxRate;
2499 //+++Used only for Station
2500 BOOLEAN bConfigChanged; // Config Change flag for the same SSID setting
2501 //---
2503 ULONG ExtraInfo; // Extra information for displaying status
2504 ULONG SystemErrorBitmap; // b0: E2PROM version error
2506 //+++Didn't used anymore
2507 ULONG MacIcVersion; // MAC/BBP serial interface issue solved after ver.D
2508 //---
2510 // ---------------------------
2511 // System event log
2512 // ---------------------------
2513 RT_802_11_EVENT_TABLE EventTab;
2516 BOOLEAN HTCEnable;
2518 /*****************************************************************************************/
2519 /* Statistic related parameters */
2520 /*****************************************************************************************/
2522 BOOLEAN bUpdateBcnCntDone;
2523 ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition
2524 // ----------------------------
2525 // DEBUG paramerts
2526 // ----------------------------
2527 //ULONG DebugSetting[4];
2528 BOOLEAN bBanAllBaSetup;
2529 BOOLEAN bPromiscuous;
2531 // ----------------------------
2532 // rt2860c emulation-use Parameters
2533 // ----------------------------
2534 //ULONG rtsaccu[30];
2535 //ULONG ctsaccu[30];
2536 //ULONG cfendaccu[30];
2537 //ULONG bacontent[16];
2538 //ULONG rxint[RX_RING_SIZE+1];
2539 //UCHAR rcvba[60];
2540 BOOLEAN bLinkAdapt;
2541 BOOLEAN bForcePrintTX;
2542 BOOLEAN bForcePrintRX;
2543 //BOOLEAN bDisablescanning; //defined in RT2870 USB
2544 BOOLEAN bStaFifoTest;
2545 BOOLEAN bProtectionTest;
2547 BOOLEAN bHCCATest;
2548 BOOLEAN bGenOneHCCA;
2550 BOOLEAN bBroadComHT;
2551 //+++Following add from RT2870 USB.
2552 ULONG BulkOutReq;
2553 ULONG BulkOutComplete;
2554 ULONG BulkOutCompleteOther;
2555 ULONG BulkOutCompleteCancel; // seems not use now?
2556 ULONG BulkInReq;
2557 ULONG BulkInComplete;
2558 ULONG BulkInCompleteFail;
2559 //---
2561 struct wificonf WIFItestbed;
2563 #ifdef RALINK_ATE
2564 ATE_INFO ate;
2565 #endif // RALINK_ATE //
2567 #ifdef DOT11_N_SUPPORT
2568 struct reordering_mpdu_pool mpdu_blk_pool;
2569 #endif // DOT11_N_SUPPORT //
2571 ULONG OneSecondnonBEpackets; // record non BE packets per second
2573 #ifdef LINUX
2574 #if WIRELESS_EXT >= 12
2575 struct iw_statistics iw_stats;
2576 #endif
2578 struct net_device_stats stats;
2579 #endif // LINUX //
2581 #ifdef BLOCK_NET_IF
2582 BLOCK_QUEUE_ENTRY blockQueueTab[NUM_OF_TX_RING];
2583 #endif // BLOCK_NET_IF //
2587 #ifdef MULTIPLE_CARD_SUPPORT
2588 INT32 MC_RowID;
2589 STRING MC_FileName[256];
2590 #endif // MULTIPLE_CARD_SUPPORT //
2592 ULONG TbttTickCount;
2593 #ifdef PCI_MSI_SUPPORT
2594 BOOLEAN HaveMsi;
2595 #endif // PCI_MSI_SUPPORT //
2598 UCHAR is_on;
2600 #define TIME_BASE (1000000/OS_HZ)
2601 #define TIME_ONE_SECOND (1000000/TIME_BASE)
2602 UCHAR flg_be_adjust;
2603 ULONG be_adjust_last_time;
2605 #ifdef NINTENDO_AP
2606 NINDO_CTRL_BLOCK nindo_ctrl_block;
2607 #endif // NINTENDO_AP //
2610 #ifdef IKANOS_VX_1X0
2611 struct IKANOS_TX_INFO IkanosTxInfo;
2612 struct IKANOS_TX_INFO IkanosRxInfo[MAX_MBSSID_NUM + MAX_WDS_ENTRY + MAX_APCLI_NUM + MAX_MESH_NUM];
2613 #endif // IKANOS_VX_1X0 //
2616 #ifdef DBG_DIAGNOSE
2617 RtmpDiagStruct DiagStruct;
2618 #endif // DBG_DIAGNOSE //
2621 UINT8 FlgCtsEnabled;
2622 UINT8 PM_FlgSuspend;
2624 #ifdef RT30xx
2625 #ifdef RTMP_EFUSE_SUPPORT
2626 BOOLEAN bUseEfuse;
2627 BOOLEAN bEEPROMFile;
2628 BOOLEAN bFroceEEPROMBuffer;
2629 UCHAR EEPROMImage[1024];
2630 #endif // RTMP_EFUSE_SUPPORT //
2631 #endif // RT30xx //
2633 #ifdef CONFIG_STA_SUPPORT
2634 #endif // CONFIG_STA_SUPPORT //
2640 #ifdef TONE_RADAR_DETECT_SUPPORT
2641 #define DELAYINTMASK 0x0013fffb
2642 #define INTMASK 0x0013fffb
2643 #define IndMask 0x0013fffc
2644 #define RadarInt 0x00100000
2645 #else
2646 #define DELAYINTMASK 0x0003fffb
2647 #define INTMASK 0x0003fffb
2648 #define IndMask 0x0003fffc
2649 #endif // TONE_RADAR_DETECT_SUPPORT //
2651 #define RxINT 0x00000005 // Delayed Rx or indivi rx
2652 #define TxDataInt 0x000000fa // Delayed Tx or indivi tx
2653 #define TxMgmtInt 0x00000102 // Delayed Tx or indivi tx
2654 #define TxCoherent 0x00020000 // tx coherent
2655 #define RxCoherent 0x00010000 // rx coherent
2656 #define McuCommand 0x00000200 // mcu
2657 #define PreTBTTInt 0x00001000 // Pre-TBTT interrupt
2658 #define TBTTInt 0x00000800 // TBTT interrupt
2659 #define GPTimeOutInt 0x00008000 // GPtimeout interrupt
2660 #define AutoWakeupInt 0x00004000 // AutoWakeupInt interrupt
2661 #define FifoStaFullInt 0x00002000 // fifo statistics full interrupt
2664 /***************************************************************************
2665 * Rx Path software control block related data structures
2666 **************************************************************************/
2667 typedef struct _RX_BLK_
2669 // RXD_STRUC RxD; // sample
2670 RT28XX_RXD_STRUC RxD;
2671 PRXWI_STRUC pRxWI;
2672 PHEADER_802_11 pHeader;
2673 PNDIS_PACKET pRxPacket;
2674 UCHAR *pData;
2675 USHORT DataSize;
2676 USHORT Flags;
2677 UCHAR UserPriority; // for calculate TKIP MIC using
2678 } RX_BLK;
2681 #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag)
2682 #define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag)
2683 #define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag))
2686 #define fRX_WDS 0x0001
2687 #define fRX_AMSDU 0x0002
2688 #define fRX_ARALINK 0x0004
2689 #define fRX_HTC 0x0008
2690 #define fRX_PAD 0x0010
2691 #define fRX_AMPDU 0x0020
2692 #define fRX_QOS 0x0040
2693 #define fRX_INFRA 0x0080
2694 #define fRX_EAP 0x0100
2695 #define fRX_MESH 0x0200
2696 #define fRX_APCLI 0x0400
2697 #define fRX_DLS 0x0800
2698 #define fRX_WPI 0x1000
2700 #define LENGTH_AMSDU_SUBFRAMEHEAD 14
2701 #define LENGTH_ARALINK_SUBFRAMEHEAD 14
2702 #define LENGTH_ARALINK_HEADER_FIELD 2
2705 /***************************************************************************
2706 * Tx Path software control block related data structures
2707 **************************************************************************/
2708 #define TX_UNKOWN_FRAME 0x00
2709 #define TX_MCAST_FRAME 0x01
2710 #define TX_LEGACY_FRAME 0x02
2711 #define TX_AMPDU_FRAME 0x04
2712 #define TX_AMSDU_FRAME 0x08
2713 #define TX_RALINK_FRAME 0x10
2714 #define TX_FRAG_FRAME 0x20
2717 // Currently the sizeof(TX_BLK) is 148 bytes.
2718 typedef struct _TX_BLK_
2720 UCHAR QueIdx;
2721 UCHAR TxFrameType; // Indicate the Transmission type of the all frames in one batch
2722 UCHAR TotalFrameNum; // Total frame number want to send-out in one batch
2723 USHORT TotalFragNum; // Total frame fragments required in one batch
2724 USHORT TotalFrameLen; // Total length of all frames want to send-out in one batch
2726 QUEUE_HEADER TxPacketList;
2727 MAC_TABLE_ENTRY *pMacEntry; // NULL: packet with 802.11 RA field is multicast/broadcast address
2728 HTTRANSMIT_SETTING *pTransmit;
2730 // Following structure used for the characteristics of a specific packet.
2731 PNDIS_PACKET pPacket;
2732 PUCHAR pSrcBufHeader; // Reference to the head of sk_buff->data
2733 PUCHAR pSrcBufData; // Reference to the sk_buff->data, will changed depends on hanlding progresss
2734 UINT SrcBufLen; // Length of packet payload which not including Layer 2 header
2735 PUCHAR pExtraLlcSnapEncap; // NULL means no extra LLC/SNAP is required
2736 UCHAR HeaderBuf[96]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP
2737 UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding
2738 UCHAR HdrPadLen; // recording Header Padding Length;
2739 UCHAR apidx; // The interface associated to this packet
2740 UCHAR Wcid; // The MAC entry associated to this packet
2741 UCHAR UserPriority; // priority class of packet
2742 UCHAR FrameGap; // what kind of IFS this packet use
2743 UCHAR MpduReqNum; // number of fragments of this frame
2744 UCHAR TxRate; // TODO: Obsoleted? Should change to MCS?
2745 UCHAR CipherAlg; // cipher alogrithm
2746 PCIPHER_KEY pKey;
2750 USHORT Flags; //See following definitions for detail.
2752 //YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer.
2753 ULONG Priv; // Hardware specific value saved in here.
2755 } TX_BLK, *PTX_BLK;
2758 #define fTX_bRtsRequired 0x0001 // Indicate if need send RTS frame for protection. Not used in RT2860/RT2870.
2759 #define fTX_bAckRequired 0x0002 // the packet need ack response
2760 #define fTX_bPiggyBack 0x0004 // Legacy device use Piggback or not
2761 #define fTX_bHTRate 0x0008 // allow to use HT rate
2762 #define fTX_bForceNonQoS 0x0010 // force to transmit frame without WMM-QoS in HT mode
2763 #define fTX_bAllowFrag 0x0020 // allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment
2764 #define fTX_bMoreData 0x0040 // there are more data packets in PowerSave Queue
2765 #define fTX_bWMM 0x0080 // QOS Data
2766 #define fTX_bClearEAPFrame 0x0100
2770 #ifdef CONFIG_STA_SUPPORT
2771 #endif // CONFIG_STA_SUPPORT //
2776 #define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag)
2777 #define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0)
2778 #define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag))
2783 #ifdef RT_BIG_ENDIAN
2784 /***************************************************************************
2785 * Endian conversion related functions
2786 **************************************************************************/
2788 ========================================================================
2790 Routine Description:
2791 Endian conversion of Tx/Rx descriptor .
2793 Arguments:
2794 pAd Pointer to our adapter
2795 pData Pointer to Tx/Rx descriptor
2796 DescriptorType Direction of the frame
2798 Return Value:
2799 None
2801 Note:
2802 Call this function when read or update descriptor
2803 ========================================================================
2805 static inline VOID RTMPWIEndianChange(
2806 IN PUCHAR pData,
2807 IN ULONG DescriptorType)
2809 int size;
2810 int i;
2812 size = ((DescriptorType == TYPE_TXWI) ? TXWI_SIZE : RXWI_SIZE);
2814 if(DescriptorType == TYPE_TXWI)
2816 *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); // Byte 0~3
2817 *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData+4))); // Byte 4~7
2819 else
2821 for(i=0; i < size/4 ; i++)
2822 *(((UINT32 *)pData) +i) = SWAP32(*(((UINT32 *)pData)+i));
2827 #ifdef RTMP_MAC_PCI
2828 static inline VOID WriteBackToDescriptor(
2829 IN PUCHAR Dest,
2830 IN PUCHAR Src,
2831 IN BOOLEAN DoEncrypt,
2832 IN ULONG DescriptorType)
2834 UINT32 *p1, *p2;
2836 p1 = ((UINT32 *)Dest);
2837 p2 = ((UINT32 *)Src);
2839 *p1 = *p2;
2840 *(p1+2) = *(p2+2);
2841 *(p1+3) = *(p2+3);
2842 *(p1+1) = *(p2+1); // Word 1; this must be written back last
2844 #endif // RTMP_MAC_PCI //
2848 ========================================================================
2850 Routine Description:
2851 Endian conversion of Tx/Rx descriptor .
2853 Arguments:
2854 pAd Pointer to our adapter
2855 pData Pointer to Tx/Rx descriptor
2856 DescriptorType Direction of the frame
2858 Return Value:
2859 None
2861 Note:
2862 Call this function when read or update descriptor
2863 ========================================================================
2865 #ifdef RTMP_MAC_PCI
2866 static inline VOID RTMPDescriptorEndianChange(
2867 IN PUCHAR pData,
2868 IN ULONG DescriptorType)
2870 *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); // Byte 0~3
2871 *((UINT32 *)(pData + 8)) = SWAP32(*((UINT32 *)(pData+8))); // Byte 8~11
2872 *((UINT32 *)(pData +12)) = SWAP32(*((UINT32 *)(pData + 12))); // Byte 12~15
2873 *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData + 4))); // Byte 4~7, this must be swapped last
2875 #endif // RTMP_MAC_PCI //
2878 ========================================================================
2880 Routine Description:
2881 Endian conversion of all kinds of 802.11 frames .
2883 Arguments:
2884 pAd Pointer to our adapter
2885 pData Pointer to the 802.11 frame structure
2886 Dir Direction of the frame
2887 FromRxDoneInt Caller is from RxDone interrupt
2889 Return Value:
2890 None
2892 Note:
2893 Call this function when read or update buffer data
2894 ========================================================================
2896 static inline VOID RTMPFrameEndianChange(
2897 IN PRTMP_ADAPTER pAd,
2898 IN PUCHAR pData,
2899 IN ULONG Dir,
2900 IN BOOLEAN FromRxDoneInt)
2902 PHEADER_802_11 pFrame;
2903 PUCHAR pMacHdr;
2905 // swab 16 bit fields - Frame Control field
2906 if(Dir == DIR_READ)
2908 *(USHORT *)pData = SWAP16(*(USHORT *)pData);
2911 pFrame = (PHEADER_802_11) pData;
2912 pMacHdr = (PUCHAR) pFrame;
2914 // swab 16 bit fields - Duration/ID field
2915 *(USHORT *)(pMacHdr + 2) = SWAP16(*(USHORT *)(pMacHdr + 2));
2917 // swab 16 bit fields - Sequence Control field
2918 *(USHORT *)(pMacHdr + 22) = SWAP16(*(USHORT *)(pMacHdr + 22));
2920 if(pFrame->FC.Type == BTYPE_MGMT)
2922 switch(pFrame->FC.SubType)
2924 case SUBTYPE_ASSOC_REQ:
2925 case SUBTYPE_REASSOC_REQ:
2926 // swab 16 bit fields - CapabilityInfo field
2927 pMacHdr += sizeof(HEADER_802_11);
2928 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2930 // swab 16 bit fields - Listen Interval field
2931 pMacHdr += 2;
2932 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2933 break;
2935 case SUBTYPE_ASSOC_RSP:
2936 case SUBTYPE_REASSOC_RSP:
2937 // swab 16 bit fields - CapabilityInfo field
2938 pMacHdr += sizeof(HEADER_802_11);
2939 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2941 // swab 16 bit fields - Status Code field
2942 pMacHdr += 2;
2943 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2945 // swab 16 bit fields - AID field
2946 pMacHdr += 2;
2947 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2948 break;
2950 case SUBTYPE_AUTH:
2951 // If from APHandleRxDoneInterrupt routine, it is still a encrypt format.
2952 // The convertion is delayed to RTMPHandleDecryptionDoneInterrupt.
2953 if(!FromRxDoneInt && pFrame->FC.Wep == 1)
2954 break;
2955 else
2957 // swab 16 bit fields - Auth Alg No. field
2958 pMacHdr += sizeof(HEADER_802_11);
2959 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2961 // swab 16 bit fields - Auth Seq No. field
2962 pMacHdr += 2;
2963 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2965 // swab 16 bit fields - Status Code field
2966 pMacHdr += 2;
2967 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2969 break;
2971 case SUBTYPE_BEACON:
2972 case SUBTYPE_PROBE_RSP:
2973 // swab 16 bit fields - BeaconInterval field
2974 pMacHdr += (sizeof(HEADER_802_11) + TIMESTAMP_LEN);
2975 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2977 // swab 16 bit fields - CapabilityInfo field
2978 pMacHdr += sizeof(USHORT);
2979 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2980 break;
2982 case SUBTYPE_DEAUTH:
2983 case SUBTYPE_DISASSOC:
2984 // swab 16 bit fields - Reason code field
2985 pMacHdr += sizeof(HEADER_802_11);
2986 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
2987 break;
2990 else if( pFrame->FC.Type == BTYPE_DATA )
2993 else if(pFrame->FC.Type == BTYPE_CNTL)
2995 switch(pFrame->FC.SubType)
2997 case SUBTYPE_BLOCK_ACK_REQ:
2999 PFRAME_BA_REQ pBAReq = (PFRAME_BA_REQ)pFrame;
3000 *(USHORT *)(&pBAReq->BARControl) = SWAP16(*(USHORT *)(&pBAReq->BARControl));
3001 pBAReq->BAStartingSeq.word = SWAP16(pBAReq->BAStartingSeq.word);
3003 break;
3004 case SUBTYPE_BLOCK_ACK:
3005 // For Block Ack packet, the HT_CONTROL field is in the same offset with Addr3
3006 *(UINT32 *)(&pFrame->Addr3[0]) = SWAP32(*(UINT32 *)(&pFrame->Addr3[0]));
3007 break;
3009 case SUBTYPE_ACK:
3010 //For ACK packet, the HT_CONTROL field is in the same offset with Addr2
3011 *(UINT32 *)(&pFrame->Addr2[0])= SWAP32(*(UINT32 *)(&pFrame->Addr2[0]));
3012 break;
3015 else
3017 DBGPRINT(RT_DEBUG_ERROR,("Invalid Frame Type!!!\n"));
3020 // swab 16 bit fields - Frame Control
3021 if(Dir == DIR_WRITE)
3023 *(USHORT *)pData = SWAP16(*(USHORT *)pData);
3026 #endif // RT_BIG_ENDIAN //
3029 /***************************************************************************
3030 * Other static inline function definitions
3031 **************************************************************************/
3032 static inline VOID ConvertMulticastIP2MAC(
3033 IN PUCHAR pIpAddr,
3034 IN PUCHAR *ppMacAddr,
3035 IN UINT16 ProtoType)
3037 if (pIpAddr == NULL)
3038 return;
3040 if (ppMacAddr == NULL || *ppMacAddr == NULL)
3041 return;
3043 switch (ProtoType)
3045 case ETH_P_IPV6:
3046 // memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS);
3047 *(*ppMacAddr) = 0x33;
3048 *(*ppMacAddr + 1) = 0x33;
3049 *(*ppMacAddr + 2) = pIpAddr[12];
3050 *(*ppMacAddr + 3) = pIpAddr[13];
3051 *(*ppMacAddr + 4) = pIpAddr[14];
3052 *(*ppMacAddr + 5) = pIpAddr[15];
3053 break;
3055 case ETH_P_IP:
3056 default:
3057 // memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS);
3058 *(*ppMacAddr) = 0x01;
3059 *(*ppMacAddr + 1) = 0x00;
3060 *(*ppMacAddr + 2) = 0x5e;
3061 *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f;
3062 *(*ppMacAddr + 4) = pIpAddr[2];
3063 *(*ppMacAddr + 5) = pIpAddr[3];
3064 break;
3067 return;
3071 char *GetPhyMode(int Mode);
3072 char* GetBW(int BW);
3076 BOOLEAN RTMPCheckForHang(
3077 IN NDIS_HANDLE MiniportAdapterContext);
3079 VOID RTMPHalt(
3080 IN NDIS_HANDLE MiniportAdapterContext);
3083 // Private routines in rtmp_init.c
3085 NDIS_STATUS RTMPAllocAdapterBlock(
3086 IN PVOID handle,
3087 OUT PRTMP_ADAPTER *ppAdapter);
3089 NDIS_STATUS RTMPAllocTxRxRingMemory(
3090 IN PRTMP_ADAPTER pAd);
3092 NDIS_STATUS RTMPFindAdapter(
3093 IN PRTMP_ADAPTER pAd,
3094 IN NDIS_HANDLE WrapperConfigurationContext);
3096 NDIS_STATUS RTMPReadParametersHook(
3097 IN PRTMP_ADAPTER pAd);
3099 NDIS_STATUS RTMPSetProfileParameters(
3100 IN RTMP_ADAPTER *pAd,
3101 IN PSTRING pBuffer);
3103 INT RTMPGetKeyParameter(
3104 IN PSTRING key,
3105 OUT PSTRING dest,
3106 IN INT destsize,
3107 IN PSTRING buffer,
3108 IN BOOLEAN bTrimSpace);
3110 VOID RTMPFreeAdapter(
3111 IN PRTMP_ADAPTER pAd);
3113 NDIS_STATUS NICReadRegParameters(
3114 IN PRTMP_ADAPTER pAd,
3115 IN NDIS_HANDLE WrapperConfigurationContext);
3117 #ifdef RTMP_RF_RW_SUPPORT
3118 VOID NICInitRFRegisters(
3119 IN PRTMP_ADAPTER pAd);
3121 VOID RtmpChipOpsRFHook(
3122 IN RTMP_ADAPTER *pAd);
3124 NDIS_STATUS RT30xxWriteRFRegister(
3125 IN PRTMP_ADAPTER pAd,
3126 IN UCHAR regID,
3127 IN UCHAR value);
3129 NDIS_STATUS RT30xxReadRFRegister(
3130 IN PRTMP_ADAPTER pAd,
3131 IN UCHAR regID,
3132 IN PUCHAR pValue);
3133 #endif // RTMP_RF_RW_SUPPORT //
3135 VOID NICReadEEPROMParameters(
3136 IN PRTMP_ADAPTER pAd,
3137 IN PUCHAR mac_addr);
3139 VOID NICInitAsicFromEEPROM(
3140 IN PRTMP_ADAPTER pAd);
3143 NDIS_STATUS NICInitializeAdapter(
3144 IN PRTMP_ADAPTER pAd,
3145 IN BOOLEAN bHardReset);
3147 NDIS_STATUS NICInitializeAsic(
3148 IN PRTMP_ADAPTER pAd,
3149 IN BOOLEAN bHardReset);
3151 VOID NICIssueReset(
3152 IN PRTMP_ADAPTER pAd);
3154 VOID RTMPRingCleanUp(
3155 IN PRTMP_ADAPTER pAd,
3156 IN UCHAR RingType);
3158 VOID RxTest(
3159 IN PRTMP_ADAPTER pAd);
3161 NDIS_STATUS DbgSendPacket(
3162 IN PRTMP_ADAPTER pAd,
3163 IN PNDIS_PACKET pPacket);
3165 VOID UserCfgInit(
3166 IN PRTMP_ADAPTER pAd);
3168 VOID NICResetFromError(
3169 IN PRTMP_ADAPTER pAd);
3171 NDIS_STATUS NICLoadFirmware(
3172 IN PRTMP_ADAPTER pAd);
3174 VOID NICEraseFirmware(
3175 IN PRTMP_ADAPTER pAd);
3177 NDIS_STATUS NICLoadRateSwitchingParams(
3178 IN PRTMP_ADAPTER pAd);
3180 BOOLEAN NICCheckForHang(
3181 IN PRTMP_ADAPTER pAd);
3183 VOID NICUpdateFifoStaCounters(
3184 IN PRTMP_ADAPTER pAd);
3186 VOID NICUpdateRawCounters(
3187 IN PRTMP_ADAPTER pAd);
3189 VOID RTMPZeroMemory(
3190 IN PVOID pSrc,
3191 IN ULONG Length);
3193 ULONG RTMPCompareMemory(
3194 IN PVOID pSrc1,
3195 IN PVOID pSrc2,
3196 IN ULONG Length);
3198 VOID RTMPMoveMemory(
3199 OUT PVOID pDest,
3200 IN PVOID pSrc,
3201 IN ULONG Length);
3203 VOID AtoH(
3204 PSTRING src,
3205 PUCHAR dest,
3206 int destlen);
3208 UCHAR BtoH(
3209 char ch);
3211 VOID RTMPPatchMacBbpBug(
3212 IN PRTMP_ADAPTER pAd);
3214 VOID RTMPPatchCardBus(
3215 IN PRTMP_ADAPTER pAdapter);
3217 VOID RTMPPatchRalinkCardBus(
3218 IN PRTMP_ADAPTER pAdapter,
3219 IN ULONG Bus);
3221 ULONG RTMPReadCBConfig(
3222 IN ULONG Bus,
3223 IN ULONG Slot,
3224 IN ULONG Func,
3225 IN ULONG Offset);
3227 VOID RTMPWriteCBConfig(
3228 IN ULONG Bus,
3229 IN ULONG Slot,
3230 IN ULONG Func,
3231 IN ULONG Offset,
3232 IN ULONG Value);
3234 VOID RTMPInitTimer(
3235 IN PRTMP_ADAPTER pAd,
3236 IN PRALINK_TIMER_STRUCT pTimer,
3237 IN PVOID pTimerFunc,
3238 IN PVOID pData,
3239 IN BOOLEAN Repeat);
3241 VOID RTMPSetTimer(
3242 IN PRALINK_TIMER_STRUCT pTimer,
3243 IN ULONG Value);
3246 VOID RTMPModTimer(
3247 IN PRALINK_TIMER_STRUCT pTimer,
3248 IN ULONG Value);
3250 VOID RTMPCancelTimer(
3251 IN PRALINK_TIMER_STRUCT pTimer,
3252 OUT BOOLEAN *pCancelled);
3254 VOID RTMPSetLED(
3255 IN PRTMP_ADAPTER pAd,
3256 IN UCHAR Status);
3258 VOID RTMPSetSignalLED(
3259 IN PRTMP_ADAPTER pAd,
3260 IN NDIS_802_11_RSSI Dbm);
3263 VOID RTMPEnableRxTx(
3264 IN PRTMP_ADAPTER pAd);
3267 // prototype in action.c
3269 VOID ActionStateMachineInit(
3270 IN PRTMP_ADAPTER pAd,
3271 IN STATE_MACHINE *S,
3272 OUT STATE_MACHINE_FUNC Trans[]);
3274 VOID MlmeADDBAAction(
3275 IN PRTMP_ADAPTER pAd,
3276 IN MLME_QUEUE_ELEM *Elem);
3278 VOID MlmeDELBAAction(
3279 IN PRTMP_ADAPTER pAd,
3280 IN MLME_QUEUE_ELEM *Elem);
3282 VOID MlmeDLSAction(
3283 IN PRTMP_ADAPTER pAd,
3284 IN MLME_QUEUE_ELEM *Elem);
3286 VOID MlmeInvalidAction(
3287 IN PRTMP_ADAPTER pAd,
3288 IN MLME_QUEUE_ELEM *Elem);
3290 VOID MlmeQOSAction(
3291 IN PRTMP_ADAPTER pAd,
3292 IN MLME_QUEUE_ELEM *Elem);
3294 #ifdef DOT11_N_SUPPORT
3295 VOID PeerAddBAReqAction(
3296 IN PRTMP_ADAPTER pAd,
3297 IN MLME_QUEUE_ELEM *Elem);
3299 VOID PeerAddBARspAction(
3300 IN PRTMP_ADAPTER pAd,
3301 IN MLME_QUEUE_ELEM *Elem);
3303 VOID PeerDelBAAction(
3304 IN PRTMP_ADAPTER pAd,
3305 IN MLME_QUEUE_ELEM *Elem);
3307 VOID PeerBAAction(
3308 IN PRTMP_ADAPTER pAd,
3309 IN MLME_QUEUE_ELEM *Elem);
3310 #endif // DOT11_N_SUPPORT //
3312 VOID SendPSMPAction(
3313 IN PRTMP_ADAPTER pAd,
3314 IN UCHAR Wcid,
3315 IN UCHAR Psmp);
3318 VOID PeerRMAction(
3319 IN PRTMP_ADAPTER pAd,
3320 IN MLME_QUEUE_ELEM *Elem);
3322 VOID PeerPublicAction(
3323 IN PRTMP_ADAPTER pAd,
3324 IN MLME_QUEUE_ELEM *Elem);
3326 #ifdef CONFIG_STA_SUPPORT
3327 VOID StaPublicAction(
3328 IN PRTMP_ADAPTER pAd,
3329 IN UCHAR Bss2040Coexist);
3330 #endif // CONFIG_STA_SUPPORT //
3333 VOID PeerBSSTranAction(
3334 IN PRTMP_ADAPTER pAd,
3335 IN MLME_QUEUE_ELEM *Elem);
3337 #ifdef DOT11_N_SUPPORT
3338 VOID PeerHTAction(
3339 IN PRTMP_ADAPTER pAd,
3340 IN MLME_QUEUE_ELEM *Elem);
3341 #endif // DOT11_N_SUPPORT //
3343 VOID PeerQOSAction(
3344 IN PRTMP_ADAPTER pAd,
3345 IN MLME_QUEUE_ELEM *Elem);
3347 #ifdef QOS_DLS_SUPPORT
3348 VOID PeerDLSAction(
3349 IN PRTMP_ADAPTER pAd,
3350 IN MLME_QUEUE_ELEM *Elem);
3351 #endif // QOS_DLS_SUPPORT //
3353 #ifdef CONFIG_STA_SUPPORT
3354 #ifdef QOS_DLS_SUPPORT
3355 VOID DlsParmFill(
3356 IN PRTMP_ADAPTER pAd,
3357 IN OUT MLME_DLS_REQ_STRUCT *pDlsReq,
3358 IN PRT_802_11_DLS pDls,
3359 IN USHORT reason);
3360 #endif // QOS_DLS_SUPPORT //
3361 #endif // CONFIG_STA_SUPPORT //
3363 #ifdef DOT11_N_SUPPORT
3364 VOID RECBATimerTimeout(
3365 IN PVOID SystemSpecific1,
3366 IN PVOID FunctionContext,
3367 IN PVOID SystemSpecific2,
3368 IN PVOID SystemSpecific3);
3370 VOID ORIBATimerTimeout(
3371 IN PRTMP_ADAPTER pAd);
3373 VOID SendRefreshBAR(
3374 IN PRTMP_ADAPTER pAd,
3375 IN MAC_TABLE_ENTRY *pEntry);
3377 #ifdef DOT11N_DRAFT3
3378 VOID SendBSS2040CoexistMgmtAction(
3379 IN PRTMP_ADAPTER pAd,
3380 IN UCHAR Wcid,
3381 IN UCHAR apidx,
3382 IN UCHAR InfoReq);
3384 VOID SendNotifyBWActionFrame(
3385 IN PRTMP_ADAPTER pAd,
3386 IN UCHAR Wcid,
3387 IN UCHAR apidx);
3389 BOOLEAN ChannelSwitchSanityCheck(
3390 IN PRTMP_ADAPTER pAd,
3391 IN UCHAR Wcid,
3392 IN UCHAR NewChannel,
3393 IN UCHAR Secondary);
3395 VOID ChannelSwitchAction(
3396 IN PRTMP_ADAPTER pAd,
3397 IN UCHAR Wcid,
3398 IN UCHAR Channel,
3399 IN UCHAR Secondary);
3401 ULONG BuildIntolerantChannelRep(
3402 IN PRTMP_ADAPTER pAd,
3403 IN PUCHAR pDest);
3405 VOID Update2040CoexistFrameAndNotify(
3406 IN PRTMP_ADAPTER pAd,
3407 IN UCHAR Wcid,
3408 IN BOOLEAN bAddIntolerantCha);
3410 VOID Send2040CoexistAction(
3411 IN PRTMP_ADAPTER pAd,
3412 IN UCHAR Wcid,
3413 IN BOOLEAN bAddIntolerantCha);
3414 #endif // DOT11N_DRAFT3 //
3415 #endif // DOT11_N_SUPPORT //
3417 VOID ActHeaderInit(
3418 IN PRTMP_ADAPTER pAd,
3419 IN OUT PHEADER_802_11 pHdr80211,
3420 IN PUCHAR Addr1,
3421 IN PUCHAR Addr2,
3422 IN PUCHAR Addr3);
3424 VOID BarHeaderInit(
3425 IN PRTMP_ADAPTER pAd,
3426 IN OUT PFRAME_BAR pCntlBar,
3427 IN PUCHAR pDA,
3428 IN PUCHAR pSA);
3430 VOID InsertActField(
3431 IN PRTMP_ADAPTER pAd,
3432 OUT PUCHAR pFrameBuf,
3433 OUT PULONG pFrameLen,
3434 IN UINT8 Category,
3435 IN UINT8 ActCode);
3437 BOOLEAN QosBADataParse(
3438 IN PRTMP_ADAPTER pAd,
3439 IN BOOLEAN bAMSDU,
3440 IN PUCHAR p8023Header,
3441 IN UCHAR WCID,
3442 IN UCHAR TID,
3443 IN USHORT Sequence,
3444 IN UCHAR DataOffset,
3445 IN USHORT Datasize,
3446 IN UINT CurRxIndex);
3448 #ifdef DOT11_N_SUPPORT
3449 BOOLEAN CntlEnqueueForRecv(
3450 IN PRTMP_ADAPTER pAd,
3451 IN ULONG Wcid,
3452 IN ULONG MsgLen,
3453 IN PFRAME_BA_REQ pMsg);
3455 VOID BaAutoManSwitch(
3456 IN PRTMP_ADAPTER pAd);
3457 #endif // DOT11_N_SUPPORT //
3459 VOID HTIOTCheck(
3460 IN PRTMP_ADAPTER pAd,
3461 IN UCHAR BatRecIdx);
3464 // Private routines in rtmp_data.c
3466 BOOLEAN RTMPHandleRxDoneInterrupt(
3467 IN PRTMP_ADAPTER pAd);
3469 VOID RTMPHandleTxDoneInterrupt(
3470 IN PRTMP_ADAPTER pAd);
3472 BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(
3473 IN PRTMP_ADAPTER pAd,
3474 IN INT_SOURCE_CSR_STRUC TxRingBitmap);
3476 VOID RTMPHandleMgmtRingDmaDoneInterrupt(
3477 IN PRTMP_ADAPTER pAd);
3479 VOID RTMPHandleTBTTInterrupt(
3480 IN PRTMP_ADAPTER pAd);
3482 VOID RTMPHandlePreTBTTInterrupt(
3483 IN PRTMP_ADAPTER pAd);
3485 void RTMPHandleTwakeupInterrupt(
3486 IN PRTMP_ADAPTER pAd);
3488 VOID RTMPHandleRxCoherentInterrupt(
3489 IN PRTMP_ADAPTER pAd);
3492 BOOLEAN TxFrameIsAggregatible(
3493 IN PRTMP_ADAPTER pAd,
3494 IN PUCHAR pPrevAddr1,
3495 IN PUCHAR p8023hdr);
3497 BOOLEAN PeerIsAggreOn(
3498 IN PRTMP_ADAPTER pAd,
3499 IN ULONG TxRate,
3500 IN PMAC_TABLE_ENTRY pMacEntry);
3503 NDIS_STATUS Sniff2BytesFromNdisBuffer(
3504 IN PNDIS_BUFFER pFirstBuffer,
3505 IN UCHAR DesiredOffset,
3506 OUT PUCHAR pByte0,
3507 OUT PUCHAR pByte1);
3509 NDIS_STATUS STASendPacket(
3510 IN PRTMP_ADAPTER pAd,
3511 IN PNDIS_PACKET pPacket);
3513 VOID STASendPackets(
3514 IN NDIS_HANDLE MiniportAdapterContext,
3515 IN PPNDIS_PACKET ppPacketArray,
3516 IN UINT NumberOfPackets);
3518 VOID RTMPDeQueuePacket(
3519 IN PRTMP_ADAPTER pAd,
3520 IN BOOLEAN bIntContext,
3521 IN UCHAR QueIdx,
3522 IN UCHAR Max_Tx_Packets);
3524 NDIS_STATUS RTMPHardTransmit(
3525 IN PRTMP_ADAPTER pAd,
3526 IN PNDIS_PACKET pPacket,
3527 IN UCHAR QueIdx,
3528 OUT PULONG pFreeTXDLeft);
3530 NDIS_STATUS STAHardTransmit(
3531 IN PRTMP_ADAPTER pAd,
3532 IN TX_BLK *pTxBlk,
3533 IN UCHAR QueIdx);
3535 VOID STARxEAPOLFrameIndicate(
3536 IN PRTMP_ADAPTER pAd,
3537 IN MAC_TABLE_ENTRY *pEntry,
3538 IN RX_BLK *pRxBlk,
3539 IN UCHAR FromWhichBSSID);
3541 NDIS_STATUS RTMPFreeTXDRequest(
3542 IN PRTMP_ADAPTER pAd,
3543 IN UCHAR RingType,
3544 IN UCHAR NumberRequired,
3545 IN PUCHAR FreeNumberIs);
3547 NDIS_STATUS MlmeHardTransmit(
3548 IN PRTMP_ADAPTER pAd,
3549 IN UCHAR QueIdx,
3550 IN PNDIS_PACKET pPacket);
3552 NDIS_STATUS MlmeHardTransmitMgmtRing(
3553 IN PRTMP_ADAPTER pAd,
3554 IN UCHAR QueIdx,
3555 IN PNDIS_PACKET pPacket);
3557 #ifdef RTMP_MAC_PCI
3558 NDIS_STATUS MlmeHardTransmitTxRing(
3559 IN PRTMP_ADAPTER pAd,
3560 IN UCHAR QueIdx,
3561 IN PNDIS_PACKET pPacket);
3563 NDIS_STATUS MlmeDataHardTransmit(
3564 IN PRTMP_ADAPTER pAd,
3565 IN UCHAR QueIdx,
3566 IN PNDIS_PACKET pPacket);
3568 VOID RTMPWriteTxDescriptor(
3569 IN PRTMP_ADAPTER pAd,
3570 IN PTXD_STRUC pTxD,
3571 IN BOOLEAN bWIV,
3572 IN UCHAR QSEL);
3573 #endif // RTMP_MAC_PCI //
3575 USHORT RTMPCalcDuration(
3576 IN PRTMP_ADAPTER pAd,
3577 IN UCHAR Rate,
3578 IN ULONG Size);
3580 VOID RTMPWriteTxWI(
3581 IN PRTMP_ADAPTER pAd,
3582 IN PTXWI_STRUC pTxWI,
3583 IN BOOLEAN FRAG,
3584 IN BOOLEAN CFACK,
3585 IN BOOLEAN InsTimestamp,
3586 IN BOOLEAN AMPDU,
3587 IN BOOLEAN Ack,
3588 IN BOOLEAN NSeq, // HW new a sequence.
3589 IN UCHAR BASize,
3590 IN UCHAR WCID,
3591 IN ULONG Length,
3592 IN UCHAR PID,
3593 IN UCHAR TID,
3594 IN UCHAR TxRate,
3595 IN UCHAR Txopmode,
3596 IN BOOLEAN CfAck,
3597 IN HTTRANSMIT_SETTING *pTransmit);
3600 VOID RTMPWriteTxWI_Data(
3601 IN PRTMP_ADAPTER pAd,
3602 IN OUT PTXWI_STRUC pTxWI,
3603 IN TX_BLK *pTxBlk);
3606 VOID RTMPWriteTxWI_Cache(
3607 IN PRTMP_ADAPTER pAd,
3608 IN OUT PTXWI_STRUC pTxWI,
3609 IN TX_BLK *pTxBlk);
3611 VOID RTMPSuspendMsduTransmission(
3612 IN PRTMP_ADAPTER pAd);
3614 VOID RTMPResumeMsduTransmission(
3615 IN PRTMP_ADAPTER pAd);
3617 NDIS_STATUS MiniportMMRequest(
3618 IN PRTMP_ADAPTER pAd,
3619 IN UCHAR QueIdx,
3620 IN PUCHAR pData,
3621 IN UINT Length);
3623 //+++mark by shiang, now this function merge to MiniportMMRequest()
3624 //---mark by shiang, now this function merge to MiniportMMRequest()
3626 VOID RTMPSendNullFrame(
3627 IN PRTMP_ADAPTER pAd,
3628 IN UCHAR TxRate,
3629 IN BOOLEAN bQosNull);
3631 VOID RTMPSendDisassociationFrame(
3632 IN PRTMP_ADAPTER pAd);
3634 VOID RTMPSendRTSFrame(
3635 IN PRTMP_ADAPTER pAd,
3636 IN PUCHAR pDA,
3637 IN unsigned int NextMpduSize,
3638 IN UCHAR TxRate,
3639 IN UCHAR RTSRate,
3640 IN USHORT AckDuration,
3641 IN UCHAR QueIdx,
3642 IN UCHAR FrameGap);
3645 NDIS_STATUS RTMPApplyPacketFilter(
3646 IN PRTMP_ADAPTER pAd,
3647 IN PRT28XX_RXD_STRUC pRxD,
3648 IN PHEADER_802_11 pHeader);
3650 PQUEUE_HEADER RTMPCheckTxSwQueue(
3651 IN PRTMP_ADAPTER pAd,
3652 OUT UCHAR *QueIdx);
3654 #ifdef CONFIG_STA_SUPPORT
3655 VOID RTMPReportMicError(
3656 IN PRTMP_ADAPTER pAd,
3657 IN PCIPHER_KEY pWpaKey);
3659 VOID WpaMicFailureReportFrame(
3660 IN PRTMP_ADAPTER pAd,
3661 IN MLME_QUEUE_ELEM *Elem);
3663 VOID WpaDisassocApAndBlockAssoc(
3664 IN PVOID SystemSpecific1,
3665 IN PVOID FunctionContext,
3666 IN PVOID SystemSpecific2,
3667 IN PVOID SystemSpecific3);
3669 VOID WpaStaPairwiseKeySetting(
3670 IN PRTMP_ADAPTER pAd);
3672 VOID WpaStaGroupKeySetting(
3673 IN PRTMP_ADAPTER pAd);
3675 #endif // CONFIG_STA_SUPPORT //
3677 NDIS_STATUS RTMPCloneNdisPacket(
3678 IN PRTMP_ADAPTER pAd,
3679 IN BOOLEAN pInsAMSDUHdr,
3680 IN PNDIS_PACKET pInPacket,
3681 OUT PNDIS_PACKET *ppOutPacket);
3683 NDIS_STATUS RTMPAllocateNdisPacket(
3684 IN PRTMP_ADAPTER pAd,
3685 IN PNDIS_PACKET *pPacket,
3686 IN PUCHAR pHeader,
3687 IN UINT HeaderLen,
3688 IN PUCHAR pData,
3689 IN UINT DataLen);
3691 VOID RTMPFreeNdisPacket(
3692 IN PRTMP_ADAPTER pAd,
3693 IN PNDIS_PACKET pPacket);
3695 BOOLEAN RTMPFreeTXDUponTxDmaDone(
3696 IN PRTMP_ADAPTER pAd,
3697 IN UCHAR QueIdx);
3699 BOOLEAN RTMPCheckDHCPFrame(
3700 IN PRTMP_ADAPTER pAd,
3701 IN PNDIS_PACKET pPacket);
3704 BOOLEAN RTMPCheckEtherType(
3705 IN PRTMP_ADAPTER pAd,
3706 IN PNDIS_PACKET pPacket);
3709 VOID RTMPCckBbpTuning(
3710 IN PRTMP_ADAPTER pAd,
3711 IN UINT TxRate);
3714 // Private routines in rtmp_wep.c
3716 VOID RTMPInitWepEngine(
3717 IN PRTMP_ADAPTER pAd,
3718 IN PUCHAR pKey,
3719 IN UCHAR KeyId,
3720 IN UCHAR KeyLen,
3721 IN PUCHAR pDest);
3723 VOID RTMPEncryptData(
3724 IN PRTMP_ADAPTER pAd,
3725 IN PUCHAR pSrc,
3726 IN PUCHAR pDest,
3727 IN UINT Len);
3729 BOOLEAN RTMPDecryptData(
3730 IN PRTMP_ADAPTER pAdapter,
3731 IN PUCHAR pSrc,
3732 IN UINT Len,
3733 IN UINT idx);
3735 BOOLEAN RTMPSoftDecryptWEP(
3736 IN PRTMP_ADAPTER pAd,
3737 IN PUCHAR pData,
3738 IN ULONG DataByteCnt,
3739 IN PCIPHER_KEY pGroupKey);
3741 VOID RTMPSetICV(
3742 IN PRTMP_ADAPTER pAd,
3743 IN PUCHAR pDest);
3745 VOID ARCFOUR_INIT(
3746 IN PARCFOURCONTEXT Ctx,
3747 IN PUCHAR pKey,
3748 IN UINT KeyLen);
3750 UCHAR ARCFOUR_BYTE(
3751 IN PARCFOURCONTEXT Ctx);
3753 VOID ARCFOUR_DECRYPT(
3754 IN PARCFOURCONTEXT Ctx,
3755 IN PUCHAR pDest,
3756 IN PUCHAR pSrc,
3757 IN UINT Len);
3759 VOID ARCFOUR_ENCRYPT(
3760 IN PARCFOURCONTEXT Ctx,
3761 IN PUCHAR pDest,
3762 IN PUCHAR pSrc,
3763 IN UINT Len);
3765 VOID WPAARCFOUR_ENCRYPT(
3766 IN PARCFOURCONTEXT Ctx,
3767 IN PUCHAR pDest,
3768 IN PUCHAR pSrc,
3769 IN UINT Len);
3771 UINT RTMP_CALC_FCS32(
3772 IN UINT Fcs,
3773 IN PUCHAR Cp,
3774 IN INT Len);
3777 // MLME routines
3780 // Asic/RF/BBP related functions
3782 VOID AsicAdjustTxPower(
3783 IN PRTMP_ADAPTER pAd);
3785 VOID AsicUpdateProtect(
3786 IN PRTMP_ADAPTER pAd,
3787 IN USHORT OperaionMode,
3788 IN UCHAR SetMask,
3789 IN BOOLEAN bDisableBGProtect,
3790 IN BOOLEAN bNonGFExist);
3792 VOID AsicSwitchChannel(
3793 IN PRTMP_ADAPTER pAd,
3794 IN UCHAR Channel,
3795 IN BOOLEAN bScan);
3797 VOID AsicLockChannel(
3798 IN PRTMP_ADAPTER pAd,
3799 IN UCHAR Channel) ;
3801 VOID AsicAntennaSelect(
3802 IN PRTMP_ADAPTER pAd,
3803 IN UCHAR Channel);
3805 VOID AsicAntennaSetting(
3806 IN PRTMP_ADAPTER pAd,
3807 IN ABGBAND_STATE BandState);
3809 VOID AsicRfTuningExec(
3810 IN PVOID SystemSpecific1,
3811 IN PVOID FunctionContext,
3812 IN PVOID SystemSpecific2,
3813 IN PVOID SystemSpecific3);
3815 #ifdef CONFIG_STA_SUPPORT
3817 VOID AsicResetBBPAgent(
3818 IN PRTMP_ADAPTER pAd);
3820 VOID AsicSleepThenAutoWakeup(
3821 IN PRTMP_ADAPTER pAd,
3822 IN USHORT TbttNumToNextWakeUp);
3824 VOID AsicForceSleep(
3825 IN PRTMP_ADAPTER pAd);
3827 VOID AsicForceWakeup(
3828 IN PRTMP_ADAPTER pAd,
3829 IN BOOLEAN bFromTx);
3830 #endif // CONFIG_STA_SUPPORT //
3832 VOID AsicSetBssid(
3833 IN PRTMP_ADAPTER pAd,
3834 IN PUCHAR pBssid);
3836 VOID AsicSetMcastWC(
3837 IN PRTMP_ADAPTER pAd);
3840 VOID AsicDelWcidTab(
3841 IN PRTMP_ADAPTER pAd,
3842 IN UCHAR Wcid);
3844 VOID AsicEnableRDG(
3845 IN PRTMP_ADAPTER pAd);
3847 VOID AsicDisableRDG(
3848 IN PRTMP_ADAPTER pAd);
3850 VOID AsicDisableSync(
3851 IN PRTMP_ADAPTER pAd);
3853 VOID AsicEnableBssSync(
3854 IN PRTMP_ADAPTER pAd);
3856 VOID AsicEnableIbssSync(
3857 IN PRTMP_ADAPTER pAd);
3859 VOID AsicSetEdcaParm(
3860 IN PRTMP_ADAPTER pAd,
3861 IN PEDCA_PARM pEdcaParm);
3863 VOID AsicSetSlotTime(
3864 IN PRTMP_ADAPTER pAd,
3865 IN BOOLEAN bUseShortSlotTime);
3868 VOID AsicAddSharedKeyEntry(
3869 IN PRTMP_ADAPTER pAd,
3870 IN UCHAR BssIndex,
3871 IN UCHAR KeyIdx,
3872 IN UCHAR CipherAlg,
3873 IN PUCHAR pKey,
3874 IN PUCHAR pTxMic,
3875 IN PUCHAR pRxMic);
3877 VOID AsicRemoveSharedKeyEntry(
3878 IN PRTMP_ADAPTER pAd,
3879 IN UCHAR BssIndex,
3880 IN UCHAR KeyIdx);
3882 VOID AsicUpdateWCIDAttribute(
3883 IN PRTMP_ADAPTER pAd,
3884 IN USHORT WCID,
3885 IN UCHAR BssIndex,
3886 IN UCHAR CipherAlg,
3887 IN BOOLEAN bUsePairewiseKeyTable);
3889 VOID AsicUpdateWCIDIVEIV(
3890 IN PRTMP_ADAPTER pAd,
3891 IN USHORT WCID,
3892 IN ULONG uIV,
3893 IN ULONG uEIV);
3895 VOID AsicUpdateRxWCIDTable(
3896 IN PRTMP_ADAPTER pAd,
3897 IN USHORT WCID,
3898 IN PUCHAR pAddr);
3900 VOID AsicAddKeyEntry(
3901 IN PRTMP_ADAPTER pAd,
3902 IN USHORT WCID,
3903 IN UCHAR BssIndex,
3904 IN UCHAR KeyIdx,
3905 IN PCIPHER_KEY pCipherKey,
3906 IN BOOLEAN bUsePairewiseKeyTable,
3907 IN BOOLEAN bTxKey);
3909 VOID AsicAddPairwiseKeyEntry(
3910 IN PRTMP_ADAPTER pAd,
3911 IN PUCHAR pAddr,
3912 IN UCHAR WCID,
3913 IN CIPHER_KEY *pCipherKey);
3915 VOID AsicRemovePairwiseKeyEntry(
3916 IN PRTMP_ADAPTER pAd,
3917 IN UCHAR BssIdx,
3918 IN UCHAR Wcid);
3920 BOOLEAN AsicSendCommandToMcu(
3921 IN PRTMP_ADAPTER pAd,
3922 IN UCHAR Command,
3923 IN UCHAR Token,
3924 IN UCHAR Arg0,
3925 IN UCHAR Arg1);
3928 #ifdef RTMP_MAC_PCI
3929 BOOLEAN AsicCheckCommanOk(
3930 IN PRTMP_ADAPTER pAd,
3931 IN UCHAR Command);
3932 #endif // RTMP_MAC_PCI //
3934 VOID MacAddrRandomBssid(
3935 IN PRTMP_ADAPTER pAd,
3936 OUT PUCHAR pAddr);
3938 VOID MgtMacHeaderInit(
3939 IN PRTMP_ADAPTER pAd,
3940 IN OUT PHEADER_802_11 pHdr80211,
3941 IN UCHAR SubType,
3942 IN UCHAR ToDs,
3943 IN PUCHAR pDA,
3944 IN PUCHAR pBssid);
3946 VOID MlmeRadioOff(
3947 IN PRTMP_ADAPTER pAd);
3949 VOID MlmeRadioOn(
3950 IN PRTMP_ADAPTER pAd);
3953 VOID BssTableInit(
3954 IN BSS_TABLE *Tab);
3956 #ifdef DOT11_N_SUPPORT
3957 VOID BATableInit(
3958 IN PRTMP_ADAPTER pAd,
3959 IN BA_TABLE *Tab);
3960 #endif // DOT11_N_SUPPORT //
3962 ULONG BssTableSearch(
3963 IN BSS_TABLE *Tab,
3964 IN PUCHAR pBssid,
3965 IN UCHAR Channel);
3967 ULONG BssSsidTableSearch(
3968 IN BSS_TABLE *Tab,
3969 IN PUCHAR pBssid,
3970 IN PUCHAR pSsid,
3971 IN UCHAR SsidLen,
3972 IN UCHAR Channel);
3974 ULONG BssTableSearchWithSSID(
3975 IN BSS_TABLE *Tab,
3976 IN PUCHAR Bssid,
3977 IN PUCHAR pSsid,
3978 IN UCHAR SsidLen,
3979 IN UCHAR Channel);
3981 ULONG BssSsidTableSearchBySSID(
3982 IN BSS_TABLE *Tab,
3983 IN PUCHAR pSsid,
3984 IN UCHAR SsidLen);
3986 VOID BssTableDeleteEntry(
3987 IN OUT PBSS_TABLE pTab,
3988 IN PUCHAR pBssid,
3989 IN UCHAR Channel);
3991 #ifdef DOT11_N_SUPPORT
3992 VOID BATableDeleteORIEntry(
3993 IN OUT PRTMP_ADAPTER pAd,
3994 IN BA_ORI_ENTRY *pBAORIEntry);
3996 VOID BATableDeleteRECEntry(
3997 IN OUT PRTMP_ADAPTER pAd,
3998 IN BA_REC_ENTRY *pBARECEntry);
4000 VOID BATableTearORIEntry(
4001 IN OUT PRTMP_ADAPTER pAd,
4002 IN UCHAR TID,
4003 IN UCHAR Wcid,
4004 IN BOOLEAN bForceDelete,
4005 IN BOOLEAN ALL);
4007 VOID BATableTearRECEntry(
4008 IN OUT PRTMP_ADAPTER pAd,
4009 IN UCHAR TID,
4010 IN UCHAR WCID,
4011 IN BOOLEAN ALL);
4012 #endif // DOT11_N_SUPPORT //
4014 VOID BssEntrySet(
4015 IN PRTMP_ADAPTER pAd,
4016 OUT PBSS_ENTRY pBss,
4017 IN PUCHAR pBssid,
4018 IN CHAR Ssid[],
4019 IN UCHAR SsidLen,
4020 IN UCHAR BssType,
4021 IN USHORT BeaconPeriod,
4022 IN PCF_PARM CfParm,
4023 IN USHORT AtimWin,
4024 IN USHORT CapabilityInfo,
4025 IN UCHAR SupRate[],
4026 IN UCHAR SupRateLen,
4027 IN UCHAR ExtRate[],
4028 IN UCHAR ExtRateLen,
4029 IN HT_CAPABILITY_IE *pHtCapability,
4030 IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
4031 IN UCHAR HtCapabilityLen,
4032 IN UCHAR AddHtInfoLen,
4033 IN UCHAR NewExtChanOffset,
4034 IN UCHAR Channel,
4035 IN CHAR Rssi,
4036 IN LARGE_INTEGER TimeStamp,
4037 IN UCHAR CkipFlag,
4038 IN PEDCA_PARM pEdcaParm,
4039 IN PQOS_CAPABILITY_PARM pQosCapability,
4040 IN PQBSS_LOAD_PARM pQbssLoad,
4041 IN USHORT LengthVIE,
4042 IN PNDIS_802_11_VARIABLE_IEs pVIE);
4044 ULONG BssTableSetEntry(
4045 IN PRTMP_ADAPTER pAd,
4046 OUT PBSS_TABLE pTab,
4047 IN PUCHAR pBssid,
4048 IN CHAR Ssid[],
4049 IN UCHAR SsidLen,
4050 IN UCHAR BssType,
4051 IN USHORT BeaconPeriod,
4052 IN CF_PARM *CfParm,
4053 IN USHORT AtimWin,
4054 IN USHORT CapabilityInfo,
4055 IN UCHAR SupRate[],
4056 IN UCHAR SupRateLen,
4057 IN UCHAR ExtRate[],
4058 IN UCHAR ExtRateLen,
4059 IN HT_CAPABILITY_IE *pHtCapability,
4060 IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
4061 IN UCHAR HtCapabilityLen,
4062 IN UCHAR AddHtInfoLen,
4063 IN UCHAR NewExtChanOffset,
4064 IN UCHAR Channel,
4065 IN CHAR Rssi,
4066 IN LARGE_INTEGER TimeStamp,
4067 IN UCHAR CkipFlag,
4068 IN PEDCA_PARM pEdcaParm,
4069 IN PQOS_CAPABILITY_PARM pQosCapability,
4070 IN PQBSS_LOAD_PARM pQbssLoad,
4071 IN USHORT LengthVIE,
4072 IN PNDIS_802_11_VARIABLE_IEs pVIE);
4074 #ifdef DOT11_N_SUPPORT
4075 VOID BATableInsertEntry(
4076 IN PRTMP_ADAPTER pAd,
4077 IN USHORT Aid,
4078 IN USHORT TimeOutValue,
4079 IN USHORT StartingSeq,
4080 IN UCHAR TID,
4081 IN UCHAR BAWinSize,
4082 IN UCHAR OriginatorStatus,
4083 IN BOOLEAN IsRecipient);
4085 #ifdef DOT11N_DRAFT3
4086 VOID Bss2040CoexistTimeOut(
4087 IN PVOID SystemSpecific1,
4088 IN PVOID FunctionContext,
4089 IN PVOID SystemSpecific2,
4090 IN PVOID SystemSpecific3);
4093 VOID TriEventInit(
4094 IN PRTMP_ADAPTER pAd);
4096 ULONG TriEventTableSetEntry(
4097 IN PRTMP_ADAPTER pAd,
4098 OUT TRIGGER_EVENT_TAB *Tab,
4099 IN PUCHAR pBssid,
4100 IN HT_CAPABILITY_IE *pHtCapability,
4101 IN UCHAR HtCapabilityLen,
4102 IN UCHAR RegClass,
4103 IN UCHAR ChannelNo);
4105 VOID TriEventCounterMaintenance(
4106 IN PRTMP_ADAPTER pAd);
4107 #endif // DOT11N_DRAFT3 //
4108 #endif // DOT11_N_SUPPORT //
4110 VOID BssTableSsidSort(
4111 IN PRTMP_ADAPTER pAd,
4112 OUT BSS_TABLE *OutTab,
4113 IN CHAR Ssid[],
4114 IN UCHAR SsidLen);
4116 VOID BssTableSortByRssi(
4117 IN OUT BSS_TABLE *OutTab);
4119 VOID BssCipherParse(
4120 IN OUT PBSS_ENTRY pBss);
4122 NDIS_STATUS MlmeQueueInit(
4123 IN MLME_QUEUE *Queue);
4125 VOID MlmeQueueDestroy(
4126 IN MLME_QUEUE *Queue);
4128 BOOLEAN MlmeEnqueue(
4129 IN PRTMP_ADAPTER pAd,
4130 IN ULONG Machine,
4131 IN ULONG MsgType,
4132 IN ULONG MsgLen,
4133 IN VOID *Msg);
4135 BOOLEAN MlmeEnqueueForRecv(
4136 IN PRTMP_ADAPTER pAd,
4137 IN ULONG Wcid,
4138 IN ULONG TimeStampHigh,
4139 IN ULONG TimeStampLow,
4140 IN UCHAR Rssi0,
4141 IN UCHAR Rssi1,
4142 IN UCHAR Rssi2,
4143 IN ULONG MsgLen,
4144 IN PVOID Msg,
4145 IN UCHAR Signal);
4148 BOOLEAN MlmeDequeue(
4149 IN MLME_QUEUE *Queue,
4150 OUT MLME_QUEUE_ELEM **Elem);
4152 VOID MlmeRestartStateMachine(
4153 IN PRTMP_ADAPTER pAd);
4155 BOOLEAN MlmeQueueEmpty(
4156 IN MLME_QUEUE *Queue);
4158 BOOLEAN MlmeQueueFull(
4159 IN MLME_QUEUE *Queue);
4161 BOOLEAN MsgTypeSubst(
4162 IN PRTMP_ADAPTER pAd,
4163 IN PFRAME_802_11 pFrame,
4164 OUT INT *Machine,
4165 OUT INT *MsgType);
4167 VOID StateMachineInit(
4168 IN STATE_MACHINE *Sm,
4169 IN STATE_MACHINE_FUNC Trans[],
4170 IN ULONG StNr,
4171 IN ULONG MsgNr,
4172 IN STATE_MACHINE_FUNC DefFunc,
4173 IN ULONG InitState,
4174 IN ULONG Base);
4176 VOID StateMachineSetAction(
4177 IN STATE_MACHINE *S,
4178 IN ULONG St,
4179 ULONG Msg,
4180 IN STATE_MACHINE_FUNC F);
4182 VOID StateMachinePerformAction(
4183 IN PRTMP_ADAPTER pAd,
4184 IN STATE_MACHINE *S,
4185 IN MLME_QUEUE_ELEM *Elem);
4187 VOID Drop(
4188 IN PRTMP_ADAPTER pAd,
4189 IN MLME_QUEUE_ELEM *Elem);
4191 VOID AssocStateMachineInit(
4192 IN PRTMP_ADAPTER pAd,
4193 IN STATE_MACHINE *Sm,
4194 OUT STATE_MACHINE_FUNC Trans[]);
4196 VOID ReassocTimeout(
4197 IN PVOID SystemSpecific1,
4198 IN PVOID FunctionContext,
4199 IN PVOID SystemSpecific2,
4200 IN PVOID SystemSpecific3);
4202 VOID AssocTimeout(
4203 IN PVOID SystemSpecific1,
4204 IN PVOID FunctionContext,
4205 IN PVOID SystemSpecific2,
4206 IN PVOID SystemSpecific3);
4208 VOID DisassocTimeout(
4209 IN PVOID SystemSpecific1,
4210 IN PVOID FunctionContext,
4211 IN PVOID SystemSpecific2,
4212 IN PVOID SystemSpecific3);
4214 //----------------------------------------------
4215 VOID MlmeDisassocReqAction(
4216 IN PRTMP_ADAPTER pAd,
4217 IN MLME_QUEUE_ELEM *Elem);
4219 VOID MlmeAssocReqAction(
4220 IN PRTMP_ADAPTER pAd,
4221 IN MLME_QUEUE_ELEM *Elem);
4223 VOID MlmeReassocReqAction(
4224 IN PRTMP_ADAPTER pAd,
4225 IN MLME_QUEUE_ELEM *Elem);
4227 VOID MlmeDisassocReqAction(
4228 IN PRTMP_ADAPTER pAd,
4229 IN MLME_QUEUE_ELEM *Elem);
4231 VOID PeerAssocRspAction(
4232 IN PRTMP_ADAPTER pAd,
4233 IN MLME_QUEUE_ELEM *Elem);
4235 VOID PeerReassocRspAction(
4236 IN PRTMP_ADAPTER pAd,
4237 IN MLME_QUEUE_ELEM *Elem);
4239 VOID PeerDisassocAction(
4240 IN PRTMP_ADAPTER pAd,
4241 IN MLME_QUEUE_ELEM *Elem);
4243 VOID DisassocTimeoutAction(
4244 IN PRTMP_ADAPTER pAd,
4245 IN MLME_QUEUE_ELEM *Elem);
4247 VOID AssocTimeoutAction(
4248 IN PRTMP_ADAPTER pAd,
4249 IN MLME_QUEUE_ELEM *Elem);
4251 VOID ReassocTimeoutAction(
4252 IN PRTMP_ADAPTER pAd,
4253 IN MLME_QUEUE_ELEM *Elem);
4255 VOID Cls3errAction(
4256 IN PRTMP_ADAPTER pAd,
4257 IN PUCHAR pAddr);
4259 VOID InvalidStateWhenAssoc(
4260 IN PRTMP_ADAPTER pAd,
4261 IN MLME_QUEUE_ELEM *Elem);
4263 VOID InvalidStateWhenReassoc(
4264 IN PRTMP_ADAPTER pAd,
4265 IN MLME_QUEUE_ELEM *Elem);
4267 VOID InvalidStateWhenDisassociate(
4268 IN PRTMP_ADAPTER pAd,
4269 IN MLME_QUEUE_ELEM *Elem);
4272 VOID ComposePsPoll(
4273 IN PRTMP_ADAPTER pAd);
4275 VOID ComposeNullFrame(
4276 IN PRTMP_ADAPTER pAd);
4278 VOID AssocPostProc(
4279 IN PRTMP_ADAPTER pAd,
4280 IN PUCHAR pAddr2,
4281 IN USHORT CapabilityInfo,
4282 IN USHORT Aid,
4283 IN UCHAR SupRate[],
4284 IN UCHAR SupRateLen,
4285 IN UCHAR ExtRate[],
4286 IN UCHAR ExtRateLen,
4287 IN PEDCA_PARM pEdcaParm,
4288 IN HT_CAPABILITY_IE *pHtCapability,
4289 IN UCHAR HtCapabilityLen,
4290 IN ADD_HT_INFO_IE *pAddHtInfo);
4292 VOID AuthStateMachineInit(
4293 IN PRTMP_ADAPTER pAd,
4294 IN PSTATE_MACHINE sm,
4295 OUT STATE_MACHINE_FUNC Trans[]);
4297 VOID AuthTimeout(
4298 IN PVOID SystemSpecific1,
4299 IN PVOID FunctionContext,
4300 IN PVOID SystemSpecific2,
4301 IN PVOID SystemSpecific3);
4303 VOID MlmeAuthReqAction(
4304 IN PRTMP_ADAPTER pAd,
4305 IN MLME_QUEUE_ELEM *Elem);
4307 VOID PeerAuthRspAtSeq2Action(
4308 IN PRTMP_ADAPTER pAd,
4309 IN MLME_QUEUE_ELEM *Elem);
4311 VOID PeerAuthRspAtSeq4Action(
4312 IN PRTMP_ADAPTER pAd,
4313 IN MLME_QUEUE_ELEM *Elem);
4315 VOID AuthTimeoutAction(
4316 IN PRTMP_ADAPTER pAd,
4317 IN MLME_QUEUE_ELEM *Elem);
4319 VOID Cls2errAction(
4320 IN PRTMP_ADAPTER pAd,
4321 IN PUCHAR pAddr);
4323 VOID MlmeDeauthReqAction(
4324 IN PRTMP_ADAPTER pAd,
4325 IN MLME_QUEUE_ELEM *Elem);
4327 VOID InvalidStateWhenAuth(
4328 IN PRTMP_ADAPTER pAd,
4329 IN MLME_QUEUE_ELEM *Elem);
4331 //=============================================
4333 VOID AuthRspStateMachineInit(
4334 IN PRTMP_ADAPTER pAd,
4335 IN PSTATE_MACHINE Sm,
4336 IN STATE_MACHINE_FUNC Trans[]);
4338 VOID PeerDeauthAction(
4339 IN PRTMP_ADAPTER pAd,
4340 IN MLME_QUEUE_ELEM *Elem);
4342 VOID PeerAuthSimpleRspGenAndSend(
4343 IN PRTMP_ADAPTER pAd,
4344 IN PHEADER_802_11 pHdr80211,
4345 IN USHORT Alg,
4346 IN USHORT Seq,
4347 IN USHORT Reason,
4348 IN USHORT Status);
4351 // Private routines in dls.c
4354 #ifdef CONFIG_STA_SUPPORT
4355 #ifdef QOS_DLS_SUPPORT
4356 void DlsStateMachineInit(
4357 IN PRTMP_ADAPTER pAd,
4358 IN STATE_MACHINE *Sm,
4359 OUT STATE_MACHINE_FUNC Trans[]);
4361 VOID MlmeDlsReqAction(
4362 IN PRTMP_ADAPTER pAd,
4363 IN MLME_QUEUE_ELEM *Elem);
4365 VOID PeerDlsReqAction(
4366 IN PRTMP_ADAPTER pAd,
4367 IN MLME_QUEUE_ELEM *Elem);
4369 VOID PeerDlsRspAction(
4370 IN PRTMP_ADAPTER pAd,
4371 IN MLME_QUEUE_ELEM *Elem);
4373 VOID MlmeDlsTearDownAction(
4374 IN PRTMP_ADAPTER pAd,
4375 IN MLME_QUEUE_ELEM *Elem);
4377 VOID PeerDlsTearDownAction(
4378 IN PRTMP_ADAPTER pAd,
4379 IN MLME_QUEUE_ELEM *Elem);
4381 VOID RTMPCheckDLSTimeOut(
4382 IN PRTMP_ADAPTER pAd);
4384 BOOLEAN RTMPRcvFrameDLSCheck(
4385 IN PRTMP_ADAPTER pAd,
4386 IN PHEADER_802_11 pHeader,
4387 IN ULONG Len,
4388 IN PRT28XX_RXD_STRUC pRxD);
4390 INT RTMPCheckDLSFrame(
4391 IN PRTMP_ADAPTER pAd,
4392 IN PUCHAR pDA);
4394 VOID RTMPSendDLSTearDownFrame(
4395 IN PRTMP_ADAPTER pAd,
4396 IN PUCHAR pDA);
4398 NDIS_STATUS RTMPSendSTAKeyRequest(
4399 IN PRTMP_ADAPTER pAd,
4400 IN PUCHAR pDA);
4402 NDIS_STATUS RTMPSendSTAKeyHandShake(
4403 IN PRTMP_ADAPTER pAd,
4404 IN PUCHAR pDA);
4406 VOID DlsTimeoutAction(
4407 IN PVOID SystemSpecific1,
4408 IN PVOID FunctionContext,
4409 IN PVOID SystemSpecific2,
4410 IN PVOID SystemSpecific3);
4412 BOOLEAN MlmeDlsReqSanity(
4413 IN PRTMP_ADAPTER pAd,
4414 IN VOID *Msg,
4415 IN ULONG MsgLen,
4416 OUT PRT_802_11_DLS *pDLS,
4417 OUT PUSHORT pReason);
4419 INT Set_DlsEntryInfo_Display_Proc(
4420 IN PRTMP_ADAPTER pAd,
4421 IN PUCHAR arg);
4423 MAC_TABLE_ENTRY *MacTableInsertDlsEntry(
4424 IN PRTMP_ADAPTER pAd,
4425 IN PUCHAR pAddr,
4426 IN UINT DlsEntryIdx);
4428 BOOLEAN MacTableDeleteDlsEntry(
4429 IN PRTMP_ADAPTER pAd,
4430 IN USHORT wcid,
4431 IN PUCHAR pAddr);
4433 MAC_TABLE_ENTRY *DlsEntryTableLookup(
4434 IN PRTMP_ADAPTER pAd,
4435 IN PUCHAR pAddr,
4436 IN BOOLEAN bResetIdelCount);
4438 MAC_TABLE_ENTRY *DlsEntryTableLookupByWcid(
4439 IN PRTMP_ADAPTER pAd,
4440 IN UCHAR wcid,
4441 IN PUCHAR pAddr,
4442 IN BOOLEAN bResetIdelCount);
4444 INT Set_DlsAddEntry_Proc(
4445 IN PRTMP_ADAPTER pAd,
4446 IN PSTRING arg);
4448 INT Set_DlsTearDownEntry_Proc(
4449 IN PRTMP_ADAPTER pAd,
4450 IN PSTRING arg);
4451 #endif // QOS_DLS_SUPPORT //
4452 #endif // CONFIG_STA_SUPPORT //
4454 #ifdef QOS_DLS_SUPPORT
4455 BOOLEAN PeerDlsReqSanity(
4456 IN PRTMP_ADAPTER pAd,
4457 IN VOID *Msg,
4458 IN ULONG MsgLen,
4459 OUT PUCHAR pDA,
4460 OUT PUCHAR pSA,
4461 OUT USHORT *pCapabilityInfo,
4462 OUT USHORT *pDlsTimeout,
4463 OUT UCHAR *pRatesLen,
4464 OUT UCHAR Rates[],
4465 OUT UCHAR *pHtCapabilityLen,
4466 OUT HT_CAPABILITY_IE *pHtCapability);
4468 BOOLEAN PeerDlsRspSanity(
4469 IN PRTMP_ADAPTER pAd,
4470 IN VOID *Msg,
4471 IN ULONG MsgLen,
4472 OUT PUCHAR pDA,
4473 OUT PUCHAR pSA,
4474 OUT USHORT *pCapabilityInfo,
4475 OUT USHORT *pStatus,
4476 OUT UCHAR *pRatesLen,
4477 OUT UCHAR Rates[],
4478 OUT UCHAR *pHtCapabilityLen,
4479 OUT HT_CAPABILITY_IE *pHtCapability);
4481 BOOLEAN PeerDlsTearDownSanity(
4482 IN PRTMP_ADAPTER pAd,
4483 IN VOID *Msg,
4484 IN ULONG MsgLen,
4485 OUT PUCHAR pDA,
4486 OUT PUCHAR pSA,
4487 OUT USHORT *pReason);
4488 #endif // QOS_DLS_SUPPORT //
4490 //========================================
4492 VOID SyncStateMachineInit(
4493 IN PRTMP_ADAPTER pAd,
4494 IN STATE_MACHINE *Sm,
4495 OUT STATE_MACHINE_FUNC Trans[]);
4497 VOID BeaconTimeout(
4498 IN PVOID SystemSpecific1,
4499 IN PVOID FunctionContext,
4500 IN PVOID SystemSpecific2,
4501 IN PVOID SystemSpecific3);
4503 VOID ScanTimeout(
4504 IN PVOID SystemSpecific1,
4505 IN PVOID FunctionContext,
4506 IN PVOID SystemSpecific2,
4507 IN PVOID SystemSpecific3);
4509 VOID MlmeScanReqAction(
4510 IN PRTMP_ADAPTER pAd,
4511 IN MLME_QUEUE_ELEM *Elem);
4513 VOID InvalidStateWhenScan(
4514 IN PRTMP_ADAPTER pAd,
4515 IN MLME_QUEUE_ELEM *Elem);
4517 VOID InvalidStateWhenJoin(
4518 IN PRTMP_ADAPTER pAd,
4519 IN MLME_QUEUE_ELEM *Elem);
4521 VOID InvalidStateWhenStart(
4522 IN PRTMP_ADAPTER pAd,
4523 IN MLME_QUEUE_ELEM *Elem);
4525 VOID PeerBeacon(
4526 IN PRTMP_ADAPTER pAd,
4527 IN MLME_QUEUE_ELEM *Elem);
4529 VOID EnqueueProbeRequest(
4530 IN PRTMP_ADAPTER pAd);
4532 BOOLEAN ScanRunning(
4533 IN PRTMP_ADAPTER pAd);
4534 //=========================================
4536 VOID MlmeCntlInit(
4537 IN PRTMP_ADAPTER pAd,
4538 IN STATE_MACHINE *S,
4539 OUT STATE_MACHINE_FUNC Trans[]);
4541 VOID MlmeCntlMachinePerformAction(
4542 IN PRTMP_ADAPTER pAd,
4543 IN STATE_MACHINE *S,
4544 IN MLME_QUEUE_ELEM *Elem);
4546 VOID CntlIdleProc(
4547 IN PRTMP_ADAPTER pAd,
4548 IN MLME_QUEUE_ELEM *Elem);
4550 VOID CntlOidScanProc(
4551 IN PRTMP_ADAPTER pAd,
4552 IN MLME_QUEUE_ELEM *Elem);
4554 VOID CntlOidSsidProc(
4555 IN PRTMP_ADAPTER pAd,
4556 IN MLME_QUEUE_ELEM * Elem);
4558 VOID CntlOidRTBssidProc(
4559 IN PRTMP_ADAPTER pAd,
4560 IN MLME_QUEUE_ELEM * Elem);
4562 VOID CntlMlmeRoamingProc(
4563 IN PRTMP_ADAPTER pAd,
4564 IN MLME_QUEUE_ELEM * Elem);
4566 VOID CntlWaitDisassocProc(
4567 IN PRTMP_ADAPTER pAd,
4568 IN MLME_QUEUE_ELEM *Elem);
4570 VOID CntlWaitJoinProc(
4571 IN PRTMP_ADAPTER pAd,
4572 IN MLME_QUEUE_ELEM *Elem);
4574 VOID CntlWaitReassocProc(
4575 IN PRTMP_ADAPTER pAd,
4576 IN MLME_QUEUE_ELEM *Elem);
4578 VOID CntlWaitStartProc(
4579 IN PRTMP_ADAPTER pAd,
4580 IN MLME_QUEUE_ELEM *Elem);
4582 VOID CntlWaitAuthProc(
4583 IN PRTMP_ADAPTER pAd,
4584 IN MLME_QUEUE_ELEM *Elem);
4586 VOID CntlWaitAuthProc2(
4587 IN PRTMP_ADAPTER pAd,
4588 IN MLME_QUEUE_ELEM *Elem);
4590 VOID CntlWaitAssocProc(
4591 IN PRTMP_ADAPTER pAd,
4592 IN MLME_QUEUE_ELEM *Elem);
4594 #ifdef QOS_DLS_SUPPORT
4595 VOID CntlOidDLSSetupProc(
4596 IN PRTMP_ADAPTER pAd,
4597 IN MLME_QUEUE_ELEM *Elem);
4598 #endif // QOS_DLS_SUPPORT //
4600 VOID LinkUp(
4601 IN PRTMP_ADAPTER pAd,
4602 IN UCHAR BssType);
4604 VOID LinkDown(
4605 IN PRTMP_ADAPTER pAd,
4606 IN BOOLEAN IsReqFromAP);
4608 VOID IterateOnBssTab(
4609 IN PRTMP_ADAPTER pAd);
4611 VOID IterateOnBssTab2(
4612 IN PRTMP_ADAPTER pAd);;
4614 VOID JoinParmFill(
4615 IN PRTMP_ADAPTER pAd,
4616 IN OUT MLME_JOIN_REQ_STRUCT *JoinReq,
4617 IN ULONG BssIdx);
4619 VOID AssocParmFill(
4620 IN PRTMP_ADAPTER pAd,
4621 IN OUT MLME_ASSOC_REQ_STRUCT *AssocReq,
4622 IN PUCHAR pAddr,
4623 IN USHORT CapabilityInfo,
4624 IN ULONG Timeout,
4625 IN USHORT ListenIntv);
4627 VOID ScanParmFill(
4628 IN PRTMP_ADAPTER pAd,
4629 IN OUT MLME_SCAN_REQ_STRUCT *ScanReq,
4630 IN STRING Ssid[],
4631 IN UCHAR SsidLen,
4632 IN UCHAR BssType,
4633 IN UCHAR ScanType);
4635 VOID DisassocParmFill(
4636 IN PRTMP_ADAPTER pAd,
4637 IN OUT MLME_DISASSOC_REQ_STRUCT *DisassocReq,
4638 IN PUCHAR pAddr,
4639 IN USHORT Reason);
4641 VOID StartParmFill(
4642 IN PRTMP_ADAPTER pAd,
4643 IN OUT MLME_START_REQ_STRUCT *StartReq,
4644 IN CHAR Ssid[],
4645 IN UCHAR SsidLen);
4647 VOID AuthParmFill(
4648 IN PRTMP_ADAPTER pAd,
4649 IN OUT MLME_AUTH_REQ_STRUCT *AuthReq,
4650 IN PUCHAR pAddr,
4651 IN USHORT Alg);
4653 VOID EnqueuePsPoll(
4654 IN PRTMP_ADAPTER pAd);
4656 VOID EnqueueBeaconFrame(
4657 IN PRTMP_ADAPTER pAd);
4659 VOID MlmeJoinReqAction(
4660 IN PRTMP_ADAPTER pAd,
4661 IN MLME_QUEUE_ELEM *Elem);
4663 VOID MlmeScanReqAction(
4664 IN PRTMP_ADAPTER pAd,
4665 IN MLME_QUEUE_ELEM *Elem);
4667 VOID MlmeStartReqAction(
4668 IN PRTMP_ADAPTER pAd,
4669 IN MLME_QUEUE_ELEM *Elem);
4671 VOID ScanTimeoutAction(
4672 IN PRTMP_ADAPTER pAd,
4673 IN MLME_QUEUE_ELEM *Elem);
4675 VOID BeaconTimeoutAtJoinAction(
4676 IN PRTMP_ADAPTER pAd,
4677 IN MLME_QUEUE_ELEM *Elem);
4679 VOID PeerBeaconAtScanAction(
4680 IN PRTMP_ADAPTER pAd,
4681 IN MLME_QUEUE_ELEM *Elem);
4683 VOID PeerBeaconAtJoinAction(
4684 IN PRTMP_ADAPTER pAd,
4685 IN MLME_QUEUE_ELEM *Elem);
4687 VOID PeerBeacon(
4688 IN PRTMP_ADAPTER pAd,
4689 IN MLME_QUEUE_ELEM *Elem);
4691 VOID PeerProbeReqAction(
4692 IN PRTMP_ADAPTER pAd,
4693 IN MLME_QUEUE_ELEM *Elem);
4695 VOID ScanNextChannel(
4696 IN PRTMP_ADAPTER pAd);
4698 ULONG MakeIbssBeacon(
4699 IN PRTMP_ADAPTER pAd);
4701 VOID CCXAdjacentAPReport(
4702 IN PRTMP_ADAPTER pAd);
4704 BOOLEAN MlmeScanReqSanity(
4705 IN PRTMP_ADAPTER pAd,
4706 IN VOID *Msg,
4707 IN ULONG MsgLen,
4708 OUT UCHAR *BssType,
4709 OUT CHAR ssid[],
4710 OUT UCHAR *SsidLen,
4711 OUT UCHAR *ScanType);
4713 BOOLEAN PeerBeaconAndProbeRspSanity(
4714 IN PRTMP_ADAPTER pAd,
4715 IN VOID *Msg,
4716 IN ULONG MsgLen,
4717 IN UCHAR MsgChannel,
4718 OUT PUCHAR pAddr2,
4719 OUT PUCHAR pBssid,
4720 OUT CHAR Ssid[],
4721 OUT UCHAR *pSsidLen,
4722 OUT UCHAR *pBssType,
4723 OUT USHORT *pBeaconPeriod,
4724 OUT UCHAR *pChannel,
4725 OUT UCHAR *pNewChannel,
4726 OUT LARGE_INTEGER *pTimestamp,
4727 OUT CF_PARM *pCfParm,
4728 OUT USHORT *pAtimWin,
4729 OUT USHORT *pCapabilityInfo,
4730 OUT UCHAR *pErp,
4731 OUT UCHAR *pDtimCount,
4732 OUT UCHAR *pDtimPeriod,
4733 OUT UCHAR *pBcastFlag,
4734 OUT UCHAR *pMessageToMe,
4735 OUT UCHAR SupRate[],
4736 OUT UCHAR *pSupRateLen,
4737 OUT UCHAR ExtRate[],
4738 OUT UCHAR *pExtRateLen,
4739 OUT UCHAR *pCkipFlag,
4740 OUT UCHAR *pAironetCellPowerLimit,
4741 OUT PEDCA_PARM pEdcaParm,
4742 OUT PQBSS_LOAD_PARM pQbssLoad,
4743 OUT PQOS_CAPABILITY_PARM pQosCapability,
4744 OUT ULONG *pRalinkIe,
4745 OUT UCHAR *pHtCapabilityLen,
4746 #ifdef CONFIG_STA_SUPPORT
4747 OUT UCHAR *pPreNHtCapabilityLen,
4748 #endif // CONFIG_STA_SUPPORT //
4749 OUT HT_CAPABILITY_IE *pHtCapability,
4750 OUT UCHAR *AddHtInfoLen,
4751 OUT ADD_HT_INFO_IE *AddHtInfo,
4752 OUT UCHAR *NewExtChannel,
4753 OUT USHORT *LengthVIE,
4754 OUT PNDIS_802_11_VARIABLE_IEs pVIE);
4756 BOOLEAN PeerAddBAReqActionSanity(
4757 IN PRTMP_ADAPTER pAd,
4758 IN VOID *pMsg,
4759 IN ULONG MsgLen,
4760 OUT PUCHAR pAddr2);
4762 BOOLEAN PeerAddBARspActionSanity(
4763 IN PRTMP_ADAPTER pAd,
4764 IN VOID *pMsg,
4765 IN ULONG MsgLen);
4767 BOOLEAN PeerDelBAActionSanity(
4768 IN PRTMP_ADAPTER pAd,
4769 IN UCHAR Wcid,
4770 IN VOID *pMsg,
4771 IN ULONG MsgLen);
4773 BOOLEAN MlmeAssocReqSanity(
4774 IN PRTMP_ADAPTER pAd,
4775 IN VOID *Msg,
4776 IN ULONG MsgLen,
4777 OUT PUCHAR pApAddr,
4778 OUT USHORT *CapabilityInfo,
4779 OUT ULONG *Timeout,
4780 OUT USHORT *ListenIntv);
4782 BOOLEAN MlmeAuthReqSanity(
4783 IN PRTMP_ADAPTER pAd,
4784 IN VOID *Msg,
4785 IN ULONG MsgLen,
4786 OUT PUCHAR pAddr,
4787 OUT ULONG *Timeout,
4788 OUT USHORT *Alg);
4790 BOOLEAN MlmeStartReqSanity(
4791 IN PRTMP_ADAPTER pAd,
4792 IN VOID *Msg,
4793 IN ULONG MsgLen,
4794 OUT CHAR Ssid[],
4795 OUT UCHAR *Ssidlen);
4797 BOOLEAN PeerAuthSanity(
4798 IN PRTMP_ADAPTER pAd,
4799 IN VOID *Msg,
4800 IN ULONG MsgLen,
4801 OUT PUCHAR pAddr,
4802 OUT USHORT *Alg,
4803 OUT USHORT *Seq,
4804 OUT USHORT *Status,
4805 OUT CHAR ChlgText[]);
4807 BOOLEAN PeerAssocRspSanity(
4808 IN PRTMP_ADAPTER pAd,
4809 IN VOID *pMsg,
4810 IN ULONG MsgLen,
4811 OUT PUCHAR pAddr2,
4812 OUT USHORT *pCapabilityInfo,
4813 OUT USHORT *pStatus,
4814 OUT USHORT *pAid,
4815 OUT UCHAR SupRate[],
4816 OUT UCHAR *pSupRateLen,
4817 OUT UCHAR ExtRate[],
4818 OUT UCHAR *pExtRateLen,
4819 OUT HT_CAPABILITY_IE *pHtCapability,
4820 OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
4821 OUT UCHAR *pHtCapabilityLen,
4822 OUT UCHAR *pAddHtInfoLen,
4823 OUT UCHAR *pNewExtChannelOffset,
4824 OUT PEDCA_PARM pEdcaParm,
4825 OUT UCHAR *pCkipFlag);
4827 BOOLEAN PeerDisassocSanity(
4828 IN PRTMP_ADAPTER pAd,
4829 IN VOID *Msg,
4830 IN ULONG MsgLen,
4831 OUT PUCHAR pAddr2,
4832 OUT USHORT *Reason);
4834 BOOLEAN PeerWpaMessageSanity(
4835 IN PRTMP_ADAPTER pAd,
4836 IN PEAPOL_PACKET pMsg,
4837 IN ULONG MsgLen,
4838 IN UCHAR MsgType,
4839 IN MAC_TABLE_ENTRY *pEntry);
4841 BOOLEAN PeerDeauthSanity(
4842 IN PRTMP_ADAPTER pAd,
4843 IN VOID *Msg,
4844 IN ULONG MsgLen,
4845 OUT PUCHAR pAddr2,
4846 OUT USHORT *Reason);
4848 BOOLEAN PeerProbeReqSanity(
4849 IN PRTMP_ADAPTER pAd,
4850 IN VOID *Msg,
4851 IN ULONG MsgLen,
4852 OUT PUCHAR pAddr2,
4853 OUT CHAR Ssid[],
4854 OUT UCHAR *pSsidLen);
4856 BOOLEAN GetTimBit(
4857 IN CHAR *Ptr,
4858 IN USHORT Aid,
4859 OUT UCHAR *TimLen,
4860 OUT UCHAR *BcastFlag,
4861 OUT UCHAR *DtimCount,
4862 OUT UCHAR *DtimPeriod,
4863 OUT UCHAR *MessageToMe);
4865 UCHAR ChannelSanity(
4866 IN PRTMP_ADAPTER pAd,
4867 IN UCHAR channel);
4869 NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(
4870 IN PBSS_ENTRY pBss);
4873 BOOLEAN MlmeDelBAReqSanity(
4874 IN PRTMP_ADAPTER pAd,
4875 IN VOID *Msg,
4876 IN ULONG MsgLen);
4878 BOOLEAN MlmeAddBAReqSanity(
4879 IN PRTMP_ADAPTER pAd,
4880 IN VOID *Msg,
4881 IN ULONG MsgLen,
4882 OUT PUCHAR pAddr2);
4884 ULONG MakeOutgoingFrame(
4885 OUT UCHAR *Buffer,
4886 OUT ULONG *Length, ...);
4888 VOID LfsrInit(
4889 IN PRTMP_ADAPTER pAd,
4890 IN ULONG Seed);
4892 UCHAR RandomByte(
4893 IN PRTMP_ADAPTER pAd);
4895 VOID AsicUpdateAutoFallBackTable(
4896 IN PRTMP_ADAPTER pAd,
4897 IN PUCHAR pTxRate);
4899 VOID MlmePeriodicExec(
4900 IN PVOID SystemSpecific1,
4901 IN PVOID FunctionContext,
4902 IN PVOID SystemSpecific2,
4903 IN PVOID SystemSpecific3);
4905 VOID LinkDownExec(
4906 IN PVOID SystemSpecific1,
4907 IN PVOID FunctionContext,
4908 IN PVOID SystemSpecific2,
4909 IN PVOID SystemSpecific3);
4911 VOID LinkUpExec(
4912 IN PVOID SystemSpecific1,
4913 IN PVOID FunctionContext,
4914 IN PVOID SystemSpecific2,
4915 IN PVOID SystemSpecific3);
4917 VOID STAMlmePeriodicExec(
4918 PRTMP_ADAPTER pAd);
4920 VOID MlmeAutoScan(
4921 IN PRTMP_ADAPTER pAd);
4923 VOID MlmeAutoReconnectLastSSID(
4924 IN PRTMP_ADAPTER pAd);
4926 BOOLEAN MlmeValidateSSID(
4927 IN PUCHAR pSsid,
4928 IN UCHAR SsidLen);
4930 VOID MlmeCheckForRoaming(
4931 IN PRTMP_ADAPTER pAd,
4932 IN ULONG Now32);
4934 BOOLEAN MlmeCheckForFastRoaming(
4935 IN PRTMP_ADAPTER pAd);
4937 VOID MlmeDynamicTxRateSwitching(
4938 IN PRTMP_ADAPTER pAd);
4940 VOID MlmeSetTxRate(
4941 IN PRTMP_ADAPTER pAd,
4942 IN PMAC_TABLE_ENTRY pEntry,
4943 IN PRTMP_TX_RATE_SWITCH pTxRate);
4945 VOID MlmeSelectTxRateTable(
4946 IN PRTMP_ADAPTER pAd,
4947 IN PMAC_TABLE_ENTRY pEntry,
4948 IN PUCHAR *ppTable,
4949 IN PUCHAR pTableSize,
4950 IN PUCHAR pInitTxRateIdx);
4952 VOID MlmeCalculateChannelQuality(
4953 IN PRTMP_ADAPTER pAd,
4954 IN PMAC_TABLE_ENTRY pMacEntry,
4955 IN ULONG Now);
4957 VOID MlmeCheckPsmChange(
4958 IN PRTMP_ADAPTER pAd,
4959 IN ULONG Now32);
4961 VOID MlmeSetPsmBit(
4962 IN PRTMP_ADAPTER pAd,
4963 IN USHORT psm);
4965 VOID MlmeSetTxPreamble(
4966 IN PRTMP_ADAPTER pAd,
4967 IN USHORT TxPreamble);
4969 VOID UpdateBasicRateBitmap(
4970 IN PRTMP_ADAPTER pAd);
4972 VOID MlmeUpdateTxRates(
4973 IN PRTMP_ADAPTER pAd,
4974 IN BOOLEAN bLinkUp,
4975 IN UCHAR apidx);
4977 #ifdef DOT11_N_SUPPORT
4978 VOID MlmeUpdateHtTxRates(
4979 IN PRTMP_ADAPTER pAd,
4980 IN UCHAR apidx);
4981 #endif // DOT11_N_SUPPORT //
4983 VOID RTMPCheckRates(
4984 IN PRTMP_ADAPTER pAd,
4985 IN OUT UCHAR SupRate[],
4986 IN OUT UCHAR *SupRateLen);
4988 #ifdef CONFIG_STA_SUPPORT
4989 BOOLEAN RTMPCheckChannel(
4990 IN PRTMP_ADAPTER pAd,
4991 IN UCHAR CentralChannel,
4992 IN UCHAR Channel);
4993 #endif // CONFIG_STA_SUPPORT //
4995 BOOLEAN RTMPCheckHt(
4996 IN PRTMP_ADAPTER pAd,
4997 IN UCHAR Wcid,
4998 IN OUT HT_CAPABILITY_IE *pHtCapability,
4999 IN OUT ADD_HT_INFO_IE *pAddHtInfo);
5001 VOID StaQuickResponeForRateUpExec(
5002 IN PVOID SystemSpecific1,
5003 IN PVOID FunctionContext,
5004 IN PVOID SystemSpecific2,
5005 IN PVOID SystemSpecific3);
5007 VOID AsicBbpTuning1(
5008 IN PRTMP_ADAPTER pAd);
5010 VOID AsicBbpTuning2(
5011 IN PRTMP_ADAPTER pAd);
5013 VOID RTMPUpdateMlmeRate(
5014 IN PRTMP_ADAPTER pAd);
5016 CHAR RTMPMaxRssi(
5017 IN PRTMP_ADAPTER pAd,
5018 IN CHAR Rssi0,
5019 IN CHAR Rssi1,
5020 IN CHAR Rssi2);
5022 #ifdef RT30xx
5023 VOID AsicSetRxAnt(
5024 IN PRTMP_ADAPTER pAd,
5025 IN UCHAR Ant);
5027 VOID RTMPFilterCalibration(
5028 IN PRTMP_ADAPTER pAd);
5030 #ifdef RTMP_EFUSE_SUPPORT
5031 //2008/09/11:KH add to support efuse<--
5032 INT set_eFuseGetFreeBlockCount_Proc(
5033 IN PRTMP_ADAPTER pAd,
5034 IN PSTRING arg);
5036 INT set_eFusedump_Proc(
5037 IN PRTMP_ADAPTER pAd,
5038 IN PSTRING arg);
5040 INT set_eFuseLoadFromBin_Proc(
5041 IN PRTMP_ADAPTER pAd,
5042 IN PSTRING arg);
5044 VOID eFusePhysicalReadRegisters(
5045 IN PRTMP_ADAPTER pAd,
5046 IN USHORT Offset,
5047 IN USHORT Length,
5048 OUT USHORT* pData);
5050 int RtmpEfuseSupportCheck(
5051 IN RTMP_ADAPTER *pAd);
5053 INT set_eFuseBufferModeWriteBack_Proc(
5054 IN PRTMP_ADAPTER pAd,
5055 IN PSTRING arg);
5057 INT eFuseLoadEEPROM(
5058 IN PRTMP_ADAPTER pAd);
5060 INT eFuseWriteEeeppromBuf(
5061 IN PRTMP_ADAPTER pAd);
5063 VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd,
5064 PUINT EfuseFreeBlock);
5066 INT eFuse_init(
5067 IN PRTMP_ADAPTER pAd);
5069 NTSTATUS eFuseRead(
5070 IN PRTMP_ADAPTER pAd,
5071 IN USHORT Offset,
5072 OUT PUCHAR pData,
5073 IN USHORT Length);
5075 NTSTATUS eFuseWrite(
5076 IN PRTMP_ADAPTER pAd,
5077 IN USHORT Offset,
5078 IN PUCHAR pData,
5079 IN USHORT length);
5080 //2008/09/11:KH add to support efuse-->
5081 #endif // RTMP_EFUSE_SUPPORT //
5083 // add by johnli, RF power sequence setup
5084 VOID RT30xxLoadRFNormalModeSetup(
5085 IN PRTMP_ADAPTER pAd);
5087 VOID RT30xxLoadRFSleepModeSetup(
5088 IN PRTMP_ADAPTER pAd);
5090 VOID RT30xxReverseRFSleepModeSetup(
5091 IN PRTMP_ADAPTER pAd);
5092 // end johnli
5095 #ifdef RT3090
5096 VOID NICInitRT3090RFRegisters(
5097 IN RTMP_ADAPTER *pAd);
5098 #endif // RT3090 //
5100 VOID RT30xxHaltAction(
5101 IN PRTMP_ADAPTER pAd);
5103 VOID RT30xxSetRxAnt(
5104 IN PRTMP_ADAPTER pAd,
5105 IN UCHAR Ant);
5106 #endif // RT30xx //
5107 #ifdef RT33xx
5108 VOID RT33xxLoadRFNormalModeSetup(
5109 IN PRTMP_ADAPTER pAd);
5111 VOID RT33xxLoadRFSleepModeSetup(
5112 IN PRTMP_ADAPTER pAd);
5114 VOID RT33xxReverseRFSleepModeSetup(
5115 IN PRTMP_ADAPTER pAd);
5117 #ifdef RT3370
5118 VOID NICInitRT3370RFRegisters(
5119 IN RTMP_ADAPTER *pAd);
5120 #endif // RT3070 //
5122 #ifdef RT3390
5123 VOID NICInitRT3390RFRegisters(
5124 IN RTMP_ADAPTER *pAd);
5125 #endif // RT3090 //
5127 VOID RT33xxHaltAction(
5128 IN PRTMP_ADAPTER pAd);
5130 VOID RT33xxSetRxAnt(
5131 IN PRTMP_ADAPTER pAd,
5132 IN UCHAR Ant);
5134 #endif // RT33xx //
5138 VOID AsicEvaluateRxAnt(
5139 IN PRTMP_ADAPTER pAd);
5141 VOID AsicRxAntEvalTimeout(
5142 IN PVOID SystemSpecific1,
5143 IN PVOID FunctionContext,
5144 IN PVOID SystemSpecific2,
5145 IN PVOID SystemSpecific3);
5147 VOID APSDPeriodicExec(
5148 IN PVOID SystemSpecific1,
5149 IN PVOID FunctionContext,
5150 IN PVOID SystemSpecific2,
5151 IN PVOID SystemSpecific3);
5153 BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(
5154 IN PRTMP_ADAPTER pAd,
5155 IN PMAC_TABLE_ENTRY pEntry);
5157 UCHAR RTMPStaFixedTxMode(
5158 IN PRTMP_ADAPTER pAd,
5159 IN PMAC_TABLE_ENTRY pEntry);
5161 VOID RTMPUpdateLegacyTxSetting(
5162 UCHAR fixed_tx_mode,
5163 PMAC_TABLE_ENTRY pEntry);
5165 BOOLEAN RTMPAutoRateSwitchCheck(
5166 IN PRTMP_ADAPTER pAd);
5168 NDIS_STATUS MlmeInit(
5169 IN PRTMP_ADAPTER pAd);
5171 VOID MlmeHandler(
5172 IN PRTMP_ADAPTER pAd);
5174 VOID MlmeHalt(
5175 IN PRTMP_ADAPTER pAd);
5177 VOID MlmeResetRalinkCounters(
5178 IN PRTMP_ADAPTER pAd);
5180 VOID BuildChannelList(
5181 IN PRTMP_ADAPTER pAd);
5183 UCHAR FirstChannel(
5184 IN PRTMP_ADAPTER pAd);
5186 UCHAR NextChannel(
5187 IN PRTMP_ADAPTER pAd,
5188 IN UCHAR channel);
5190 VOID ChangeToCellPowerLimit(
5191 IN PRTMP_ADAPTER pAd,
5192 IN UCHAR AironetCellPowerLimit);
5195 // Prototypes of function definition in rtmp_tkip.c
5197 VOID RTMPInitTkipEngine(
5198 IN PRTMP_ADAPTER pAd,
5199 IN PUCHAR pTKey,
5200 IN UCHAR KeyId,
5201 IN PUCHAR pTA,
5202 IN PUCHAR pMICKey,
5203 IN PUCHAR pTSC,
5204 OUT PULONG pIV16,
5205 OUT PULONG pIV32);
5207 VOID RTMPInitMICEngine(
5208 IN PRTMP_ADAPTER pAd,
5209 IN PUCHAR pKey,
5210 IN PUCHAR pDA,
5211 IN PUCHAR pSA,
5212 IN UCHAR UserPriority,
5213 IN PUCHAR pMICKey);
5215 BOOLEAN RTMPTkipCompareMICValue(
5216 IN PRTMP_ADAPTER pAd,
5217 IN PUCHAR pSrc,
5218 IN PUCHAR pDA,
5219 IN PUCHAR pSA,
5220 IN PUCHAR pMICKey,
5221 IN UCHAR UserPriority,
5222 IN UINT Len);
5224 VOID RTMPCalculateMICValue(
5225 IN PRTMP_ADAPTER pAd,
5226 IN PNDIS_PACKET pPacket,
5227 IN PUCHAR pEncap,
5228 IN PCIPHER_KEY pKey,
5229 IN UCHAR apidx);
5231 BOOLEAN RTMPTkipCompareMICValueWithLLC(
5232 IN PRTMP_ADAPTER pAd,
5233 IN PUCHAR pLLC,
5234 IN PUCHAR pSrc,
5235 IN PUCHAR pDA,
5236 IN PUCHAR pSA,
5237 IN PUCHAR pMICKey,
5238 IN UINT Len);
5240 VOID RTMPTkipAppendByte(
5241 IN PTKIP_KEY_INFO pTkip,
5242 IN UCHAR uChar);
5244 VOID RTMPTkipAppend(
5245 IN PTKIP_KEY_INFO pTkip,
5246 IN PUCHAR pSrc,
5247 IN UINT nBytes);
5249 VOID RTMPTkipGetMIC(
5250 IN PTKIP_KEY_INFO pTkip);
5252 BOOLEAN RTMPSoftDecryptTKIP(
5253 IN PRTMP_ADAPTER pAd,
5254 IN PUCHAR pData,
5255 IN ULONG DataByteCnt,
5256 IN UCHAR UserPriority,
5257 IN PCIPHER_KEY pWpaKey);
5259 BOOLEAN RTMPSoftDecryptAES(
5260 IN PRTMP_ADAPTER pAd,
5261 IN PUCHAR pData,
5262 IN ULONG DataByteCnt,
5263 IN PCIPHER_KEY pWpaKey);
5268 // Prototypes of function definition in cmm_info.c
5270 INT RT_CfgSetCountryRegion(
5271 IN PRTMP_ADAPTER pAd,
5272 IN PSTRING arg,
5273 IN INT band);
5275 INT RT_CfgSetWirelessMode(
5276 IN PRTMP_ADAPTER pAd,
5277 IN PSTRING arg);
5279 INT RT_CfgSetShortSlot(
5280 IN PRTMP_ADAPTER pAd,
5281 IN PSTRING arg);
5283 INT RT_CfgSetWepKey(
5284 IN PRTMP_ADAPTER pAd,
5285 IN PSTRING keyString,
5286 IN CIPHER_KEY *pSharedKey,
5287 IN INT keyIdx);
5289 INT RT_CfgSetWPAPSKKey(
5290 IN RTMP_ADAPTER *pAd,
5291 IN PSTRING keyString,
5292 IN UCHAR *pHashStr,
5293 IN INT hashStrLen,
5294 OUT PUCHAR pPMKBuf);
5299 // Prototypes of function definition in cmm_info.c
5301 NDIS_STATUS RTMPWPARemoveKeyProc(
5302 IN PRTMP_ADAPTER pAd,
5303 IN PVOID pBuf);
5305 VOID RTMPWPARemoveAllKeys(
5306 IN PRTMP_ADAPTER pAd);
5308 BOOLEAN RTMPCheckStrPrintAble(
5309 IN CHAR *pInPutStr,
5310 IN UCHAR strLen);
5312 VOID RTMPSetPhyMode(
5313 IN PRTMP_ADAPTER pAd,
5314 IN ULONG phymode);
5316 VOID RTMPUpdateHTIE(
5317 IN RT_HT_CAPABILITY *pRtHt,
5318 IN UCHAR *pMcsSet,
5319 OUT HT_CAPABILITY_IE *pHtCapability,
5320 OUT ADD_HT_INFO_IE *pAddHtInfo);
5322 VOID RTMPAddWcidAttributeEntry(
5323 IN PRTMP_ADAPTER pAd,
5324 IN UCHAR BssIdx,
5325 IN UCHAR KeyIdx,
5326 IN UCHAR CipherAlg,
5327 IN MAC_TABLE_ENTRY *pEntry);
5329 PSTRING GetEncryptType(
5330 CHAR enc);
5332 PSTRING GetAuthMode(
5333 CHAR auth);
5336 VOID RTMPIndicateWPA2Status(
5337 IN PRTMP_ADAPTER pAdapter);
5339 VOID RTMPOPModeSwitching(
5340 IN PRTMP_ADAPTER pAd);
5343 #ifdef DOT11_N_SUPPORT
5344 VOID RTMPSetHT(
5345 IN PRTMP_ADAPTER pAd,
5346 IN OID_SET_HT_PHYMODE *pHTPhyMode);
5348 VOID RTMPSetIndividualHT(
5349 IN PRTMP_ADAPTER pAd,
5350 IN UCHAR apidx);
5351 #endif // DOT11_N_SUPPORT //
5353 VOID RTMPSendWirelessEvent(
5354 IN PRTMP_ADAPTER pAd,
5355 IN USHORT Event_flag,
5356 IN PUCHAR pAddr,
5357 IN UCHAR BssIdx,
5358 IN CHAR Rssi);
5360 VOID NICUpdateCntlCounters(
5361 IN PRTMP_ADAPTER pAd,
5362 IN PHEADER_802_11 pHeader,
5363 IN UCHAR SubType,
5364 IN PRXWI_STRUC pRxWI);
5366 VOID DBGPRINT_TX_RING(
5367 IN PRTMP_ADAPTER pAd,
5368 IN UCHAR QueIdx);
5370 VOID DBGPRINT_RX_RING(
5371 IN PRTMP_ADAPTER pAd);
5373 CHAR ConvertToRssi(
5374 IN PRTMP_ADAPTER pAd,
5375 IN CHAR Rssi,
5376 IN UCHAR RssiNumber);
5379 #ifdef DOT11N_DRAFT3
5380 VOID BuildEffectedChannelList(
5381 IN PRTMP_ADAPTER pAd);
5382 #endif // DOT11N_DRAFT3 //
5385 VOID APAsicEvaluateRxAnt(
5386 IN PRTMP_ADAPTER pAd);
5388 #ifdef ANT_DIVERSITY_SUPPORT
5389 VOID APAsicAntennaAvg(
5390 IN PRTMP_ADAPTER pAd,
5391 IN UCHAR AntSelect,
5392 IN SHORT *RssiAvg);
5393 #endif // ANT_DIVERSITY_SUPPORT //
5395 VOID APAsicRxAntEvalTimeout(
5396 IN PRTMP_ADAPTER pAd);
5398 /*===================================
5399 Function prototype in cmm_wpa.c
5400 =================================== */
5401 VOID RTMPToWirelessSta(
5402 IN PRTMP_ADAPTER pAd,
5403 IN PMAC_TABLE_ENTRY pEntry,
5404 IN PUCHAR pHeader802_3,
5405 IN UINT HdrLen,
5406 IN PUCHAR pData,
5407 IN UINT DataLen,
5408 IN BOOLEAN bClearFrame);
5410 VOID WpaDerivePTK(
5411 IN PRTMP_ADAPTER pAd,
5412 IN UCHAR *PMK,
5413 IN UCHAR *ANonce,
5414 IN UCHAR *AA,
5415 IN UCHAR *SNonce,
5416 IN UCHAR *SA,
5417 OUT UCHAR *output,
5418 IN UINT len);
5420 VOID GenRandom(
5421 IN PRTMP_ADAPTER pAd,
5422 IN UCHAR *macAddr,
5423 OUT UCHAR *random);
5425 BOOLEAN RTMPCheckWPAframe(
5426 IN PRTMP_ADAPTER pAd,
5427 IN PMAC_TABLE_ENTRY pEntry,
5428 IN PUCHAR pData,
5429 IN ULONG DataByteCount,
5430 IN UCHAR FromWhichBSSID);
5432 VOID AES_GTK_KEY_UNWRAP(
5433 IN UCHAR *key,
5434 OUT UCHAR *plaintext,
5435 IN UINT32 c_len,
5436 IN UCHAR *ciphertext);
5438 BOOLEAN RTMPParseEapolKeyData(
5439 IN PRTMP_ADAPTER pAd,
5440 IN PUCHAR pKeyData,
5441 IN UCHAR KeyDataLen,
5442 IN UCHAR GroupKeyIndex,
5443 IN UCHAR MsgType,
5444 IN BOOLEAN bWPA2,
5445 IN MAC_TABLE_ENTRY *pEntry);
5447 VOID ConstructEapolMsg(
5448 IN PMAC_TABLE_ENTRY pEntry,
5449 IN UCHAR GroupKeyWepStatus,
5450 IN UCHAR MsgType,
5451 IN UCHAR DefaultKeyIdx,
5452 IN UCHAR *KeyNonce,
5453 IN UCHAR *TxRSC,
5454 IN UCHAR *GTK,
5455 IN UCHAR *RSNIE,
5456 IN UCHAR RSNIE_Len,
5457 OUT PEAPOL_PACKET pMsg);
5459 NDIS_STATUS RTMPSoftDecryptBroadCastData(
5460 IN PRTMP_ADAPTER pAd,
5461 IN RX_BLK *pRxBlk,
5462 IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher,
5463 IN PCIPHER_KEY pShard_key);
5465 VOID RTMPMakeRSNIE(
5466 IN PRTMP_ADAPTER pAd,
5467 IN UINT AuthMode,
5468 IN UINT WepStatus,
5469 IN UCHAR apidx);
5472 // function prototype in ap_wpa.c
5474 VOID RTMPGetTxTscFromAsic(
5475 IN PRTMP_ADAPTER pAd,
5476 IN UCHAR apidx,
5477 OUT PUCHAR pTxTsc);
5479 VOID APInstallPairwiseKey(
5480 PRTMP_ADAPTER pAd,
5481 PMAC_TABLE_ENTRY pEntry);
5483 MAC_TABLE_ENTRY *PACInquiry(
5484 IN PRTMP_ADAPTER pAd,
5485 IN ULONG Wcid);
5487 UINT APValidateRSNIE(
5488 IN PRTMP_ADAPTER pAd,
5489 IN PMAC_TABLE_ENTRY pEntry,
5490 IN PUCHAR pRsnIe,
5491 IN UCHAR rsnie_len);
5493 VOID HandleCounterMeasure(
5494 IN PRTMP_ADAPTER pAd,
5495 IN MAC_TABLE_ENTRY *pEntry);
5497 VOID WPAStart4WayHS(
5498 IN PRTMP_ADAPTER pAd,
5499 IN MAC_TABLE_ENTRY *pEntry,
5500 IN ULONG TimeInterval);
5502 VOID WPAStart2WayGroupHS(
5503 IN PRTMP_ADAPTER pAd,
5504 IN MAC_TABLE_ENTRY *pEntry);
5506 VOID PeerPairMsg1Action(
5507 IN PRTMP_ADAPTER pAd,
5508 IN MAC_TABLE_ENTRY *pEntry,
5509 IN MLME_QUEUE_ELEM *Elem);
5511 VOID PeerPairMsg2Action(
5512 IN PRTMP_ADAPTER pAd,
5513 IN MAC_TABLE_ENTRY *pEntry,
5514 IN MLME_QUEUE_ELEM *Elem);
5516 VOID PeerPairMsg3Action(
5517 IN PRTMP_ADAPTER pAd,
5518 IN MAC_TABLE_ENTRY *pEntry,
5519 IN MLME_QUEUE_ELEM *Elem);
5521 VOID PeerPairMsg4Action(
5522 IN PRTMP_ADAPTER pAd,
5523 IN MAC_TABLE_ENTRY *pEntry,
5524 IN MLME_QUEUE_ELEM *Elem);
5526 VOID PeerGroupMsg1Action(
5527 IN PRTMP_ADAPTER pAd,
5528 IN PMAC_TABLE_ENTRY pEntry,
5529 IN MLME_QUEUE_ELEM *Elem);
5531 VOID PeerGroupMsg2Action(
5532 IN PRTMP_ADAPTER pAd,
5533 IN PMAC_TABLE_ENTRY pEntry,
5534 IN VOID *Msg,
5535 IN UINT MsgLen);
5537 VOID CMTimerExec(
5538 IN PVOID SystemSpecific1,
5539 IN PVOID FunctionContext,
5540 IN PVOID SystemSpecific2,
5541 IN PVOID SystemSpecific3);
5543 VOID WPARetryExec(
5544 IN PVOID SystemSpecific1,
5545 IN PVOID FunctionContext,
5546 IN PVOID SystemSpecific2,
5547 IN PVOID SystemSpecific3);
5549 VOID EnqueueStartForPSKExec(
5550 IN PVOID SystemSpecific1,
5551 IN PVOID FunctionContext,
5552 IN PVOID SystemSpecific2,
5553 IN PVOID SystemSpecific3);
5555 VOID RTMPHandleSTAKey(
5556 IN PRTMP_ADAPTER pAdapter,
5557 IN MAC_TABLE_ENTRY *pEntry,
5558 IN MLME_QUEUE_ELEM *Elem);
5560 VOID PairDisAssocAction(
5561 IN PRTMP_ADAPTER pAd,
5562 IN PMAC_TABLE_ENTRY pEntry,
5563 IN USHORT Reason);
5565 VOID MlmeDeAuthAction(
5566 IN PRTMP_ADAPTER pAd,
5567 IN PMAC_TABLE_ENTRY pEntry,
5568 IN USHORT Reason);
5570 VOID GREKEYPeriodicExec(
5571 IN PVOID SystemSpecific1,
5572 IN PVOID FunctionContext,
5573 IN PVOID SystemSpecific2,
5574 IN PVOID SystemSpecific3);
5576 VOID WpaDeriveGTK(
5577 IN UCHAR *PMK,
5578 IN UCHAR *GNonce,
5579 IN UCHAR *AA,
5580 OUT UCHAR *output,
5581 IN UINT len);
5583 VOID AES_GTK_KEY_WRAP(
5584 IN UCHAR *key,
5585 IN UCHAR *plaintext,
5586 IN UINT32 p_len,
5587 OUT UCHAR *ciphertext);
5589 VOID AES_128_CMAC(
5590 IN PUCHAR key,
5591 IN PUCHAR input,
5592 IN INT len,
5593 OUT PUCHAR mac);
5595 VOID WpaSend(
5596 IN PRTMP_ADAPTER pAdapter,
5597 IN PUCHAR pPacket,
5598 IN ULONG Len);
5600 VOID RTMPAddPMKIDCache(
5601 IN PRTMP_ADAPTER pAd,
5602 IN INT apidx,
5603 IN PUCHAR pAddr,
5604 IN UCHAR *PMKID,
5605 IN UCHAR *PMK);
5607 INT RTMPSearchPMKIDCache(
5608 IN PRTMP_ADAPTER pAd,
5609 IN INT apidx,
5610 IN PUCHAR pAddr);
5612 VOID RTMPDeletePMKIDCache(
5613 IN PRTMP_ADAPTER pAd,
5614 IN INT apidx,
5615 IN INT idx);
5617 VOID RTMPMaintainPMKIDCache(
5618 IN PRTMP_ADAPTER pAd);
5620 VOID RTMPSendTriggerFrame(
5621 IN PRTMP_ADAPTER pAd,
5622 IN PVOID pBuffer,
5623 IN ULONG Length,
5624 IN UCHAR TxRate,
5625 IN BOOLEAN bQosNull);
5627 //typedef void (*TIMER_FUNCTION)(unsigned long);
5630 /* timeout -- ms */
5631 VOID RTMP_SetPeriodicTimer(
5632 IN NDIS_MINIPORT_TIMER *pTimer,
5633 IN unsigned long timeout);
5635 VOID RTMP_OS_Init_Timer(
5636 IN PRTMP_ADAPTER pAd,
5637 IN NDIS_MINIPORT_TIMER *pTimer,
5638 IN TIMER_FUNCTION function,
5639 IN PVOID data);
5641 VOID RTMP_OS_Add_Timer(
5642 IN NDIS_MINIPORT_TIMER *pTimer,
5643 IN unsigned long timeout);
5645 VOID RTMP_OS_Mod_Timer(
5646 IN NDIS_MINIPORT_TIMER *pTimer,
5647 IN unsigned long timeout);
5650 VOID RTMP_OS_Del_Timer(
5651 IN NDIS_MINIPORT_TIMER *pTimer,
5652 OUT BOOLEAN *pCancelled);
5655 VOID RTMP_OS_Release_Packet(
5656 IN PRTMP_ADAPTER pAd,
5657 IN PQUEUE_ENTRY pEntry);
5659 VOID RTMPusecDelay(
5660 IN ULONG usec);
5662 NDIS_STATUS os_alloc_mem(
5663 IN RTMP_ADAPTER *pAd,
5664 OUT UCHAR **mem,
5665 IN ULONG size);
5667 NDIS_STATUS os_free_mem(
5668 IN PRTMP_ADAPTER pAd,
5669 IN PVOID mem);
5672 void RTMP_AllocateSharedMemory(
5673 IN PRTMP_ADAPTER pAd,
5674 IN ULONG Length,
5675 IN BOOLEAN Cached,
5676 OUT PVOID *VirtualAddress,
5677 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5679 VOID RTMPFreeTxRxRingMemory(
5680 IN PRTMP_ADAPTER pAd);
5682 NDIS_STATUS AdapterBlockAllocateMemory(
5683 IN PVOID handle,
5684 OUT PVOID *ppAd);
5686 void RTMP_AllocateTxDescMemory(
5687 IN PRTMP_ADAPTER pAd,
5688 IN UINT Index,
5689 IN ULONG Length,
5690 IN BOOLEAN Cached,
5691 OUT PVOID *VirtualAddress,
5692 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5694 void RTMP_AllocateFirstTxBuffer(
5695 IN PRTMP_ADAPTER pAd,
5696 IN UINT Index,
5697 IN ULONG Length,
5698 IN BOOLEAN Cached,
5699 OUT PVOID *VirtualAddress,
5700 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5702 void RTMP_FreeFirstTxBuffer(
5703 IN PRTMP_ADAPTER pAd,
5704 IN ULONG Length,
5705 IN BOOLEAN Cached,
5706 IN PVOID VirtualAddress,
5707 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
5709 void RTMP_AllocateMgmtDescMemory(
5710 IN PRTMP_ADAPTER pAd,
5711 IN ULONG Length,
5712 IN BOOLEAN Cached,
5713 OUT PVOID *VirtualAddress,
5714 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5716 void RTMP_AllocateRxDescMemory(
5717 IN PRTMP_ADAPTER pAd,
5718 IN ULONG Length,
5719 IN BOOLEAN Cached,
5720 OUT PVOID *VirtualAddress,
5721 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5723 void RTMP_FreeDescMemory(
5724 IN PRTMP_ADAPTER pAd,
5725 IN ULONG Length,
5726 IN PVOID VirtualAddress,
5727 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
5729 PNDIS_PACKET RtmpOSNetPktAlloc(
5730 IN RTMP_ADAPTER *pAd,
5731 IN int size);
5733 PNDIS_PACKET RTMP_AllocateRxPacketBuffer(
5734 IN PRTMP_ADAPTER pAd,
5735 IN ULONG Length,
5736 IN BOOLEAN Cached,
5737 OUT PVOID *VirtualAddress,
5738 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5740 PNDIS_PACKET RTMP_AllocateTxPacketBuffer(
5741 IN PRTMP_ADAPTER pAd,
5742 IN ULONG Length,
5743 IN BOOLEAN Cached,
5744 OUT PVOID *VirtualAddress);
5746 PNDIS_PACKET RTMP_AllocateFragPacketBuffer(
5747 IN PRTMP_ADAPTER pAd,
5748 IN ULONG Length);
5750 void RTMP_QueryPacketInfo(
5751 IN PNDIS_PACKET pPacket,
5752 OUT PACKET_INFO *pPacketInfo,
5753 OUT PUCHAR *pSrcBufVA,
5754 OUT UINT *pSrcBufLen);
5756 void RTMP_QueryNextPacketInfo(
5757 IN PNDIS_PACKET *ppPacket,
5758 OUT PACKET_INFO *pPacketInfo,
5759 OUT PUCHAR *pSrcBufVA,
5760 OUT UINT *pSrcBufLen);
5763 BOOLEAN RTMP_FillTxBlkInfo(
5764 IN RTMP_ADAPTER *pAd,
5765 IN TX_BLK *pTxBlk);
5768 PRTMP_SCATTER_GATHER_LIST
5769 rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST *sg);
5772 void announce_802_3_packet(
5773 IN PRTMP_ADAPTER pAd,
5774 IN PNDIS_PACKET pPacket);
5777 UINT BA_Reorder_AMSDU_Annnounce(
5778 IN PRTMP_ADAPTER pAd,
5779 IN PNDIS_PACKET pPacket);
5782 UINT Handle_AMSDU_Packet(
5783 IN PRTMP_ADAPTER pAd,
5784 IN PUCHAR pData,
5785 IN ULONG DataSize,
5786 IN UCHAR FromWhichBSSID);
5789 void convert_802_11_to_802_3_packet(
5790 IN PRTMP_ADAPTER pAd,
5791 IN PNDIS_PACKET pPacket,
5792 IN PUCHAR p8023hdr,
5793 IN PUCHAR pData,
5794 IN ULONG DataSize,
5795 IN UCHAR FromWhichBSSID);
5798 PNET_DEV get_netdev_from_bssid(
5799 IN PRTMP_ADAPTER pAd,
5800 IN UCHAR FromWhichBSSID);
5803 PNDIS_PACKET duplicate_pkt(
5804 IN PRTMP_ADAPTER pAd,
5805 IN PUCHAR pHeader802_3,
5806 IN UINT HdrLen,
5807 IN PUCHAR pData,
5808 IN ULONG DataSize,
5809 IN UCHAR FromWhichBSSID);
5812 PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(
5813 IN PRTMP_ADAPTER pAd,
5814 IN PNDIS_PACKET pOldPkt);
5816 PNDIS_PACKET duplicate_pkt_with_VLAN(
5817 IN PRTMP_ADAPTER pAd,
5818 IN PUCHAR pHeader802_3,
5819 IN UINT HdrLen,
5820 IN PUCHAR pData,
5821 IN ULONG DataSize,
5822 IN UCHAR FromWhichBSSID);
5825 UCHAR VLAN_8023_Header_Copy(
5826 IN PRTMP_ADAPTER pAd,
5827 IN PUCHAR pHeader802_3,
5828 IN UINT HdrLen,
5829 OUT PUCHAR pData,
5830 IN UCHAR FromWhichBSSID);
5832 #ifdef DOT11_N_SUPPORT
5833 void ba_flush_reordering_timeout_mpdus(
5834 IN PRTMP_ADAPTER pAd,
5835 IN PBA_REC_ENTRY pBAEntry,
5836 IN ULONG Now32);
5839 VOID BAOriSessionSetUp(
5840 IN PRTMP_ADAPTER pAd,
5841 IN MAC_TABLE_ENTRY *pEntry,
5842 IN UCHAR TID,
5843 IN USHORT TimeOut,
5844 IN ULONG DelayTime,
5845 IN BOOLEAN isForced);
5847 VOID BASessionTearDownALL(
5848 IN OUT PRTMP_ADAPTER pAd,
5849 IN UCHAR Wcid);
5850 #endif // DOT11_N_SUPPORT //
5852 BOOLEAN OS_Need_Clone_Packet(void);
5855 VOID build_tx_packet(
5856 IN PRTMP_ADAPTER pAd,
5857 IN PNDIS_PACKET pPacket,
5858 IN PUCHAR pFrame,
5859 IN ULONG FrameLen);
5862 VOID BAOriSessionTearDown(
5863 IN OUT PRTMP_ADAPTER pAd,
5864 IN UCHAR Wcid,
5865 IN UCHAR TID,
5866 IN BOOLEAN bPassive,
5867 IN BOOLEAN bForceSend);
5869 VOID BARecSessionTearDown(
5870 IN OUT PRTMP_ADAPTER pAd,
5871 IN UCHAR Wcid,
5872 IN UCHAR TID,
5873 IN BOOLEAN bPassive);
5875 BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num);
5876 void ba_reordering_resource_release(PRTMP_ADAPTER pAd);
5880 #ifdef NINTENDO_AP
5881 VOID InitNINTENDO_TABLE(
5882 IN PRTMP_ADAPTER pAd);
5884 UCHAR CheckNINTENDO_TABLE(
5885 IN PRTMP_ADAPTER pAd,
5886 PCHAR pDS_Ssid,
5887 UCHAR DS_SsidLen,
5888 PUCHAR pDS_Addr);
5890 UCHAR DelNINTENDO_ENTRY(
5891 IN PRTMP_ADAPTER pAd,
5892 UCHAR * pDS_Addr);
5894 VOID RTMPIoctlNintendoCapable(
5895 IN PRTMP_ADAPTER pAd,
5896 IN struct iwreq *wrq);
5898 VOID RTMPIoctlNintendoGetTable(
5899 IN PRTMP_ADAPTER pAd,
5900 IN struct iwreq *wrq);
5902 VOID RTMPIoctlNintendoSetTable(
5903 IN PRTMP_ADAPTER pAd,
5904 IN struct iwreq *wrq);
5906 #endif // NINTENDO_AP //
5908 BOOLEAN rtstrmactohex(
5909 IN PSTRING s1,
5910 IN PSTRING s2);
5912 BOOLEAN rtstrcasecmp(
5913 IN PSTRING s1,
5914 IN PSTRING s2);
5916 PSTRING rtstrstruncasecmp(
5917 IN PSTRING s1,
5918 IN PSTRING s2);
5920 PSTRING rtstrstr(
5921 IN const PSTRING s1,
5922 IN const PSTRING s2);
5924 PSTRING rstrtok(
5925 IN PSTRING s,
5926 IN const PSTRING ct);
5928 int rtinet_aton(
5929 const PSTRING cp,
5930 unsigned int *addr);
5932 ////////// common ioctl functions //////////
5933 INT Set_DriverVersion_Proc(
5934 IN PRTMP_ADAPTER pAd,
5935 IN PSTRING arg);
5937 INT Set_CountryRegion_Proc(
5938 IN PRTMP_ADAPTER pAd,
5939 IN PSTRING arg);
5941 INT Set_CountryRegionABand_Proc(
5942 IN PRTMP_ADAPTER pAd,
5943 IN PSTRING arg);
5945 INT Set_WirelessMode_Proc(
5946 IN PRTMP_ADAPTER pAd,
5947 IN PSTRING arg);
5949 INT Set_Channel_Proc(
5950 IN PRTMP_ADAPTER pAd,
5951 IN PSTRING arg);
5953 INT Set_ShortSlot_Proc(
5954 IN PRTMP_ADAPTER pAd,
5955 IN PSTRING arg);
5957 INT Set_TxPower_Proc(
5958 IN PRTMP_ADAPTER pAd,
5959 IN PSTRING arg);
5961 INT Set_BGProtection_Proc(
5962 IN PRTMP_ADAPTER pAd,
5963 IN PSTRING arg);
5965 INT Set_TxPreamble_Proc(
5966 IN PRTMP_ADAPTER pAd,
5967 IN PSTRING arg);
5969 INT Set_RTSThreshold_Proc(
5970 IN PRTMP_ADAPTER pAd,
5971 IN PSTRING arg);
5973 INT Set_FragThreshold_Proc(
5974 IN PRTMP_ADAPTER pAd,
5975 IN PSTRING arg);
5977 INT Set_TxBurst_Proc(
5978 IN PRTMP_ADAPTER pAd,
5979 IN PSTRING arg);
5981 #ifdef AGGREGATION_SUPPORT
5982 INT Set_PktAggregate_Proc(
5983 IN PRTMP_ADAPTER pAd,
5984 IN PSTRING arg);
5985 #endif // AGGREGATION_SUPPORT //
5987 #ifdef INF_AMAZON_PPA
5988 INT Set_INF_AMAZON_SE_PPA_Proc(
5989 IN PRTMP_ADAPTER pAd,
5990 IN PUCHAR arg);
5992 #endif // INF_AMAZON_PPA //
5994 INT Set_IEEE80211H_Proc(
5995 IN PRTMP_ADAPTER pAd,
5996 IN PSTRING arg);
5998 #ifdef DBG
5999 INT Set_Debug_Proc(
6000 IN PRTMP_ADAPTER pAd,
6001 IN PSTRING arg);
6002 #endif
6004 INT Show_DescInfo_Proc(
6005 IN PRTMP_ADAPTER pAd,
6006 IN PSTRING arg);
6008 INT Set_ResetStatCounter_Proc(
6009 IN PRTMP_ADAPTER pAd,
6010 IN PSTRING arg);
6012 #ifdef DOT11_N_SUPPORT
6013 INT Set_BASetup_Proc(
6014 IN PRTMP_ADAPTER pAd,
6015 IN PSTRING arg);
6017 INT Set_BADecline_Proc(
6018 IN PRTMP_ADAPTER pAd,
6019 IN PSTRING arg);
6021 INT Set_BAOriTearDown_Proc(
6022 IN PRTMP_ADAPTER pAd,
6023 IN PSTRING arg);
6025 INT Set_BARecTearDown_Proc(
6026 IN PRTMP_ADAPTER pAd,
6027 IN PSTRING arg);
6029 INT Set_HtBw_Proc(
6030 IN PRTMP_ADAPTER pAd,
6031 IN PSTRING arg);
6033 INT Set_HtMcs_Proc(
6034 IN PRTMP_ADAPTER pAd,
6035 IN PSTRING arg);
6037 INT Set_HtGi_Proc(
6038 IN PRTMP_ADAPTER pAd,
6039 IN PSTRING arg);
6041 INT Set_HtOpMode_Proc(
6042 IN PRTMP_ADAPTER pAd,
6043 IN PSTRING arg);
6045 INT Set_HtStbc_Proc(
6046 IN PRTMP_ADAPTER pAd,
6047 IN PSTRING arg);
6049 INT Set_HtHtc_Proc(
6050 IN PRTMP_ADAPTER pAd,
6051 IN PSTRING arg);
6053 INT Set_HtExtcha_Proc(
6054 IN PRTMP_ADAPTER pAd,
6055 IN PSTRING arg);
6057 INT Set_HtMpduDensity_Proc(
6058 IN PRTMP_ADAPTER pAd,
6059 IN PSTRING arg);
6061 INT Set_HtBaWinSize_Proc(
6062 IN PRTMP_ADAPTER pAd,
6063 IN PSTRING arg);
6065 INT Set_HtRdg_Proc(
6066 IN PRTMP_ADAPTER pAd,
6067 IN PSTRING arg);
6069 INT Set_HtLinkAdapt_Proc(
6070 IN PRTMP_ADAPTER pAd,
6071 IN PSTRING arg);
6073 INT Set_HtAmsdu_Proc(
6074 IN PRTMP_ADAPTER pAd,
6075 IN PSTRING arg);
6077 INT Set_HtAutoBa_Proc(
6078 IN PRTMP_ADAPTER pAd,
6079 IN PSTRING arg);
6081 INT Set_HtProtect_Proc(
6082 IN PRTMP_ADAPTER pAd,
6083 IN PSTRING arg);
6085 INT Set_HtMimoPs_Proc(
6086 IN PRTMP_ADAPTER pAd,
6087 IN PSTRING arg);
6090 INT Set_ForceShortGI_Proc(
6091 IN PRTMP_ADAPTER pAd,
6092 IN PSTRING arg);
6094 INT Set_ForceGF_Proc(
6095 IN PRTMP_ADAPTER pAd,
6096 IN PSTRING arg);
6098 INT SetCommonHT(
6099 IN PRTMP_ADAPTER pAd);
6101 INT Set_SendPSMPAction_Proc(
6102 IN PRTMP_ADAPTER pAd,
6103 IN PSTRING arg);
6105 INT Set_HtMIMOPSmode_Proc(
6106 IN PRTMP_ADAPTER pAd,
6107 IN PSTRING arg);
6110 INT Set_HtTxBASize_Proc(
6111 IN PRTMP_ADAPTER pAd,
6112 IN PSTRING arg);
6114 INT Set_HtDisallowTKIP_Proc(
6115 IN PRTMP_ADAPTER pAd,
6116 IN PSTRING arg);
6118 #endif // DOT11_N_SUPPORT //
6122 #ifdef CONFIG_STA_SUPPORT
6123 //Dls , kathy
6124 VOID RTMPSendDLSTearDownFrame(
6125 IN PRTMP_ADAPTER pAd,
6126 IN PUCHAR pDA);
6128 #ifdef DOT11_N_SUPPORT
6129 //Block ACK
6130 VOID QueryBATABLE(
6131 IN PRTMP_ADAPTER pAd,
6132 OUT PQUERYBA_TABLE pBAT);
6133 #endif // DOT11_N_SUPPORT //
6135 #ifdef WPA_SUPPLICANT_SUPPORT
6136 INT WpaCheckEapCode(
6137 IN PRTMP_ADAPTER pAd,
6138 IN PUCHAR pFrame,
6139 IN USHORT FrameLen,
6140 IN USHORT OffSet);
6142 VOID WpaSendMicFailureToWpaSupplicant(
6143 IN PRTMP_ADAPTER pAd,
6144 IN BOOLEAN bUnicast);
6146 VOID SendAssocIEsToWpaSupplicant(
6147 IN PRTMP_ADAPTER pAd);
6148 #endif // WPA_SUPPLICANT_SUPPORT //
6150 #ifdef NATIVE_WPA_SUPPLICANT_SUPPORT
6151 int wext_notify_event_assoc(
6152 IN RTMP_ADAPTER *pAd);
6153 #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
6155 #endif // CONFIG_STA_SUPPORT //
6159 #ifdef DOT11_N_SUPPORT
6160 VOID Handle_BSS_Width_Trigger_Events(
6161 IN PRTMP_ADAPTER pAd);
6163 void build_ext_channel_switch_ie(
6164 IN PRTMP_ADAPTER pAd,
6165 IN HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE *pIE);
6166 #endif // DOT11_N_SUPPORT //
6169 BOOLEAN APRxDoneInterruptHandle(
6170 IN PRTMP_ADAPTER pAd);
6172 BOOLEAN STARxDoneInterruptHandle(
6173 IN PRTMP_ADAPTER pAd,
6174 IN BOOLEAN argc);
6176 #ifdef DOT11_N_SUPPORT
6177 // AMPDU packet indication
6178 VOID Indicate_AMPDU_Packet(
6179 IN PRTMP_ADAPTER pAd,
6180 IN RX_BLK *pRxBlk,
6181 IN UCHAR FromWhichBSSID);
6183 // AMSDU packet indication
6184 VOID Indicate_AMSDU_Packet(
6185 IN PRTMP_ADAPTER pAd,
6186 IN RX_BLK *pRxBlk,
6187 IN UCHAR FromWhichBSSID);
6188 #endif // DOT11_N_SUPPORT //
6190 // Normal legacy Rx packet indication
6191 VOID Indicate_Legacy_Packet(
6192 IN PRTMP_ADAPTER pAd,
6193 IN RX_BLK *pRxBlk,
6194 IN UCHAR FromWhichBSSID);
6196 VOID Indicate_EAPOL_Packet(
6197 IN PRTMP_ADAPTER pAd,
6198 IN RX_BLK *pRxBlk,
6199 IN UCHAR FromWhichBSSID);
6201 void update_os_packet_info(
6202 IN PRTMP_ADAPTER pAd,
6203 IN RX_BLK *pRxBlk,
6204 IN UCHAR FromWhichBSSID);
6206 void wlan_802_11_to_802_3_packet(
6207 IN PRTMP_ADAPTER pAd,
6208 IN RX_BLK *pRxBlk,
6209 IN PUCHAR pHeader802_3,
6210 IN UCHAR FromWhichBSSID);
6212 UINT deaggregate_AMSDU_announce(
6213 IN PRTMP_ADAPTER pAd,
6214 PNDIS_PACKET pPacket,
6215 IN PUCHAR pData,
6216 IN ULONG DataSize);
6219 #ifdef CONFIG_STA_SUPPORT
6220 // remove LLC and get 802_3 Header
6221 #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \
6223 PUCHAR _pRemovedLLCSNAP = NULL, _pDA, _pSA; \
6225 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) \
6227 _pDA = _pRxBlk->pHeader->Addr3; \
6228 _pSA = (PUCHAR)_pRxBlk->pHeader + sizeof(HEADER_802_11); \
6230 else \
6232 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_INFRA)) \
6234 _pDA = _pRxBlk->pHeader->Addr1; \
6235 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_DLS)) \
6236 _pSA = _pRxBlk->pHeader->Addr2; \
6237 else \
6238 _pSA = _pRxBlk->pHeader->Addr3; \
6240 else \
6242 _pDA = _pRxBlk->pHeader->Addr1; \
6243 _pSA = _pRxBlk->pHeader->Addr2; \
6247 CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \
6248 _pRxBlk->DataSize, _pRemovedLLCSNAP); \
6250 #endif // CONFIG_STA_SUPPORT //
6253 BOOLEAN APFowardWirelessStaToWirelessSta(
6254 IN PRTMP_ADAPTER pAd,
6255 IN PNDIS_PACKET pPacket,
6256 IN ULONG FromWhichBSSID);
6258 VOID Announce_or_Forward_802_3_Packet(
6259 IN PRTMP_ADAPTER pAd,
6260 IN PNDIS_PACKET pPacket,
6261 IN UCHAR FromWhichBSSID);
6263 VOID Sta_Announce_or_Forward_802_3_Packet(
6264 IN PRTMP_ADAPTER pAd,
6265 IN PNDIS_PACKET pPacket,
6266 IN UCHAR FromWhichBSSID);
6269 #ifdef CONFIG_STA_SUPPORT
6270 #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\
6271 Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS);
6272 //announce_802_3_packet(_pAd, _pPacket);
6273 #endif // CONFIG_STA_SUPPORT //
6276 PNDIS_PACKET DuplicatePacket(
6277 IN PRTMP_ADAPTER pAd,
6278 IN PNDIS_PACKET pPacket,
6279 IN UCHAR FromWhichBSSID);
6282 PNDIS_PACKET ClonePacket(
6283 IN PRTMP_ADAPTER pAd,
6284 IN PNDIS_PACKET pPacket,
6285 IN PUCHAR pData,
6286 IN ULONG DataSize);
6289 // Normal, AMPDU or AMSDU
6290 VOID CmmRxnonRalinkFrameIndicate(
6291 IN PRTMP_ADAPTER pAd,
6292 IN RX_BLK *pRxBlk,
6293 IN UCHAR FromWhichBSSID);
6295 VOID CmmRxRalinkFrameIndicate(
6296 IN PRTMP_ADAPTER pAd,
6297 IN MAC_TABLE_ENTRY *pEntry,
6298 IN RX_BLK *pRxBlk,
6299 IN UCHAR FromWhichBSSID);
6301 VOID Update_Rssi_Sample(
6302 IN PRTMP_ADAPTER pAd,
6303 IN RSSI_SAMPLE *pRssi,
6304 IN PRXWI_STRUC pRxWI);
6306 PNDIS_PACKET GetPacketFromRxRing(
6307 IN PRTMP_ADAPTER pAd,
6308 OUT PRT28XX_RXD_STRUC pSaveRxD,
6309 OUT BOOLEAN *pbReschedule,
6310 IN OUT UINT32 *pRxPending);
6312 PNDIS_PACKET RTMPDeFragmentDataFrame(
6313 IN PRTMP_ADAPTER pAd,
6314 IN RX_BLK *pRxBlk);
6316 ////////////////////////////////////////
6318 VOID RTMPIoctlGetSiteSurvey(
6319 IN PRTMP_ADAPTER pAdapter,
6320 IN struct iwreq *wrq);
6326 #ifdef SNMP_SUPPORT
6327 //for snmp , kathy
6328 typedef struct _DefaultKeyIdxValue
6330 UCHAR KeyIdx;
6331 UCHAR Value[16];
6332 } DefaultKeyIdxValue, *PDefaultKeyIdxValue;
6333 #endif
6336 #ifdef CONFIG_STA_SUPPORT
6337 enum {
6338 DIDmsg_lnxind_wlansniffrm = 0x00000044,
6339 DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044,
6340 DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044,
6341 DIDmsg_lnxind_wlansniffrm_channel = 0x00030044,
6342 DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044,
6343 DIDmsg_lnxind_wlansniffrm_sq = 0x00050044,
6344 DIDmsg_lnxind_wlansniffrm_signal = 0x00060044,
6345 DIDmsg_lnxind_wlansniffrm_noise = 0x00070044,
6346 DIDmsg_lnxind_wlansniffrm_rate = 0x00080044,
6347 DIDmsg_lnxind_wlansniffrm_istx = 0x00090044,
6348 DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044
6350 enum {
6351 P80211ENUM_msgitem_status_no_value = 0x00
6353 enum {
6354 P80211ENUM_truth_false = 0x00,
6355 P80211ENUM_truth_true = 0x01
6358 /* Definition from madwifi */
6359 typedef struct {
6360 UINT32 did;
6361 UINT16 status;
6362 UINT16 len;
6363 UINT32 data;
6364 } p80211item_uint32_t;
6366 typedef struct {
6367 UINT32 msgcode;
6368 UINT32 msglen;
6369 #define WLAN_DEVNAMELEN_MAX 16
6370 UINT8 devname[WLAN_DEVNAMELEN_MAX];
6371 p80211item_uint32_t hosttime;
6372 p80211item_uint32_t mactime;
6373 p80211item_uint32_t channel;
6374 p80211item_uint32_t rssi;
6375 p80211item_uint32_t sq;
6376 p80211item_uint32_t signal;
6377 p80211item_uint32_t noise;
6378 p80211item_uint32_t rate;
6379 p80211item_uint32_t istx;
6380 p80211item_uint32_t frmlen;
6381 } wlan_ng_prism2_header;
6383 /* The radio capture header precedes the 802.11 header. */
6384 typedef struct PACKED _ieee80211_radiotap_header {
6385 UINT8 it_version; /* Version 0. Only increases
6386 * for drastic changes,
6387 * introduction of compatible
6388 * new fields does not count.
6390 UINT8 it_pad;
6391 UINT16 it_len; /* length of the whole
6392 * header in bytes, including
6393 * it_version, it_pad,
6394 * it_len, and data fields.
6396 UINT32 it_present; /* A bitmap telling which
6397 * fields are present. Set bit 31
6398 * (0x80000000) to extend the
6399 * bitmap by another 32 bits.
6400 * Additional extensions are made
6401 * by setting bit 31.
6403 }ieee80211_radiotap_header ;
6405 enum ieee80211_radiotap_type {
6406 IEEE80211_RADIOTAP_TSFT = 0,
6407 IEEE80211_RADIOTAP_FLAGS = 1,
6408 IEEE80211_RADIOTAP_RATE = 2,
6409 IEEE80211_RADIOTAP_CHANNEL = 3,
6410 IEEE80211_RADIOTAP_FHSS = 4,
6411 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
6412 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
6413 IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
6414 IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
6415 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
6416 IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
6417 IEEE80211_RADIOTAP_ANTENNA = 11,
6418 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
6419 IEEE80211_RADIOTAP_DB_ANTNOISE = 13
6422 #define WLAN_RADIOTAP_PRESENT ( \
6423 (1 << IEEE80211_RADIOTAP_TSFT) | \
6424 (1 << IEEE80211_RADIOTAP_FLAGS) | \
6425 (1 << IEEE80211_RADIOTAP_RATE) | \
6428 typedef struct _wlan_radiotap_header {
6429 ieee80211_radiotap_header wt_ihdr;
6430 INT64 wt_tsft;
6431 UINT8 wt_flags;
6432 UINT8 wt_rate;
6433 } wlan_radiotap_header;
6434 /* Definition from madwifi */
6436 void send_monitor_packets(
6437 IN PRTMP_ADAPTER pAd,
6438 IN RX_BLK *pRxBlk);
6441 VOID RTMPSetDesiredRates(
6442 IN PRTMP_ADAPTER pAdapter,
6443 IN LONG Rates);
6444 #endif // CONFIG_STA_SUPPORT //
6446 INT Set_FixedTxMode_Proc(
6447 IN PRTMP_ADAPTER pAd,
6448 IN PSTRING arg);
6450 #ifdef CONFIG_APSTA_MIXED_SUPPORT
6451 INT Set_OpMode_Proc(
6452 IN PRTMP_ADAPTER pAd,
6453 IN PSTRING arg);
6454 #endif // CONFIG_APSTA_MIXED_SUPPORT //
6456 INT Set_LongRetryLimit_Proc(
6457 IN PRTMP_ADAPTER pAdapter,
6458 IN PSTRING arg);
6460 INT Set_ShortRetryLimit_Proc(
6461 IN PRTMP_ADAPTER pAdapter,
6462 IN PSTRING arg);
6464 BOOLEAN RT28XXChipsetCheck(
6465 IN void *_dev_p);
6468 VOID RT28XXDMADisable(
6469 IN RTMP_ADAPTER *pAd);
6471 VOID RT28XXDMAEnable(
6472 IN RTMP_ADAPTER *pAd);
6474 VOID RT28xx_UpdateBeaconToAsic(
6475 IN RTMP_ADAPTER * pAd,
6476 IN INT apidx,
6477 IN ULONG BeaconLen,
6478 IN ULONG UpdatePos);
6480 int rt28xx_init(
6481 IN PRTMP_ADAPTER pAd,
6482 IN PSTRING pDefaultMac,
6483 IN PSTRING pHostName);
6485 BOOLEAN RT28XXSecurityKeyAdd(
6486 IN PRTMP_ADAPTER pAd,
6487 IN ULONG apidx,
6488 IN ULONG KeyIdx,
6489 IN MAC_TABLE_ENTRY *pEntry);
6491 NDIS_STATUS RtmpNetTaskInit(
6492 IN RTMP_ADAPTER *pAd);
6494 VOID RtmpNetTaskExit(
6495 IN PRTMP_ADAPTER pAd);
6497 NDIS_STATUS RtmpMgmtTaskInit(
6498 IN RTMP_ADAPTER *pAd);
6500 VOID RtmpMgmtTaskExit(
6501 IN RTMP_ADAPTER *pAd);
6503 void tbtt_tasklet(unsigned long data);
6506 PNET_DEV RtmpPhyNetDevInit(
6507 IN RTMP_ADAPTER *pAd,
6508 IN RTMP_OS_NETDEV_OP_HOOK *pNetHook);
6510 BOOLEAN RtmpPhyNetDevExit(
6511 IN RTMP_ADAPTER *pAd,
6512 IN PNET_DEV net_dev);
6514 INT RtmpRaDevCtrlInit(
6515 IN RTMP_ADAPTER *pAd,
6516 IN RTMP_INF_TYPE infType);
6518 BOOLEAN RtmpRaDevCtrlExit(
6519 IN RTMP_ADAPTER *pAd);
6522 #ifdef RTMP_MAC_PCI
6524 // Function Prototype in cmm_data_pci.c
6526 USHORT RtmpPCI_WriteTxResource(
6527 IN PRTMP_ADAPTER pAd,
6528 IN TX_BLK *pTxBlk,
6529 IN BOOLEAN bIsLast,
6530 OUT USHORT *FreeNumber);
6532 USHORT RtmpPCI_WriteSingleTxResource(
6533 IN PRTMP_ADAPTER pAd,
6534 IN TX_BLK *pTxBlk,
6535 IN BOOLEAN bIsLast,
6536 OUT USHORT *FreeNumber);
6538 USHORT RtmpPCI_WriteMultiTxResource(
6539 IN PRTMP_ADAPTER pAd,
6540 IN TX_BLK *pTxBlk,
6541 IN UCHAR frameNum,
6542 OUT USHORT *FreeNumber);
6544 USHORT RtmpPCI_WriteFragTxResource(
6545 IN PRTMP_ADAPTER pAd,
6546 IN TX_BLK *pTxBlk,
6547 IN UCHAR fragNum,
6548 OUT USHORT *FreeNumber);
6550 USHORT RtmpPCI_WriteSubTxResource(
6551 IN PRTMP_ADAPTER pAd,
6552 IN TX_BLK *pTxBlk,
6553 IN BOOLEAN bIsLast,
6554 OUT USHORT *FreeNumber);
6556 VOID RtmpPCI_FinalWriteTxResource(
6557 IN PRTMP_ADAPTER pAd,
6558 IN TX_BLK *pTxBlk,
6559 IN USHORT totalMPDUSize,
6560 IN USHORT FirstTxIdx);
6562 VOID RtmpPCIDataLastTxIdx(
6563 IN PRTMP_ADAPTER pAd,
6564 IN UCHAR QueIdx,
6565 IN USHORT LastTxIdx);
6567 VOID RtmpPCIDataKickOut(
6568 IN PRTMP_ADAPTER pAd,
6569 IN TX_BLK *pTxBlk,
6570 IN UCHAR QueIdx);
6573 int RtmpPCIMgmtKickOut(
6574 IN RTMP_ADAPTER *pAd,
6575 IN UCHAR QueIdx,
6576 IN PNDIS_PACKET pPacket,
6577 IN PUCHAR pSrcBufVA,
6578 IN UINT SrcBufLen);
6581 NDIS_STATUS RTMPCheckRxError(
6582 IN PRTMP_ADAPTER pAd,
6583 IN PHEADER_802_11 pHeader,
6584 IN PRXWI_STRUC pRxWI,
6585 IN PRT28XX_RXD_STRUC pRxD);
6587 BOOLEAN RT28xxPciAsicRadioOff(
6588 IN PRTMP_ADAPTER pAd,
6589 IN UCHAR Level,
6590 IN USHORT TbttNumToNextWakeUp);
6592 BOOLEAN RT28xxPciAsicRadioOn(
6593 IN PRTMP_ADAPTER pAd,
6594 IN UCHAR Level);
6596 #ifdef CONFIG_STA_SUPPORT
6597 VOID RTMPInitPCIeLinkCtrlValue(
6598 IN PRTMP_ADAPTER pAd);
6600 VOID RTMPFindHostPCIDev(
6601 IN PRTMP_ADAPTER pAd);
6603 VOID RTMPPCIeLinkCtrlValueRestore(
6604 IN PRTMP_ADAPTER pAd,
6605 IN UCHAR Level);
6607 VOID RTMPPCIeLinkCtrlSetting(
6608 IN PRTMP_ADAPTER pAd,
6609 IN USHORT Max);
6611 VOID RTMPrt3xSetPCIePowerLinkCtrl(
6612 IN PRTMP_ADAPTER pAd);
6615 VOID RT28xxPciStaAsicForceWakeup(
6616 IN PRTMP_ADAPTER pAd,
6617 IN BOOLEAN bFromTx);
6619 VOID RT28xxPciStaAsicSleepThenAutoWakeup(
6620 IN PRTMP_ADAPTER pAd,
6621 IN USHORT TbttNumToNextWakeUp);
6623 VOID PsPollWakeExec(
6624 IN PVOID SystemSpecific1,
6625 IN PVOID FunctionContext,
6626 IN PVOID SystemSpecific2,
6627 IN PVOID SystemSpecific3);
6629 VOID RadioOnExec(
6630 IN PVOID SystemSpecific1,
6631 IN PVOID FunctionContext,
6632 IN PVOID SystemSpecific2,
6633 IN PVOID SystemSpecific3);
6634 #endif // CONFIG_STA_SUPPORT //
6636 VOID RT28xxPciMlmeRadioOn(
6637 IN PRTMP_ADAPTER pAd);
6639 VOID RT28xxPciMlmeRadioOFF(
6640 IN PRTMP_ADAPTER pAd);
6641 #endif // RTMP_MAC_PCI //
6643 VOID AsicTurnOffRFClk(
6644 IN PRTMP_ADAPTER pAd,
6645 IN UCHAR Channel);
6647 VOID AsicTurnOnRFClk(
6648 IN PRTMP_ADAPTER pAd,
6649 IN UCHAR Channel);
6653 #ifdef RTMP_TIMER_TASK_SUPPORT
6654 INT RtmpTimerQThread(
6655 IN OUT PVOID Context);
6657 RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert(
6658 IN RTMP_ADAPTER *pAd,
6659 IN RALINK_TIMER_STRUCT *pTimer);
6661 BOOLEAN RtmpTimerQRemove(
6662 IN RTMP_ADAPTER *pAd,
6663 IN RALINK_TIMER_STRUCT *pTimer);
6665 void RtmpTimerQExit(
6666 IN RTMP_ADAPTER *pAd);
6668 void RtmpTimerQInit(
6669 IN RTMP_ADAPTER *pAd);
6670 #endif // RTMP_TIMER_TASK_SUPPORT //
6674 ////////////////////////////////////////
6676 VOID QBSS_LoadInit(
6677 IN RTMP_ADAPTER *pAd);
6679 UINT32 QBSS_LoadElementAppend(
6680 IN RTMP_ADAPTER *pAd,
6681 OUT UINT8 *buf_p);
6683 VOID QBSS_LoadUpdate(
6684 IN RTMP_ADAPTER *pAd);
6686 ///////////////////////////////////////
6687 INT RTMPShowCfgValue(
6688 IN PRTMP_ADAPTER pAd,
6689 IN PSTRING pName,
6690 IN PSTRING pBuf);
6692 PSTRING RTMPGetRalinkAuthModeStr(
6693 IN NDIS_802_11_AUTHENTICATION_MODE authMode);
6695 PSTRING RTMPGetRalinkEncryModeStr(
6696 IN USHORT encryMode);
6697 //////////////////////////////////////
6699 #ifdef CONFIG_STA_SUPPORT
6700 VOID AsicStaBbpTuning(
6701 IN PRTMP_ADAPTER pAd);
6703 BOOLEAN StaAddMacTableEntry(
6704 IN PRTMP_ADAPTER pAd,
6705 IN PMAC_TABLE_ENTRY pEntry,
6706 IN UCHAR MaxSupportedRateIn500Kbps,
6707 IN HT_CAPABILITY_IE *pHtCapability,
6708 IN UCHAR HtCapabilityLen,
6709 IN ADD_HT_INFO_IE *pAddHtInfo,
6710 IN UCHAR AddHtInfoLen,
6711 IN USHORT CapabilityInfo);
6714 BOOLEAN AUTH_ReqSend(
6715 IN PRTMP_ADAPTER pAd,
6716 IN PMLME_QUEUE_ELEM pElem,
6717 IN PRALINK_TIMER_STRUCT pAuthTimer,
6718 IN PSTRING pSMName,
6719 IN USHORT SeqNo,
6720 IN PUCHAR pNewElement,
6721 IN ULONG ElementLen);
6722 #endif // CONFIG_STA_SUPPORT //
6724 void RTMP_IndicateMediaState(
6725 IN PRTMP_ADAPTER pAd);
6727 VOID ReSyncBeaconTime(
6728 IN PRTMP_ADAPTER pAd);
6730 VOID RTMPSetAGCInitValue(
6731 IN PRTMP_ADAPTER pAd,
6732 IN UCHAR BandWidth);
6734 int rt28xx_close(IN PNET_DEV dev);
6735 int rt28xx_open(IN PNET_DEV dev);
6738 #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++)
6739 #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--)
6740 #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt)
6743 #ifdef LINUX
6744 __inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd)
6746 if (VIRTUAL_IF_NUM(pAd) == 0)
6748 if (rt28xx_open(pAd->net_dev) != 0)
6750 DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_open return fail!\n"));
6751 return -1;
6754 else
6757 VIRTUAL_IF_INC(pAd);
6758 return 0;
6761 __inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd)
6763 VIRTUAL_IF_DEC(pAd);
6764 if (VIRTUAL_IF_NUM(pAd) == 0)
6765 rt28xx_close(pAd->net_dev);
6766 return;
6768 #endif // LINUX //
6774 OS Related funciton prototype definitions.
6775 TODO: Maybe we need to move these function prototypes to other proper place.
6777 int RtmpOSWrielessEventSend(
6778 IN RTMP_ADAPTER *pAd,
6779 IN UINT32 eventType,
6780 IN INT flags,
6781 IN PUCHAR pSrcMac,
6782 IN PUCHAR pData,
6783 IN UINT32 dataLen);
6785 int RtmpOSNetDevAddrSet(
6786 IN PNET_DEV pNetDev,
6787 IN PUCHAR pMacAddr);
6789 int RtmpOSNetDevAttach(
6790 IN PNET_DEV pNetDev,
6791 IN RTMP_OS_NETDEV_OP_HOOK *pDevOpHook);
6793 void RtmpOSNetDevClose(
6794 IN PNET_DEV pNetDev);
6796 void RtmpOSNetDevDetach(
6797 IN PNET_DEV pNetDev);
6799 INT RtmpOSNetDevAlloc(
6800 IN PNET_DEV *pNewNetDev,
6801 IN UINT32 privDataSize);
6803 void RtmpOSNetDevFree(
6804 IN PNET_DEV pNetDev);
6806 PNET_DEV RtmpOSNetDevGetByName(
6807 IN PNET_DEV pNetDev,
6808 IN PSTRING pDevName);
6810 void RtmpOSNetDeviceRefPut(
6811 IN PNET_DEV pNetDev);
6813 PNET_DEV RtmpOSNetDevCreate(
6814 IN RTMP_ADAPTER *pAd,
6815 IN INT devType,
6816 IN INT devNum,
6817 IN INT privMemSize,
6818 IN PSTRING pNamePrefix);
6821 Task operation related function prototypes
6823 void RtmpOSTaskCustomize(
6824 IN RTMP_OS_TASK *pTask);
6826 INT RtmpOSTaskNotifyToExit(
6827 IN RTMP_OS_TASK *pTask);
6829 NDIS_STATUS RtmpOSTaskKill(
6830 IN RTMP_OS_TASK *pTask);
6832 NDIS_STATUS RtmpOSTaskInit(
6833 IN RTMP_OS_TASK *pTask,
6834 PSTRING pTaskName,
6835 VOID *pPriv);
6837 NDIS_STATUS RtmpOSTaskAttach(
6838 IN RTMP_OS_TASK *pTask,
6839 IN int (*fn)(void *),
6840 IN void *arg);
6844 File operation related function prototypes
6846 RTMP_OS_FD RtmpOSFileOpen(
6847 IN char *pPath,
6848 IN int flag,
6849 IN int mode);
6851 int RtmpOSFileClose(
6852 IN RTMP_OS_FD osfd);
6854 void RtmpOSFileSeek(
6855 IN RTMP_OS_FD osfd,
6856 IN int offset);
6858 int RtmpOSFileRead(
6859 IN RTMP_OS_FD osfd,
6860 IN char *pDataPtr,
6861 IN int readLen);
6863 int RtmpOSFileWrite(
6864 IN RTMP_OS_FD osfd,
6865 IN char *pDataPtr,
6866 IN int writeLen);
6868 void RtmpOSFSInfoChange(
6869 IN RTMP_OS_FS_INFO *pOSFSInfo,
6870 IN BOOLEAN bSet);
6873 #endif // __RTMP_H__