Merge branch 'ixp4xx' of git://git.kernel.org/pub/scm/linux/kernel/git/chris/linux-2.6
[linux/fpc-iii.git] / drivers / staging / rt2860 / rtmp.h
blob90fd40f24734244b52fb617ed642e3da45810088
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 "spectrum_def.h"
45 #include "aironet.h"
47 #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++)
48 #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--)
49 #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt)
51 #ifdef RT2870
52 ////////////////////////////////////////////////////////////////////////////
53 // The TX_BUFFER structure forms the transmitted USB packet to the device
54 ////////////////////////////////////////////////////////////////////////////
55 typedef struct __TX_BUFFER{
56 union {
57 UCHAR WirelessPacket[TX_BUFFER_NORMSIZE];
58 HEADER_802_11 NullFrame;
59 PSPOLL_FRAME PsPollPacket;
60 RTS_FRAME RTSFrame;
61 }field;
62 UCHAR Aggregation[4]; //Buffer for save Aggregation size.
63 } TX_BUFFER, *PTX_BUFFER;
65 typedef struct __HTTX_BUFFER{
66 union {
67 UCHAR WirelessPacket[MAX_TXBULK_SIZE];
68 HEADER_802_11 NullFrame;
69 PSPOLL_FRAME PsPollPacket;
70 RTS_FRAME RTSFrame;
71 }field;
72 UCHAR Aggregation[4]; //Buffer for save Aggregation size.
73 } HTTX_BUFFER, *PHTTX_BUFFER;
76 // used to track driver-generated write irps
77 typedef struct _TX_CONTEXT
79 PVOID pAd; //Initialized in MiniportInitialize
80 PURB pUrb; //Initialized in MiniportInitialize
81 PIRP pIrp; //used to cancel pending bulk out.
82 //Initialized in MiniportInitialize
83 PTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize
84 ULONG BulkOutSize;
85 UCHAR BulkOutPipeId;
86 UCHAR SelfIdx;
87 BOOLEAN InUse;
88 BOOLEAN bWaitingBulkOut; // at least one packet is in this TxContext, ready for making IRP anytime.
89 BOOLEAN bFullForBulkOut; // all tx buffer are full , so waiting for tx bulkout.
90 BOOLEAN IRPPending;
91 BOOLEAN LastOne;
92 BOOLEAN bAggregatible;
93 UCHAR Header_802_3[LENGTH_802_3];
94 UCHAR Rsv[2];
95 ULONG DataOffset;
96 UINT TxRate;
97 dma_addr_t data_dma; // urb dma on linux
99 } TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT;
102 // used to track driver-generated write irps
103 typedef struct _HT_TX_CONTEXT
105 PVOID pAd; //Initialized in MiniportInitialize
106 PURB pUrb; //Initialized in MiniportInitialize
107 PIRP pIrp; //used to cancel pending bulk out.
108 //Initialized in MiniportInitialize
109 PHTTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize
110 ULONG BulkOutSize; // Indicate the total bulk-out size in bytes in one bulk-transmission
111 UCHAR BulkOutPipeId;
112 BOOLEAN IRPPending;
113 BOOLEAN LastOne;
114 BOOLEAN bCurWriting;
115 BOOLEAN bRingEmpty;
116 BOOLEAN bCopySavePad;
117 UCHAR SavedPad[8];
118 UCHAR Header_802_3[LENGTH_802_3];
119 ULONG CurWritePosition; // Indicate the buffer offset which packet will be inserted start from.
120 ULONG CurWriteRealPos; // Indicate the buffer offset which packet now are writing to.
121 ULONG NextBulkOutPosition; // Indicate the buffer start offset of a bulk-transmission
122 ULONG ENextBulkOutPosition; // Indicate the buffer end offset of a bulk-transmission
123 UINT TxRate;
124 dma_addr_t data_dma; // urb dma on linux
125 } HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT;
129 // Structure to keep track of receive packets and buffers to indicate
130 // receive data to the protocol.
132 typedef struct _RX_CONTEXT
134 PUCHAR TransferBuffer;
135 PVOID pAd;
136 PIRP pIrp;//used to cancel pending bulk in.
137 PURB pUrb;
138 //These 2 Boolean shouldn't both be 1 at the same time.
139 ULONG BulkInOffset; // number of packets waiting for reordering .
140 BOOLEAN bRxHandling; // Notify this packet is being process now.
141 BOOLEAN InUse; // USB Hardware Occupied. Wait for USB HW to put packet.
142 BOOLEAN Readable; // Receive Complete back. OK for driver to indicate receiving packet.
143 BOOLEAN IRPPending; // TODO: To be removed
144 atomic_t IrpLock;
145 NDIS_SPIN_LOCK RxContextLock;
146 dma_addr_t data_dma; // urb dma on linux
147 } RX_CONTEXT, *PRX_CONTEXT;
148 #endif // RT2870 //
152 // NDIS Version definitions
154 #ifdef NDIS50_MINIPORT
155 #define RTMP_NDIS_MAJOR_VERSION 5
156 #define RTMP_NDIS_MINOR_VERSION 0
157 #endif
159 #ifdef NDIS51_MINIPORT
160 #define RTMP_NDIS_MAJOR_VERSION 5
161 #define RTMP_NDIS_MINOR_VERSION 1
162 #endif
164 extern char NIC_VENDOR_DESC[];
165 extern int NIC_VENDOR_DESC_LEN;
167 extern unsigned char SNAP_AIRONET[];
168 extern unsigned char CipherSuiteCiscoCCKM[];
169 extern unsigned char CipherSuiteCiscoCCKMLen;
170 extern unsigned char CipherSuiteCiscoCCKM24[];
171 extern unsigned char CipherSuiteCiscoCCKM24Len;
172 extern unsigned char CipherSuiteCCXTkip[];
173 extern unsigned char CipherSuiteCCXTkipLen;
174 extern unsigned char CISCO_OUI[];
175 extern UCHAR BaSizeArray[4];
177 extern UCHAR BROADCAST_ADDR[MAC_ADDR_LEN];
178 extern UCHAR MULTICAST_ADDR[MAC_ADDR_LEN];
179 extern UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN];
180 extern ULONG BIT32[32];
181 extern UCHAR BIT8[8];
182 extern char* CipherName[];
183 extern char* MCSToMbps[];
184 extern UCHAR RxwiMCSToOfdmRate[12];
185 extern UCHAR SNAP_802_1H[6];
186 extern UCHAR SNAP_BRIDGE_TUNNEL[6];
187 extern UCHAR SNAP_AIRONET[8];
188 extern UCHAR CKIP_LLC_SNAP[8];
189 extern UCHAR EAPOL_LLC_SNAP[8];
190 extern UCHAR EAPOL[2];
191 extern UCHAR IPX[2];
192 extern UCHAR APPLE_TALK[2];
193 extern UCHAR RateIdToPlcpSignal[12]; // see IEEE802.11a-1999 p.14
194 extern UCHAR OfdmRateToRxwiMCS[];
195 extern UCHAR OfdmSignalToRateId[16] ;
196 extern UCHAR default_cwmin[4];
197 extern UCHAR default_cwmax[4];
198 extern UCHAR default_sta_aifsn[4];
199 extern UCHAR MapUserPriorityToAccessCategory[8];
201 extern USHORT RateUpPER[];
202 extern USHORT RateDownPER[];
203 extern UCHAR Phy11BNextRateDownward[];
204 extern UCHAR Phy11BNextRateUpward[];
205 extern UCHAR Phy11BGNextRateDownward[];
206 extern UCHAR Phy11BGNextRateUpward[];
207 extern UCHAR Phy11ANextRateDownward[];
208 extern UCHAR Phy11ANextRateUpward[];
209 extern CHAR RssiSafeLevelForTxRate[];
210 extern UCHAR RateIdToMbps[];
211 extern USHORT RateIdTo500Kbps[];
213 extern UCHAR CipherSuiteWpaNoneTkip[];
214 extern UCHAR CipherSuiteWpaNoneTkipLen;
216 extern UCHAR CipherSuiteWpaNoneAes[];
217 extern UCHAR CipherSuiteWpaNoneAesLen;
219 extern UCHAR SsidIe;
220 extern UCHAR SupRateIe;
221 extern UCHAR ExtRateIe;
223 extern UCHAR HtCapIe;
224 extern UCHAR AddHtInfoIe;
225 extern UCHAR NewExtChanIe;
227 extern UCHAR ErpIe;
228 extern UCHAR DsIe;
229 extern UCHAR TimIe;
230 extern UCHAR WpaIe;
231 extern UCHAR Wpa2Ie;
232 extern UCHAR IbssIe;
233 extern UCHAR Ccx2Ie;
235 extern UCHAR WPA_OUI[];
236 extern UCHAR RSN_OUI[];
237 extern UCHAR WME_INFO_ELEM[];
238 extern UCHAR WME_PARM_ELEM[];
239 extern UCHAR Ccx2QosInfo[];
240 extern UCHAR Ccx2IeInfo[];
241 extern UCHAR RALINK_OUI[];
242 extern UCHAR PowerConstraintIE[];
245 extern UCHAR RateSwitchTable[];
246 extern UCHAR RateSwitchTable11B[];
247 extern UCHAR RateSwitchTable11G[];
248 extern UCHAR RateSwitchTable11BG[];
250 extern UCHAR RateSwitchTable11BGN1S[];
251 extern UCHAR RateSwitchTable11BGN2S[];
252 extern UCHAR RateSwitchTable11BGN2SForABand[];
253 extern UCHAR RateSwitchTable11N1S[];
254 extern UCHAR RateSwitchTable11N2S[];
255 extern UCHAR RateSwitchTable11N2SForABand[];
257 extern UCHAR PRE_N_HT_OUI[];
259 #define MAXSEQ (0xFFF)
261 struct reordering_mpdu
263 struct reordering_mpdu *next;
264 PNDIS_PACKET pPacket; /* coverted to 802.3 frame */
265 int Sequence; /* sequence number of MPDU */
266 BOOLEAN bAMSDU;
269 struct reordering_list
271 struct reordering_mpdu *next;
272 int qlen;
275 struct reordering_mpdu_pool
277 PVOID mem;
278 NDIS_SPIN_LOCK lock;
279 struct reordering_list freelist;
282 typedef struct _RSSI_SAMPLE {
283 CHAR LastRssi0; // last received RSSI
284 CHAR LastRssi1; // last received RSSI
285 CHAR LastRssi2; // last received RSSI
286 CHAR AvgRssi0;
287 CHAR AvgRssi1;
288 CHAR AvgRssi2;
289 SHORT AvgRssi0X8;
290 SHORT AvgRssi1X8;
291 SHORT AvgRssi2X8;
292 } RSSI_SAMPLE;
295 // Queue structure and macros
297 typedef struct _QUEUE_ENTRY {
298 struct _QUEUE_ENTRY *Next;
299 } QUEUE_ENTRY, *PQUEUE_ENTRY;
301 // Queue structure
302 typedef struct _QUEUE_HEADER {
303 PQUEUE_ENTRY Head;
304 PQUEUE_ENTRY Tail;
305 ULONG Number;
306 } QUEUE_HEADER, *PQUEUE_HEADER;
308 #define InitializeQueueHeader(QueueHeader) \
310 (QueueHeader)->Head = (QueueHeader)->Tail = NULL; \
311 (QueueHeader)->Number = 0; \
314 #define RemoveHeadQueue(QueueHeader) \
315 (QueueHeader)->Head; \
317 PQUEUE_ENTRY pNext; \
318 if ((QueueHeader)->Head != NULL) \
320 pNext = (QueueHeader)->Head->Next; \
321 (QueueHeader)->Head = pNext; \
322 if (pNext == NULL) \
323 (QueueHeader)->Tail = NULL; \
324 (QueueHeader)->Number--; \
328 #define InsertHeadQueue(QueueHeader, QueueEntry) \
330 ((PQUEUE_ENTRY)QueueEntry)->Next = (QueueHeader)->Head; \
331 (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \
332 if ((QueueHeader)->Tail == NULL) \
333 (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \
334 (QueueHeader)->Number++; \
337 #define InsertTailQueue(QueueHeader, QueueEntry) \
339 ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \
340 if ((QueueHeader)->Tail) \
341 (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \
342 else \
343 (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \
344 (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \
345 (QueueHeader)->Number++; \
349 // Macros for flag and ref count operations
351 #define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
352 #define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
353 #define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0)
354 #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
355 #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
357 #ifdef RT2860
358 // Macro for power save flag.
359 #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F))
360 #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F))
361 #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0)
362 #define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0)
363 #define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F))
364 #endif
366 #define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F))
367 #define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F))
368 #define OPSTATUS_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.OpStatusFlags & (_F)) != 0)
370 #define CLIENT_STATUS_SET_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags |= (_F))
371 #define CLIENT_STATUS_CLEAR_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags &= ~(_F))
372 #define CLIENT_STATUS_TEST_FLAG(_pEntry,_F) (((_pEntry)->ClientStatusFlags & (_F)) != 0)
374 #define RX_FILTER_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter |= (_F))
375 #define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F))
376 #define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0)
378 #define STA_NO_SECURITY_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11EncryptionDisabled)
379 #define STA_WEP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption1Enabled)
380 #define STA_TKIP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption2Enabled)
381 #define STA_AES_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)
383 #define STA_TGN_WIFI_ON(_p) (_p->StaCfg.bTGnWifiTest == TRUE)
385 #define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
386 #define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
389 #define INC_RING_INDEX(_idx, _RingSize) \
391 (_idx) = (_idx+1) % (_RingSize); \
394 #ifdef RT2870
395 // We will have a cost down version which mac version is 0x3090xxxx
396 #define IS_RT3090(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30710000) || (((_pAd)->MACVersion & 0xffff0000) == 0x30900000))
397 #else
398 #define IS_RT3090(_pAd) 0
399 #endif
400 #define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30700000)
401 #ifdef RT2870
402 #define IS_RT3071(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30710000)
403 #define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000)
404 #endif
406 #define RING_PACKET_INIT(_TxRing, _idx) \
408 _TxRing->Cell[_idx].pNdisPacket = NULL; \
409 _TxRing->Cell[_idx].pNextNdisPacket = NULL; \
412 #define TXDT_INIT(_TxD) \
414 NdisZeroMemory(_TxD, TXD_SIZE); \
415 _TxD->DMADONE = 1; \
418 //Set last data segment
419 #define RING_SET_LASTDS(_TxD, _IsSD0) \
421 if (_IsSD0) {_TxD->LastSec0 = 1;} \
422 else {_TxD->LastSec1 = 1;} \
425 // Increase TxTsc value for next transmission
426 // TODO:
427 // When i==6, means TSC has done one full cycle, do re-keying stuff follow specs
428 // Should send a special event microsoft defined to request re-key
429 #define INC_TX_TSC(_tsc) \
431 int i=0; \
432 while (++_tsc[i] == 0x0) \
434 i++; \
435 if (i == 6) \
436 break; \
440 // StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here.
441 #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \
443 _pAd->StaActive.SupportedHtPhy.ChannelWidth = _pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth; \
444 _pAd->StaActive.SupportedHtPhy.MimoPs = _pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs; \
445 _pAd->StaActive.SupportedHtPhy.GF = _pAd->MlmeAux.HtCapability.HtCapInfo.GF; \
446 _pAd->StaActive.SupportedHtPhy.ShortGIfor20 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20; \
447 _pAd->StaActive.SupportedHtPhy.ShortGIfor40 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40; \
448 _pAd->StaActive.SupportedHtPhy.TxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC; \
449 _pAd->StaActive.SupportedHtPhy.RxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC; \
450 _pAd->StaActive.SupportedHtPhy.ExtChanOffset = _pAd->MlmeAux.AddHtInfo.AddHtInfo.ExtChanOffset; \
451 _pAd->StaActive.SupportedHtPhy.RecomWidth = _pAd->MlmeAux.AddHtInfo.AddHtInfo.RecomWidth; \
452 _pAd->StaActive.SupportedHtPhy.OperaionMode = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode; \
453 _pAd->StaActive.SupportedHtPhy.NonGfPresent = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent; \
454 NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(UCHAR) * 16);\
457 #define COPY_AP_HTSETTINGS_FROM_BEACON(_pAd, _pHtCapability) \
459 _pAd->MacTab.Content[BSSID_WCID].AMsduSize = (UCHAR)(_pHtCapability->HtCapInfo.AMsduSize); \
460 _pAd->MacTab.Content[BSSID_WCID].MmpsMode= (UCHAR)(_pHtCapability->HtCapInfo.MimoPs); \
461 _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (UCHAR)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \
465 // MACRO for 32-bit PCI register read / write
467 // Usage : RTMP_IO_READ32(
468 // PRTMP_ADAPTER pAd,
469 // ULONG Register_Offset,
470 // PULONG pValue)
472 // RTMP_IO_WRITE32(
473 // PRTMP_ADAPTER pAd,
474 // ULONG Register_Offset,
475 // ULONG Value)
479 // BBP & RF are using indirect access. Before write any value into it.
480 // We have to make sure there is no outstanding command pending via checking busy bit.
482 #define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register
484 #ifdef RT2860
485 #define RTMP_RF_IO_WRITE32(_A, _V) \
487 PHY_CSR4_STRUC Value; \
488 ULONG BusyCnt = 0; \
489 if ((_A)->bPCIclkOff) \
491 return; \
493 do { \
494 RTMP_IO_READ32(_A, RF_CSR_CFG0, &Value.word); \
495 if (Value.field.Busy == IDLE) \
496 break; \
497 BusyCnt++; \
498 } while (BusyCnt < MAX_BUSY_COUNT); \
499 if (BusyCnt < MAX_BUSY_COUNT) \
501 RTMP_IO_WRITE32(_A, RF_CSR_CFG0, _V); \
505 #define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
507 BBP_CSR_CFG_STRUC BbpCsr; \
508 int i, k; \
509 for (i=0; i<MAX_BUSY_COUNT; i++) \
511 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
512 if (BbpCsr.field.Busy == BUSY) \
514 continue; \
516 BbpCsr.word = 0; \
517 BbpCsr.field.fRead = 1; \
518 BbpCsr.field.BBP_RW_MODE = 1; \
519 BbpCsr.field.Busy = 1; \
520 BbpCsr.field.RegNum = _I; \
521 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
522 for (k=0; k<MAX_BUSY_COUNT; k++) \
524 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
525 if (BbpCsr.field.Busy == IDLE) \
526 break; \
528 if ((BbpCsr.field.Busy == IDLE) && \
529 (BbpCsr.field.RegNum == _I)) \
531 *(_pV) = (UCHAR)BbpCsr.field.Value; \
532 break; \
535 if (BbpCsr.field.Busy == BUSY) \
537 DBGPRINT_ERR(("DFS BBP read R%d fail\n", _I)); \
538 *(_pV) = (_A)->BbpWriteLatch[_I]; \
542 //#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) {}
543 // Read BBP register by register's ID. Generate PER to test BA
544 #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
546 BBP_CSR_CFG_STRUC BbpCsr; \
547 int i, k; \
548 if ((_A)->bPCIclkOff == FALSE) \
550 for (i=0; i<MAX_BUSY_COUNT; i++) \
552 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
553 if (BbpCsr.field.Busy == BUSY) \
555 continue; \
557 BbpCsr.word = 0; \
558 BbpCsr.field.fRead = 1; \
559 BbpCsr.field.BBP_RW_MODE = 1; \
560 BbpCsr.field.Busy = 1; \
561 BbpCsr.field.RegNum = _I; \
562 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
563 AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
564 RTMPusecDelay(1000); \
565 for (k=0; k<MAX_BUSY_COUNT; k++) \
567 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
568 if (BbpCsr.field.Busy == IDLE) \
569 break; \
571 if ((BbpCsr.field.Busy == IDLE) && \
572 (BbpCsr.field.RegNum == _I)) \
574 *(_pV) = (UCHAR)BbpCsr.field.Value; \
575 break; \
578 if (BbpCsr.field.Busy == BUSY) \
580 DBGPRINT_ERR(("BBP read R%d=0x%x fail\n", _I, BbpCsr.word)); \
581 *(_pV) = (_A)->BbpWriteLatch[_I]; \
582 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
583 BbpCsr.field.Busy = 0; \
584 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
589 #define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \
591 BBP_CSR_CFG_STRUC BbpCsr; \
592 int BusyCnt; \
593 for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
595 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
596 if (BbpCsr.field.Busy == BUSY) \
597 continue; \
598 BbpCsr.word = 0; \
599 BbpCsr.field.fRead = 0; \
600 BbpCsr.field.BBP_RW_MODE = 1; \
601 BbpCsr.field.Busy = 1; \
602 BbpCsr.field.Value = _V; \
603 BbpCsr.field.RegNum = _I; \
604 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
605 (_A)->BbpWriteLatch[_I] = _V; \
606 break; \
608 if (BusyCnt == MAX_BUSY_COUNT) \
610 DBGPRINT_ERR(("BBP write R%d fail\n", _I)); \
614 // Write BBP register by register's ID & value
615 #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \
617 BBP_CSR_CFG_STRUC BbpCsr; \
618 int BusyCnt; \
619 if ((_A)->bPCIclkOff == FALSE) \
621 for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
623 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
624 if (BbpCsr.field.Busy == BUSY) \
625 continue; \
626 BbpCsr.word = 0; \
627 BbpCsr.field.fRead = 0; \
628 BbpCsr.field.BBP_RW_MODE = 1; \
629 BbpCsr.field.Busy = 1; \
630 BbpCsr.field.Value = _V; \
631 BbpCsr.field.RegNum = _I; \
632 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
633 AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
634 if (_A->OpMode == OPMODE_AP) \
635 RTMPusecDelay(1000); \
636 (_A)->BbpWriteLatch[_I] = _V; \
637 break; \
639 if (BusyCnt == MAX_BUSY_COUNT) \
641 DBGPRINT_ERR(("BBP write R%d=0x%x fail\n", _I, BbpCsr.word)); \
642 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
643 BbpCsr.field.Busy = 0; \
644 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
648 #endif /* RT2860 */
649 #ifdef RT2870
650 #define RTMP_RF_IO_WRITE32(_A, _V) RTUSBWriteRFRegister(_A, _V)
651 #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV)
652 #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V)
654 #define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V)
655 #define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV)
656 #endif // RT2870 //
658 #define MAP_CHANNEL_ID_TO_KHZ(ch, khz) { \
659 switch (ch) \
661 case 1: khz = 2412000; break; \
662 case 2: khz = 2417000; break; \
663 case 3: khz = 2422000; break; \
664 case 4: khz = 2427000; break; \
665 case 5: khz = 2432000; break; \
666 case 6: khz = 2437000; break; \
667 case 7: khz = 2442000; break; \
668 case 8: khz = 2447000; break; \
669 case 9: khz = 2452000; break; \
670 case 10: khz = 2457000; break; \
671 case 11: khz = 2462000; break; \
672 case 12: khz = 2467000; break; \
673 case 13: khz = 2472000; break; \
674 case 14: khz = 2484000; break; \
675 case 36: /* UNII */ khz = 5180000; break; \
676 case 40: /* UNII */ khz = 5200000; break; \
677 case 44: /* UNII */ khz = 5220000; break; \
678 case 48: /* UNII */ khz = 5240000; break; \
679 case 52: /* UNII */ khz = 5260000; break; \
680 case 56: /* UNII */ khz = 5280000; break; \
681 case 60: /* UNII */ khz = 5300000; break; \
682 case 64: /* UNII */ khz = 5320000; break; \
683 case 149: /* UNII */ khz = 5745000; break; \
684 case 153: /* UNII */ khz = 5765000; break; \
685 case 157: /* UNII */ khz = 5785000; break; \
686 case 161: /* UNII */ khz = 5805000; break; \
687 case 165: /* UNII */ khz = 5825000; break; \
688 case 100: /* HiperLAN2 */ khz = 5500000; break; \
689 case 104: /* HiperLAN2 */ khz = 5520000; break; \
690 case 108: /* HiperLAN2 */ khz = 5540000; break; \
691 case 112: /* HiperLAN2 */ khz = 5560000; break; \
692 case 116: /* HiperLAN2 */ khz = 5580000; break; \
693 case 120: /* HiperLAN2 */ khz = 5600000; break; \
694 case 124: /* HiperLAN2 */ khz = 5620000; break; \
695 case 128: /* HiperLAN2 */ khz = 5640000; break; \
696 case 132: /* HiperLAN2 */ khz = 5660000; break; \
697 case 136: /* HiperLAN2 */ khz = 5680000; break; \
698 case 140: /* HiperLAN2 */ khz = 5700000; break; \
699 case 34: /* Japan MMAC */ khz = 5170000; break; \
700 case 38: /* Japan MMAC */ khz = 5190000; break; \
701 case 42: /* Japan MMAC */ khz = 5210000; break; \
702 case 46: /* Japan MMAC */ khz = 5230000; break; \
703 case 184: /* Japan */ khz = 4920000; break; \
704 case 188: /* Japan */ khz = 4940000; break; \
705 case 192: /* Japan */ khz = 4960000; break; \
706 case 196: /* Japan */ khz = 4980000; break; \
707 case 208: /* Japan, means J08 */ khz = 5040000; break; \
708 case 212: /* Japan, means J12 */ khz = 5060000; break; \
709 case 216: /* Japan, means J16 */ khz = 5080000; break; \
710 default: khz = 2412000; break; \
714 #define MAP_KHZ_TO_CHANNEL_ID(khz, ch) { \
715 switch (khz) \
717 case 2412000: ch = 1; break; \
718 case 2417000: ch = 2; break; \
719 case 2422000: ch = 3; break; \
720 case 2427000: ch = 4; break; \
721 case 2432000: ch = 5; break; \
722 case 2437000: ch = 6; break; \
723 case 2442000: ch = 7; break; \
724 case 2447000: ch = 8; break; \
725 case 2452000: ch = 9; break; \
726 case 2457000: ch = 10; break; \
727 case 2462000: ch = 11; break; \
728 case 2467000: ch = 12; break; \
729 case 2472000: ch = 13; break; \
730 case 2484000: ch = 14; break; \
731 case 5180000: ch = 36; /* UNII */ break; \
732 case 5200000: ch = 40; /* UNII */ break; \
733 case 5220000: ch = 44; /* UNII */ break; \
734 case 5240000: ch = 48; /* UNII */ break; \
735 case 5260000: ch = 52; /* UNII */ break; \
736 case 5280000: ch = 56; /* UNII */ break; \
737 case 5300000: ch = 60; /* UNII */ break; \
738 case 5320000: ch = 64; /* UNII */ break; \
739 case 5745000: ch = 149; /* UNII */ break; \
740 case 5765000: ch = 153; /* UNII */ break; \
741 case 5785000: ch = 157; /* UNII */ break; \
742 case 5805000: ch = 161; /* UNII */ break; \
743 case 5825000: ch = 165; /* UNII */ break; \
744 case 5500000: ch = 100; /* HiperLAN2 */ break; \
745 case 5520000: ch = 104; /* HiperLAN2 */ break; \
746 case 5540000: ch = 108; /* HiperLAN2 */ break; \
747 case 5560000: ch = 112; /* HiperLAN2 */ break; \
748 case 5580000: ch = 116; /* HiperLAN2 */ break; \
749 case 5600000: ch = 120; /* HiperLAN2 */ break; \
750 case 5620000: ch = 124; /* HiperLAN2 */ break; \
751 case 5640000: ch = 128; /* HiperLAN2 */ break; \
752 case 5660000: ch = 132; /* HiperLAN2 */ break; \
753 case 5680000: ch = 136; /* HiperLAN2 */ break; \
754 case 5700000: ch = 140; /* HiperLAN2 */ break; \
755 case 5170000: ch = 34; /* Japan MMAC */ break; \
756 case 5190000: ch = 38; /* Japan MMAC */ break; \
757 case 5210000: ch = 42; /* Japan MMAC */ break; \
758 case 5230000: ch = 46; /* Japan MMAC */ break; \
759 case 4920000: ch = 184; /* Japan */ break; \
760 case 4940000: ch = 188; /* Japan */ break; \
761 case 4960000: ch = 192; /* Japan */ break; \
762 case 4980000: ch = 196; /* Japan */ break; \
763 case 5040000: ch = 208; /* Japan, means J08 */ break; \
764 case 5060000: ch = 212; /* Japan, means J12 */ break; \
765 case 5080000: ch = 216; /* Japan, means J16 */ break; \
766 default: ch = 1; break; \
771 // Common fragment list structure - Identical to the scatter gather frag list structure
773 #define NIC_MAX_PHYS_BUF_COUNT 8
775 typedef struct _RTMP_SCATTER_GATHER_ELEMENT {
776 PVOID Address;
777 ULONG Length;
778 PULONG Reserved;
779 } RTMP_SCATTER_GATHER_ELEMENT, *PRTMP_SCATTER_GATHER_ELEMENT;
782 typedef struct _RTMP_SCATTER_GATHER_LIST {
783 ULONG NumberOfElements;
784 PULONG Reserved;
785 RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT];
786 } RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST;
789 // Some utility macros
791 #ifndef min
792 #define min(_a, _b) (((_a) < (_b)) ? (_a) : (_b))
793 #endif
795 #ifndef max
796 #define max(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
797 #endif
799 #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))))
801 #define INC_COUNTER64(Val) (Val.QuadPart++)
803 #define INFRA_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_INFRA_ON))
804 #define ADHOC_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_ADHOC_ON))
805 #define MONITOR_ON(_p) (((_p)->StaCfg.BssType) == BSS_MONITOR)
806 #define IDLE_ON(_p) (!INFRA_ON(_p) && !ADHOC_ON(_p))
808 // Check LEAP & CCKM flags
809 #define LEAP_ON(_p) (((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP)
810 #define LEAP_CCKM_ON(_p) ((((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg.LeapAuthInfo.CCKM == TRUE))
812 // if orginal Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required
813 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \
815 if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) \
817 _pExtraLlcSnapEncap = SNAP_802_1H; \
818 if (NdisEqualMemory(IPX, _pBufVA + 12, 2) || \
819 NdisEqualMemory(APPLE_TALK, _pBufVA + 12, 2)) \
821 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
824 else \
826 _pExtraLlcSnapEncap = NULL; \
830 // New Define for new Tx Path.
831 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \
833 if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) \
835 _pExtraLlcSnapEncap = SNAP_802_1H; \
836 if (NdisEqualMemory(IPX, _pBufVA, 2) || \
837 NdisEqualMemory(APPLE_TALK, _pBufVA, 2)) \
839 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
842 else \
844 _pExtraLlcSnapEncap = NULL; \
849 #define MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType) \
851 NdisMoveMemory(_p, _pMac1, MAC_ADDR_LEN); \
852 NdisMoveMemory((_p + MAC_ADDR_LEN), _pMac2, MAC_ADDR_LEN); \
853 NdisMoveMemory((_p + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \
856 // if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way.
857 // else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field
858 // else remove the LLC/SNAP field from the result Ethernet frame
859 // Patch for WHQL only, which did not turn on Netbios but use IPX within its payload
860 // Note:
861 // _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO
862 // _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed
863 #define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \
865 char LLC_Len[2]; \
867 _pRemovedLLCSNAP = NULL; \
868 if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \
869 NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) \
871 PUCHAR pProto = _pData + 6; \
873 if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \
874 NdisEqualMemory(SNAP_802_1H, _pData, 6)) \
876 LLC_Len[0] = (UCHAR)(_DataSize / 256); \
877 LLC_Len[1] = (UCHAR)(_DataSize % 256); \
878 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
880 else \
882 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \
883 _pRemovedLLCSNAP = _pData; \
884 _DataSize -= LENGTH_802_1_H; \
885 _pData += LENGTH_802_1_H; \
888 else \
890 LLC_Len[0] = (UCHAR)(_DataSize / 256); \
891 LLC_Len[1] = (UCHAR)(_DataSize % 256); \
892 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
896 #define SWITCH_AB( _pAA, _pBB) \
898 PVOID pCC; \
899 pCC = _pBB; \
900 _pBB = _pAA; \
901 _pAA = pCC; \
904 // Enqueue this frame to MLME engine
905 // We need to enqueue the whole frame because MLME need to pass data type
906 // information from 802.11 header
907 #ifdef RT2860
908 #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
910 UINT32 High32TSF, Low32TSF; \
911 RTMP_IO_READ32(_pAd, TSF_TIMER_DW1, &High32TSF); \
912 RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \
913 MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \
915 #endif
916 #ifdef RT2870
917 #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
919 UINT32 High32TSF=0, Low32TSF=0; \
920 MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \
922 #endif // RT2870 //
924 //Need to collect each ant's rssi concurrently
925 //rssi1 is report to pair2 Ant and rss2 is reprot to pair1 Ant when 4 Ant
926 #define COLLECT_RX_ANTENNA_AVERAGE_RSSI(_pAd, _rssi1, _rssi2) \
928 SHORT AvgRssi; \
929 UCHAR UsedAnt; \
930 if (_pAd->RxAnt.EvaluatePeriod == 0) \
932 UsedAnt = _pAd->RxAnt.Pair1PrimaryRxAnt; \
933 AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \
934 if (AvgRssi < 0) \
935 AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \
936 else \
937 AvgRssi = _rssi1 << 3; \
938 _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \
940 else \
942 UsedAnt = _pAd->RxAnt.Pair1SecondaryRxAnt; \
943 AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \
944 if ((AvgRssi < 0) && (_pAd->RxAnt.FirstPktArrivedWhenEvaluate)) \
945 AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \
946 else \
948 _pAd->RxAnt.FirstPktArrivedWhenEvaluate = TRUE; \
949 AvgRssi = _rssi1 << 3; \
951 _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \
952 _pAd->RxAnt.RcvPktNumWhenEvaluate++; \
956 #define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \
957 NdisQueryBuffer(_NdisBuf, _ppVA, _pBufLen)
959 #define MAC_ADDR_EQUAL(pAddr1,pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), MAC_ADDR_LEN)
960 #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1==len2) && (RTMPEqualMemory(ssid1, ssid2, len1)))
963 // Check if it is Japan W53(ch52,56,60,64) channel.
965 #define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64))
967 #ifdef RT2860
968 #define STA_PORT_SECURED(_pAd) \
970 _pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \
971 RTMP_SET_PSFLAG(_pAd, fRTMP_PS_CAN_GO_SLEEP); \
972 NdisAcquireSpinLock(&(_pAd)->MacTabLock); \
973 _pAd->MacTab.Content[BSSID_WCID].PortSecured = _pAd->StaCfg.PortSecured; \
974 NdisReleaseSpinLock(&(_pAd)->MacTabLock); \
976 #endif
977 #ifdef RT2870
978 #define STA_PORT_SECURED(_pAd) \
980 _pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \
981 NdisAcquireSpinLock(&_pAd->MacTabLock); \
982 _pAd->MacTab.Content[BSSID_WCID].PortSecured = _pAd->StaCfg.PortSecured; \
983 NdisReleaseSpinLock(&_pAd->MacTabLock); \
985 #endif
988 // Register set pair for initialzation register set definition
990 typedef struct _RTMP_REG_PAIR
992 ULONG Register;
993 ULONG Value;
994 } RTMP_REG_PAIR, *PRTMP_REG_PAIR;
996 typedef struct _REG_PAIR
998 UCHAR Register;
999 UCHAR Value;
1000 } REG_PAIR, *PREG_PAIR;
1003 // Register set pair for initialzation register set definition
1005 typedef struct _RTMP_RF_REGS
1007 UCHAR Channel;
1008 ULONG R1;
1009 ULONG R2;
1010 ULONG R3;
1011 ULONG R4;
1012 } RTMP_RF_REGS, *PRTMP_RF_REGS;
1014 typedef struct _FREQUENCY_ITEM {
1015 UCHAR Channel;
1016 UCHAR N;
1017 UCHAR R;
1018 UCHAR K;
1019 } FREQUENCY_ITEM, *PFREQUENCY_ITEM;
1022 // Data buffer for DMA operation, the buffer must be contiguous physical memory
1023 // Both DMA to / from CPU use the same structure.
1025 typedef struct _RTMP_DMABUF
1027 ULONG AllocSize;
1028 PVOID AllocVa; // TxBuf virtual address
1029 NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address
1030 } RTMP_DMABUF, *PRTMP_DMABUF;
1033 typedef union _HEADER_802_11_SEQ{
1034 struct {
1035 USHORT Frag:4;
1036 USHORT Sequence:12;
1037 } field;
1038 USHORT value;
1039 } HEADER_802_11_SEQ, *PHEADER_802_11_SEQ;
1042 // Data buffer for DMA operation, the buffer must be contiguous physical memory
1043 // Both DMA to / from CPU use the same structure.
1045 typedef struct _RTMP_REORDERBUF
1047 BOOLEAN IsFull;
1048 PVOID AllocVa; // TxBuf virtual address
1049 UCHAR Header802_3[14];
1050 HEADER_802_11_SEQ Sequence; //support compressed bitmap BA, so no consider fragment in BA
1051 UCHAR DataOffset;
1052 USHORT Datasize;
1053 ULONG AllocSize;
1054 #ifdef RT2860
1055 NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address
1056 #endif
1057 #ifdef RT2870
1058 PUCHAR AllocPa;
1059 #endif // RT2870 //
1060 } RTMP_REORDERBUF, *PRTMP_REORDERBUF;
1063 // Control block (Descriptor) for all ring descriptor DMA operation, buffer must be
1064 // contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor
1065 // which won't be released, driver has to wait until upper layer return the packet
1066 // before giveing up this rx ring descriptor to ASIC. NDIS_BUFFER is assocaited pair
1067 // to describe the packet buffer. For Tx, NDIS_PACKET stored the tx packet descriptor
1068 // which driver should ACK upper layer when the tx is physically done or failed.
1070 typedef struct _RTMP_DMACB
1072 ULONG AllocSize; // Control block size
1073 PVOID AllocVa; // Control block virtual address
1074 NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address
1075 PNDIS_PACKET pNdisPacket;
1076 PNDIS_PACKET pNextNdisPacket;
1078 RTMP_DMABUF DmaBuf; // Associated DMA buffer structure
1079 } RTMP_DMACB, *PRTMP_DMACB;
1081 typedef struct _RTMP_TX_BUF
1083 PQUEUE_ENTRY Next;
1084 UCHAR Index;
1085 ULONG AllocSize; // Control block size
1086 PVOID AllocVa; // Control block virtual address
1087 NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address
1088 } RTMP_TXBUF, *PRTMP_TXBUF;
1090 typedef struct _RTMP_RX_BUF
1092 BOOLEAN InUse;
1093 ULONG ByBaRecIndex;
1094 RTMP_REORDERBUF MAP_RXBuf[MAX_RX_REORDERBUF];
1095 } RTMP_RXBUF, *PRTMP_RXBUF;
1096 typedef struct _RTMP_TX_RING
1098 RTMP_DMACB Cell[TX_RING_SIZE];
1099 UINT32 TxCpuIdx;
1100 UINT32 TxDmaIdx;
1101 UINT32 TxSwFreeIdx; // software next free tx index
1102 } RTMP_TX_RING, *PRTMP_TX_RING;
1104 typedef struct _RTMP_RX_RING
1106 RTMP_DMACB Cell[RX_RING_SIZE];
1107 UINT32 RxCpuIdx;
1108 UINT32 RxDmaIdx;
1109 INT32 RxSwReadIdx; // software next read index
1110 } RTMP_RX_RING, *PRTMP_RX_RING;
1112 typedef struct _RTMP_MGMT_RING
1114 RTMP_DMACB Cell[MGMT_RING_SIZE];
1115 UINT32 TxCpuIdx;
1116 UINT32 TxDmaIdx;
1117 UINT32 TxSwFreeIdx; // software next free tx index
1118 } RTMP_MGMT_RING, *PRTMP_MGMT_RING;
1121 // Statistic counter structure
1123 typedef struct _COUNTER_802_3
1125 // General Stats
1126 ULONG GoodTransmits;
1127 ULONG GoodReceives;
1128 ULONG TxErrors;
1129 ULONG RxErrors;
1130 ULONG RxNoBuffer;
1132 // Ethernet Stats
1133 ULONG RcvAlignmentErrors;
1134 ULONG OneCollision;
1135 ULONG MoreCollisions;
1137 } COUNTER_802_3, *PCOUNTER_802_3;
1139 typedef struct _COUNTER_802_11 {
1140 ULONG Length;
1141 LARGE_INTEGER LastTransmittedFragmentCount;
1142 LARGE_INTEGER TransmittedFragmentCount;
1143 LARGE_INTEGER MulticastTransmittedFrameCount;
1144 LARGE_INTEGER FailedCount;
1145 LARGE_INTEGER RetryCount;
1146 LARGE_INTEGER MultipleRetryCount;
1147 LARGE_INTEGER RTSSuccessCount;
1148 LARGE_INTEGER RTSFailureCount;
1149 LARGE_INTEGER ACKFailureCount;
1150 LARGE_INTEGER FrameDuplicateCount;
1151 LARGE_INTEGER ReceivedFragmentCount;
1152 LARGE_INTEGER MulticastReceivedFrameCount;
1153 LARGE_INTEGER FCSErrorCount;
1154 } COUNTER_802_11, *PCOUNTER_802_11;
1156 typedef struct _COUNTER_RALINK {
1157 ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput
1158 #ifdef RT2860
1159 ULONG LastReceivedByteCount;
1160 #endif
1161 ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput
1162 ULONG BeenDisassociatedCount;
1163 ULONG BadCQIAutoRecoveryCount;
1164 ULONG PoorCQIRoamingCount;
1165 ULONG MgmtRingFullCount;
1166 ULONG RxCountSinceLastNULL;
1167 ULONG RxCount;
1168 ULONG RxRingErrCount;
1169 ULONG KickTxCount;
1170 ULONG TxRingErrCount;
1171 LARGE_INTEGER RealFcsErrCount;
1172 ULONG PendingNdisPacketCount;
1174 ULONG OneSecOsTxCount[NUM_OF_TX_RING];
1175 ULONG OneSecDmaDoneCount[NUM_OF_TX_RING];
1176 UINT32 OneSecTxDoneCount;
1177 ULONG OneSecRxCount;
1178 UINT32 OneSecTxAggregationCount;
1179 UINT32 OneSecRxAggregationCount;
1181 UINT32 OneSecFrameDuplicateCount;
1183 #ifdef RT2870
1184 ULONG OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput
1185 #endif // RT2870 //
1187 UINT32 OneSecTxNoRetryOkCount;
1188 UINT32 OneSecTxRetryOkCount;
1189 UINT32 OneSecTxFailCount;
1190 UINT32 OneSecFalseCCACnt; // CCA error count, for debug purpose, might move to global counter
1191 UINT32 OneSecRxOkCnt; // RX without error
1192 UINT32 OneSecRxOkDataCnt; // unicast-to-me DATA frame count
1193 UINT32 OneSecRxFcsErrCnt; // CRC error
1194 UINT32 OneSecBeaconSentCnt;
1195 UINT32 LastOneSecTotalTxCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount
1196 UINT32 LastOneSecRxOkDataCnt; // OneSecRxOkDataCnt
1197 ULONG DuplicateRcv;
1198 ULONG TxAggCount;
1199 ULONG TxNonAggCount;
1200 ULONG TxAgg1MPDUCount;
1201 ULONG TxAgg2MPDUCount;
1202 ULONG TxAgg3MPDUCount;
1203 ULONG TxAgg4MPDUCount;
1204 ULONG TxAgg5MPDUCount;
1205 ULONG TxAgg6MPDUCount;
1206 ULONG TxAgg7MPDUCount;
1207 ULONG TxAgg8MPDUCount;
1208 ULONG TxAgg9MPDUCount;
1209 ULONG TxAgg10MPDUCount;
1210 ULONG TxAgg11MPDUCount;
1211 ULONG TxAgg12MPDUCount;
1212 ULONG TxAgg13MPDUCount;
1213 ULONG TxAgg14MPDUCount;
1214 ULONG TxAgg15MPDUCount;
1215 ULONG TxAgg16MPDUCount;
1217 LARGE_INTEGER TransmittedOctetsInAMSDU;
1218 LARGE_INTEGER TransmittedAMSDUCount;
1219 LARGE_INTEGER ReceivedOctesInAMSDUCount;
1220 LARGE_INTEGER ReceivedAMSDUCount;
1221 LARGE_INTEGER TransmittedAMPDUCount;
1222 LARGE_INTEGER TransmittedMPDUsInAMPDUCount;
1223 LARGE_INTEGER TransmittedOctetsInAMPDUCount;
1224 LARGE_INTEGER MPDUInReceivedAMPDUCount;
1225 } COUNTER_RALINK, *PCOUNTER_RALINK;
1227 typedef struct _PID_COUNTER {
1228 ULONG TxAckRequiredCount; // CRC error
1229 ULONG TxAggreCount;
1230 ULONG TxSuccessCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount
1231 ULONG LastSuccessRate;
1232 } PID_COUNTER, *PPID_COUNTER;
1234 typedef struct _COUNTER_DRS {
1235 // to record the each TX rate's quality. 0 is best, the bigger the worse.
1236 USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
1237 UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH];
1238 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
1239 ULONG CurrTxRateStableTime; // # of second in current TX rate
1240 BOOLEAN fNoisyEnvironment;
1241 BOOLEAN fLastSecAccordingRSSI;
1242 UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down
1243 UCHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction
1244 ULONG LastTxOkCount;
1245 } COUNTER_DRS, *PCOUNTER_DRS;
1248 // Arcfour Structure Added by PaulWu
1250 typedef struct _ARCFOUR
1252 UINT X;
1253 UINT Y;
1254 UCHAR STATE[256];
1255 } ARCFOURCONTEXT, *PARCFOURCONTEXT;
1257 // MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI too. just copy to TXWI.
1258 typedef struct _RECEIVE_SETTING {
1259 USHORT NumOfRX:2; // MIMO. WE HAVE 3R
1260 USHORT Mode:2; //channel bandwidth 20MHz or 40 MHz
1261 USHORT ShortGI:1;
1262 USHORT STBC:2; //SPACE
1263 USHORT rsv:3;
1264 USHORT OFDM:1;
1265 USHORT MIMO:1;
1266 } RECEIVE_SETTING, *PRECEIVE_SETTING;
1268 // Shared key data structure
1269 typedef struct _WEP_KEY {
1270 UCHAR KeyLen; // Key length for each key, 0: entry is invalid
1271 UCHAR Key[MAX_LEN_OF_KEY]; // right now we implement 4 keys, 128 bits max
1272 } WEP_KEY, *PWEP_KEY;
1274 typedef struct _CIPHER_KEY {
1275 UCHAR Key[16]; // right now we implement 4 keys, 128 bits max
1276 UCHAR RxMic[8]; // make alignment
1277 UCHAR TxMic[8];
1278 UCHAR TxTsc[6]; // 48bit TSC value
1279 UCHAR RxTsc[6]; // 48bit TSC value
1280 UCHAR CipherAlg; // 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128
1281 UCHAR KeyLen;
1282 UCHAR BssId[6];
1283 // Key length for each key, 0: entry is invalid
1284 UCHAR Type; // Indicate Pairwise/Group when reporting MIC error
1285 } CIPHER_KEY, *PCIPHER_KEY;
1287 typedef struct _BBP_TUNING_STRUCT {
1288 BOOLEAN Enable;
1289 UCHAR FalseCcaCountUpperBound; // 100 per sec
1290 UCHAR FalseCcaCountLowerBound; // 10 per sec
1291 UCHAR R17LowerBound; // specified in E2PROM
1292 UCHAR R17UpperBound; // 0x68 according to David Tung
1293 UCHAR CurrentR17Value;
1294 } BBP_TUNING, *PBBP_TUNING;
1296 typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT {
1297 UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status
1298 #ifdef RT2870
1299 UCHAR EvaluateStableCnt;
1300 #endif
1301 UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2
1302 UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2
1303 UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4
1304 UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4
1305 SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2
1306 SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4
1307 SHORT Pair1LastAvgRssi; //
1308 SHORT Pair2LastAvgRssi; //
1309 ULONG RcvPktNumWhenEvaluate;
1310 BOOLEAN FirstPktArrivedWhenEvaluate;
1311 RALINK_TIMER_STRUCT RxAntDiversityTimer;
1312 } SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY;
1314 typedef struct _LEAP_AUTH_INFO {
1315 BOOLEAN Enabled; //Ture: Enable LEAP Authentication
1316 BOOLEAN CCKM; //Ture: Use Fast Reauthentication with CCKM
1317 UCHAR Reserve[2];
1318 UCHAR UserName[256]; //LEAP, User name
1319 ULONG UserNameLen;
1320 UCHAR Password[256]; //LEAP, User Password
1321 ULONG PasswordLen;
1322 } LEAP_AUTH_INFO, *PLEAP_AUTH_INFO;
1324 typedef struct {
1325 UCHAR Addr[MAC_ADDR_LEN];
1326 UCHAR ErrorCode[2]; //00 01-Invalid authentication type
1327 //00 02-Authentication timeout
1328 //00 03-Challenge from AP failed
1329 //00 04-Challenge to AP failed
1330 BOOLEAN Reported;
1331 } ROGUEAP_ENTRY, *PROGUEAP_ENTRY;
1333 typedef struct {
1334 UCHAR RogueApNr;
1335 ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE];
1336 } ROGUEAP_TABLE, *PROGUEAP_TABLE;
1338 typedef struct {
1339 BOOLEAN Enable;
1340 UCHAR Delta;
1341 BOOLEAN PlusSign;
1342 } CCK_TX_POWER_CALIBRATE, *PCCK_TX_POWER_CALIBRATE;
1345 // Receive Tuple Cache Format
1347 typedef struct _TUPLE_CACHE {
1348 BOOLEAN Valid;
1349 UCHAR MacAddress[MAC_ADDR_LEN];
1350 USHORT Sequence;
1351 USHORT Frag;
1352 } TUPLE_CACHE, *PTUPLE_CACHE;
1355 // Fragment Frame structure
1357 typedef struct _FRAGMENT_FRAME {
1358 PNDIS_PACKET pFragPacket;
1359 ULONG RxSize;
1360 USHORT Sequence;
1361 USHORT LastFrag;
1362 ULONG Flags; // Some extra frame information. bit 0: LLC presented
1363 } FRAGMENT_FRAME, *PFRAGMENT_FRAME;
1367 // Packet information for NdisQueryPacket
1369 typedef struct _PACKET_INFO {
1370 UINT PhysicalBufferCount; // Physical breaks of buffer descripor chained
1371 UINT BufferCount ; // Number of Buffer descriptor chained
1372 UINT TotalPacketLength ; // Self explained
1373 PNDIS_BUFFER pFirstBuffer; // Pointer to first buffer descriptor
1374 } PACKET_INFO, *PPACKET_INFO;
1377 // Tkip Key structure which RC4 key & MIC calculation
1379 typedef struct _TKIP_KEY_INFO {
1380 UINT nBytesInM; // # bytes in M for MICKEY
1381 ULONG IV16;
1382 ULONG IV32;
1383 ULONG K0; // for MICKEY Low
1384 ULONG K1; // for MICKEY Hig
1385 ULONG L; // Current state for MICKEY
1386 ULONG R; // Current state for MICKEY
1387 ULONG M; // Message accumulator for MICKEY
1388 UCHAR RC4KEY[16];
1389 UCHAR MIC[8];
1390 } TKIP_KEY_INFO, *PTKIP_KEY_INFO;
1393 // Private / Misc data, counters for driver internal use
1395 typedef struct __PRIVATE_STRUC {
1396 UINT SystemResetCnt; // System reset counter
1397 UINT TxRingFullCnt; // Tx ring full occurrance number
1398 UINT PhyRxErrCnt; // PHY Rx error count, for debug purpose, might move to global counter
1399 // Variables for WEP encryption / decryption in rtmp_wep.c
1400 UINT FCSCRC32;
1401 ARCFOURCONTEXT WEPCONTEXT;
1402 // Tkip stuff
1403 TKIP_KEY_INFO Tx;
1404 TKIP_KEY_INFO Rx;
1405 } PRIVATE_STRUC, *PPRIVATE_STRUC;
1407 // structure to tune BBP R66 (BBP TUNING)
1408 typedef struct _BBP_R66_TUNING {
1409 BOOLEAN bEnable;
1410 USHORT FalseCcaLowerThreshold; // default 100
1411 USHORT FalseCcaUpperThreshold; // default 512
1412 UCHAR R66Delta;
1413 UCHAR R66CurrentValue;
1414 BOOLEAN R66LowerUpperSelect; //Before LinkUp, Used LowerBound or UpperBound as R66 value.
1415 } BBP_R66_TUNING, *PBBP_R66_TUNING;
1417 // structure to store channel TX power
1418 typedef struct _CHANNEL_TX_POWER {
1419 USHORT RemainingTimeForUse; //unit: sec
1420 UCHAR Channel;
1421 CHAR Power;
1422 CHAR Power2;
1423 UCHAR MaxTxPwr;
1424 UCHAR DfsReq;
1425 } CHANNEL_TX_POWER, *PCHANNEL_TX_POWER;
1427 // structure to store 802.11j channel TX power
1428 typedef struct _CHANNEL_11J_TX_POWER {
1429 UCHAR Channel;
1430 UCHAR BW; // BW_10 or BW_20
1431 CHAR Power;
1432 CHAR Power2;
1433 USHORT RemainingTimeForUse; //unit: sec
1434 } CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER;
1436 typedef enum _ABGBAND_STATE_ {
1437 UNKNOWN_BAND,
1438 BG_BAND,
1439 A_BAND,
1440 } ABGBAND_STATE;
1442 typedef struct _MLME_STRUCT {
1443 // STA state machines
1444 STATE_MACHINE CntlMachine;
1445 STATE_MACHINE AssocMachine;
1446 STATE_MACHINE AuthMachine;
1447 STATE_MACHINE AuthRspMachine;
1448 STATE_MACHINE SyncMachine;
1449 STATE_MACHINE WpaPskMachine;
1450 STATE_MACHINE LeapMachine;
1451 STATE_MACHINE AironetMachine;
1452 STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE];
1453 STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE];
1454 STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE];
1455 STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE];
1456 STATE_MACHINE_FUNC WpaPskFunc[WPA_PSK_FUNC_SIZE];
1457 STATE_MACHINE_FUNC AironetFunc[AIRONET_FUNC_SIZE];
1458 STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE];
1459 // Action
1460 STATE_MACHINE ActMachine;
1462 ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming
1463 ULONG Now32; // latch the value of NdisGetSystemUpTime()
1464 ULONG LastSendNULLpsmTime;
1466 BOOLEAN bRunning;
1467 NDIS_SPIN_LOCK TaskLock;
1468 MLME_QUEUE Queue;
1470 UINT ShiftReg;
1472 RALINK_TIMER_STRUCT PeriodicTimer;
1473 RALINK_TIMER_STRUCT APSDPeriodicTimer;
1474 RALINK_TIMER_STRUCT LinkDownTimer;
1475 RALINK_TIMER_STRUCT LinkUpTimer;
1476 #ifdef RT2860
1477 UCHAR bPsPollTimerRunning;
1478 RALINK_TIMER_STRUCT PsPollTimer;
1479 RALINK_TIMER_STRUCT RadioOnOffTimer;
1480 #endif
1481 ULONG PeriodicRound;
1482 ULONG OneSecPeriodicRound;
1484 UCHAR RealRxPath;
1485 BOOLEAN bLowThroughput;
1486 BOOLEAN bEnableAutoAntennaCheck;
1487 RALINK_TIMER_STRUCT RxAntEvalTimer;
1489 #ifdef RT2870
1490 UCHAR CaliBW40RfR24;
1491 UCHAR CaliBW20RfR24;
1492 #endif // RT2870 //
1493 } MLME_STRUCT, *PMLME_STRUCT;
1495 // structure for radar detection and channel switch
1496 typedef struct _RADAR_DETECT_STRUCT {
1497 UCHAR CSCount; //Channel switch counter
1498 UCHAR CSPeriod; //Channel switch period (beacon count)
1499 UCHAR RDCount; //Radar detection counter
1500 UCHAR RDMode; //Radar Detection mode
1501 UCHAR RDDurRegion; //Radar detection duration region
1502 UCHAR BBPR16;
1503 UCHAR BBPR17;
1504 UCHAR BBPR18;
1505 UCHAR BBPR21;
1506 UCHAR BBPR22;
1507 UCHAR BBPR64;
1508 ULONG InServiceMonitorCount; // unit: sec
1509 UINT8 DfsSessionTime;
1510 BOOLEAN bFastDfs;
1511 UINT8 ChMovingTime;
1512 UINT8 LongPulseRadarTh;
1513 } RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT;
1515 typedef enum _REC_BLOCKACK_STATUS
1517 Recipient_NONE=0,
1518 Recipient_USED,
1519 Recipient_HandleRes,
1520 Recipient_Accept
1521 } REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS;
1523 typedef enum _ORI_BLOCKACK_STATUS
1525 Originator_NONE=0,
1526 Originator_USED,
1527 Originator_WaitRes,
1528 Originator_Done
1529 } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS;
1531 typedef struct _BA_ORI_ENTRY{
1532 UCHAR Wcid;
1533 UCHAR TID;
1534 UCHAR BAWinSize;
1535 UCHAR Token;
1536 // Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header.
1537 USHORT Sequence;
1538 USHORT TimeOutValue;
1539 ORI_BLOCKACK_STATUS ORI_BA_Status;
1540 RALINK_TIMER_STRUCT ORIBATimer;
1541 PVOID pAdapter;
1542 } BA_ORI_ENTRY, *PBA_ORI_ENTRY;
1544 typedef struct _BA_REC_ENTRY {
1545 UCHAR Wcid;
1546 UCHAR TID;
1547 UCHAR BAWinSize; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU.
1548 USHORT LastIndSeq;
1549 USHORT TimeOutValue;
1550 RALINK_TIMER_STRUCT RECBATimer;
1551 ULONG LastIndSeqAtTimer;
1552 ULONG nDropPacket;
1553 ULONG rcvSeq;
1554 REC_BLOCKACK_STATUS REC_BA_Status;
1555 NDIS_SPIN_LOCK RxReRingLock; // Rx Ring spinlock
1556 PVOID pAdapter;
1557 struct reordering_list list;
1558 } BA_REC_ENTRY, *PBA_REC_ENTRY;
1561 typedef struct {
1562 ULONG numAsRecipient; // I am recipient of numAsRecipient clients. These client are in the BARecEntry[]
1563 ULONG numAsOriginator; // I am originator of numAsOriginator clients. These clients are in the BAOriEntry[]
1564 BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE];
1565 BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE];
1566 } BA_TABLE, *PBA_TABLE;
1568 //For QureyBATableOID use;
1569 typedef struct PACKED _OID_BA_REC_ENTRY{
1570 UCHAR MACAddr[MAC_ADDR_LEN];
1571 UCHAR BaBitmap; // if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize
1572 UCHAR rsv;
1573 UCHAR BufSize[8];
1574 REC_BLOCKACK_STATUS REC_BA_Status[8];
1575 } OID_BA_REC_ENTRY, *POID_BA_REC_ENTRY;
1577 //For QureyBATableOID use;
1578 typedef struct PACKED _OID_BA_ORI_ENTRY{
1579 UCHAR MACAddr[MAC_ADDR_LEN];
1580 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
1581 UCHAR rsv;
1582 UCHAR BufSize[8];
1583 ORI_BLOCKACK_STATUS ORI_BA_Status[8];
1584 } OID_BA_ORI_ENTRY, *POID_BA_ORI_ENTRY;
1586 typedef struct _QUERYBA_TABLE{
1587 OID_BA_ORI_ENTRY BAOriEntry[32];
1588 OID_BA_REC_ENTRY BARecEntry[32];
1589 UCHAR OriNum;// Number of below BAOriEntry
1590 UCHAR RecNum;// Number of below BARecEntry
1591 } QUERYBA_TABLE, *PQUERYBA_TABLE;
1593 typedef union _BACAP_STRUC {
1594 struct {
1595 UINT32 RxBAWinLimit:8;
1596 UINT32 TxBAWinLimit:8;
1597 UINT32 AutoBA:1; // automatically BA
1598 UINT32 Policy:2; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use
1599 UINT32 MpduDensity:3;
1600 UINT32 AmsduEnable:1; //Enable AMSDU transmisstion
1601 UINT32 AmsduSize:1; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935};
1602 UINT32 MMPSmode:2; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable
1603 UINT32 bHtAdhoc:1; // adhoc can use ht rate.
1604 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.
1605 UINT32 :4;
1606 } field;
1607 UINT32 word;
1608 } BACAP_STRUC, *PBACAP_STRUC;
1610 //This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic)
1611 typedef struct _IOT_STRUC {
1612 UCHAR Threshold[2];
1613 UCHAR ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[0]
1614 UCHAR RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[1]
1615 ULONG OneSecInWindowCount;
1616 ULONG OneSecFrameDuplicateCount;
1617 ULONG OneSecOutWindowCount;
1618 UCHAR DelOriAct;
1619 UCHAR DelRecAct;
1620 UCHAR RTSShortProt;
1621 UCHAR RTSLongProt;
1622 BOOLEAN bRTSLongProtOn;
1623 BOOLEAN bLastAtheros;
1624 BOOLEAN bCurrentAtheros;
1625 BOOLEAN bNowAtherosBurstOn;
1626 BOOLEAN bNextDisableRxBA;
1627 BOOLEAN bToggle;
1628 } IOT_STRUC, *PIOT_STRUC;
1630 // This is the registry setting for 802.11n transmit setting. Used in advanced page.
1631 typedef union _REG_TRANSMIT_SETTING {
1632 struct {
1633 UINT32 rsv0:10;
1634 UINT32 TxBF:1;
1635 UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz
1636 UINT32 ShortGI:1;
1637 UINT32 STBC:1; //SPACE
1638 UINT32 TRANSNO:2;
1639 UINT32 HTMODE:1;
1640 UINT32 EXTCHA:2;
1641 UINT32 rsv:13;
1642 } field;
1643 UINT32 word;
1644 } REG_TRANSMIT_SETTING, *PREG_TRANSMIT_SETTING;
1646 typedef union _DESIRED_TRANSMIT_SETTING {
1647 struct {
1648 USHORT MCS:7; // MCS
1649 USHORT PhyMode:4;
1650 USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode.
1651 USHORT rsv:3;
1652 } field;
1653 USHORT word;
1654 } DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING;
1656 typedef struct {
1657 BOOLEAN IsRecipient;
1658 UCHAR MACAddr[MAC_ADDR_LEN];
1659 UCHAR TID;
1660 UCHAR nMSDU;
1661 USHORT TimeOut;
1662 BOOLEAN bAllTid; // If True, delete all TID for BA sessions with this MACaddr.
1663 } OID_ADD_BA_ENTRY, *POID_ADD_BA_ENTRY;
1666 // Multiple SSID structure
1668 #define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */
1669 #define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */
1671 /* clear bcmc TIM bit */
1672 #define WLAN_MR_TIM_BCMC_CLEAR(apidx) \
1673 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] &= ~BIT8[0];
1675 /* set bcmc TIM bit */
1676 #define WLAN_MR_TIM_BCMC_SET(apidx) \
1677 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] |= BIT8[0];
1679 /* clear a station PS TIM bit */
1680 #define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, wcid) \
1681 { UCHAR tim_offset = wcid >> 3; \
1682 UCHAR bit_offset = wcid & 0x7; \
1683 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); }
1685 /* set a station PS TIM bit */
1686 #define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \
1687 { UCHAR tim_offset = wcid >> 3; \
1688 UCHAR bit_offset = wcid & 0x7; \
1689 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; }
1691 #ifdef RT2870
1692 #define BEACON_BITMAP_MASK 0xff
1693 typedef struct _BEACON_SYNC_STRUCT_
1695 UCHAR BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET];
1696 UCHAR BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE];
1697 ULONG TimIELocationInBeacon[HW_BEACON_MAX_COUNT];
1698 ULONG CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT];
1699 BOOLEAN EnableBeacon; // trigger to enable beacon transmission.
1700 UCHAR BeaconBitMap; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change.
1701 UCHAR DtimBitOn; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change.
1702 }BEACON_SYNC_STRUCT;
1703 #endif // RT2870 //
1705 typedef struct _MULTISSID_STRUCT {
1706 UCHAR Bssid[MAC_ADDR_LEN];
1707 UCHAR SsidLen;
1708 CHAR Ssid[MAX_LEN_OF_SSID];
1709 USHORT CapabilityInfo;
1711 PNET_DEV MSSIDDev;
1713 NDIS_802_11_AUTHENTICATION_MODE AuthMode;
1714 NDIS_802_11_WEP_STATUS WepStatus;
1715 NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
1716 WPA_MIX_PAIR_CIPHER WpaMixPairCipher;
1718 ULONG TxCount;
1719 ULONG RxCount;
1720 ULONG ReceivedByteCount;
1721 ULONG TransmittedByteCount;
1722 ULONG RxErrorCount;
1723 ULONG RxDropCount;
1725 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
1726 RT_HT_PHY_INFO DesiredHtPhyInfo;
1727 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting. this is for reading registry setting only. not useful.
1728 BOOLEAN bAutoTxRateSwitch;
1730 UCHAR DefaultKeyId;
1732 UCHAR TxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11, ...
1733 UCHAR DesiredRates[MAX_LEN_OF_SUPPORTED_RATES];// OID_802_11_DESIRED_RATES
1734 UCHAR DesiredRatesIndex;
1735 UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1737 UCHAR TimBitmaps[WLAN_MAX_NUM_OF_TIM];
1739 // WPA
1740 UCHAR GMK[32];
1741 UCHAR PMK[32];
1742 UCHAR GTK[32];
1743 BOOLEAN IEEE8021X;
1744 BOOLEAN PreAuth;
1745 UCHAR GNonce[32];
1746 UCHAR PortSecured;
1747 NDIS_802_11_PRIVACY_FILTER PrivacyFilter;
1748 UCHAR BANClass3Data;
1749 ULONG IsolateInterStaTraffic;
1751 UCHAR RSNIE_Len[2];
1752 UCHAR RSN_IE[2][MAX_LEN_OF_RSNIE];
1755 UCHAR TimIELocationInBeacon;
1756 UCHAR CapabilityInfoLocationInBeacon;
1757 // outgoing BEACON frame buffer and corresponding TXWI
1758 // PTXWI_STRUC BeaconTxWI; //
1759 CHAR BeaconBuf[MAX_BEACON_SIZE]; // NOTE: BeaconBuf should be 4-byte aligned
1761 BOOLEAN bHideSsid;
1762 UINT16 StationKeepAliveTime; // unit: second
1764 USHORT VLAN_VID;
1765 USHORT VLAN_Priority;
1767 RT_802_11_ACL AccessControlList;
1769 // EDCA Qos
1770 BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM
1771 BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS
1773 UCHAR DlsPTK[64]; // Due to windows dirver count on meetinghouse to handle 4-way shake
1775 // For 802.1x daemon setting per BSS
1776 UCHAR radius_srv_num;
1777 RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM];
1779 #ifdef RTL865X_SOC
1780 unsigned int mylinkid;
1781 #endif
1784 UINT32 RcvdConflictSsidCount;
1785 UINT32 RcvdSpoofedAssocRespCount;
1786 UINT32 RcvdSpoofedReassocRespCount;
1787 UINT32 RcvdSpoofedProbeRespCount;
1788 UINT32 RcvdSpoofedBeaconCount;
1789 UINT32 RcvdSpoofedDisassocCount;
1790 UINT32 RcvdSpoofedAuthCount;
1791 UINT32 RcvdSpoofedDeauthCount;
1792 UINT32 RcvdSpoofedUnknownMgmtCount;
1793 UINT32 RcvdReplayAttackCount;
1795 CHAR RssiOfRcvdConflictSsid;
1796 CHAR RssiOfRcvdSpoofedAssocResp;
1797 CHAR RssiOfRcvdSpoofedReassocResp;
1798 CHAR RssiOfRcvdSpoofedProbeResp;
1799 CHAR RssiOfRcvdSpoofedBeacon;
1800 CHAR RssiOfRcvdSpoofedDisassoc;
1801 CHAR RssiOfRcvdSpoofedAuth;
1802 CHAR RssiOfRcvdSpoofedDeauth;
1803 CHAR RssiOfRcvdSpoofedUnknownMgmt;
1804 CHAR RssiOfRcvdReplayAttack;
1806 BOOLEAN bBcnSntReq;
1807 UCHAR BcnBufIdx;
1808 } MULTISSID_STRUCT, *PMULTISSID_STRUCT;
1810 // configuration common to OPMODE_AP as well as OPMODE_STA
1811 typedef struct _COMMON_CONFIG {
1813 BOOLEAN bCountryFlag;
1814 UCHAR CountryCode[3];
1815 UCHAR Geography;
1816 UCHAR CountryRegion; // Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel
1817 UCHAR CountryRegionForABand; // Enum of country region for A band
1818 UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED
1819 USHORT Dsifs; // in units of usec
1820 ULONG PacketFilter; // Packet filter for receiving
1822 CHAR Ssid[MAX_LEN_OF_SSID]; // NOT NULL-terminated
1823 UCHAR SsidLen; // the actual ssid length in used
1824 UCHAR LastSsidLen; // the actual ssid length in used
1825 CHAR LastSsid[MAX_LEN_OF_SSID]; // NOT NULL-terminated
1826 UCHAR LastBssid[MAC_ADDR_LEN];
1828 UCHAR Bssid[MAC_ADDR_LEN];
1829 USHORT BeaconPeriod;
1830 UCHAR Channel;
1831 UCHAR CentralChannel; // Central Channel when using 40MHz is indicating. not real channel.
1833 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
1834 UCHAR SupRateLen;
1835 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
1836 UCHAR ExtRateLen;
1837 UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; // OID_802_11_DESIRED_RATES
1838 UCHAR MaxDesiredRate;
1839 UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES];
1841 ULONG BasicRateBitmap; // backup basic ratebitmap
1843 BOOLEAN bAPSDCapable;
1844 BOOLEAN bInServicePeriod;
1845 BOOLEAN bAPSDAC_BE;
1846 BOOLEAN bAPSDAC_BK;
1847 BOOLEAN bAPSDAC_VI;
1848 BOOLEAN bAPSDAC_VO;
1849 BOOLEAN bNeedSendTriggerFrame;
1850 BOOLEAN bAPSDForcePowerSave; // Force power save mode, should only use in APSD-STAUT
1851 ULONG TriggerTimerCount;
1852 UCHAR MaxSPLength;
1853 UCHAR BBPCurrentBW; // BW_10, BW_20, BW_40
1854 REG_TRANSMIT_SETTING RegTransmitSetting; //registry transmit setting. this is for reading registry setting only. not useful.
1855 UCHAR TxRate; // Same value to fill in TXD. TxRate is 6-bit
1856 UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1857 UCHAR TxRateIndex; // Tx rate index in RateSwitchTable
1858 UCHAR TxRateTableSize; // Valid Tx rate table size in RateSwitchTable
1859 UCHAR MinTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1860 UCHAR RtsRate; // RATE_xxx
1861 HTTRANSMIT_SETTING MlmeTransmit; // MGMT frame PHY rate setting when operatin at Ht rate.
1862 UCHAR MlmeRate; // RATE_xxx, used to send MLME frames
1863 UCHAR BasicMlmeRate; // Default Rate for sending MLME frames
1865 USHORT RtsThreshold; // in unit of BYTE
1866 USHORT FragmentThreshold; // in unit of BYTE
1868 UCHAR TxPower; // in unit of mW
1869 ULONG TxPowerPercentage; // 0~100 %
1870 ULONG TxPowerDefault; // keep for TxPowerPercentage
1872 BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0
1873 BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0
1875 IOT_STRUC IOTestParm; // 802.11n InterOpbility Test Parameter;
1876 ULONG TxPreamble; // Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto
1877 BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable
1878 ULONG UseBGProtection; // 0: auto, 1: always use, 2: always not use
1879 BOOLEAN bUseShortSlotTime; // 0: disable, 1 - use short slot (9us)
1880 BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST, 0: disable TX PACKET BURST
1881 BOOLEAN bAggregationCapable; // 1: enable TX aggregation when the peer supports it
1882 BOOLEAN bPiggyBackCapable; // 1: enable TX piggy-back according MAC's version
1883 BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec.
1884 ULONG DisableOLBCDetect; // 0: enable OLBC detect; 1 disable OLBC detect
1886 BOOLEAN bRdg;
1888 BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM
1889 QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP
1890 EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP
1891 QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP
1892 UCHAR AckPolicy[4]; // ACK policy of the specified AC. see ACK_xxx
1893 BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS
1894 // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular
1895 // BOOLEAN control, either ON or OFF. These flags should always be accessed via
1896 // OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros.
1897 // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition
1898 ULONG OpStatusFlags;
1900 BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff.
1901 ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode.
1903 // IEEE802.11H--DFS.
1904 RADAR_DETECT_STRUCT RadarDetect;
1906 // HT
1907 UCHAR BASize; // USer desired BAWindowSize. Should not exceed our max capability
1908 //RT_HT_CAPABILITY SupportedHtPhy;
1909 RT_HT_CAPABILITY DesiredHtPhy;
1910 HT_CAPABILITY_IE HtCapability;
1911 ADD_HT_INFO_IE AddHTInfo; // Useful as AP.
1912 //This IE is used with channel switch announcement element when changing to a new 40MHz.
1913 //This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp.
1914 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
1916 BOOLEAN bHTProtect;
1917 BOOLEAN bMIMOPSEnable;
1918 BOOLEAN bBADecline;
1919 BOOLEAN bDisableReordering;
1920 BOOLEAN bForty_Mhz_Intolerant;
1921 BOOLEAN bExtChannelSwitchAnnouncement;
1922 BOOLEAN bRcvBSSWidthTriggerEvents;
1923 ULONG LastRcvBSSWidthTriggerEventsTime;
1925 UCHAR TxBASize;
1927 // Enable wireless event
1928 BOOLEAN bWirelessEvent;
1929 BOOLEAN bWiFiTest; // Enable this parameter for WiFi test
1931 // Tx & Rx Stream number selection
1932 UCHAR TxStream;
1933 UCHAR RxStream;
1935 // transmit phy mode, trasmit rate for Multicast.
1936 #ifdef MCAST_RATE_SPECIFIC
1937 UCHAR McastTransmitMcs;
1938 UCHAR McastTransmitPhyMode;
1939 #endif // MCAST_RATE_SPECIFIC //
1941 BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled
1943 #ifdef RT2870
1944 BOOLEAN bMultipleIRP; // Multiple Bulk IN flag
1945 UCHAR NumOfBulkInIRP; // if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1
1946 RT_HT_CAPABILITY SupportedHtPhy;
1947 ULONG MaxPktOneTxBulk;
1948 UCHAR TxBulkFactor;
1949 UCHAR RxBulkFactor;
1951 BEACON_SYNC_STRUCT *pBeaconSync;
1952 RALINK_TIMER_STRUCT BeaconUpdateTimer;
1953 UINT32 BeaconAdjust;
1954 UINT32 BeaconFactor;
1955 UINT32 BeaconRemain;
1956 #endif // RT2870 //
1959 NDIS_SPIN_LOCK MeasureReqTabLock;
1960 PMEASURE_REQ_TAB pMeasureReqTab;
1962 NDIS_SPIN_LOCK TpcReqTabLock;
1963 PTPC_REQ_TAB pTpcReqTab;
1965 // transmit phy mode, trasmit rate for Multicast.
1966 #ifdef MCAST_RATE_SPECIFIC
1967 HTTRANSMIT_SETTING MCastPhyMode;
1968 #endif // MCAST_RATE_SPECIFIC //
1969 } COMMON_CONFIG, *PCOMMON_CONFIG;
1971 /* Modified by Wu Xi-Kun 4/21/2006 */
1972 // STA configuration and status
1973 typedef struct _STA_ADMIN_CONFIG {
1974 // GROUP 1 -
1975 // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe
1976 // the user intended configuration, but not necessary fully equal to the final
1977 // settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either
1978 // AP or IBSS holder).
1979 // Once initialized, user configuration can only be changed via OID_xxx
1980 UCHAR BssType; // BSS_INFRA or BSS_ADHOC
1981 USHORT AtimWin; // used when starting a new IBSS
1983 // GROUP 2 -
1984 // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe
1985 // the user intended configuration, and should be always applied to the final
1986 // settings in ACTIVE BSS without compromising with the BSS holder.
1987 // Once initialized, user configuration can only be changed via OID_xxx
1988 UCHAR RssiTrigger;
1989 UCHAR RssiTriggerMode; // RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD
1990 USHORT DefaultListenCount; // default listen count;
1991 ULONG WindowsPowerMode; // Power mode for AC power
1992 ULONG WindowsBatteryPowerMode; // Power mode for battery if exists
1993 BOOLEAN bWindowsACCAMEnable; // Enable CAM power mode when AC on
1994 BOOLEAN bAutoReconnect; // Set to TRUE when setting OID_802_11_SSID with no matching BSSID
1995 ULONG WindowsPowerProfile; // Windows power profile, for NDIS5.1 PnP
1997 // MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1)
1998 USHORT Psm; // power management mode (PWR_ACTIVE|PWR_SAVE)
1999 USHORT DisassocReason;
2000 UCHAR DisassocSta[MAC_ADDR_LEN];
2001 USHORT DeauthReason;
2002 UCHAR DeauthSta[MAC_ADDR_LEN];
2003 USHORT AuthFailReason;
2004 UCHAR AuthFailSta[MAC_ADDR_LEN];
2006 NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X
2007 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
2008 NDIS_802_11_WEP_STATUS WepStatus;
2009 NDIS_802_11_WEP_STATUS OrigWepStatus; // Original wep status set from OID
2011 // Add to support different cipher suite for WPA2/WPA mode
2012 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite
2013 NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite
2014 BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites
2015 USHORT RsnCapability;
2017 NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
2019 UCHAR PMK[32]; // WPA PSK mode PMK
2020 UCHAR PTK[64]; // WPA PSK mode PTK
2021 UCHAR GTK[32]; // GTK from authenticator
2022 BSSID_INFO SavedPMK[PMKID_NO];
2023 UINT SavedPMKNum; // Saved PMKID number
2025 UCHAR DefaultKeyId;
2028 // WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED
2029 UCHAR PortSecured;
2031 // For WPA countermeasures
2032 ULONG LastMicErrorTime; // record last MIC error time
2033 ULONG MicErrCnt; // Should be 0, 1, 2, then reset to zero (after disassoiciation).
2034 BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred.
2035 // For WPA-PSK supplicant state
2036 WPA_STATE WpaState; // Default is SS_NOTUSE and handled by microsoft 802.1x
2037 UCHAR ReplayCounter[8];
2038 UCHAR ANonce[32]; // ANonce for WPA-PSK from aurhenticator
2039 UCHAR SNonce[32]; // SNonce for WPA-PSK
2041 UCHAR LastSNR0; // last received BEACON's SNR
2042 UCHAR LastSNR1; // last received BEACON's SNR for 2nd antenna
2043 RSSI_SAMPLE RssiSample;
2044 ULONG NumOfAvgRssiSample;
2046 ULONG LastBeaconRxTime; // OS's timestamp of the last BEACON RX time
2047 ULONG Last11bBeaconRxTime; // OS's timestamp of the last 11B BEACON RX time
2048 ULONG Last11gBeaconRxTime; // OS's timestamp of the last 11G BEACON RX time
2049 ULONG Last20NBeaconRxTime; // OS's timestamp of the last 20MHz N BEACON RX time
2051 ULONG LastScanTime; // Record last scan time for issue BSSID_SCAN_LIST
2052 ULONG ScanCnt; // Scan counts since most recent SSID, BSSID, SCAN OID request
2053 BOOLEAN bSwRadio; // Software controlled Radio On/Off, TRUE: On
2054 BOOLEAN bHwRadio; // Hardware controlled Radio On/Off, TRUE: On
2055 BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state
2056 BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled
2057 BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation
2058 #ifdef RT2860
2059 BOOLEAN AdhocBOnlyJoined; // Indicate Adhoc B Join.
2060 BOOLEAN AdhocBGJoined; // Indicate Adhoc B/G Join.
2061 BOOLEAN Adhoc20NJoined; // Indicate Adhoc 20MHz N Join.
2062 #endif
2063 // New for WPA, windows want us to keep association information and
2064 // Fixed IEs from last association response
2065 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
2066 USHORT ReqVarIELen; // Length of next VIE include EID & Length
2067 UCHAR ReqVarIEs[MAX_VIE_LEN]; // The content saved here should be little-endian format.
2068 USHORT ResVarIELen; // Length of next VIE include EID & Length
2069 UCHAR ResVarIEs[MAX_VIE_LEN];
2071 UCHAR RSNIE_Len;
2072 UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be little-endian format.
2074 // New variables used for CCX 1.0
2075 BOOLEAN bCkipOn;
2076 BOOLEAN bCkipCmicOn;
2077 UCHAR CkipFlag;
2078 UCHAR GIV[3]; //for CCX iv
2079 UCHAR RxSEQ[4];
2080 UCHAR TxSEQ[4];
2081 UCHAR CKIPMIC[4];
2082 UCHAR LeapAuthMode;
2083 LEAP_AUTH_INFO LeapAuthInfo;
2084 UCHAR HashPwd[16];
2085 UCHAR NetworkChallenge[8];
2086 UCHAR NetworkChallengeResponse[24];
2087 UCHAR PeerChallenge[8];
2089 UCHAR PeerChallengeResponse[24];
2090 UCHAR SessionKey[16]; //Network session keys (NSK)
2091 RALINK_TIMER_STRUCT LeapAuthTimer;
2092 ROGUEAP_TABLE RogueApTab; //Cisco CCX1 Rogue AP Detection
2094 // New control flags for CCX
2095 CCX_CONTROL CCXControl; // Master administration state
2096 BOOLEAN CCXEnable; // Actual CCX state
2097 UCHAR CCXScanChannel; // Selected channel for CCX beacon request
2098 USHORT CCXScanTime; // Time out to wait for beacon and probe response
2099 UCHAR CCXReqType; // Current processing CCX request type
2100 BSS_TABLE CCXBssTab; // BSS Table
2101 UCHAR FrameReportBuf[2048]; // Buffer for creating frame report
2102 USHORT FrameReportLen; // Current Frame report length
2103 ULONG CLBusyBytes; // Save the total bytes received durning channel load scan time
2104 USHORT RPIDensity[8]; // Array for RPI density collection
2105 // Start address of each BSS table within FrameReportBuf
2106 // It's important to update the RxPower of the corresponding Bss
2107 USHORT BssReportOffset[MAX_LEN_OF_BSS_TABLE];
2108 USHORT BeaconToken; // Token for beacon report
2109 ULONG LastBssIndex; // Most current reported Bss index
2110 RM_REQUEST_ACTION MeasurementRequest[16]; // Saved measurement request
2111 UCHAR RMReqCnt; // Number of measurement request saved.
2112 UCHAR CurrentRMReqIdx; // Number of measurement request saved.
2113 BOOLEAN ParallelReq; // Parallel measurement, only one request performed,
2114 // It must be the same channel with maximum duration
2115 USHORT ParallelDuration; // Maximum duration for parallel measurement
2116 UCHAR ParallelChannel; // Only one channel with parallel measurement
2117 USHORT IAPPToken; // IAPP dialog token
2118 UCHAR CCXQosECWMin; // Cisco QOS ECWMin for AC 0
2119 UCHAR CCXQosECWMax; // Cisco QOS ECWMax for AC 0
2120 // Hack for channel load and noise histogram parameters
2121 UCHAR NHFactor; // Parameter for Noise histogram
2122 UCHAR CLFactor; // Parameter for channel load
2124 UCHAR KRK[16]; //Key Refresh Key.
2125 UCHAR BTK[32]; //Base Transient Key
2126 BOOLEAN CCKMLinkUpFlag;
2127 ULONG CCKMRN; //(Re)Association request number.
2128 LARGE_INTEGER CCKMBeaconAtJoinTimeStamp; //TSF timer for Re-assocaite to the new AP
2129 UCHAR AironetCellPowerLimit; //in dBm
2130 UCHAR AironetIPAddress[4]; //eg. 192.168.1.1
2131 BOOLEAN CCXAdjacentAPReportFlag; //flag for determining report Assoc Lost time
2132 CHAR CCXAdjacentAPSsid[MAX_LEN_OF_SSID]; //Adjacent AP's SSID report
2133 UCHAR CCXAdjacentAPSsidLen; // the actual ssid length in used
2134 UCHAR CCXAdjacentAPBssid[MAC_ADDR_LEN]; //Adjacent AP's BSSID report
2135 USHORT CCXAdjacentAPChannel;
2136 ULONG CCXAdjacentAPLinkDownTime; //for Spec S32.
2138 RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer;
2139 BOOLEAN StaQuickResponeForRateUpTimerRunning;
2141 UCHAR DtimCount; // 0.. DtimPeriod-1
2142 UCHAR DtimPeriod; // default = 3
2144 ////////////////////////////////////////////////////////////////////////////////////////
2145 // This is only for WHQL test.
2146 BOOLEAN WhqlTest;
2147 ////////////////////////////////////////////////////////////////////////////////////////
2149 RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer;
2150 // Fast Roaming
2151 BOOLEAN bFastRoaming; // 0:disable fast roaming, 1:enable fast roaming
2152 CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value.
2154 BOOLEAN IEEE8021X;
2155 BOOLEAN IEEE8021x_required_keys;
2156 CIPHER_KEY DesireSharedKey[4]; // Record user desired WEP keys
2157 UCHAR DesireSharedKeyId;
2159 // 0: driver ignores wpa_supplicant
2160 // 1: wpa_supplicant initiates scanning and AP selection
2161 // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters
2162 UCHAR WpaSupplicantUP;
2163 UCHAR WpaSupplicantScanCount;
2165 CHAR dev_name[16];
2166 USHORT OriDevType;
2168 BOOLEAN bTGnWifiTest;
2169 BOOLEAN bScanReqIsFromWebUI;
2171 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
2172 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting;
2173 RT_HT_PHY_INFO DesiredHtPhyInfo;
2174 BOOLEAN bAutoTxRateSwitch;
2176 #ifdef RT2860
2177 UCHAR BBPR3;
2178 #endif
2179 } STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG;
2181 // This data structure keep the current active BSS/IBSS's configuration that this STA
2182 // had agreed upon joining the network. Which means these parameters are usually decided
2183 // by the BSS/IBSS creator instead of user configuration. Data in this data structurre
2184 // is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE.
2185 // Normally, after SCAN or failed roaming attempts, we need to recover back to
2186 // the current active settings.
2187 typedef struct _STA_ACTIVE_CONFIG {
2188 USHORT Aid;
2189 USHORT AtimWin; // in kusec; IBSS parameter set element
2190 USHORT CapabilityInfo;
2191 USHORT CfpMaxDuration;
2192 USHORT CfpPeriod;
2194 // Copy supported rate from desired AP's beacon. We are trying to match
2195 // AP's supported and extended rate settings.
2196 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
2197 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
2198 UCHAR SupRateLen;
2199 UCHAR ExtRateLen;
2200 // Copy supported ht from desired AP's beacon. We are trying to match
2201 RT_HT_PHY_INFO SupportedPhyInfo;
2202 RT_HT_CAPABILITY SupportedHtPhy;
2203 } STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG;
2205 #ifdef RT2870
2206 // for USB interface, avoid in interrupt when write key
2207 typedef struct RT_ADD_PAIRWISE_KEY_ENTRY {
2208 NDIS_802_11_MAC_ADDRESS MacAddr;
2209 USHORT MacTabMatchWCID; // ASIC
2210 CIPHER_KEY CipherKey;
2211 } RT_ADD_PAIRWISE_KEY_ENTRY,*PRT_ADD_PAIRWISE_KEY_ENTRY;
2212 #endif // RT2870 //
2214 // ----------- start of AP --------------------------
2215 // AUTH-RSP State Machine Aux data structure
2216 typedef struct _AP_MLME_AUX {
2217 UCHAR Addr[MAC_ADDR_LEN];
2218 USHORT Alg;
2219 CHAR Challenge[CIPHER_TEXT_LEN];
2220 } AP_MLME_AUX, *PAP_MLME_AUX;
2222 // structure to define WPA Group Key Rekey Interval
2223 typedef struct PACKED _RT_802_11_WPA_REKEY {
2224 ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
2225 ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets
2226 } RT_WPA_REKEY,*PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY;
2228 typedef struct _MAC_TABLE_ENTRY {
2229 //Choose 1 from ValidAsWDS and ValidAsCLI to validize.
2230 BOOLEAN ValidAsCLI; // Sta mode, set this TRUE after Linkup,too.
2231 BOOLEAN ValidAsWDS; // This is WDS Entry. only for AP mode.
2232 BOOLEAN ValidAsApCli; //This is a AP-Client entry, only for AP mode which enable AP-Client functions.
2233 BOOLEAN ValidAsMesh;
2234 BOOLEAN ValidAsDls; // This is DLS Entry. only for STA mode.
2235 BOOLEAN isCached;
2236 BOOLEAN bIAmBadAtheros; // Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection.
2238 UCHAR EnqueueEapolStartTimerRunning; // Enqueue EAPoL-Start for triggering EAP SM
2239 //jan for wpa
2240 // record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB
2241 UCHAR CMTimerRunning;
2242 UCHAR apidx; // MBSS number
2243 UCHAR RSNIE_Len;
2244 UCHAR RSN_IE[MAX_LEN_OF_RSNIE];
2245 UCHAR ANonce[LEN_KEY_DESC_NONCE];
2246 UCHAR R_Counter[LEN_KEY_DESC_REPLAY];
2247 UCHAR PTK[64];
2248 UCHAR ReTryCounter;
2249 RALINK_TIMER_STRUCT RetryTimer;
2250 RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; // A timer which enqueue EAPoL-Start for triggering PSK SM
2251 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
2252 NDIS_802_11_WEP_STATUS WepStatus;
2253 AP_WPA_STATE WpaState;
2254 GTK_STATE GTKState;
2255 USHORT PortSecured;
2256 NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X
2257 CIPHER_KEY PairwiseKey;
2258 PVOID pAd;
2259 INT PMKID_CacheIdx;
2260 UCHAR PMKID[LEN_PMKID];
2263 UCHAR Addr[MAC_ADDR_LEN];
2264 UCHAR PsMode;
2265 SST Sst;
2266 AUTH_STATE AuthState; // for SHARED KEY authentication state machine used only
2267 BOOLEAN IsReassocSta; // Indicate whether this is a reassociation procedure
2268 USHORT Aid;
2269 USHORT CapabilityInfo;
2270 UCHAR LastRssi;
2271 ULONG NoDataIdleCount;
2272 UINT16 StationKeepAliveCount; // unit: second
2273 ULONG PsQIdleCount;
2274 QUEUE_HEADER PsQueue;
2276 UINT32 StaConnectTime; // the live time of this station since associated with AP
2278 BOOLEAN bSendBAR;
2279 USHORT NoBADataCountDown;
2281 UINT32 CachedBuf[16]; // UINT (4 bytes) for alignment
2282 UINT TxBFCount; // 3*3
2283 UINT FIFOCount;
2284 UINT DebugFIFOCount;
2285 UINT DebugTxCount;
2286 BOOLEAN bDlsInit;
2289 //====================================================
2290 //WDS entry needs these
2291 // rt2860 add this. if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab
2292 UINT MatchWDSTabIdx;
2293 UCHAR MaxSupportedRate;
2294 UCHAR CurrTxRate;
2295 UCHAR CurrTxRateIndex;
2296 // to record the each TX rate's quality. 0 is best, the bigger the worse.
2297 USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
2298 UINT32 OneSecTxNoRetryOkCount;
2299 UINT32 OneSecTxRetryOkCount;
2300 UINT32 OneSecTxFailCount;
2301 UINT32 ContinueTxFailCnt;
2302 UINT32 CurrTxRateStableTime; // # of second in current TX rate
2303 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
2304 //====================================================
2306 BOOLEAN fNoisyEnvironment;
2307 BOOLEAN fLastSecAccordingRSSI;
2308 UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down
2309 CHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction
2310 ULONG LastTxOkCount;
2311 UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH];
2313 // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular
2314 // BOOLEAN control, either ON or OFF. These flags should always be accessed via
2315 // CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros.
2316 // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED
2317 ULONG ClientStatusFlags;
2319 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
2321 // HT EWC MIMO-N used parameters
2322 USHORT RXBAbitmap; // fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format
2323 USHORT TXBAbitmap; // This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI
2324 USHORT TXAutoBAbitmap;
2325 USHORT BADeclineBitmap;
2326 USHORT BARecWcidArray[NUM_OF_TID]; // The mapping wcid of recipient session. if RXBAbitmap bit is masked
2327 USHORT BAOriWcidArray[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked
2328 USHORT BAOriSequence[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked
2330 // 802.11n features.
2331 UCHAR MpduDensity;
2332 UCHAR MaxRAmpduFactor;
2333 UCHAR AMsduSize;
2334 UCHAR MmpsMode; // MIMO power save more.
2336 HT_CAPABILITY_IE HTCapability;
2338 BOOLEAN bAutoTxRateSwitch;
2340 UCHAR RateLen;
2341 struct _MAC_TABLE_ENTRY *pNext;
2342 USHORT TxSeq[NUM_OF_TID];
2343 USHORT NonQosDataSeq;
2345 RSSI_SAMPLE RssiSample;
2347 UINT32 TXMCSExpected[16];
2348 UINT32 TXMCSSuccessful[16];
2349 UINT32 TXMCSFailed[16];
2350 UINT32 TXMCSAutoFallBack[16][16];
2351 #ifdef RT2870
2352 ULONG LastBeaconRxTime;
2353 #endif
2354 } MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY;
2356 typedef struct _MAC_TABLE {
2357 USHORT Size;
2358 MAC_TABLE_ENTRY *Hash[HASH_TABLE_SIZE];
2359 MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE];
2360 QUEUE_HEADER McastPsQueue;
2361 ULONG PsQIdleCount;
2362 BOOLEAN fAnyStationInPsm;
2363 BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip.
2364 BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP
2365 #ifdef RT2870
2366 BOOLEAN fAllStationAsRalink; // Check if all stations are ralink-chipset
2367 #endif
2368 BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/
2369 BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF.
2370 BOOLEAN fAnyStation20Only; // Check if any Station can't support GF.
2371 BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic
2372 BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS
2373 } MAC_TABLE, *PMAC_TABLE;
2375 #define IS_HT_STA(_pMacEntry) \
2376 (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX)
2378 #define IS_HT_RATE(_pMacEntry) \
2379 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
2381 #define PEER_IS_HT_RATE(_pMacEntry) \
2382 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
2384 typedef struct _WDS_ENTRY {
2385 BOOLEAN Valid;
2386 UCHAR Addr[MAC_ADDR_LEN];
2387 ULONG NoDataIdleCount;
2388 struct _WDS_ENTRY *pNext;
2389 } WDS_ENTRY, *PWDS_ENTRY;
2391 typedef struct _WDS_TABLE_ENTRY {
2392 USHORT Size;
2393 UCHAR WdsAddr[MAC_ADDR_LEN];
2394 WDS_ENTRY *Hash[HASH_TABLE_SIZE];
2395 WDS_ENTRY Content[MAX_LEN_OF_MAC_TABLE];
2396 UCHAR MaxSupportedRate;
2397 UCHAR CurrTxRate;
2398 USHORT TxQuality[MAX_LEN_OF_SUPPORTED_RATES];
2399 USHORT OneSecTxOkCount;
2400 USHORT OneSecTxRetryOkCount;
2401 USHORT OneSecTxFailCount;
2402 ULONG CurrTxRateStableTime; // # of second in current TX rate
2403 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
2404 } WDS_TABLE_ENTRY, *PWDS_TABLE_ENTRY;
2406 typedef struct _RT_802_11_WDS_ENTRY {
2407 PNET_DEV dev;
2408 UCHAR Valid;
2409 UCHAR PhyMode;
2410 UCHAR PeerWdsAddr[MAC_ADDR_LEN];
2411 UCHAR MacTabMatchWCID; // ASIC
2412 NDIS_802_11_WEP_STATUS WepStatus;
2413 UCHAR KeyIdx;
2414 CIPHER_KEY WdsKey;
2415 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;
2416 RT_HT_PHY_INFO DesiredHtPhyInfo;
2417 BOOLEAN bAutoTxRateSwitch;
2418 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting.
2419 } RT_802_11_WDS_ENTRY, *PRT_802_11_WDS_ENTRY;
2421 typedef struct _WDS_TABLE {
2422 UCHAR Mode;
2423 ULONG Size;
2424 RT_802_11_WDS_ENTRY WdsEntry[MAX_WDS_ENTRY];
2425 } WDS_TABLE, *PWDS_TABLE;
2427 typedef struct _APCLI_STRUCT {
2428 PNET_DEV dev;
2429 #ifdef RTL865X_SOC
2430 unsigned int mylinkid;
2431 #endif
2432 BOOLEAN Enable; // Set it as 1 if the apcli interface was configured to "1" or by iwpriv cmd "ApCliEnable"
2433 BOOLEAN Valid; // Set it as 1 if the apcli interface associated success to remote AP.
2434 UCHAR MacTabWCID; //WCID value, which point to the entry of ASIC Mac table.
2435 UCHAR SsidLen;
2436 CHAR Ssid[MAX_LEN_OF_SSID];
2438 UCHAR CfgSsidLen;
2439 CHAR CfgSsid[MAX_LEN_OF_SSID];
2440 UCHAR CfgApCliBssid[ETH_LENGTH_OF_ADDRESS];
2441 UCHAR CurrentAddress[ETH_LENGTH_OF_ADDRESS];
2443 ULONG ApCliRcvBeaconTime;
2445 ULONG CtrlCurrState;
2446 ULONG SyncCurrState;
2447 ULONG AuthCurrState;
2448 ULONG AssocCurrState;
2449 ULONG WpaPskCurrState;
2451 USHORT AuthReqCnt;
2452 USHORT AssocReqCnt;
2454 ULONG ClientStatusFlags;
2455 UCHAR MpduDensity;
2457 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
2458 NDIS_802_11_WEP_STATUS WepStatus;
2460 // Add to support different cipher suite for WPA2/WPA mode
2461 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite
2462 NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite
2463 BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites
2464 USHORT RsnCapability;
2466 UCHAR PSK[100]; // reserve PSK key material
2467 UCHAR PSKLen;
2468 UCHAR PMK[32]; // WPA PSK mode PMK
2469 UCHAR GTK[32]; // GTK from authenticator
2471 CIPHER_KEY SharedKey[SHARE_KEY_NUM];
2472 UCHAR DefaultKeyId;
2474 // store RSN_IE built by driver
2475 UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be convert to little-endian format.
2476 UCHAR RSNIE_Len;
2478 // For WPA countermeasures
2479 ULONG LastMicErrorTime; // record last MIC error time
2480 BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred.
2482 // For WPA-PSK supplicant state
2483 UCHAR SNonce[32]; // SNonce for WPA-PSK
2484 UCHAR GNonce[32]; // GNonce for WPA-PSK from authenticator
2486 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;
2487 RT_HT_PHY_INFO DesiredHtPhyInfo;
2488 BOOLEAN bAutoTxRateSwitch;
2489 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting.
2490 } APCLI_STRUCT, *PAPCLI_STRUCT;
2492 // ----------- end of AP ----------------------------
2494 struct wificonf
2496 BOOLEAN bShortGI;
2497 BOOLEAN bGreenField;
2503 typedef struct _INF_PCI_CONFIG
2505 PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use
2506 }INF_PCI_CONFIG;
2508 typedef struct _INF_USB_CONFIG
2510 UINT BulkInEpAddr; // bulk-in endpoint address
2511 UINT BulkOutEpAddr[6]; // bulk-out endpoint address
2513 }INF_USB_CONFIG;
2518 // The miniport adapter structure
2520 typedef struct _RTMP_ADAPTER
2522 PVOID OS_Cookie; // save specific structure relative to OS
2523 PNET_DEV net_dev;
2524 ULONG VirtualIfCnt;
2526 #ifdef RT2860
2527 USHORT LnkCtrlBitMask;
2528 USHORT RLnkCtrlConfiguration;
2529 USHORT RLnkCtrlOffset;
2530 USHORT HostLnkCtrlConfiguration;
2531 USHORT HostLnkCtrlOffset;
2532 USHORT PCIePowerSaveLevel;
2533 BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace..
2534 ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count.
2535 USHORT ThisTbttNumToNextWakeUp;
2536 ULONG SameRxByteCount;
2539 /*****************************************************************************************/
2540 /* PCI related parameters */
2541 /*****************************************************************************************/
2542 PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use
2544 UINT int_enable_reg;
2545 UINT int_disable_mask;
2546 UINT int_pending;
2549 RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; // Shared memory of all 1st pre-allocated TxBuf associated with each TXD
2550 RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors
2551 RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors
2552 RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA
2553 #endif
2555 NDIS_SPIN_LOCK irq_lock;
2556 UCHAR irq_disabled;
2558 #ifdef RT2870
2559 /*****************************************************************************************/
2560 /* USB related parameters */
2561 /*****************************************************************************************/
2562 struct usb_config_descriptor *config;
2563 UINT BulkInEpAddr; // bulk-in endpoint address
2564 UINT BulkOutEpAddr[6]; // bulk-out endpoint address
2566 UINT NumberOfPipes;
2567 USHORT BulkOutMaxPacketSize;
2568 USHORT BulkInMaxPacketSize;
2570 //======Control Flags
2571 LONG PendingIoCount;
2572 ULONG BulkFlags;
2573 BOOLEAN bUsbTxBulkAggre; // Flags for bulk out data priority
2576 //======Timer Thread
2577 RT2870_TIMER_QUEUE TimerQ;
2578 NDIS_SPIN_LOCK TimerQLock;
2581 //======Cmd Thread
2582 CmdQ CmdQ;
2583 NDIS_SPIN_LOCK CmdQLock; // CmdQLock spinlock
2585 BOOLEAN TimerFunc_kill;
2586 BOOLEAN mlme_kill;
2589 //======Semaphores (event)
2590 struct semaphore mlme_semaphore; /* to sleep thread on */
2591 struct semaphore RTUSBCmd_semaphore; /* to sleep thread on */
2592 struct semaphore RTUSBTimer_semaphore;
2593 struct completion TimerQComplete;
2594 struct completion mlmeComplete;
2595 struct completion CmdQComplete;
2596 wait_queue_head_t *wait;
2597 #endif // RT2870 //
2600 /*****************************************************************************************/
2601 /* Both PCI/USB related parameters */
2602 /*****************************************************************************************/
2605 /*****************************************************************************************/
2606 /* Tx related parameters */
2607 /*****************************************************************************************/
2608 BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once
2609 NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING];
2611 #ifdef RT2870
2612 // Data related context and AC specified, 4 AC supported
2613 NDIS_SPIN_LOCK BulkOutLock[6]; // BulkOut spinlock for 4 ACs
2614 NDIS_SPIN_LOCK MLMEBulkOutLock; // MLME BulkOut lock
2616 HT_TX_CONTEXT TxContext[NUM_OF_TX_RING];
2617 NDIS_SPIN_LOCK TxContextQueueLock[NUM_OF_TX_RING]; // TxContextQueue spinlock
2619 // 4 sets of Bulk Out index and pending flag
2620 UCHAR NextBulkOutIndex[4]; // only used for 4 EDCA bulkout pipe
2622 BOOLEAN BulkOutPending[6]; // used for total 6 bulkout pipe
2623 UCHAR bulkResetPipeid;
2624 BOOLEAN MgmtBulkPending;
2625 ULONG bulkResetReq[6];
2626 #endif // RT2870 //
2628 // resource for software backlog queues
2629 QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA
2630 NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; // TxSwQueue spinlock
2632 RTMP_DMABUF MgmtDescRing; // Shared memory for MGMT descriptors
2633 RTMP_MGMT_RING MgmtRing;
2634 NDIS_SPIN_LOCK MgmtRingLock; // Prio Ring spinlock
2637 /*****************************************************************************************/
2638 /* Rx related parameters */
2639 /*****************************************************************************************/
2640 #ifdef RT2860
2641 RTMP_RX_RING RxRing;
2642 NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock
2643 #endif
2644 #ifdef RT2870
2645 RX_CONTEXT RxContext[RX_RING_SIZE]; // 1 for redundant multiple IRP bulk in.
2646 NDIS_SPIN_LOCK BulkInLock; // BulkIn spinlock for 4 ACs
2647 UCHAR PendingRx; // The Maxima pending Rx value should be RX_RING_SIZE.
2648 UCHAR NextRxBulkInIndex; // Indicate the current RxContext Index which hold by Host controller.
2649 UCHAR NextRxBulkInReadIndex; // Indicate the current RxContext Index which driver can read & process it.
2650 ULONG NextRxBulkInPosition; // Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength.
2651 ULONG TransferBufferLength; // current length of the packet buffer
2652 ULONG ReadPosition; // current read position in a packet buffer
2653 #endif // RT2870 //
2656 /*****************************************************************************************/
2657 /* ASIC related parameters */
2658 /*****************************************************************************************/
2659 UINT32 MACVersion; // MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101)..
2661 // ---------------------------
2662 // E2PROM
2663 // ---------------------------
2664 ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused
2665 UCHAR EEPROMAddressNum; // 93c46=6 93c66=8
2666 USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS];
2667 #ifdef RT2870
2668 BOOLEAN EepromAccess;
2669 #endif
2670 ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused.
2672 // ---------------------------
2673 // BBP Control
2674 // ---------------------------
2675 UCHAR BbpWriteLatch[140]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID
2676 UCHAR BbpRssiToDbmDelta;
2677 BBP_R66_TUNING BbpTuning;
2679 // ----------------------------
2680 // RFIC control
2681 // ----------------------------
2682 UCHAR RfIcType; // RFIC_xxx
2683 ULONG RfFreqOffset; // Frequency offset for channel switching
2684 RTMP_RF_REGS LatchRfRegs; // latch th latest RF programming value since RF IC doesn't support READ
2686 EEPROM_ANTENNA_STRUC Antenna; // Since ANtenna definition is different for a & g. We need to save it for future reference.
2687 EEPROM_NIC_CONFIG2_STRUC NicConfig2;
2689 // This soft Rx Antenna Diversity mechanism is used only when user set
2690 // RX Antenna = DIVERSITY ON
2691 SOFT_RX_ANT_DIVERSITY RxAnt;
2693 UCHAR RFProgSeq;
2694 CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; // Store Tx power value for all channels.
2695 CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; // list all supported channels for site survey
2696 CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; // 802.11j channel and bw
2697 CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; // list all supported channels for site survey
2699 UCHAR ChannelListNum; // number of channel in ChannelList[]
2700 UCHAR Bbp94;
2701 BOOLEAN BbpForCCK;
2702 ULONG Tx20MPwrCfgABand[5];
2703 ULONG Tx20MPwrCfgGBand[5];
2704 ULONG Tx40MPwrCfgABand[5];
2705 ULONG Tx40MPwrCfgGBand[5];
2707 BOOLEAN bAutoTxAgcA; // Enable driver auto Tx Agc control
2708 UCHAR TssiRefA; // Store Tssi reference value as 25 temperature.
2709 UCHAR TssiPlusBoundaryA[5]; // Tssi boundary for increase Tx power to compensate.
2710 UCHAR TssiMinusBoundaryA[5]; // Tssi boundary for decrease Tx power to compensate.
2711 UCHAR TxAgcStepA; // Store Tx TSSI delta increment / decrement value
2712 CHAR TxAgcCompensateA; // Store the compensation (TxAgcStep * (idx-1))
2714 BOOLEAN bAutoTxAgcG; // Enable driver auto Tx Agc control
2715 UCHAR TssiRefG; // Store Tssi reference value as 25 temperature.
2716 UCHAR TssiPlusBoundaryG[5]; // Tssi boundary for increase Tx power to compensate.
2717 UCHAR TssiMinusBoundaryG[5]; // Tssi boundary for decrease Tx power to compensate.
2718 UCHAR TxAgcStepG; // Store Tx TSSI delta increment / decrement value
2719 CHAR TxAgcCompensateG; // Store the compensation (TxAgcStep * (idx-1))
2721 //+++For RT2870, the parameteres is start from BGRssiOffset1 ~ BGRssiOffset3
2722 CHAR BGRssiOffset0; // Store B/G RSSI#0 Offset value on EEPROM 0x46h
2723 CHAR BGRssiOffset1; // Store B/G RSSI#1 Offset value
2724 CHAR BGRssiOffset2; // Store B/G RSSI#2 Offset value
2725 //---
2727 //+++For RT2870, the parameteres is start from ARssiOffset1 ~ ARssiOffset3
2728 CHAR ARssiOffset0; // Store A RSSI#0 Offset value on EEPROM 0x4Ah
2729 CHAR ARssiOffset1; // Store A RSSI#1 Offset value
2730 CHAR ARssiOffset2; // Store A RSSI#2 Offset value
2731 //---
2733 CHAR BLNAGain; // Store B/G external LNA#0 value on EEPROM 0x44h
2734 CHAR ALNAGain0; // Store A external LNA#0 value for ch36~64
2735 CHAR ALNAGain1; // Store A external LNA#1 value for ch100~128
2736 CHAR ALNAGain2; // Store A external LNA#2 value for ch132~165
2738 // ----------------------------
2739 // LED control
2740 // ----------------------------
2741 MCU_LEDCS_STRUC LedCntl;
2742 USHORT Led1; // read from EEPROM 0x3c
2743 USHORT Led2; // EEPROM 0x3e
2744 USHORT Led3; // EEPROM 0x40
2745 UCHAR LedIndicatorStregth;
2746 UCHAR RssiSingalstrengthOffet;
2747 BOOLEAN bLedOnScanning;
2748 UCHAR LedStatus;
2750 /*****************************************************************************************/
2751 /* 802.11 related parameters */
2752 /*****************************************************************************************/
2753 // outgoing BEACON frame buffer and corresponding TXD
2754 TXWI_STRUC BeaconTxWI;
2755 PUCHAR BeaconBuf;
2756 USHORT BeaconOffset[HW_BEACON_MAX_COUNT];
2758 // pre-build PS-POLL and NULL frame upon link up. for efficiency purpose.
2759 PSPOLL_FRAME PsPollFrame;
2760 HEADER_802_11 NullFrame;
2762 #ifdef RT2870
2763 TX_CONTEXT BeaconContext[BEACON_RING_SIZE];
2764 TX_CONTEXT NullContext;
2765 TX_CONTEXT PsPollContext;
2766 TX_CONTEXT RTSContext;
2767 #endif // RT2870 //
2771 //=========AP===========
2774 //=======STA===========
2775 /* Modified by Wu Xi-Kun 4/21/2006 */
2776 // -----------------------------------------------
2777 // STA specific configuration & operation status
2778 // used only when pAd->OpMode == OPMODE_STA
2779 // -----------------------------------------------
2780 STA_ADMIN_CONFIG StaCfg; // user desired settings
2781 STA_ACTIVE_CONFIG StaActive; // valid only when ADHOC_ON(pAd) || INFRA_ON(pAd)
2782 CHAR nickname[IW_ESSID_MAX_SIZE+1]; // nickname, only used in the iwconfig i/f
2783 NDIS_MEDIA_STATE PreMediaState;
2785 //=======Common===========
2786 // OP mode: either AP or STA
2787 UCHAR OpMode; // OPMODE_STA, OPMODE_AP
2789 NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected
2792 // configuration: read from Registry & E2PROM
2793 BOOLEAN bLocalAdminMAC; // Use user changed MAC
2794 UCHAR PermanentAddress[MAC_ADDR_LEN]; // Factory default MAC address
2795 UCHAR CurrentAddress[MAC_ADDR_LEN]; // User changed MAC address
2797 // ------------------------------------------------------
2798 // common configuration to both OPMODE_STA and OPMODE_AP
2799 // ------------------------------------------------------
2800 COMMON_CONFIG CommonCfg;
2801 MLME_STRUCT Mlme;
2803 // AP needs those vaiables for site survey feature.
2804 MLME_AUX MlmeAux; // temporary settings used during MLME state machine
2805 BSS_TABLE ScanTab; // store the latest SCAN result
2807 //About MacTab, the sta driver will use #0 and #1 for multicast and AP.
2808 MAC_TABLE MacTab; // ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table.
2809 NDIS_SPIN_LOCK MacTabLock;
2811 BA_TABLE BATable;
2813 NDIS_SPIN_LOCK BATabLock;
2814 RALINK_TIMER_STRUCT RECBATimer;
2816 // encryption/decryption KEY tables
2817 CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; // STA always use SharedKey[BSS0][0..3]
2819 // RX re-assembly buffer for fragmentation
2820 FRAGMENT_FRAME FragFrame; // Frame storage for fragment frame
2822 // various Counters
2823 COUNTER_802_3 Counters8023; // 802.3 counters
2824 COUNTER_802_11 WlanCounters; // 802.11 MIB counters
2825 COUNTER_RALINK RalinkCounters; // Ralink propriety counters
2826 COUNTER_DRS DrsCounters; // counters for Dynamic TX Rate Switching
2827 PRIVATE_STRUC PrivateInfo; // Private information & counters
2829 // flags, see fRTMP_ADAPTER_xxx flags
2830 ULONG Flags; // Represent current device status
2831 #ifdef RT2860
2832 ULONG PSFlags; // Power Save operation flag.
2833 #endif
2835 // current TX sequence #
2836 USHORT Sequence;
2838 // Control disconnect / connect event generation
2839 //+++Didn't used anymore
2840 ULONG LinkDownTime;
2841 //---
2842 ULONG LastRxRate;
2843 ULONG LastTxRate;
2844 //+++Used only for Station
2845 BOOLEAN bConfigChanged; // Config Change flag for the same SSID setting
2846 //---
2848 ULONG ExtraInfo; // Extra information for displaying status
2849 ULONG SystemErrorBitmap; // b0: E2PROM version error
2851 //+++Didn't used anymore
2852 ULONG MacIcVersion; // MAC/BBP serial interface issue solved after ver.D
2853 //---
2855 // ---------------------------
2856 // System event log
2857 // ---------------------------
2858 RT_802_11_EVENT_TABLE EventTab;
2861 BOOLEAN HTCEnable;
2863 /*****************************************************************************************/
2864 /* Statistic related parameters */
2865 /*****************************************************************************************/
2866 #ifdef RT2870
2867 ULONG BulkOutDataOneSecCount;
2868 ULONG BulkInDataOneSecCount;
2869 ULONG BulkLastOneSecCount; // BulkOutDataOneSecCount + BulkInDataOneSecCount
2870 ULONG watchDogRxCnt;
2871 ULONG watchDogRxOverFlowCnt;
2872 ULONG watchDogTxPendingCnt[NUM_OF_TX_RING];
2873 #endif // RT2870 //
2875 BOOLEAN bUpdateBcnCntDone;
2876 ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition
2877 // ----------------------------
2878 // DEBUG paramerts
2879 // ----------------------------
2880 BOOLEAN bBanAllBaSetup;
2881 BOOLEAN bPromiscuous;
2883 // ----------------------------
2884 // rt2860c emulation-use Parameters
2885 // ----------------------------
2886 ULONG rtsaccu[30];
2887 ULONG ctsaccu[30];
2888 ULONG cfendaccu[30];
2889 ULONG bacontent[16];
2890 ULONG rxint[RX_RING_SIZE+1];
2891 UCHAR rcvba[60];
2892 BOOLEAN bLinkAdapt;
2893 BOOLEAN bForcePrintTX;
2894 BOOLEAN bForcePrintRX;
2895 BOOLEAN bDisablescanning; //defined in RT2870 USB
2896 BOOLEAN bStaFifoTest;
2897 BOOLEAN bProtectionTest;
2898 BOOLEAN bHCCATest;
2899 BOOLEAN bGenOneHCCA;
2900 BOOLEAN bBroadComHT;
2901 //+++Following add from RT2870 USB.
2902 ULONG BulkOutReq;
2903 ULONG BulkOutComplete;
2904 ULONG BulkOutCompleteOther;
2905 ULONG BulkOutCompleteCancel; // seems not use now?
2906 ULONG BulkInReq;
2907 ULONG BulkInComplete;
2908 ULONG BulkInCompleteFail;
2909 //---
2911 struct wificonf WIFItestbed;
2913 struct reordering_mpdu_pool mpdu_blk_pool;
2915 ULONG OneSecondnonBEpackets; // record non BE packets per second
2917 struct iw_statistics iw_stats;
2919 struct net_device_stats stats;
2921 ULONG TbttTickCount;
2922 #ifdef PCI_MSI_SUPPORT
2923 BOOLEAN HaveMsi;
2924 #endif // PCI_MSI_SUPPORT //
2927 UCHAR is_on;
2929 #define TIME_BASE (1000000/OS_HZ)
2930 #define TIME_ONE_SECOND (1000000/TIME_BASE)
2931 UCHAR flg_be_adjust;
2932 ULONG be_adjust_last_time;
2936 UINT8 PM_FlgSuspend;
2938 #ifdef RT2870
2939 BOOLEAN bUseEfuse;
2940 #endif
2941 } RTMP_ADAPTER, *PRTMP_ADAPTER;
2944 // Cisco IAPP format
2946 typedef struct _CISCO_IAPP_CONTENT_
2948 USHORT Length; //IAPP Length
2949 UCHAR MessageType; //IAPP type
2950 UCHAR FunctionCode; //IAPP function type
2951 UCHAR DestinaionMAC[MAC_ADDR_LEN];
2952 UCHAR SourceMAC[MAC_ADDR_LEN];
2953 USHORT Tag; //Tag(element IE) - Adjacent AP report
2954 USHORT TagLength; //Length of element not including 4 byte header
2955 UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00
2956 UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point
2957 USHORT Channel;
2958 USHORT SsidLen;
2959 UCHAR Ssid[MAX_LEN_OF_SSID];
2960 USHORT Seconds; //Seconds that the client has been disassociated.
2961 } CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT;
2963 #define DELAYINTMASK 0x0003fffb
2964 #define INTMASK 0x0003fffb
2965 #define IndMask 0x0003fffc
2966 #define RxINT 0x00000005 // Delayed Rx or indivi rx
2967 #define TxDataInt 0x000000fa // Delayed Tx or indivi tx
2968 #define TxMgmtInt 0x00000102 // Delayed Tx or indivi tx
2969 #define TxCoherent 0x00020000 // tx coherent
2970 #define RxCoherent 0x00010000 // rx coherent
2971 #define McuCommand 0x00000200 // mcu
2972 #define PreTBTTInt 0x00001000 // Pre-TBTT interrupt
2973 #define TBTTInt 0x00000800 // TBTT interrupt
2974 #define GPTimeOutInt 0x00008000 // GPtimeout interrupt
2975 #define AutoWakeupInt 0x00004000 // AutoWakeupInt interrupt
2976 #define FifoStaFullInt 0x00002000 // fifo statistics full interrupt
2979 typedef struct _RX_BLK_
2981 RT28XX_RXD_STRUC RxD;
2982 PRXWI_STRUC pRxWI;
2983 PHEADER_802_11 pHeader;
2984 PNDIS_PACKET pRxPacket;
2985 UCHAR *pData;
2986 USHORT DataSize;
2987 USHORT Flags;
2988 UCHAR UserPriority; // for calculate TKIP MIC using
2989 } RX_BLK;
2992 #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag)
2993 #define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag)
2994 #define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag))
2997 #define fRX_WDS 0x0001
2998 #define fRX_AMSDU 0x0002
2999 #define fRX_ARALINK 0x0004
3000 #define fRX_HTC 0x0008
3001 #define fRX_PAD 0x0010
3002 #define fRX_AMPDU 0x0020
3003 #define fRX_QOS 0x0040
3004 #define fRX_INFRA 0x0080
3005 #define fRX_EAP 0x0100
3006 #define fRX_MESH 0x0200
3007 #define fRX_APCLI 0x0400
3008 #define fRX_DLS 0x0800
3009 #define fRX_WPI 0x1000
3011 #define LENGTH_AMSDU_SUBFRAMEHEAD 14
3012 #define LENGTH_ARALINK_SUBFRAMEHEAD 14
3013 #define LENGTH_ARALINK_HEADER_FIELD 2
3015 #define TX_UNKOWN_FRAME 0x00
3016 #define TX_MCAST_FRAME 0x01
3017 #define TX_LEGACY_FRAME 0x02
3018 #define TX_AMPDU_FRAME 0x04
3019 #define TX_AMSDU_FRAME 0x08
3020 #define TX_RALINK_FRAME 0x10
3021 #define TX_FRAG_FRAME 0x20
3024 // Currently the sizeof(TX_BLK) is 148 bytes.
3025 typedef struct _TX_BLK_
3027 UCHAR QueIdx;
3028 UCHAR TxFrameType; // Indicate the Transmission type of the all frames in one batch
3029 UCHAR TotalFrameNum; // Total frame number want to send-out in one batch
3030 USHORT TotalFragNum; // Total frame fragments required in one batch
3031 USHORT TotalFrameLen; // Total length of all frames want to send-out in one batch
3033 QUEUE_HEADER TxPacketList;
3034 MAC_TABLE_ENTRY *pMacEntry; // NULL: packet with 802.11 RA field is multicast/broadcast address
3035 HTTRANSMIT_SETTING *pTransmit;
3037 // Following structure used for the characteristics of a specific packet.
3038 PNDIS_PACKET pPacket;
3039 PUCHAR pSrcBufHeader; // Reference to the head of sk_buff->data
3040 PUCHAR pSrcBufData; // Reference to the sk_buff->data, will changed depends on hanlding progresss
3041 UINT SrcBufLen; // Length of packet payload which not including Layer 2 header
3042 PUCHAR pExtraLlcSnapEncap; // NULL means no extra LLC/SNAP is required
3043 UCHAR HeaderBuf[80]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP
3044 UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding
3045 UCHAR HdrPadLen; // recording Header Padding Length;
3046 UCHAR apidx; // The interface associated to this packet
3047 UCHAR Wcid; // The MAC entry associated to this packet
3048 UCHAR UserPriority; // priority class of packet
3049 UCHAR FrameGap; // what kind of IFS this packet use
3050 UCHAR MpduReqNum; // number of fragments of this frame
3051 UCHAR TxRate; // TODO: Obsoleted? Should change to MCS?
3052 UCHAR CipherAlg; // cipher alogrithm
3053 PCIPHER_KEY pKey;
3057 USHORT Flags; //See following definitions for detail.
3059 //YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer.
3060 ULONG Priv; // Hardware specific value saved in here.
3061 } TX_BLK, *PTX_BLK;
3064 #define fTX_bRtsRequired 0x0001 // Indicate if need send RTS frame for protection. Not used in RT2860/RT2870.
3065 #define fTX_bAckRequired 0x0002 // the packet need ack response
3066 #define fTX_bPiggyBack 0x0004 // Legacy device use Piggback or not
3067 #define fTX_bHTRate 0x0008 // allow to use HT rate
3068 #define fTX_bForceNonQoS 0x0010 // force to transmit frame without WMM-QoS in HT mode
3069 #define fTX_bAllowFrag 0x0020 // allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment
3070 #define fTX_bMoreData 0x0040 // there are more data packets in PowerSave Queue
3071 #define fTX_bWMM 0x0080 // QOS Data
3073 #define fTX_bClearEAPFrame 0x0100
3075 #define TX_BLK_ASSIGN_FLAG(_pTxBlk, _flag, value) \
3076 do { \
3077 if (value) \
3078 (_pTxBlk->Flags |= _flag) \
3079 else \
3080 (_pTxBlk->Flags &= ~(_flag)) \
3081 }while(0)
3083 #define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag)
3084 #define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0)
3085 #define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag))
3091 //------------------------------------------------------------------------------------------
3093 #ifdef RT2860
3095 // Enable & Disable NIC interrupt via writing interrupt mask register
3096 // Since it use ADAPTER structure, it have to be put after structure definition.
3098 __inline VOID NICDisableInterrupt(
3099 IN PRTMP_ADAPTER pAd)
3101 RTMP_IO_WRITE32(pAd, INT_MASK_CSR, 0x0); // 0: disable
3102 //RTMP_IO_WRITE32(pAd, PBF_INT_ENA, 0x0); // 0x418 is for firmware . SW doesn't handle here.
3103 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
3106 __inline VOID NICEnableInterrupt(
3107 IN PRTMP_ADAPTER pAd)
3110 // Flag "fOP_STATUS_DOZE" On, means ASIC put to sleep, else means ASIC WakeUp
3111 // To prevent System hang, we should enalbe the interrupt when
3112 // ASIC is already Wake Up.
3114 // RT2661 => when ASIC is sleeping, MAC register cannot be read and written.
3115 // RT2860 => when ASIC is sleeping, MAC register can be read and written.
3116 //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
3118 RTMP_IO_WRITE32(pAd, INT_MASK_CSR, pAd->int_enable_reg /*DELAYINTMASK*/); // 1:enable
3120 //else
3121 // DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n"));
3123 //RTMP_IO_WRITE32(pAd, PBF_INT_ENA, 0x00000030); // 1 : enable
3124 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
3127 static inline VOID ConvertMulticastIP2MAC(
3128 IN PUCHAR pIpAddr,
3129 IN PUCHAR *ppMacAddr,
3130 IN UINT16 ProtoType)
3132 if (pIpAddr == NULL)
3133 return;
3135 if (ppMacAddr == NULL || *ppMacAddr == NULL)
3136 return;
3138 switch (ProtoType)
3140 case ETH_P_IPV6:
3141 // memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS);
3142 *(*ppMacAddr) = 0x33;
3143 *(*ppMacAddr + 1) = 0x33;
3144 *(*ppMacAddr + 2) = pIpAddr[12];
3145 *(*ppMacAddr + 3) = pIpAddr[13];
3146 *(*ppMacAddr + 4) = pIpAddr[14];
3147 *(*ppMacAddr + 5) = pIpAddr[15];
3148 break;
3150 case ETH_P_IP:
3151 default:
3152 // memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS);
3153 *(*ppMacAddr) = 0x01;
3154 *(*ppMacAddr + 1) = 0x00;
3155 *(*ppMacAddr + 2) = 0x5e;
3156 *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f;
3157 *(*ppMacAddr + 4) = pIpAddr[2];
3158 *(*ppMacAddr + 5) = pIpAddr[3];
3159 break;
3162 return;
3164 #endif /* RT2860 */
3167 // Private routines in rtmp_init.c
3169 NDIS_STATUS RTMPAllocAdapterBlock(
3170 IN PVOID handle,
3171 OUT PRTMP_ADAPTER *ppAdapter
3174 NDIS_STATUS RTMPAllocTxRxRingMemory(
3175 IN PRTMP_ADAPTER pAd
3178 NDIS_STATUS RTMPReadParametersHook(
3179 IN PRTMP_ADAPTER pAd
3182 VOID RTMPFreeAdapter(
3183 IN PRTMP_ADAPTER pAd
3186 NDIS_STATUS NICReadRegParameters(
3187 IN PRTMP_ADAPTER pAd,
3188 IN NDIS_HANDLE WrapperConfigurationContext
3191 #ifdef RT2870
3192 VOID NICInitRT30xxRFRegisters(
3193 IN PRTMP_ADAPTER pAd);
3194 #endif // RT2870 //
3196 VOID NICReadEEPROMParameters(
3197 IN PRTMP_ADAPTER pAd,
3198 IN PUCHAR mac_addr);
3200 VOID NICInitAsicFromEEPROM(
3201 IN PRTMP_ADAPTER pAd);
3203 VOID NICInitTxRxRingAndBacklogQueue(
3204 IN PRTMP_ADAPTER pAd);
3206 NDIS_STATUS NICInitializeAdapter(
3207 IN PRTMP_ADAPTER pAd,
3208 IN BOOLEAN bHardReset);
3210 NDIS_STATUS NICInitializeAsic(
3211 IN PRTMP_ADAPTER pAd,
3212 IN BOOLEAN bHardReset);
3213 #ifdef RT2860
3214 VOID NICRestoreBBPValue(
3215 IN PRTMP_ADAPTER pAd);
3216 #endif
3217 VOID NICIssueReset(
3218 IN PRTMP_ADAPTER pAd);
3220 VOID RTMPRingCleanUp(
3221 IN PRTMP_ADAPTER pAd,
3222 IN UCHAR RingType);
3224 VOID UserCfgInit(
3225 IN PRTMP_ADAPTER pAd);
3227 VOID NICResetFromError(
3228 IN PRTMP_ADAPTER pAd);
3230 VOID NICEraseFirmware(
3231 IN PRTMP_ADAPTER pAd);
3233 NDIS_STATUS NICLoadFirmware(
3234 IN PRTMP_ADAPTER pAd);
3236 NDIS_STATUS NICLoadRateSwitchingParams(
3237 IN PRTMP_ADAPTER pAd);
3239 BOOLEAN NICCheckForHang(
3240 IN PRTMP_ADAPTER pAd);
3242 VOID NICUpdateFifoStaCounters(
3243 IN PRTMP_ADAPTER pAd);
3245 VOID NICUpdateRawCounters(
3246 IN PRTMP_ADAPTER pAd);
3248 ULONG RTMPNotAllZero(
3249 IN PVOID pSrc1,
3250 IN ULONG Length);
3252 VOID RTMPZeroMemory(
3253 IN PVOID pSrc,
3254 IN ULONG Length);
3256 ULONG RTMPCompareMemory(
3257 IN PVOID pSrc1,
3258 IN PVOID pSrc2,
3259 IN ULONG Length);
3261 VOID RTMPMoveMemory(
3262 OUT PVOID pDest,
3263 IN PVOID pSrc,
3264 IN ULONG Length);
3266 VOID AtoH(
3267 char *src,
3268 UCHAR *dest,
3269 int destlen);
3271 UCHAR BtoH(
3272 char ch);
3274 VOID RTMPPatchMacBbpBug(
3275 IN PRTMP_ADAPTER pAd);
3277 VOID RTMPInitTimer(
3278 IN PRTMP_ADAPTER pAd,
3279 IN PRALINK_TIMER_STRUCT pTimer,
3280 IN PVOID pTimerFunc,
3281 IN PVOID pData,
3282 IN BOOLEAN Repeat);
3284 VOID RTMPSetTimer(
3285 IN PRALINK_TIMER_STRUCT pTimer,
3286 IN ULONG Value);
3289 VOID RTMPModTimer(
3290 IN PRALINK_TIMER_STRUCT pTimer,
3291 IN ULONG Value);
3293 VOID RTMPCancelTimer(
3294 IN PRALINK_TIMER_STRUCT pTimer,
3295 OUT BOOLEAN *pCancelled);
3297 VOID RTMPSetLED(
3298 IN PRTMP_ADAPTER pAd,
3299 IN UCHAR Status);
3301 VOID RTMPSetSignalLED(
3302 IN PRTMP_ADAPTER pAd,
3303 IN NDIS_802_11_RSSI Dbm);
3305 VOID RTMPEnableRxTx(
3306 IN PRTMP_ADAPTER pAd);
3309 // prototype in action.c
3311 VOID ActionStateMachineInit(
3312 IN PRTMP_ADAPTER pAd,
3313 IN STATE_MACHINE *S,
3314 OUT STATE_MACHINE_FUNC Trans[]);
3316 VOID MlmeADDBAAction(
3317 IN PRTMP_ADAPTER pAd,
3318 IN MLME_QUEUE_ELEM *Elem);
3320 VOID MlmeDELBAAction(
3321 IN PRTMP_ADAPTER pAd,
3322 IN MLME_QUEUE_ELEM *Elem);
3324 VOID MlmeDLSAction(
3325 IN PRTMP_ADAPTER pAd,
3326 IN MLME_QUEUE_ELEM *Elem);
3328 VOID MlmeInvalidAction(
3329 IN PRTMP_ADAPTER pAd,
3330 IN MLME_QUEUE_ELEM *Elem);
3332 VOID MlmeQOSAction(
3333 IN PRTMP_ADAPTER pAd,
3334 IN MLME_QUEUE_ELEM *Elem);
3336 VOID PeerAddBAReqAction(
3337 IN PRTMP_ADAPTER pAd,
3338 IN MLME_QUEUE_ELEM *Elem);
3340 VOID PeerAddBARspAction(
3341 IN PRTMP_ADAPTER pAd,
3342 IN MLME_QUEUE_ELEM *Elem);
3344 VOID PeerDelBAAction(
3345 IN PRTMP_ADAPTER pAd,
3346 IN MLME_QUEUE_ELEM *Elem);
3348 VOID PeerBAAction(
3349 IN PRTMP_ADAPTER pAd,
3350 IN MLME_QUEUE_ELEM *Elem);
3352 VOID SendPSMPAction(
3353 IN PRTMP_ADAPTER pAd,
3354 IN UCHAR Wcid,
3355 IN UCHAR Psmp);
3357 VOID PeerRMAction(
3358 IN PRTMP_ADAPTER pAd,
3359 IN MLME_QUEUE_ELEM *Elem);
3361 VOID PeerPublicAction(
3362 IN PRTMP_ADAPTER pAd,
3363 IN MLME_QUEUE_ELEM *Elem);
3365 VOID PeerHTAction(
3366 IN PRTMP_ADAPTER pAd,
3367 IN MLME_QUEUE_ELEM *Elem);
3369 VOID PeerQOSAction(
3370 IN PRTMP_ADAPTER pAd,
3371 IN MLME_QUEUE_ELEM *Elem);
3373 VOID RECBATimerTimeout(
3374 IN PVOID SystemSpecific1,
3375 IN PVOID FunctionContext,
3376 IN PVOID SystemSpecific2,
3377 IN PVOID SystemSpecific3);
3379 VOID ORIBATimerTimeout(
3380 IN PRTMP_ADAPTER pAd);
3382 VOID SendRefreshBAR(
3383 IN PRTMP_ADAPTER pAd,
3384 IN MAC_TABLE_ENTRY *pEntry);
3386 VOID ActHeaderInit(
3387 IN PRTMP_ADAPTER pAd,
3388 IN OUT PHEADER_802_11 pHdr80211,
3389 IN PUCHAR Addr1,
3390 IN PUCHAR Addr2,
3391 IN PUCHAR Addr3);
3393 VOID BarHeaderInit(
3394 IN PRTMP_ADAPTER pAd,
3395 IN OUT PFRAME_BAR pCntlBar,
3396 IN PUCHAR pDA,
3397 IN PUCHAR pSA);
3399 VOID InsertActField(
3400 IN PRTMP_ADAPTER pAd,
3401 OUT PUCHAR pFrameBuf,
3402 OUT PULONG pFrameLen,
3403 IN UINT8 Category,
3404 IN UINT8 ActCode);
3406 BOOLEAN CntlEnqueueForRecv(
3407 IN PRTMP_ADAPTER pAd,
3408 IN ULONG Wcid,
3409 IN ULONG MsgLen,
3410 IN PFRAME_BA_REQ pMsg);
3413 // Private routines in rtmp_data.c
3415 BOOLEAN RTMPHandleRxDoneInterrupt(
3416 IN PRTMP_ADAPTER pAd);
3418 BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(
3419 IN PRTMP_ADAPTER pAd,
3420 IN INT_SOURCE_CSR_STRUC TxRingBitmap);
3422 VOID RTMPHandleMgmtRingDmaDoneInterrupt(
3423 IN PRTMP_ADAPTER pAd);
3425 VOID RTMPHandleTBTTInterrupt(
3426 IN PRTMP_ADAPTER pAd);
3428 VOID RTMPHandlePreTBTTInterrupt(
3429 IN PRTMP_ADAPTER pAd);
3431 void RTMPHandleTwakeupInterrupt(
3432 IN PRTMP_ADAPTER pAd);
3434 VOID RTMPHandleRxCoherentInterrupt(
3435 IN PRTMP_ADAPTER pAd);
3437 BOOLEAN TxFrameIsAggregatible(
3438 IN PRTMP_ADAPTER pAd,
3439 IN PUCHAR pPrevAddr1,
3440 IN PUCHAR p8023hdr);
3442 BOOLEAN PeerIsAggreOn(
3443 IN PRTMP_ADAPTER pAd,
3444 IN ULONG TxRate,
3445 IN PMAC_TABLE_ENTRY pMacEntry);
3447 NDIS_STATUS Sniff2BytesFromNdisBuffer(
3448 IN PNDIS_BUFFER pFirstBuffer,
3449 IN UCHAR DesiredOffset,
3450 OUT PUCHAR pByte0,
3451 OUT PUCHAR pByte1);
3453 NDIS_STATUS STASendPacket(
3454 IN PRTMP_ADAPTER pAd,
3455 IN PNDIS_PACKET pPacket);
3457 VOID STASendPackets(
3458 IN NDIS_HANDLE MiniportAdapterContext,
3459 IN PPNDIS_PACKET ppPacketArray,
3460 IN UINT NumberOfPackets);
3462 VOID RTMPDeQueuePacket(
3463 IN PRTMP_ADAPTER pAd,
3464 IN BOOLEAN bIntContext,
3465 IN UCHAR QueIdx,
3466 IN UCHAR Max_Tx_Packets);
3468 NDIS_STATUS RTMPHardTransmit(
3469 IN PRTMP_ADAPTER pAd,
3470 IN PNDIS_PACKET pPacket,
3471 IN UCHAR QueIdx,
3472 OUT PULONG pFreeTXDLeft);
3474 NDIS_STATUS STAHardTransmit(
3475 IN PRTMP_ADAPTER pAd,
3476 IN TX_BLK *pTxBlk,
3477 IN UCHAR QueIdx);
3479 VOID STARxEAPOLFrameIndicate(
3480 IN PRTMP_ADAPTER pAd,
3481 IN MAC_TABLE_ENTRY *pEntry,
3482 IN RX_BLK *pRxBlk,
3483 IN UCHAR FromWhichBSSID);
3485 NDIS_STATUS RTMPFreeTXDRequest(
3486 IN PRTMP_ADAPTER pAd,
3487 IN UCHAR RingType,
3488 IN UCHAR NumberRequired,
3489 IN PUCHAR FreeNumberIs);
3491 NDIS_STATUS MlmeHardTransmit(
3492 IN PRTMP_ADAPTER pAd,
3493 IN UCHAR QueIdx,
3494 IN PNDIS_PACKET pPacket);
3496 NDIS_STATUS MlmeHardTransmitMgmtRing(
3497 IN PRTMP_ADAPTER pAd,
3498 IN UCHAR QueIdx,
3499 IN PNDIS_PACKET pPacket);
3501 NDIS_STATUS MlmeHardTransmitTxRing(
3502 IN PRTMP_ADAPTER pAd,
3503 IN UCHAR QueIdx,
3504 IN PNDIS_PACKET pPacket);
3506 USHORT RTMPCalcDuration(
3507 IN PRTMP_ADAPTER pAd,
3508 IN UCHAR Rate,
3509 IN ULONG Size);
3511 VOID RTMPWriteTxWI(
3512 IN PRTMP_ADAPTER pAd,
3513 IN PTXWI_STRUC pTxWI,
3514 IN BOOLEAN FRAG,
3515 IN BOOLEAN CFACK,
3516 IN BOOLEAN InsTimestamp,
3517 IN BOOLEAN AMPDU,
3518 IN BOOLEAN Ack,
3519 IN BOOLEAN NSeq, // HW new a sequence.
3520 IN UCHAR BASize,
3521 IN UCHAR WCID,
3522 IN ULONG Length,
3523 IN UCHAR PID,
3524 IN UCHAR TID,
3525 IN UCHAR TxRate,
3526 IN UCHAR Txopmode,
3527 IN BOOLEAN CfAck,
3528 IN HTTRANSMIT_SETTING *pTransmit);
3531 VOID RTMPWriteTxWI_Data(
3532 IN PRTMP_ADAPTER pAd,
3533 IN OUT PTXWI_STRUC pTxWI,
3534 IN TX_BLK *pTxBlk);
3537 VOID RTMPWriteTxWI_Cache(
3538 IN PRTMP_ADAPTER pAd,
3539 IN OUT PTXWI_STRUC pTxWI,
3540 IN TX_BLK *pTxBlk);
3542 VOID RTMPWriteTxDescriptor(
3543 IN PRTMP_ADAPTER pAd,
3544 IN PTXD_STRUC pTxD,
3545 IN BOOLEAN bWIV,
3546 IN UCHAR QSEL);
3548 VOID RTMPSuspendMsduTransmission(
3549 IN PRTMP_ADAPTER pAd);
3551 VOID RTMPResumeMsduTransmission(
3552 IN PRTMP_ADAPTER pAd);
3554 NDIS_STATUS MiniportMMRequest(
3555 IN PRTMP_ADAPTER pAd,
3556 IN UCHAR QueIdx,
3557 IN PUCHAR pData,
3558 IN UINT Length);
3560 VOID RTMPSendNullFrame(
3561 IN PRTMP_ADAPTER pAd,
3562 IN UCHAR TxRate,
3563 IN BOOLEAN bQosNull);
3565 VOID RTMPSendDisassociationFrame(
3566 IN PRTMP_ADAPTER pAd);
3568 VOID RTMPSendRTSFrame(
3569 IN PRTMP_ADAPTER pAd,
3570 IN PUCHAR pDA,
3571 IN unsigned int NextMpduSize,
3572 IN UCHAR TxRate,
3573 IN UCHAR RTSRate,
3574 IN USHORT AckDuration,
3575 IN UCHAR QueIdx,
3576 IN UCHAR FrameGap);
3578 PQUEUE_HEADER RTMPCheckTxSwQueue(
3579 IN PRTMP_ADAPTER pAd,
3580 OUT UCHAR *QueIdx);
3582 VOID RTMPReportMicError(
3583 IN PRTMP_ADAPTER pAd,
3584 IN PCIPHER_KEY pWpaKey);
3586 VOID WpaMicFailureReportFrame(
3587 IN PRTMP_ADAPTER pAd,
3588 IN MLME_QUEUE_ELEM *Elem);
3590 VOID WpaDisassocApAndBlockAssoc(
3591 IN PVOID SystemSpecific1,
3592 IN PVOID FunctionContext,
3593 IN PVOID SystemSpecific2,
3594 IN PVOID SystemSpecific3);
3596 NDIS_STATUS RTMPCloneNdisPacket(
3597 IN PRTMP_ADAPTER pAd,
3598 IN BOOLEAN pInsAMSDUHdr,
3599 IN PNDIS_PACKET pInPacket,
3600 OUT PNDIS_PACKET *ppOutPacket);
3602 NDIS_STATUS RTMPAllocateNdisPacket(
3603 IN PRTMP_ADAPTER pAd,
3604 IN PNDIS_PACKET *pPacket,
3605 IN PUCHAR pHeader,
3606 IN UINT HeaderLen,
3607 IN PUCHAR pData,
3608 IN UINT DataLen);
3610 VOID RTMPFreeNdisPacket(
3611 IN PRTMP_ADAPTER pAd,
3612 IN PNDIS_PACKET pPacket);
3614 BOOLEAN RTMPFreeTXDUponTxDmaDone(
3615 IN PRTMP_ADAPTER pAd,
3616 IN UCHAR QueIdx);
3618 BOOLEAN RTMPCheckDHCPFrame(
3619 IN PRTMP_ADAPTER pAd,
3620 IN PNDIS_PACKET pPacket);
3623 BOOLEAN RTMPCheckEtherType(
3624 IN PRTMP_ADAPTER pAd,
3625 IN PNDIS_PACKET pPacket);
3629 // Private routines in rtmp_wep.c
3631 VOID RTMPInitWepEngine(
3632 IN PRTMP_ADAPTER pAd,
3633 IN PUCHAR pKey,
3634 IN UCHAR KeyId,
3635 IN UCHAR KeyLen,
3636 IN PUCHAR pDest);
3638 VOID RTMPEncryptData(
3639 IN PRTMP_ADAPTER pAd,
3640 IN PUCHAR pSrc,
3641 IN PUCHAR pDest,
3642 IN UINT Len);
3644 BOOLEAN RTMPSoftDecryptWEP(
3645 IN PRTMP_ADAPTER pAd,
3646 IN PUCHAR pData,
3647 IN ULONG DataByteCnt,
3648 IN PCIPHER_KEY pGroupKey);
3650 VOID RTMPSetICV(
3651 IN PRTMP_ADAPTER pAd,
3652 IN PUCHAR pDest);
3654 VOID ARCFOUR_INIT(
3655 IN PARCFOURCONTEXT Ctx,
3656 IN PUCHAR pKey,
3657 IN UINT KeyLen);
3659 UCHAR ARCFOUR_BYTE(
3660 IN PARCFOURCONTEXT Ctx);
3662 VOID ARCFOUR_DECRYPT(
3663 IN PARCFOURCONTEXT Ctx,
3664 IN PUCHAR pDest,
3665 IN PUCHAR pSrc,
3666 IN UINT Len);
3668 VOID ARCFOUR_ENCRYPT(
3669 IN PARCFOURCONTEXT Ctx,
3670 IN PUCHAR pDest,
3671 IN PUCHAR pSrc,
3672 IN UINT Len);
3674 VOID WPAARCFOUR_ENCRYPT(
3675 IN PARCFOURCONTEXT Ctx,
3676 IN PUCHAR pDest,
3677 IN PUCHAR pSrc,
3678 IN UINT Len);
3680 UINT RTMP_CALC_FCS32(
3681 IN UINT Fcs,
3682 IN PUCHAR Cp,
3683 IN INT Len);
3686 // MLME routines
3689 // Asic/RF/BBP related functions
3691 VOID AsicAdjustTxPower(
3692 IN PRTMP_ADAPTER pAd);
3694 VOID AsicUpdateProtect(
3695 IN PRTMP_ADAPTER pAd,
3696 IN USHORT OperaionMode,
3697 IN UCHAR SetMask,
3698 IN BOOLEAN bDisableBGProtect,
3699 IN BOOLEAN bNonGFExist);
3701 VOID AsicSwitchChannel(
3702 IN PRTMP_ADAPTER pAd,
3703 IN UCHAR Channel,
3704 IN BOOLEAN bScan);
3706 VOID AsicLockChannel(
3707 IN PRTMP_ADAPTER pAd,
3708 IN UCHAR Channel) ;
3710 VOID AsicRfTuningExec(
3711 IN PVOID SystemSpecific1,
3712 IN PVOID FunctionContext,
3713 IN PVOID SystemSpecific2,
3714 IN PVOID SystemSpecific3);
3716 VOID AsicSleepThenAutoWakeup(
3717 IN PRTMP_ADAPTER pAd,
3718 IN USHORT TbttNumToNextWakeUp);
3720 VOID AsicForceSleep(
3721 IN PRTMP_ADAPTER pAd);
3723 VOID AsicForceWakeup(
3724 IN PRTMP_ADAPTER pAd,
3725 #ifdef RT2860
3726 IN UCHAR Level);
3727 #endif
3728 #ifdef RT2870
3729 IN BOOLEAN bFromTx);
3730 #endif
3732 VOID AsicSetBssid(
3733 IN PRTMP_ADAPTER pAd,
3734 IN PUCHAR pBssid);
3736 VOID AsicSetMcastWC(
3737 IN PRTMP_ADAPTER pAd);
3739 VOID AsicDelWcidTab(
3740 IN PRTMP_ADAPTER pAd,
3741 IN UCHAR Wcid);
3743 VOID AsicEnableRDG(
3744 IN PRTMP_ADAPTER pAd);
3746 VOID AsicDisableRDG(
3747 IN PRTMP_ADAPTER pAd);
3749 VOID AsicDisableSync(
3750 IN PRTMP_ADAPTER pAd);
3752 VOID AsicEnableBssSync(
3753 IN PRTMP_ADAPTER pAd);
3755 VOID AsicEnableIbssSync(
3756 IN PRTMP_ADAPTER pAd);
3758 VOID AsicSetEdcaParm(
3759 IN PRTMP_ADAPTER pAd,
3760 IN PEDCA_PARM pEdcaParm);
3762 VOID AsicSetSlotTime(
3763 IN PRTMP_ADAPTER pAd,
3764 IN BOOLEAN bUseShortSlotTime);
3766 VOID AsicAddSharedKeyEntry(
3767 IN PRTMP_ADAPTER pAd,
3768 IN UCHAR BssIndex,
3769 IN UCHAR KeyIdx,
3770 IN UCHAR CipherAlg,
3771 IN PUCHAR pKey,
3772 IN PUCHAR pTxMic,
3773 IN PUCHAR pRxMic);
3775 VOID AsicRemoveSharedKeyEntry(
3776 IN PRTMP_ADAPTER pAd,
3777 IN UCHAR BssIndex,
3778 IN UCHAR KeyIdx);
3780 VOID AsicUpdateWCIDAttribute(
3781 IN PRTMP_ADAPTER pAd,
3782 IN USHORT WCID,
3783 IN UCHAR BssIndex,
3784 IN UCHAR CipherAlg,
3785 IN BOOLEAN bUsePairewiseKeyTable);
3787 VOID AsicUpdateWCIDIVEIV(
3788 IN PRTMP_ADAPTER pAd,
3789 IN USHORT WCID,
3790 IN ULONG uIV,
3791 IN ULONG uEIV);
3793 VOID AsicUpdateRxWCIDTable(
3794 IN PRTMP_ADAPTER pAd,
3795 IN USHORT WCID,
3796 IN PUCHAR pAddr);
3798 VOID AsicAddKeyEntry(
3799 IN PRTMP_ADAPTER pAd,
3800 IN USHORT WCID,
3801 IN UCHAR BssIndex,
3802 IN UCHAR KeyIdx,
3803 IN PCIPHER_KEY pCipherKey,
3804 IN BOOLEAN bUsePairewiseKeyTable,
3805 IN BOOLEAN bTxKey);
3807 VOID AsicAddPairwiseKeyEntry(
3808 IN PRTMP_ADAPTER pAd,
3809 IN PUCHAR pAddr,
3810 IN UCHAR WCID,
3811 IN CIPHER_KEY *pCipherKey);
3813 VOID AsicRemovePairwiseKeyEntry(
3814 IN PRTMP_ADAPTER pAd,
3815 IN UCHAR BssIdx,
3816 IN UCHAR Wcid);
3818 BOOLEAN AsicSendCommandToMcu(
3819 IN PRTMP_ADAPTER pAd,
3820 IN UCHAR Command,
3821 IN UCHAR Token,
3822 IN UCHAR Arg0,
3823 IN UCHAR Arg1);
3824 #ifdef RT2860
3825 BOOLEAN AsicCheckCommanOk(
3826 IN PRTMP_ADAPTER pAd,
3827 IN UCHAR Command);
3828 #endif
3829 VOID MacAddrRandomBssid(
3830 IN PRTMP_ADAPTER pAd,
3831 OUT PUCHAR pAddr);
3833 VOID MgtMacHeaderInit(
3834 IN PRTMP_ADAPTER pAd,
3835 IN OUT PHEADER_802_11 pHdr80211,
3836 IN UCHAR SubType,
3837 IN UCHAR ToDs,
3838 IN PUCHAR pDA,
3839 IN PUCHAR pBssid);
3841 VOID MlmeRadioOff(
3842 IN PRTMP_ADAPTER pAd);
3844 VOID MlmeRadioOn(
3845 IN PRTMP_ADAPTER pAd);
3848 VOID BssTableInit(
3849 IN BSS_TABLE *Tab);
3851 VOID BATableInit(
3852 IN PRTMP_ADAPTER pAd,
3853 IN BA_TABLE *Tab);
3855 ULONG BssTableSearch(
3856 IN BSS_TABLE *Tab,
3857 IN PUCHAR pBssid,
3858 IN UCHAR Channel);
3860 ULONG BssSsidTableSearch(
3861 IN BSS_TABLE *Tab,
3862 IN PUCHAR pBssid,
3863 IN PUCHAR pSsid,
3864 IN UCHAR SsidLen,
3865 IN UCHAR Channel);
3867 ULONG BssTableSearchWithSSID(
3868 IN BSS_TABLE *Tab,
3869 IN PUCHAR Bssid,
3870 IN PUCHAR pSsid,
3871 IN UCHAR SsidLen,
3872 IN UCHAR Channel);
3874 VOID BssTableDeleteEntry(
3875 IN OUT PBSS_TABLE pTab,
3876 IN PUCHAR pBssid,
3877 IN UCHAR Channel);
3879 VOID BATableDeleteORIEntry(
3880 IN OUT PRTMP_ADAPTER pAd,
3881 IN BA_ORI_ENTRY *pBAORIEntry);
3883 VOID BssEntrySet(
3884 IN PRTMP_ADAPTER pAd,
3885 OUT PBSS_ENTRY pBss,
3886 IN PUCHAR pBssid,
3887 IN CHAR Ssid[],
3888 IN UCHAR SsidLen,
3889 IN UCHAR BssType,
3890 IN USHORT BeaconPeriod,
3891 IN PCF_PARM CfParm,
3892 IN USHORT AtimWin,
3893 IN USHORT CapabilityInfo,
3894 IN UCHAR SupRate[],
3895 IN UCHAR SupRateLen,
3896 IN UCHAR ExtRate[],
3897 IN UCHAR ExtRateLen,
3898 IN HT_CAPABILITY_IE *pHtCapability,
3899 IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
3900 IN UCHAR HtCapabilityLen,
3901 IN UCHAR AddHtInfoLen,
3902 IN UCHAR NewExtChanOffset,
3903 IN UCHAR Channel,
3904 IN CHAR Rssi,
3905 IN LARGE_INTEGER TimeStamp,
3906 IN UCHAR CkipFlag,
3907 IN PEDCA_PARM pEdcaParm,
3908 IN PQOS_CAPABILITY_PARM pQosCapability,
3909 IN PQBSS_LOAD_PARM pQbssLoad,
3910 IN USHORT LengthVIE,
3911 IN PNDIS_802_11_VARIABLE_IEs pVIE);
3913 ULONG BssTableSetEntry(
3914 IN PRTMP_ADAPTER pAd,
3915 OUT PBSS_TABLE pTab,
3916 IN PUCHAR pBssid,
3917 IN CHAR Ssid[],
3918 IN UCHAR SsidLen,
3919 IN UCHAR BssType,
3920 IN USHORT BeaconPeriod,
3921 IN CF_PARM *CfParm,
3922 IN USHORT AtimWin,
3923 IN USHORT CapabilityInfo,
3924 IN UCHAR SupRate[],
3925 IN UCHAR SupRateLen,
3926 IN UCHAR ExtRate[],
3927 IN UCHAR ExtRateLen,
3928 IN HT_CAPABILITY_IE *pHtCapability,
3929 IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
3930 IN UCHAR HtCapabilityLen,
3931 IN UCHAR AddHtInfoLen,
3932 IN UCHAR NewExtChanOffset,
3933 IN UCHAR Channel,
3934 IN CHAR Rssi,
3935 IN LARGE_INTEGER TimeStamp,
3936 IN UCHAR CkipFlag,
3937 IN PEDCA_PARM pEdcaParm,
3938 IN PQOS_CAPABILITY_PARM pQosCapability,
3939 IN PQBSS_LOAD_PARM pQbssLoad,
3940 IN USHORT LengthVIE,
3941 IN PNDIS_802_11_VARIABLE_IEs pVIE);
3943 VOID BATableInsertEntry(
3944 IN PRTMP_ADAPTER pAd,
3945 IN USHORT Aid,
3946 IN USHORT TimeOutValue,
3947 IN USHORT StartingSeq,
3948 IN UCHAR TID,
3949 IN UCHAR BAWinSize,
3950 IN UCHAR OriginatorStatus,
3951 IN BOOLEAN IsRecipient);
3953 VOID BssTableSsidSort(
3954 IN PRTMP_ADAPTER pAd,
3955 OUT BSS_TABLE *OutTab,
3956 IN CHAR Ssid[],
3957 IN UCHAR SsidLen);
3959 VOID BssTableSortByRssi(
3960 IN OUT BSS_TABLE *OutTab);
3962 VOID BssCipherParse(
3963 IN OUT PBSS_ENTRY pBss);
3965 NDIS_STATUS MlmeQueueInit(
3966 IN MLME_QUEUE *Queue);
3968 VOID MlmeQueueDestroy(
3969 IN MLME_QUEUE *Queue);
3971 BOOLEAN MlmeEnqueue(
3972 IN PRTMP_ADAPTER pAd,
3973 IN ULONG Machine,
3974 IN ULONG MsgType,
3975 IN ULONG MsgLen,
3976 IN VOID *Msg);
3978 BOOLEAN MlmeEnqueueForRecv(
3979 IN PRTMP_ADAPTER pAd,
3980 IN ULONG Wcid,
3981 IN ULONG TimeStampHigh,
3982 IN ULONG TimeStampLow,
3983 IN UCHAR Rssi0,
3984 IN UCHAR Rssi1,
3985 IN UCHAR Rssi2,
3986 IN ULONG MsgLen,
3987 IN PVOID Msg,
3988 IN UCHAR Signal);
3991 BOOLEAN MlmeDequeue(
3992 IN MLME_QUEUE *Queue,
3993 OUT MLME_QUEUE_ELEM **Elem);
3995 VOID MlmeRestartStateMachine(
3996 IN PRTMP_ADAPTER pAd);
3998 BOOLEAN MlmeQueueEmpty(
3999 IN MLME_QUEUE *Queue);
4001 BOOLEAN MlmeQueueFull(
4002 IN MLME_QUEUE *Queue);
4004 BOOLEAN MsgTypeSubst(
4005 IN PRTMP_ADAPTER pAd,
4006 IN PFRAME_802_11 pFrame,
4007 OUT INT *Machine,
4008 OUT INT *MsgType);
4010 VOID StateMachineInit(
4011 IN STATE_MACHINE *Sm,
4012 IN STATE_MACHINE_FUNC Trans[],
4013 IN ULONG StNr,
4014 IN ULONG MsgNr,
4015 IN STATE_MACHINE_FUNC DefFunc,
4016 IN ULONG InitState,
4017 IN ULONG Base);
4019 VOID StateMachineSetAction(
4020 IN STATE_MACHINE *S,
4021 IN ULONG St,
4022 ULONG Msg,
4023 IN STATE_MACHINE_FUNC F);
4025 VOID StateMachinePerformAction(
4026 IN PRTMP_ADAPTER pAd,
4027 IN STATE_MACHINE *S,
4028 IN MLME_QUEUE_ELEM *Elem);
4030 VOID Drop(
4031 IN PRTMP_ADAPTER pAd,
4032 IN MLME_QUEUE_ELEM *Elem);
4034 VOID AssocStateMachineInit(
4035 IN PRTMP_ADAPTER pAd,
4036 IN STATE_MACHINE *Sm,
4037 OUT STATE_MACHINE_FUNC Trans[]);
4039 VOID ReassocTimeout(
4040 IN PVOID SystemSpecific1,
4041 IN PVOID FunctionContext,
4042 IN PVOID SystemSpecific2,
4043 IN PVOID SystemSpecific3);
4045 VOID AssocTimeout(
4046 IN PVOID SystemSpecific1,
4047 IN PVOID FunctionContext,
4048 IN PVOID SystemSpecific2,
4049 IN PVOID SystemSpecific3);
4051 VOID DisassocTimeout(
4052 IN PVOID SystemSpecific1,
4053 IN PVOID FunctionContext,
4054 IN PVOID SystemSpecific2,
4055 IN PVOID SystemSpecific3);
4057 //----------------------------------------------
4058 VOID MlmeAssocReqAction(
4059 IN PRTMP_ADAPTER pAd,
4060 IN MLME_QUEUE_ELEM *Elem);
4062 VOID MlmeReassocReqAction(
4063 IN PRTMP_ADAPTER pAd,
4064 IN MLME_QUEUE_ELEM *Elem);
4066 VOID MlmeDisassocReqAction(
4067 IN PRTMP_ADAPTER pAd,
4068 IN MLME_QUEUE_ELEM *Elem);
4070 VOID PeerAssocRspAction(
4071 IN PRTMP_ADAPTER pAd,
4072 IN MLME_QUEUE_ELEM *Elem);
4074 VOID PeerReassocRspAction(
4075 IN PRTMP_ADAPTER pAd,
4076 IN MLME_QUEUE_ELEM *Elem);
4078 VOID PeerDisassocAction(
4079 IN PRTMP_ADAPTER pAd,
4080 IN MLME_QUEUE_ELEM *Elem);
4082 VOID DisassocTimeoutAction(
4083 IN PRTMP_ADAPTER pAd,
4084 IN MLME_QUEUE_ELEM *Elem);
4086 VOID AssocTimeoutAction(
4087 IN PRTMP_ADAPTER pAd,
4088 IN MLME_QUEUE_ELEM *Elem);
4090 VOID ReassocTimeoutAction(
4091 IN PRTMP_ADAPTER pAd,
4092 IN MLME_QUEUE_ELEM *Elem);
4094 VOID Cls3errAction(
4095 IN PRTMP_ADAPTER pAd,
4096 IN PUCHAR pAddr);
4098 VOID SwitchBetweenWepAndCkip(
4099 IN PRTMP_ADAPTER pAd);
4101 VOID InvalidStateWhenAssoc(
4102 IN PRTMP_ADAPTER pAd,
4103 IN MLME_QUEUE_ELEM *Elem);
4105 VOID InvalidStateWhenReassoc(
4106 IN PRTMP_ADAPTER pAd,
4107 IN MLME_QUEUE_ELEM *Elem);
4109 VOID InvalidStateWhenDisassociate(
4110 IN PRTMP_ADAPTER pAd,
4111 IN MLME_QUEUE_ELEM *Elem);
4113 #ifdef RT2870
4114 VOID MlmeCntlConfirm(
4115 IN PRTMP_ADAPTER pAd,
4116 IN ULONG MsgType,
4117 IN USHORT Msg);
4118 #endif // RT2870 //
4120 VOID ComposePsPoll(
4121 IN PRTMP_ADAPTER pAd);
4123 VOID ComposeNullFrame(
4124 IN PRTMP_ADAPTER pAd);
4126 VOID AssocPostProc(
4127 IN PRTMP_ADAPTER pAd,
4128 IN PUCHAR pAddr2,
4129 IN USHORT CapabilityInfo,
4130 IN USHORT Aid,
4131 IN UCHAR SupRate[],
4132 IN UCHAR SupRateLen,
4133 IN UCHAR ExtRate[],
4134 IN UCHAR ExtRateLen,
4135 IN PEDCA_PARM pEdcaParm,
4136 IN HT_CAPABILITY_IE *pHtCapability,
4137 IN UCHAR HtCapabilityLen,
4138 IN ADD_HT_INFO_IE *pAddHtInfo);
4140 VOID AuthStateMachineInit(
4141 IN PRTMP_ADAPTER pAd,
4142 IN PSTATE_MACHINE sm,
4143 OUT STATE_MACHINE_FUNC Trans[]);
4145 VOID AuthTimeout(
4146 IN PVOID SystemSpecific1,
4147 IN PVOID FunctionContext,
4148 IN PVOID SystemSpecific2,
4149 IN PVOID SystemSpecific3);
4151 VOID MlmeAuthReqAction(
4152 IN PRTMP_ADAPTER pAd,
4153 IN MLME_QUEUE_ELEM *Elem);
4155 VOID PeerAuthRspAtSeq2Action(
4156 IN PRTMP_ADAPTER pAd,
4157 IN MLME_QUEUE_ELEM *Elem);
4159 VOID PeerAuthRspAtSeq4Action(
4160 IN PRTMP_ADAPTER pAd,
4161 IN MLME_QUEUE_ELEM *Elem);
4163 VOID AuthTimeoutAction(
4164 IN PRTMP_ADAPTER pAd,
4165 IN MLME_QUEUE_ELEM *Elem);
4167 VOID Cls2errAction(
4168 IN PRTMP_ADAPTER pAd,
4169 IN PUCHAR pAddr);
4171 VOID MlmeDeauthReqAction(
4172 IN PRTMP_ADAPTER pAd,
4173 IN MLME_QUEUE_ELEM *Elem);
4175 VOID InvalidStateWhenAuth(
4176 IN PRTMP_ADAPTER pAd,
4177 IN MLME_QUEUE_ELEM *Elem);
4179 //=============================================
4181 VOID AuthRspStateMachineInit(
4182 IN PRTMP_ADAPTER pAd,
4183 IN PSTATE_MACHINE Sm,
4184 IN STATE_MACHINE_FUNC Trans[]);
4186 VOID PeerDeauthAction(
4187 IN PRTMP_ADAPTER pAd,
4188 IN MLME_QUEUE_ELEM *Elem);
4190 VOID PeerAuthSimpleRspGenAndSend(
4191 IN PRTMP_ADAPTER pAd,
4192 IN PHEADER_802_11 pHdr80211,
4193 IN USHORT Alg,
4194 IN USHORT Seq,
4195 IN USHORT Reason,
4196 IN USHORT Status);
4199 // Private routines in dls.c
4202 //========================================
4204 VOID SyncStateMachineInit(
4205 IN PRTMP_ADAPTER pAd,
4206 IN STATE_MACHINE *Sm,
4207 OUT STATE_MACHINE_FUNC Trans[]);
4209 VOID BeaconTimeout(
4210 IN PVOID SystemSpecific1,
4211 IN PVOID FunctionContext,
4212 IN PVOID SystemSpecific2,
4213 IN PVOID SystemSpecific3);
4215 VOID ScanTimeout(
4216 IN PVOID SystemSpecific1,
4217 IN PVOID FunctionContext,
4218 IN PVOID SystemSpecific2,
4219 IN PVOID SystemSpecific3);
4221 VOID InvalidStateWhenScan(
4222 IN PRTMP_ADAPTER pAd,
4223 IN MLME_QUEUE_ELEM *Elem);
4225 VOID InvalidStateWhenJoin(
4226 IN PRTMP_ADAPTER pAd,
4227 IN MLME_QUEUE_ELEM *Elem);
4229 VOID InvalidStateWhenStart(
4230 IN PRTMP_ADAPTER pAd,
4231 IN MLME_QUEUE_ELEM *Elem);
4233 VOID EnqueueProbeRequest(
4234 IN PRTMP_ADAPTER pAd);
4236 BOOLEAN ScanRunning(
4237 IN PRTMP_ADAPTER pAd);
4238 //=========================================
4240 VOID MlmeCntlInit(
4241 IN PRTMP_ADAPTER pAd,
4242 IN STATE_MACHINE *S,
4243 OUT STATE_MACHINE_FUNC Trans[]);
4245 VOID MlmeCntlMachinePerformAction(
4246 IN PRTMP_ADAPTER pAd,
4247 IN STATE_MACHINE *S,
4248 IN MLME_QUEUE_ELEM *Elem);
4250 VOID CntlIdleProc(
4251 IN PRTMP_ADAPTER pAd,
4252 IN MLME_QUEUE_ELEM *Elem);
4254 VOID CntlOidScanProc(
4255 IN PRTMP_ADAPTER pAd,
4256 IN MLME_QUEUE_ELEM *Elem);
4258 VOID CntlOidSsidProc(
4259 IN PRTMP_ADAPTER pAd,
4260 IN MLME_QUEUE_ELEM * Elem);
4262 VOID CntlOidRTBssidProc(
4263 IN PRTMP_ADAPTER pAd,
4264 IN MLME_QUEUE_ELEM * Elem);
4266 VOID CntlMlmeRoamingProc(
4267 IN PRTMP_ADAPTER pAd,
4268 IN MLME_QUEUE_ELEM * Elem);
4270 VOID CntlWaitDisassocProc(
4271 IN PRTMP_ADAPTER pAd,
4272 IN MLME_QUEUE_ELEM *Elem);
4274 VOID CntlWaitJoinProc(
4275 IN PRTMP_ADAPTER pAd,
4276 IN MLME_QUEUE_ELEM *Elem);
4278 VOID CntlWaitReassocProc(
4279 IN PRTMP_ADAPTER pAd,
4280 IN MLME_QUEUE_ELEM *Elem);
4282 VOID CntlWaitStartProc(
4283 IN PRTMP_ADAPTER pAd,
4284 IN MLME_QUEUE_ELEM *Elem);
4286 VOID CntlWaitAuthProc(
4287 IN PRTMP_ADAPTER pAd,
4288 IN MLME_QUEUE_ELEM *Elem);
4290 VOID CntlWaitAuthProc2(
4291 IN PRTMP_ADAPTER pAd,
4292 IN MLME_QUEUE_ELEM *Elem);
4294 VOID CntlWaitAssocProc(
4295 IN PRTMP_ADAPTER pAd,
4296 IN MLME_QUEUE_ELEM *Elem);
4298 VOID LinkUp(
4299 IN PRTMP_ADAPTER pAd,
4300 IN UCHAR BssType);
4302 VOID LinkDown(
4303 IN PRTMP_ADAPTER pAd,
4304 IN BOOLEAN IsReqFromAP);
4306 VOID IterateOnBssTab(
4307 IN PRTMP_ADAPTER pAd);
4309 VOID IterateOnBssTab2(
4310 IN PRTMP_ADAPTER pAd);;
4312 VOID JoinParmFill(
4313 IN PRTMP_ADAPTER pAd,
4314 IN OUT MLME_JOIN_REQ_STRUCT *JoinReq,
4315 IN ULONG BssIdx);
4317 VOID AssocParmFill(
4318 IN PRTMP_ADAPTER pAd,
4319 IN OUT MLME_ASSOC_REQ_STRUCT *AssocReq,
4320 IN PUCHAR pAddr,
4321 IN USHORT CapabilityInfo,
4322 IN ULONG Timeout,
4323 IN USHORT ListenIntv);
4325 VOID ScanParmFill(
4326 IN PRTMP_ADAPTER pAd,
4327 IN OUT MLME_SCAN_REQ_STRUCT *ScanReq,
4328 IN CHAR Ssid[],
4329 IN UCHAR SsidLen,
4330 IN UCHAR BssType,
4331 IN UCHAR ScanType);
4333 VOID DisassocParmFill(
4334 IN PRTMP_ADAPTER pAd,
4335 IN OUT MLME_DISASSOC_REQ_STRUCT *DisassocReq,
4336 IN PUCHAR pAddr,
4337 IN USHORT Reason);
4339 VOID StartParmFill(
4340 IN PRTMP_ADAPTER pAd,
4341 IN OUT MLME_START_REQ_STRUCT *StartReq,
4342 IN CHAR Ssid[],
4343 IN UCHAR SsidLen);
4345 VOID AuthParmFill(
4346 IN PRTMP_ADAPTER pAd,
4347 IN OUT MLME_AUTH_REQ_STRUCT *AuthReq,
4348 IN PUCHAR pAddr,
4349 IN USHORT Alg);
4351 VOID EnqueuePsPoll(
4352 IN PRTMP_ADAPTER pAd);
4354 VOID EnqueueBeaconFrame(
4355 IN PRTMP_ADAPTER pAd);
4357 VOID MlmeJoinReqAction(
4358 IN PRTMP_ADAPTER pAd,
4359 IN MLME_QUEUE_ELEM *Elem);
4361 VOID MlmeScanReqAction(
4362 IN PRTMP_ADAPTER pAd,
4363 IN MLME_QUEUE_ELEM *Elem);
4365 VOID MlmeStartReqAction(
4366 IN PRTMP_ADAPTER pAd,
4367 IN MLME_QUEUE_ELEM *Elem);
4369 VOID ScanTimeoutAction(
4370 IN PRTMP_ADAPTER pAd,
4371 IN MLME_QUEUE_ELEM *Elem);
4373 VOID BeaconTimeoutAtJoinAction(
4374 IN PRTMP_ADAPTER pAd,
4375 IN MLME_QUEUE_ELEM *Elem);
4377 VOID PeerBeaconAtScanAction(
4378 IN PRTMP_ADAPTER pAd,
4379 IN MLME_QUEUE_ELEM *Elem);
4381 VOID PeerBeaconAtJoinAction(
4382 IN PRTMP_ADAPTER pAd,
4383 IN MLME_QUEUE_ELEM *Elem);
4385 VOID PeerBeacon(
4386 IN PRTMP_ADAPTER pAd,
4387 IN MLME_QUEUE_ELEM *Elem);
4389 VOID PeerProbeReqAction(
4390 IN PRTMP_ADAPTER pAd,
4391 IN MLME_QUEUE_ELEM *Elem);
4393 VOID ScanNextChannel(
4394 IN PRTMP_ADAPTER pAd);
4396 ULONG MakeIbssBeacon(
4397 IN PRTMP_ADAPTER pAd);
4399 VOID CCXAdjacentAPReport(
4400 IN PRTMP_ADAPTER pAd);
4402 BOOLEAN MlmeScanReqSanity(
4403 IN PRTMP_ADAPTER pAd,
4404 IN VOID *Msg,
4405 IN ULONG MsgLen,
4406 OUT UCHAR *BssType,
4407 OUT CHAR ssid[],
4408 OUT UCHAR *SsidLen,
4409 OUT UCHAR *ScanType);
4411 BOOLEAN PeerBeaconAndProbeRspSanity(
4412 IN PRTMP_ADAPTER pAd,
4413 IN VOID *Msg,
4414 IN ULONG MsgLen,
4415 IN UCHAR MsgChannel,
4416 OUT PUCHAR pAddr2,
4417 OUT PUCHAR pBssid,
4418 OUT CHAR Ssid[],
4419 OUT UCHAR *pSsidLen,
4420 OUT UCHAR *pBssType,
4421 OUT USHORT *pBeaconPeriod,
4422 OUT UCHAR *pChannel,
4423 OUT UCHAR *pNewChannel,
4424 OUT LARGE_INTEGER *pTimestamp,
4425 OUT CF_PARM *pCfParm,
4426 OUT USHORT *pAtimWin,
4427 OUT USHORT *pCapabilityInfo,
4428 OUT UCHAR *pErp,
4429 OUT UCHAR *pDtimCount,
4430 OUT UCHAR *pDtimPeriod,
4431 OUT UCHAR *pBcastFlag,
4432 OUT UCHAR *pMessageToMe,
4433 OUT UCHAR SupRate[],
4434 OUT UCHAR *pSupRateLen,
4435 OUT UCHAR ExtRate[],
4436 OUT UCHAR *pExtRateLen,
4437 OUT UCHAR *pCkipFlag,
4438 OUT UCHAR *pAironetCellPowerLimit,
4439 OUT PEDCA_PARM pEdcaParm,
4440 OUT PQBSS_LOAD_PARM pQbssLoad,
4441 OUT PQOS_CAPABILITY_PARM pQosCapability,
4442 OUT ULONG *pRalinkIe,
4443 OUT UCHAR *pHtCapabilityLen,
4444 OUT UCHAR *pPreNHtCapabilityLen,
4445 OUT HT_CAPABILITY_IE *pHtCapability,
4446 OUT UCHAR *AddHtInfoLen,
4447 OUT ADD_HT_INFO_IE *AddHtInfo,
4448 OUT UCHAR *NewExtChannel,
4449 OUT USHORT *LengthVIE,
4450 OUT PNDIS_802_11_VARIABLE_IEs pVIE);
4452 BOOLEAN PeerAddBAReqActionSanity(
4453 IN PRTMP_ADAPTER pAd,
4454 IN VOID *pMsg,
4455 IN ULONG MsgLen,
4456 OUT PUCHAR pAddr2);
4458 BOOLEAN PeerAddBARspActionSanity(
4459 IN PRTMP_ADAPTER pAd,
4460 IN VOID *pMsg,
4461 IN ULONG MsgLen);
4463 BOOLEAN PeerDelBAActionSanity(
4464 IN PRTMP_ADAPTER pAd,
4465 IN UCHAR Wcid,
4466 IN VOID *pMsg,
4467 IN ULONG MsgLen);
4469 BOOLEAN MlmeAssocReqSanity(
4470 IN PRTMP_ADAPTER pAd,
4471 IN VOID *Msg,
4472 IN ULONG MsgLen,
4473 OUT PUCHAR pApAddr,
4474 OUT USHORT *CapabilityInfo,
4475 OUT ULONG *Timeout,
4476 OUT USHORT *ListenIntv);
4478 BOOLEAN MlmeAuthReqSanity(
4479 IN PRTMP_ADAPTER pAd,
4480 IN VOID *Msg,
4481 IN ULONG MsgLen,
4482 OUT PUCHAR pAddr,
4483 OUT ULONG *Timeout,
4484 OUT USHORT *Alg);
4486 BOOLEAN MlmeStartReqSanity(
4487 IN PRTMP_ADAPTER pAd,
4488 IN VOID *Msg,
4489 IN ULONG MsgLen,
4490 OUT CHAR Ssid[],
4491 OUT UCHAR *Ssidlen);
4493 BOOLEAN PeerAuthSanity(
4494 IN PRTMP_ADAPTER pAd,
4495 IN VOID *Msg,
4496 IN ULONG MsgLen,
4497 OUT PUCHAR pAddr,
4498 OUT USHORT *Alg,
4499 OUT USHORT *Seq,
4500 OUT USHORT *Status,
4501 OUT CHAR ChlgText[]);
4503 BOOLEAN PeerAssocRspSanity(
4504 IN PRTMP_ADAPTER pAd,
4505 IN VOID *pMsg,
4506 IN ULONG MsgLen,
4507 OUT PUCHAR pAddr2,
4508 OUT USHORT *pCapabilityInfo,
4509 OUT USHORT *pStatus,
4510 OUT USHORT *pAid,
4511 OUT UCHAR SupRate[],
4512 OUT UCHAR *pSupRateLen,
4513 OUT UCHAR ExtRate[],
4514 OUT UCHAR *pExtRateLen,
4515 OUT HT_CAPABILITY_IE *pHtCapability,
4516 OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
4517 OUT UCHAR *pHtCapabilityLen,
4518 OUT UCHAR *pAddHtInfoLen,
4519 OUT UCHAR *pNewExtChannelOffset,
4520 OUT PEDCA_PARM pEdcaParm,
4521 OUT UCHAR *pCkipFlag);
4523 BOOLEAN PeerDisassocSanity(
4524 IN PRTMP_ADAPTER pAd,
4525 IN VOID *Msg,
4526 IN ULONG MsgLen,
4527 OUT PUCHAR pAddr2,
4528 OUT USHORT *Reason);
4530 BOOLEAN PeerDeauthSanity(
4531 IN PRTMP_ADAPTER pAd,
4532 IN VOID *Msg,
4533 IN ULONG MsgLen,
4534 OUT PUCHAR pAddr2,
4535 OUT USHORT *Reason);
4537 BOOLEAN PeerProbeReqSanity(
4538 IN PRTMP_ADAPTER pAd,
4539 IN VOID *Msg,
4540 IN ULONG MsgLen,
4541 OUT PUCHAR pAddr2,
4542 OUT CHAR Ssid[],
4543 OUT UCHAR *pSsidLen);
4545 BOOLEAN GetTimBit(
4546 IN CHAR *Ptr,
4547 IN USHORT Aid,
4548 OUT UCHAR *TimLen,
4549 OUT UCHAR *BcastFlag,
4550 OUT UCHAR *DtimCount,
4551 OUT UCHAR *DtimPeriod,
4552 OUT UCHAR *MessageToMe);
4554 UCHAR ChannelSanity(
4555 IN PRTMP_ADAPTER pAd,
4556 IN UCHAR channel);
4558 NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(
4559 IN PBSS_ENTRY pBss);
4561 BOOLEAN MlmeDelBAReqSanity(
4562 IN PRTMP_ADAPTER pAd,
4563 IN VOID *Msg,
4564 IN ULONG MsgLen);
4566 BOOLEAN MlmeAddBAReqSanity(
4567 IN PRTMP_ADAPTER pAd,
4568 IN VOID *Msg,
4569 IN ULONG MsgLen,
4570 OUT PUCHAR pAddr2);
4572 ULONG MakeOutgoingFrame(
4573 OUT CHAR *Buffer,
4574 OUT ULONG *Length, ...);
4576 VOID LfsrInit(
4577 IN PRTMP_ADAPTER pAd,
4578 IN ULONG Seed);
4580 UCHAR RandomByte(
4581 IN PRTMP_ADAPTER pAd);
4583 VOID AsicUpdateAutoFallBackTable(
4584 IN PRTMP_ADAPTER pAd,
4585 IN PUCHAR pTxRate);
4587 VOID MlmePeriodicExec(
4588 IN PVOID SystemSpecific1,
4589 IN PVOID FunctionContext,
4590 IN PVOID SystemSpecific2,
4591 IN PVOID SystemSpecific3);
4593 VOID LinkDownExec(
4594 IN PVOID SystemSpecific1,
4595 IN PVOID FunctionContext,
4596 IN PVOID SystemSpecific2,
4597 IN PVOID SystemSpecific3);
4599 VOID STAMlmePeriodicExec(
4600 PRTMP_ADAPTER pAd);
4602 VOID MlmeAutoScan(
4603 IN PRTMP_ADAPTER pAd);
4605 VOID MlmeAutoReconnectLastSSID(
4606 IN PRTMP_ADAPTER pAd);
4608 BOOLEAN MlmeValidateSSID(
4609 IN PUCHAR pSsid,
4610 IN UCHAR SsidLen);
4612 VOID MlmeCheckForRoaming(
4613 IN PRTMP_ADAPTER pAd,
4614 IN ULONG Now32);
4616 VOID MlmeCheckForFastRoaming(
4617 IN PRTMP_ADAPTER pAd,
4618 IN ULONG Now);
4620 VOID MlmeDynamicTxRateSwitching(
4621 IN PRTMP_ADAPTER pAd);
4623 VOID MlmeSetTxRate(
4624 IN PRTMP_ADAPTER pAd,
4625 IN PMAC_TABLE_ENTRY pEntry,
4626 IN PRTMP_TX_RATE_SWITCH pTxRate);
4628 VOID MlmeSelectTxRateTable(
4629 IN PRTMP_ADAPTER pAd,
4630 IN PMAC_TABLE_ENTRY pEntry,
4631 IN PUCHAR *ppTable,
4632 IN PUCHAR pTableSize,
4633 IN PUCHAR pInitTxRateIdx);
4635 VOID MlmeCalculateChannelQuality(
4636 IN PRTMP_ADAPTER pAd,
4637 IN ULONG Now);
4639 VOID MlmeCheckPsmChange(
4640 IN PRTMP_ADAPTER pAd,
4641 IN ULONG Now32);
4643 VOID MlmeSetPsmBit(
4644 IN PRTMP_ADAPTER pAd,
4645 IN USHORT psm);
4647 VOID MlmeSetTxPreamble(
4648 IN PRTMP_ADAPTER pAd,
4649 IN USHORT TxPreamble);
4651 VOID UpdateBasicRateBitmap(
4652 IN PRTMP_ADAPTER pAd);
4654 VOID MlmeUpdateTxRates(
4655 IN PRTMP_ADAPTER pAd,
4656 IN BOOLEAN bLinkUp,
4657 IN UCHAR apidx);
4659 VOID MlmeUpdateHtTxRates(
4660 IN PRTMP_ADAPTER pAd,
4661 IN UCHAR apidx);
4663 VOID RTMPCheckRates(
4664 IN PRTMP_ADAPTER pAd,
4665 IN OUT UCHAR SupRate[],
4666 IN OUT UCHAR *SupRateLen);
4668 BOOLEAN RTMPCheckChannel(
4669 IN PRTMP_ADAPTER pAd,
4670 IN UCHAR CentralChannel,
4671 IN UCHAR Channel);
4673 BOOLEAN RTMPCheckHt(
4674 IN PRTMP_ADAPTER pAd,
4675 IN UCHAR Wcid,
4676 IN OUT HT_CAPABILITY_IE *pHtCapability,
4677 IN OUT ADD_HT_INFO_IE *pAddHtInfo);
4679 VOID StaQuickResponeForRateUpExec(
4680 IN PVOID SystemSpecific1,
4681 IN PVOID FunctionContext,
4682 IN PVOID SystemSpecific2,
4683 IN PVOID SystemSpecific3);
4685 VOID RTMPUpdateMlmeRate(
4686 IN PRTMP_ADAPTER pAd);
4688 CHAR RTMPMaxRssi(
4689 IN PRTMP_ADAPTER pAd,
4690 IN CHAR Rssi0,
4691 IN CHAR Rssi1,
4692 IN CHAR Rssi2);
4694 VOID AsicSetRxAnt(
4695 IN PRTMP_ADAPTER pAd,
4696 IN UCHAR Ant);
4698 VOID AsicEvaluateRxAnt(
4699 IN PRTMP_ADAPTER pAd);
4701 VOID AsicRxAntEvalTimeout(
4702 IN PVOID SystemSpecific1,
4703 IN PVOID FunctionContext,
4704 IN PVOID SystemSpecific2,
4705 IN PVOID SystemSpecific3);
4707 VOID APSDPeriodicExec(
4708 IN PVOID SystemSpecific1,
4709 IN PVOID FunctionContext,
4710 IN PVOID SystemSpecific2,
4711 IN PVOID SystemSpecific3);
4713 BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(
4714 IN PRTMP_ADAPTER pAd,
4715 IN PMAC_TABLE_ENTRY pEntry);
4717 UCHAR RTMPStaFixedTxMode(
4718 IN PRTMP_ADAPTER pAd,
4719 IN PMAC_TABLE_ENTRY pEntry);
4721 VOID RTMPUpdateLegacyTxSetting(
4722 UCHAR fixed_tx_mode,
4723 PMAC_TABLE_ENTRY pEntry);
4725 BOOLEAN RTMPAutoRateSwitchCheck(
4726 IN PRTMP_ADAPTER pAd);
4728 NDIS_STATUS MlmeInit(
4729 IN PRTMP_ADAPTER pAd);
4731 VOID MlmeHandler(
4732 IN PRTMP_ADAPTER pAd);
4734 VOID MlmeHalt(
4735 IN PRTMP_ADAPTER pAd);
4737 VOID MlmeResetRalinkCounters(
4738 IN PRTMP_ADAPTER pAd);
4740 VOID BuildChannelList(
4741 IN PRTMP_ADAPTER pAd);
4743 UCHAR FirstChannel(
4744 IN PRTMP_ADAPTER pAd);
4746 UCHAR NextChannel(
4747 IN PRTMP_ADAPTER pAd,
4748 IN UCHAR channel);
4750 VOID ChangeToCellPowerLimit(
4751 IN PRTMP_ADAPTER pAd,
4752 IN UCHAR AironetCellPowerLimit);
4754 USHORT RTMP_EEPROM_READ16(
4755 IN PRTMP_ADAPTER pAd,
4756 IN USHORT Offset);
4758 VOID RTMP_EEPROM_WRITE16(
4759 IN PRTMP_ADAPTER pAd,
4760 IN USHORT Offset,
4761 IN USHORT Data);
4764 // Prototypes of function definition in rtmp_tkip.c
4766 VOID RTMPInitTkipEngine(
4767 IN PRTMP_ADAPTER pAd,
4768 IN PUCHAR pTKey,
4769 IN UCHAR KeyId,
4770 IN PUCHAR pTA,
4771 IN PUCHAR pMICKey,
4772 IN PUCHAR pTSC,
4773 OUT PULONG pIV16,
4774 OUT PULONG pIV32);
4776 VOID RTMPInitMICEngine(
4777 IN PRTMP_ADAPTER pAd,
4778 IN PUCHAR pKey,
4779 IN PUCHAR pDA,
4780 IN PUCHAR pSA,
4781 IN UCHAR UserPriority,
4782 IN PUCHAR pMICKey);
4784 BOOLEAN RTMPTkipCompareMICValue(
4785 IN PRTMP_ADAPTER pAd,
4786 IN PUCHAR pSrc,
4787 IN PUCHAR pDA,
4788 IN PUCHAR pSA,
4789 IN PUCHAR pMICKey,
4790 IN UCHAR UserPriority,
4791 IN UINT Len);
4793 VOID RTMPCalculateMICValue(
4794 IN PRTMP_ADAPTER pAd,
4795 IN PNDIS_PACKET pPacket,
4796 IN PUCHAR pEncap,
4797 IN PCIPHER_KEY pKey,
4798 IN UCHAR apidx);
4800 BOOLEAN RTMPTkipCompareMICValueWithLLC(
4801 IN PRTMP_ADAPTER pAd,
4802 IN PUCHAR pLLC,
4803 IN PUCHAR pSrc,
4804 IN PUCHAR pDA,
4805 IN PUCHAR pSA,
4806 IN PUCHAR pMICKey,
4807 IN UINT Len);
4809 VOID RTMPTkipAppendByte(
4810 IN PTKIP_KEY_INFO pTkip,
4811 IN UCHAR uChar);
4813 VOID RTMPTkipAppend(
4814 IN PTKIP_KEY_INFO pTkip,
4815 IN PUCHAR pSrc,
4816 IN UINT nBytes);
4818 VOID RTMPTkipGetMIC(
4819 IN PTKIP_KEY_INFO pTkip);
4821 BOOLEAN RTMPSoftDecryptTKIP(
4822 IN PRTMP_ADAPTER pAd,
4823 IN PUCHAR pData,
4824 IN ULONG DataByteCnt,
4825 IN UCHAR UserPriority,
4826 IN PCIPHER_KEY pWpaKey);
4828 BOOLEAN RTMPSoftDecryptAES(
4829 IN PRTMP_ADAPTER pAd,
4830 IN PUCHAR pData,
4831 IN ULONG DataByteCnt,
4832 IN PCIPHER_KEY pWpaKey);
4835 // Prototypes of function definition in cmm_info.c
4837 NDIS_STATUS RTMPWPARemoveKeyProc(
4838 IN PRTMP_ADAPTER pAd,
4839 IN PVOID pBuf);
4841 VOID RTMPWPARemoveAllKeys(
4842 IN PRTMP_ADAPTER pAd);
4844 BOOLEAN RTMPCheckStrPrintAble(
4845 IN CHAR *pInPutStr,
4846 IN UCHAR strLen);
4848 VOID RTMPSetPhyMode(
4849 IN PRTMP_ADAPTER pAd,
4850 IN ULONG phymode);
4852 VOID RTMPUpdateHTIE(
4853 IN RT_HT_CAPABILITY *pRtHt,
4854 IN UCHAR *pMcsSet,
4855 OUT HT_CAPABILITY_IE *pHtCapability,
4856 OUT ADD_HT_INFO_IE *pAddHtInfo);
4858 VOID RTMPAddWcidAttributeEntry(
4859 IN PRTMP_ADAPTER pAd,
4860 IN UCHAR BssIdx,
4861 IN UCHAR KeyIdx,
4862 IN UCHAR CipherAlg,
4863 IN MAC_TABLE_ENTRY *pEntry);
4865 CHAR *GetEncryptType(
4866 CHAR enc);
4868 CHAR *GetAuthMode(
4869 CHAR auth);
4871 VOID RTMPIoctlGetSiteSurvey(
4872 IN PRTMP_ADAPTER pAdapter,
4873 IN struct iwreq *wrq);
4875 VOID RTMPIoctlGetMacTable(
4876 IN PRTMP_ADAPTER pAd,
4877 IN struct iwreq *wrq);
4879 VOID RTMPAddBSSIDCipher(
4880 IN PRTMP_ADAPTER pAd,
4881 IN UCHAR Aid,
4882 IN PNDIS_802_11_KEY pKey,
4883 IN UCHAR CipherAlg);
4885 VOID RTMPSetHT(
4886 IN PRTMP_ADAPTER pAd,
4887 IN OID_SET_HT_PHYMODE *pHTPhyMode);
4889 VOID RTMPSetIndividualHT(
4890 IN PRTMP_ADAPTER pAd,
4891 IN UCHAR apidx);
4893 VOID RTMPSendWirelessEvent(
4894 IN PRTMP_ADAPTER pAd,
4895 IN USHORT Event_flag,
4896 IN PUCHAR pAddr,
4897 IN UCHAR BssIdx,
4898 IN CHAR Rssi);
4901 // prototype in wpa.c
4903 BOOLEAN WpaMsgTypeSubst(
4904 IN UCHAR EAPType,
4905 OUT INT *MsgType);
4907 VOID WpaPskStateMachineInit(
4908 IN PRTMP_ADAPTER pAd,
4909 IN STATE_MACHINE *S,
4910 OUT STATE_MACHINE_FUNC Trans[]);
4912 VOID WpaEAPOLKeyAction(
4913 IN PRTMP_ADAPTER pAd,
4914 IN MLME_QUEUE_ELEM *Elem);
4916 VOID WpaPairMsg1Action(
4917 IN PRTMP_ADAPTER pAd,
4918 IN MLME_QUEUE_ELEM *Elem);
4920 VOID WpaPairMsg3Action(
4921 IN PRTMP_ADAPTER pAd,
4922 IN MLME_QUEUE_ELEM *Elem);
4924 VOID WpaGroupMsg1Action(
4925 IN PRTMP_ADAPTER pAd,
4926 IN MLME_QUEUE_ELEM *Elem);
4928 VOID WpaMacHeaderInit(
4929 IN PRTMP_ADAPTER pAd,
4930 IN OUT PHEADER_802_11 pHdr80211,
4931 IN UCHAR wep,
4932 IN PUCHAR pAddr1);
4934 VOID Wpa2PairMsg1Action(
4935 IN PRTMP_ADAPTER pAd,
4936 IN MLME_QUEUE_ELEM *Elem);
4938 VOID Wpa2PairMsg3Action(
4939 IN PRTMP_ADAPTER pAd,
4940 IN MLME_QUEUE_ELEM *Elem);
4942 BOOLEAN ParseKeyData(
4943 IN PRTMP_ADAPTER pAd,
4944 IN PUCHAR pKeyData,
4945 IN UCHAR KeyDataLen,
4946 IN UCHAR bPairewise);
4948 VOID RTMPToWirelessSta(
4949 IN PRTMP_ADAPTER pAd,
4950 IN PUCHAR pHeader802_3,
4951 IN UINT HdrLen,
4952 IN PUCHAR pData,
4953 IN UINT DataLen,
4954 IN BOOLEAN is4wayFrame);
4956 VOID HMAC_SHA1(
4957 IN UCHAR *text,
4958 IN UINT text_len,
4959 IN UCHAR *key,
4960 IN UINT key_len,
4961 IN UCHAR *digest);
4963 VOID PRF(
4964 IN UCHAR *key,
4965 IN INT key_len,
4966 IN UCHAR *prefix,
4967 IN INT prefix_len,
4968 IN UCHAR *data,
4969 IN INT data_len,
4970 OUT UCHAR *output,
4971 IN INT len);
4973 VOID CCKMPRF(
4974 IN UCHAR *key,
4975 IN INT key_len,
4976 IN UCHAR *data,
4977 IN INT data_len,
4978 OUT UCHAR *output,
4979 IN INT len);
4981 VOID WpaCountPTK(
4982 IN PRTMP_ADAPTER pAd,
4983 IN UCHAR *PMK,
4984 IN UCHAR *ANonce,
4985 IN UCHAR *AA,
4986 IN UCHAR *SNonce,
4987 IN UCHAR *SA,
4988 OUT UCHAR *output,
4989 IN UINT len);
4991 VOID GenRandom(
4992 IN PRTMP_ADAPTER pAd,
4993 IN UCHAR *macAddr,
4994 OUT UCHAR *random);
4997 // prototype in aironet.c
4999 VOID AironetStateMachineInit(
5000 IN PRTMP_ADAPTER pAd,
5001 IN STATE_MACHINE *S,
5002 OUT STATE_MACHINE_FUNC Trans[]);
5004 VOID AironetMsgAction(
5005 IN PRTMP_ADAPTER pAd,
5006 IN MLME_QUEUE_ELEM *Elem);
5008 VOID AironetRequestAction(
5009 IN PRTMP_ADAPTER pAd,
5010 IN MLME_QUEUE_ELEM *Elem);
5012 VOID ChannelLoadRequestAction(
5013 IN PRTMP_ADAPTER pAd,
5014 IN UCHAR Index);
5016 VOID NoiseHistRequestAction(
5017 IN PRTMP_ADAPTER pAd,
5018 IN UCHAR Index);
5020 VOID BeaconRequestAction(
5021 IN PRTMP_ADAPTER pAd,
5022 IN UCHAR Index);
5024 VOID AironetReportAction(
5025 IN PRTMP_ADAPTER pAd,
5026 IN MLME_QUEUE_ELEM *Elem);
5028 VOID ChannelLoadReportAction(
5029 IN PRTMP_ADAPTER pAd,
5030 IN UCHAR Index);
5032 VOID NoiseHistReportAction(
5033 IN PRTMP_ADAPTER pAd,
5034 IN UCHAR Index);
5036 VOID AironetFinalReportAction(
5037 IN PRTMP_ADAPTER pAd);
5039 VOID BeaconReportAction(
5040 IN PRTMP_ADAPTER pAd,
5041 IN UCHAR Index);
5043 VOID AironetAddBeaconReport(
5044 IN PRTMP_ADAPTER pAd,
5045 IN ULONG Index,
5046 IN PMLME_QUEUE_ELEM pElem);
5048 VOID AironetCreateBeaconReportFromBssTable(
5049 IN PRTMP_ADAPTER pAd);
5051 CHAR ConvertToRssi(
5052 IN PRTMP_ADAPTER pAd,
5053 IN CHAR Rssi,
5054 IN UCHAR RssiNumber);
5057 // function prototype in cmm_wpa.c
5059 BOOLEAN RTMPCheckWPAframe(
5060 IN PRTMP_ADAPTER pAd,
5061 IN PMAC_TABLE_ENTRY pEntry,
5062 IN PUCHAR pData,
5063 IN ULONG DataByteCount,
5064 IN UCHAR FromWhichBSSID);
5066 VOID AES_GTK_KEY_UNWRAP(
5067 IN UCHAR *key,
5068 OUT UCHAR *plaintext,
5069 IN UCHAR c_len,
5070 IN UCHAR *ciphertext);
5072 VOID RTMPMakeRSNIE(
5073 IN PRTMP_ADAPTER pAd,
5074 IN UINT AuthMode,
5075 IN UINT WepStatus,
5076 IN UCHAR apidx);
5079 // function prototype in ap_wpa.c
5082 VOID HandleCounterMeasure(
5083 IN PRTMP_ADAPTER pAd,
5084 IN MAC_TABLE_ENTRY *pEntry);
5086 /* timeout -- ms */
5087 VOID RTMP_SetPeriodicTimer(
5088 IN NDIS_MINIPORT_TIMER *pTimer,
5089 IN unsigned long timeout);
5091 VOID RTMP_OS_Init_Timer(
5092 IN PRTMP_ADAPTER pAd,
5093 IN NDIS_MINIPORT_TIMER *pTimer,
5094 IN TIMER_FUNCTION function,
5095 IN PVOID data);
5097 VOID RTMP_OS_Add_Timer(
5098 IN NDIS_MINIPORT_TIMER *pTimer,
5099 IN unsigned long timeout);
5101 VOID RTMP_OS_Mod_Timer(
5102 IN NDIS_MINIPORT_TIMER *pTimer,
5103 IN unsigned long timeout);
5106 VOID RTMP_OS_Del_Timer(
5107 IN NDIS_MINIPORT_TIMER *pTimer,
5108 OUT BOOLEAN *pCancelled);
5111 VOID RTMP_OS_Release_Packet(
5112 IN PRTMP_ADAPTER pAd,
5113 IN PQUEUE_ENTRY pEntry);
5115 VOID RTMPusecDelay(
5116 IN ULONG usec);
5118 NDIS_STATUS os_alloc_mem(
5119 IN PRTMP_ADAPTER pAd,
5120 OUT PUCHAR *mem,
5121 IN ULONG size);
5123 NDIS_STATUS os_free_mem(
5124 IN PRTMP_ADAPTER pAd,
5125 IN PUCHAR mem);
5128 void RTMP_AllocateSharedMemory(
5129 IN PRTMP_ADAPTER pAd,
5130 IN ULONG Length,
5131 IN BOOLEAN Cached,
5132 OUT PVOID *VirtualAddress,
5133 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5135 VOID RTMPFreeTxRxRingMemory(
5136 IN PRTMP_ADAPTER pAd);
5138 NDIS_STATUS AdapterBlockAllocateMemory(
5139 IN PVOID handle,
5140 OUT PVOID *ppAd);
5142 void RTMP_AllocateTxDescMemory(
5143 IN PRTMP_ADAPTER pAd,
5144 IN UINT Index,
5145 IN ULONG Length,
5146 IN BOOLEAN Cached,
5147 OUT PVOID *VirtualAddress,
5148 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5150 void RTMP_AllocateFirstTxBuffer(
5151 IN PRTMP_ADAPTER pAd,
5152 IN UINT Index,
5153 IN ULONG Length,
5154 IN BOOLEAN Cached,
5155 OUT PVOID *VirtualAddress,
5156 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5158 void RTMP_AllocateMgmtDescMemory(
5159 IN PRTMP_ADAPTER pAd,
5160 IN ULONG Length,
5161 IN BOOLEAN Cached,
5162 OUT PVOID *VirtualAddress,
5163 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5165 void RTMP_AllocateRxDescMemory(
5166 IN PRTMP_ADAPTER pAd,
5167 IN ULONG Length,
5168 IN BOOLEAN Cached,
5169 OUT PVOID *VirtualAddress,
5170 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5172 PNDIS_PACKET RTMP_AllocateRxPacketBuffer(
5173 IN PRTMP_ADAPTER pAd,
5174 IN ULONG Length,
5175 IN BOOLEAN Cached,
5176 OUT PVOID *VirtualAddress,
5177 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5179 PNDIS_PACKET RTMP_AllocateTxPacketBuffer(
5180 IN PRTMP_ADAPTER pAd,
5181 IN ULONG Length,
5182 IN BOOLEAN Cached,
5183 OUT PVOID *VirtualAddress);
5185 PNDIS_PACKET RTMP_AllocateFragPacketBuffer(
5186 IN PRTMP_ADAPTER pAd,
5187 IN ULONG Length);
5189 void RTMP_QueryPacketInfo(
5190 IN PNDIS_PACKET pPacket,
5191 OUT PACKET_INFO *pPacketInfo,
5192 OUT PUCHAR *pSrcBufVA,
5193 OUT UINT *pSrcBufLen);
5195 void RTMP_QueryNextPacketInfo(
5196 IN PNDIS_PACKET *ppPacket,
5197 OUT PACKET_INFO *pPacketInfo,
5198 OUT PUCHAR *pSrcBufVA,
5199 OUT UINT *pSrcBufLen);
5202 BOOLEAN RTMP_FillTxBlkInfo(
5203 IN RTMP_ADAPTER *pAd,
5204 IN TX_BLK *pTxBlk);
5207 PRTMP_SCATTER_GATHER_LIST
5208 rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST *sg);
5211 void announce_802_3_packet(
5212 IN PRTMP_ADAPTER pAd,
5213 IN PNDIS_PACKET pPacket);
5216 UINT BA_Reorder_AMSDU_Annnounce(
5217 IN PRTMP_ADAPTER pAd,
5218 IN PNDIS_PACKET pPacket);
5220 PNET_DEV get_netdev_from_bssid(
5221 IN PRTMP_ADAPTER pAd,
5222 IN UCHAR FromWhichBSSID);
5225 PNDIS_PACKET duplicate_pkt(
5226 IN PRTMP_ADAPTER pAd,
5227 IN PUCHAR pHeader802_3,
5228 IN UINT HdrLen,
5229 IN PUCHAR pData,
5230 IN ULONG DataSize,
5231 IN UCHAR FromWhichBSSID);
5234 PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(
5235 IN PRTMP_ADAPTER pAd,
5236 IN PNDIS_PACKET pOldPkt);
5238 void ba_flush_reordering_timeout_mpdus(
5239 IN PRTMP_ADAPTER pAd,
5240 IN PBA_REC_ENTRY pBAEntry,
5241 IN ULONG Now32);
5244 VOID BAOriSessionSetUp(
5245 IN PRTMP_ADAPTER pAd,
5246 IN MAC_TABLE_ENTRY *pEntry,
5247 IN UCHAR TID,
5248 IN USHORT TimeOut,
5249 IN ULONG DelayTime,
5250 IN BOOLEAN isForced);
5252 VOID BASessionTearDownALL(
5253 IN OUT PRTMP_ADAPTER pAd,
5254 IN UCHAR Wcid);
5256 BOOLEAN OS_Need_Clone_Packet(void);
5259 VOID build_tx_packet(
5260 IN PRTMP_ADAPTER pAd,
5261 IN PNDIS_PACKET pPacket,
5262 IN PUCHAR pFrame,
5263 IN ULONG FrameLen);
5266 VOID BAOriSessionTearDown(
5267 IN OUT PRTMP_ADAPTER pAd,
5268 IN UCHAR Wcid,
5269 IN UCHAR TID,
5270 IN BOOLEAN bPassive,
5271 IN BOOLEAN bForceSend);
5273 VOID BARecSessionTearDown(
5274 IN OUT PRTMP_ADAPTER pAd,
5275 IN UCHAR Wcid,
5276 IN UCHAR TID,
5277 IN BOOLEAN bPassive);
5279 BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num);
5280 void ba_reordering_resource_release(PRTMP_ADAPTER pAd);
5282 BOOLEAN rtstrmactohex(
5283 IN char *s1,
5284 IN char *s2);
5286 BOOLEAN rtstrcasecmp(
5287 IN char *s1,
5288 IN char *s2);
5290 char *rtstrstruncasecmp(
5291 IN char *s1,
5292 IN char *s2);
5294 char *rtstrstr(
5295 IN const char * s1,
5296 IN const char * s2);
5298 char *rstrtok(
5299 IN char * s,
5300 IN const char * ct);
5302 int rtinet_aton(
5303 const char *cp,
5304 unsigned int *addr);
5306 ////////// common ioctl functions //////////
5307 INT Set_DriverVersion_Proc(
5308 IN PRTMP_ADAPTER pAd,
5309 IN PUCHAR arg);
5311 INT Set_CountryRegion_Proc(
5312 IN PRTMP_ADAPTER pAd,
5313 IN PUCHAR arg);
5315 INT Set_CountryRegionABand_Proc(
5316 IN PRTMP_ADAPTER pAd,
5317 IN PUCHAR arg);
5319 INT Set_WirelessMode_Proc(
5320 IN PRTMP_ADAPTER pAd,
5321 IN PUCHAR arg);
5323 INT Set_Channel_Proc(
5324 IN PRTMP_ADAPTER pAd,
5325 IN PUCHAR arg);
5327 INT Set_ShortSlot_Proc(
5328 IN PRTMP_ADAPTER pAd,
5329 IN PUCHAR arg);
5331 INT Set_TxPower_Proc(
5332 IN PRTMP_ADAPTER pAd,
5333 IN PUCHAR arg);
5335 INT Set_BGProtection_Proc(
5336 IN PRTMP_ADAPTER pAd,
5337 IN PUCHAR arg);
5339 INT Set_TxPreamble_Proc(
5340 IN PRTMP_ADAPTER pAd,
5341 IN PUCHAR arg);
5343 INT Set_RTSThreshold_Proc(
5344 IN PRTMP_ADAPTER pAd,
5345 IN PUCHAR arg);
5347 INT Set_FragThreshold_Proc(
5348 IN PRTMP_ADAPTER pAd,
5349 IN PUCHAR arg);
5351 INT Set_TxBurst_Proc(
5352 IN PRTMP_ADAPTER pAd,
5353 IN PUCHAR arg);
5355 #ifdef AGGREGATION_SUPPORT
5356 INT Set_PktAggregate_Proc(
5357 IN PRTMP_ADAPTER pAd,
5358 IN PUCHAR arg);
5359 #endif
5361 INT Set_IEEE80211H_Proc(
5362 IN PRTMP_ADAPTER pAd,
5363 IN PUCHAR arg);
5365 #ifdef DBG
5366 INT Set_Debug_Proc(
5367 IN PRTMP_ADAPTER pAd,
5368 IN PUCHAR arg);
5369 #endif
5371 INT Show_DescInfo_Proc(
5372 IN PRTMP_ADAPTER pAd,
5373 IN PUCHAR arg);
5375 INT Set_ResetStatCounter_Proc(
5376 IN PRTMP_ADAPTER pAd,
5377 IN PUCHAR arg);
5379 INT Set_BASetup_Proc(
5380 IN PRTMP_ADAPTER pAd,
5381 IN PUCHAR arg);
5383 INT Set_BADecline_Proc(
5384 IN PRTMP_ADAPTER pAd,
5385 IN PUCHAR arg);
5387 INT Set_BAOriTearDown_Proc(
5388 IN PRTMP_ADAPTER pAd,
5389 IN PUCHAR arg);
5391 INT Set_BARecTearDown_Proc(
5392 IN PRTMP_ADAPTER pAd,
5393 IN PUCHAR arg);
5395 INT Set_HtBw_Proc(
5396 IN PRTMP_ADAPTER pAd,
5397 IN PUCHAR arg);
5399 INT Set_HtMcs_Proc(
5400 IN PRTMP_ADAPTER pAd,
5401 IN PUCHAR arg);
5403 INT Set_HtGi_Proc(
5404 IN PRTMP_ADAPTER pAd,
5405 IN PUCHAR arg);
5407 INT Set_HtOpMode_Proc(
5408 IN PRTMP_ADAPTER pAd,
5409 IN PUCHAR arg);
5411 INT Set_HtStbc_Proc(
5412 IN PRTMP_ADAPTER pAd,
5413 IN PUCHAR arg);
5415 INT Set_HtHtc_Proc(
5416 IN PRTMP_ADAPTER pAd,
5417 IN PUCHAR arg);
5419 INT Set_HtExtcha_Proc(
5420 IN PRTMP_ADAPTER pAd,
5421 IN PUCHAR arg);
5423 INT Set_HtMpduDensity_Proc(
5424 IN PRTMP_ADAPTER pAd,
5425 IN PUCHAR arg);
5427 INT Set_HtBaWinSize_Proc(
5428 IN PRTMP_ADAPTER pAd,
5429 IN PUCHAR arg);
5431 INT Set_HtRdg_Proc(
5432 IN PRTMP_ADAPTER pAd,
5433 IN PUCHAR arg);
5435 INT Set_HtLinkAdapt_Proc(
5436 IN PRTMP_ADAPTER pAd,
5437 IN PUCHAR arg);
5439 INT Set_HtAmsdu_Proc(
5440 IN PRTMP_ADAPTER pAd,
5441 IN PUCHAR arg);
5443 INT Set_HtAutoBa_Proc(
5444 IN PRTMP_ADAPTER pAd,
5445 IN PUCHAR arg);
5447 INT Set_HtProtect_Proc(
5448 IN PRTMP_ADAPTER pAd,
5449 IN PUCHAR arg);
5451 INT Set_HtMimoPs_Proc(
5452 IN PRTMP_ADAPTER pAd,
5453 IN PUCHAR arg);
5456 INT Set_ForceShortGI_Proc(
5457 IN PRTMP_ADAPTER pAd,
5458 IN PUCHAR arg);
5460 INT Set_ForceGF_Proc(
5461 IN PRTMP_ADAPTER pAd,
5462 IN PUCHAR arg);
5464 INT SetCommonHT(
5465 IN PRTMP_ADAPTER pAd);
5467 INT Set_SendPSMPAction_Proc(
5468 IN PRTMP_ADAPTER pAd,
5469 IN PUCHAR arg);
5471 INT Set_HtMIMOPSmode_Proc(
5472 IN PRTMP_ADAPTER pAd,
5473 IN PUCHAR arg);
5476 INT Set_HtTxBASize_Proc(
5477 IN PRTMP_ADAPTER pAd,
5478 IN PUCHAR arg);
5480 INT WpaCheckEapCode(
5481 IN PRTMP_ADAPTER pAd,
5482 IN PUCHAR pFrame,
5483 IN USHORT FrameLen,
5484 IN USHORT OffSet);
5486 VOID WpaSendMicFailureToWpaSupplicant(
5487 IN PRTMP_ADAPTER pAd,
5488 IN BOOLEAN bUnicast);
5490 int wext_notify_event_assoc(
5491 IN RTMP_ADAPTER *pAd);
5493 BOOLEAN STARxDoneInterruptHandle(
5494 IN PRTMP_ADAPTER pAd,
5495 IN BOOLEAN argc);
5497 // AMPDU packet indication
5498 VOID Indicate_AMPDU_Packet(
5499 IN PRTMP_ADAPTER pAd,
5500 IN RX_BLK *pRxBlk,
5501 IN UCHAR FromWhichBSSID);
5503 // AMSDU packet indication
5504 VOID Indicate_AMSDU_Packet(
5505 IN PRTMP_ADAPTER pAd,
5506 IN RX_BLK *pRxBlk,
5507 IN UCHAR FromWhichBSSID);
5509 // Normal legacy Rx packet indication
5510 VOID Indicate_Legacy_Packet(
5511 IN PRTMP_ADAPTER pAd,
5512 IN RX_BLK *pRxBlk,
5513 IN UCHAR FromWhichBSSID);
5515 VOID Indicate_EAPOL_Packet(
5516 IN PRTMP_ADAPTER pAd,
5517 IN RX_BLK *pRxBlk,
5518 IN UCHAR FromWhichBSSID);
5520 void update_os_packet_info(
5521 IN PRTMP_ADAPTER pAd,
5522 IN RX_BLK *pRxBlk,
5523 IN UCHAR FromWhichBSSID);
5525 void wlan_802_11_to_802_3_packet(
5526 IN PRTMP_ADAPTER pAd,
5527 IN RX_BLK *pRxBlk,
5528 IN PUCHAR pHeader802_3,
5529 IN UCHAR FromWhichBSSID);
5531 UINT deaggregate_AMSDU_announce(
5532 IN PRTMP_ADAPTER pAd,
5533 PNDIS_PACKET pPacket,
5534 IN PUCHAR pData,
5535 IN ULONG DataSize);
5537 // remove LLC and get 802_3 Header
5538 #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \
5540 PUCHAR _pRemovedLLCSNAP = NULL, _pDA, _pSA; \
5542 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) \
5544 _pDA = _pRxBlk->pHeader->Addr3; \
5545 _pSA = (PUCHAR)_pRxBlk->pHeader + sizeof(HEADER_802_11); \
5547 else \
5549 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_INFRA)) \
5551 _pDA = _pRxBlk->pHeader->Addr1; \
5552 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_DLS)) \
5553 _pSA = _pRxBlk->pHeader->Addr2; \
5554 else \
5555 _pSA = _pRxBlk->pHeader->Addr3; \
5557 else \
5559 _pDA = _pRxBlk->pHeader->Addr1; \
5560 _pSA = _pRxBlk->pHeader->Addr2; \
5564 CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \
5565 _pRxBlk->DataSize, _pRemovedLLCSNAP); \
5568 VOID Sta_Announce_or_Forward_802_3_Packet(
5569 IN PRTMP_ADAPTER pAd,
5570 IN PNDIS_PACKET pPacket,
5571 IN UCHAR FromWhichBSSID);
5573 #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\
5574 Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS);
5575 //announce_802_3_packet(_pAd, _pPacket);
5577 PNDIS_PACKET DuplicatePacket(
5578 IN PRTMP_ADAPTER pAd,
5579 IN PNDIS_PACKET pPacket,
5580 IN UCHAR FromWhichBSSID);
5583 PNDIS_PACKET ClonePacket(
5584 IN PRTMP_ADAPTER pAd,
5585 IN PNDIS_PACKET pPacket,
5586 IN PUCHAR pData,
5587 IN ULONG DataSize);
5590 // Normal, AMPDU or AMSDU
5591 VOID CmmRxnonRalinkFrameIndicate(
5592 IN PRTMP_ADAPTER pAd,
5593 IN RX_BLK *pRxBlk,
5594 IN UCHAR FromWhichBSSID);
5596 VOID CmmRxRalinkFrameIndicate(
5597 IN PRTMP_ADAPTER pAd,
5598 IN MAC_TABLE_ENTRY *pEntry,
5599 IN RX_BLK *pRxBlk,
5600 IN UCHAR FromWhichBSSID);
5602 VOID Update_Rssi_Sample(
5603 IN PRTMP_ADAPTER pAd,
5604 IN RSSI_SAMPLE *pRssi,
5605 IN PRXWI_STRUC pRxWI);
5607 PNDIS_PACKET RTMPDeFragmentDataFrame(
5608 IN PRTMP_ADAPTER pAd,
5609 IN RX_BLK *pRxBlk);
5611 ////////////////////////////////////////
5612 enum {
5613 DIDmsg_lnxind_wlansniffrm = 0x00000044,
5614 DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044,
5615 DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044,
5616 DIDmsg_lnxind_wlansniffrm_channel = 0x00030044,
5617 DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044,
5618 DIDmsg_lnxind_wlansniffrm_sq = 0x00050044,
5619 DIDmsg_lnxind_wlansniffrm_signal = 0x00060044,
5620 DIDmsg_lnxind_wlansniffrm_noise = 0x00070044,
5621 DIDmsg_lnxind_wlansniffrm_rate = 0x00080044,
5622 DIDmsg_lnxind_wlansniffrm_istx = 0x00090044,
5623 DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044
5625 enum {
5626 P80211ENUM_msgitem_status_no_value = 0x00
5628 enum {
5629 P80211ENUM_truth_false = 0x00,
5630 P80211ENUM_truth_true = 0x01
5633 /* Definition from madwifi */
5634 typedef struct {
5635 UINT32 did;
5636 UINT16 status;
5637 UINT16 len;
5638 UINT32 data;
5639 } p80211item_uint32_t;
5641 typedef struct {
5642 UINT32 msgcode;
5643 UINT32 msglen;
5644 #define WLAN_DEVNAMELEN_MAX 16
5645 UINT8 devname[WLAN_DEVNAMELEN_MAX];
5646 p80211item_uint32_t hosttime;
5647 p80211item_uint32_t mactime;
5648 p80211item_uint32_t channel;
5649 p80211item_uint32_t rssi;
5650 p80211item_uint32_t sq;
5651 p80211item_uint32_t signal;
5652 p80211item_uint32_t noise;
5653 p80211item_uint32_t rate;
5654 p80211item_uint32_t istx;
5655 p80211item_uint32_t frmlen;
5656 } wlan_ng_prism2_header;
5658 /* The radio capture header precedes the 802.11 header. */
5659 typedef struct PACKED _ieee80211_radiotap_header {
5660 UINT8 it_version; /* Version 0. Only increases
5661 * for drastic changes,
5662 * introduction of compatible
5663 * new fields does not count.
5665 UINT8 it_pad;
5666 UINT16 it_len; /* length of the whole
5667 * header in bytes, including
5668 * it_version, it_pad,
5669 * it_len, and data fields.
5671 UINT32 it_present; /* A bitmap telling which
5672 * fields are present. Set bit 31
5673 * (0x80000000) to extend the
5674 * bitmap by another 32 bits.
5675 * Additional extensions are made
5676 * by setting bit 31.
5678 }ieee80211_radiotap_header ;
5680 enum ieee80211_radiotap_type {
5681 IEEE80211_RADIOTAP_TSFT = 0,
5682 IEEE80211_RADIOTAP_FLAGS = 1,
5683 IEEE80211_RADIOTAP_RATE = 2,
5684 IEEE80211_RADIOTAP_CHANNEL = 3,
5685 IEEE80211_RADIOTAP_FHSS = 4,
5686 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
5687 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
5688 IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
5689 IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
5690 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
5691 IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
5692 IEEE80211_RADIOTAP_ANTENNA = 11,
5693 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
5694 IEEE80211_RADIOTAP_DB_ANTNOISE = 13
5697 #define WLAN_RADIOTAP_PRESENT ( \
5698 (1 << IEEE80211_RADIOTAP_TSFT) | \
5699 (1 << IEEE80211_RADIOTAP_FLAGS) | \
5700 (1 << IEEE80211_RADIOTAP_RATE) | \
5703 typedef struct _wlan_radiotap_header {
5704 ieee80211_radiotap_header wt_ihdr;
5705 INT64 wt_tsft;
5706 UINT8 wt_flags;
5707 UINT8 wt_rate;
5708 } wlan_radiotap_header;
5709 /* Definition from madwifi */
5711 void send_monitor_packets(
5712 IN PRTMP_ADAPTER pAd,
5713 IN RX_BLK *pRxBlk);
5715 // This function will be called when query /proc
5716 struct iw_statistics *rt28xx_get_wireless_stats(
5717 IN struct net_device *net_dev);
5719 VOID RTMPSetDesiredRates(
5720 IN PRTMP_ADAPTER pAdapter,
5721 IN LONG Rates);
5723 INT Set_FixedTxMode_Proc(
5724 IN PRTMP_ADAPTER pAd,
5725 IN PUCHAR arg);
5727 static inline char* GetPhyMode(
5728 int Mode)
5730 switch(Mode)
5732 case MODE_CCK:
5733 return "CCK";
5735 case MODE_OFDM:
5736 return "OFDM";
5737 case MODE_HTMIX:
5738 return "HTMIX";
5740 case MODE_HTGREENFIELD:
5741 return "GREEN";
5742 default:
5743 return "N/A";
5748 static inline char* GetBW(
5749 int BW)
5751 switch(BW)
5753 case BW_10:
5754 return "10M";
5756 case BW_20:
5757 return "20M";
5758 case BW_40:
5759 return "40M";
5760 default:
5761 return "N/A";
5766 VOID RT28xxThreadTerminate(
5767 IN RTMP_ADAPTER *pAd);
5769 BOOLEAN RT28XXChipsetCheck(
5770 IN void *_dev_p);
5772 BOOLEAN RT28XXNetDevInit(
5773 IN void *_dev_p,
5774 IN struct net_device *net_dev,
5775 IN RTMP_ADAPTER *pAd);
5777 BOOLEAN RT28XXProbePostConfig(
5778 IN void *_dev_p,
5779 IN RTMP_ADAPTER *pAd,
5780 IN INT32 argc);
5782 VOID RT28XXDMADisable(
5783 IN RTMP_ADAPTER *pAd);
5785 VOID RT28XXDMAEnable(
5786 IN RTMP_ADAPTER *pAd);
5788 VOID RT28xx_UpdateBeaconToAsic(
5789 IN RTMP_ADAPTER * pAd,
5790 IN INT apidx,
5791 IN ULONG BeaconLen,
5792 IN ULONG UpdatePos);
5794 INT rt28xx_sta_ioctl(
5795 IN struct net_device *net_dev,
5796 IN OUT struct ifreq *rq,
5797 IN INT cmd);
5799 ////////////////////////////////////////
5800 PNDIS_PACKET GetPacketFromRxRing(
5801 IN PRTMP_ADAPTER pAd,
5802 OUT PRT28XX_RXD_STRUC pSaveRxD,
5803 OUT BOOLEAN *pbReschedule,
5804 IN OUT UINT32 *pRxPending);
5807 void kill_thread_task(PRTMP_ADAPTER pAd);
5809 void tbtt_tasklet(unsigned long data);
5811 #ifdef RT2860
5813 // Function Prototype in cmm_data_2860.c
5815 USHORT RtmpPCI_WriteTxResource(
5816 IN PRTMP_ADAPTER pAd,
5817 IN TX_BLK *pTxBlk,
5818 IN BOOLEAN bIsLast,
5819 OUT USHORT *FreeNumber);
5821 USHORT RtmpPCI_WriteSingleTxResource(
5822 IN PRTMP_ADAPTER pAd,
5823 IN TX_BLK *pTxBlk,
5824 IN BOOLEAN bIsLast,
5825 OUT USHORT *FreeNumber);
5827 USHORT RtmpPCI_WriteMultiTxResource(
5828 IN PRTMP_ADAPTER pAd,
5829 IN TX_BLK *pTxBlk,
5830 IN UCHAR frameNum,
5831 OUT USHORT *FreeNumber);
5833 USHORT RtmpPCI_WriteFragTxResource(
5834 IN PRTMP_ADAPTER pAd,
5835 IN TX_BLK *pTxBlk,
5836 IN UCHAR fragNum,
5837 OUT USHORT *FreeNumber);
5839 USHORT RtmpPCI_WriteSubTxResource(
5840 IN PRTMP_ADAPTER pAd,
5841 IN TX_BLK *pTxBlk,
5842 IN BOOLEAN bIsLast,
5843 OUT USHORT *FreeNumber);
5845 VOID RtmpPCI_FinalWriteTxResource(
5846 IN PRTMP_ADAPTER pAd,
5847 IN TX_BLK *pTxBlk,
5848 IN USHORT totalMPDUSize,
5849 IN USHORT FirstTxIdx);
5851 VOID RtmpPCIDataLastTxIdx(
5852 IN PRTMP_ADAPTER pAd,
5853 IN UCHAR QueIdx,
5854 IN USHORT LastTxIdx);
5856 VOID RtmpPCIDataKickOut(
5857 IN PRTMP_ADAPTER pAd,
5858 IN TX_BLK *pTxBlk,
5859 IN UCHAR QueIdx);
5862 int RtmpPCIMgmtKickOut(
5863 IN RTMP_ADAPTER *pAd,
5864 IN UCHAR QueIdx,
5865 IN PNDIS_PACKET pPacket,
5866 IN PUCHAR pSrcBufVA,
5867 IN UINT SrcBufLen);
5870 NDIS_STATUS RTMPCheckRxError(
5871 IN PRTMP_ADAPTER pAd,
5872 IN PHEADER_802_11 pHeader,
5873 IN PRXWI_STRUC pRxWI,
5874 IN PRT28XX_RXD_STRUC pRxD);
5876 VOID RTMPInitPCIeLinkCtrlValue(
5877 IN PRTMP_ADAPTER pAd);
5879 VOID RTMPFindHostPCIDev(
5880 IN PRTMP_ADAPTER pAd);
5882 VOID RTMPPCIeLinkCtrlValueRestore(
5883 IN PRTMP_ADAPTER pAd,
5884 IN UCHAR Level);
5886 VOID RTMPPCIeLinkCtrlSetting(
5887 IN PRTMP_ADAPTER pAd,
5888 IN USHORT Max);
5890 VOID RT28xxPciAsicRadioOff(
5891 IN PRTMP_ADAPTER pAd,
5892 IN UCHAR Level,
5893 IN USHORT TbttNumToNextWakeUp);
5895 BOOLEAN RT28xxPciAsicRadioOn(
5896 IN PRTMP_ADAPTER pAd,
5897 IN UCHAR Level);
5899 VOID RT28xxPciStaAsicForceWakeup(
5900 IN PRTMP_ADAPTER pAd,
5901 IN UCHAR Level);
5903 VOID RT28xxPciStaAsicSleepThenAutoWakeup(
5904 IN PRTMP_ADAPTER pAd,
5905 IN USHORT TbttNumToNextWakeUp);
5907 VOID PsPollWakeExec(
5908 IN PVOID SystemSpecific1,
5909 IN PVOID FunctionContext,
5910 IN PVOID SystemSpecific2,
5911 IN PVOID SystemSpecific3);
5913 VOID RadioOnExec(
5914 IN PVOID SystemSpecific1,
5915 IN PVOID FunctionContext,
5916 IN PVOID SystemSpecific2,
5917 IN PVOID SystemSpecific3);
5919 VOID RT28xxPciMlmeRadioOn(
5920 IN PRTMP_ADAPTER pAd);
5922 VOID RT28xxPciMlmeRadioOFF(
5923 IN PRTMP_ADAPTER pAd);
5924 #endif /* RT2860 */
5926 VOID AsicTurnOffRFClk(
5927 IN PRTMP_ADAPTER pAd,
5928 IN UCHAR Channel);
5930 VOID AsicTurnOnRFClk(
5931 IN PRTMP_ADAPTER pAd,
5932 IN UCHAR Channel);
5934 NTSTATUS RT30xxWriteRFRegister(
5935 IN PRTMP_ADAPTER pAd,
5936 IN UCHAR RegID,
5937 IN UCHAR Value);
5939 NTSTATUS RT30xxReadRFRegister(
5940 IN PRTMP_ADAPTER pAd,
5941 IN UCHAR RegID,
5942 IN PUCHAR pValue);
5944 UCHAR eFuseReadRegisters(
5945 IN PRTMP_ADAPTER pAd,
5946 IN USHORT Offset,
5947 IN USHORT Length,
5948 OUT USHORT* pData);
5950 VOID eFuseReadPhysical(
5951 IN PRTMP_ADAPTER pAd,
5952 IN PUSHORT lpInBuffer,
5953 IN ULONG nInBufferSize,
5954 OUT PUSHORT lpOutBuffer,
5955 IN ULONG nOutBufferSize
5958 NTSTATUS eFuseRead(
5959 IN PRTMP_ADAPTER pAd,
5960 IN USHORT Offset,
5961 OUT PUCHAR pData,
5962 IN USHORT Length);
5964 VOID eFusePhysicalWriteRegisters(
5965 IN PRTMP_ADAPTER pAd,
5966 IN USHORT Offset,
5967 IN USHORT Length,
5968 OUT USHORT* pData);
5970 NTSTATUS eFuseWriteRegisters(
5971 IN PRTMP_ADAPTER pAd,
5972 IN USHORT Offset,
5973 IN USHORT Length,
5974 IN USHORT* pData);
5976 VOID eFuseWritePhysical(
5977 IN PRTMP_ADAPTER pAd,
5978 PUSHORT lpInBuffer,
5979 ULONG nInBufferSize,
5980 PUCHAR lpOutBuffer,
5981 ULONG nOutBufferSize
5984 NTSTATUS eFuseWrite(
5985 IN PRTMP_ADAPTER pAd,
5986 IN USHORT Offset,
5987 IN PUCHAR pData,
5988 IN USHORT length);
5990 INT set_eFuseGetFreeBlockCount_Proc(
5991 IN PRTMP_ADAPTER pAd,
5992 IN PUCHAR arg);
5994 INT set_eFusedump_Proc(
5995 IN PRTMP_ADAPTER pAd,
5996 IN PUCHAR arg);
5998 INT set_eFuseLoadFromBin_Proc(
5999 IN PRTMP_ADAPTER pAd,
6000 IN PUCHAR arg);
6002 NTSTATUS eFuseWriteRegistersFromBin(
6003 IN PRTMP_ADAPTER pAd,
6004 IN USHORT Offset,
6005 IN USHORT Length,
6006 IN USHORT* pData);
6008 VOID eFusePhysicalReadRegisters(
6009 IN PRTMP_ADAPTER pAd,
6010 IN USHORT Offset,
6011 IN USHORT Length,
6012 OUT USHORT* pData);
6014 VOID RT30xxLoadRFNormalModeSetup(
6015 IN PRTMP_ADAPTER pAd);
6017 VOID RT30xxLoadRFSleepModeSetup(
6018 IN PRTMP_ADAPTER pAd);
6020 VOID RT30xxReverseRFSleepModeSetup(
6021 IN PRTMP_ADAPTER pAd);
6023 #ifdef RT2870
6025 // Function Prototype in rtusb_bulk.c
6027 VOID RTUSBInitTxDesc(
6028 IN PRTMP_ADAPTER pAd,
6029 IN PTX_CONTEXT pTxContext,
6030 IN UCHAR BulkOutPipeId,
6031 IN usb_complete_t Func);
6033 VOID RTUSBInitHTTxDesc(
6034 IN PRTMP_ADAPTER pAd,
6035 IN PHT_TX_CONTEXT pTxContext,
6036 IN UCHAR BulkOutPipeId,
6037 IN ULONG BulkOutSize,
6038 IN usb_complete_t Func);
6040 VOID RTUSBCleanUpDataBulkOutQueue(
6041 IN PRTMP_ADAPTER pAd);
6043 VOID RTUSBCancelPendingBulkOutIRP(
6044 IN PRTMP_ADAPTER pAd);
6046 VOID RTUSBBulkOutDataPacket(
6047 IN PRTMP_ADAPTER pAd,
6048 IN UCHAR BulkOutPipeId,
6049 IN UCHAR Index);
6051 VOID RTUSBBulkOutNullFrame(
6052 IN PRTMP_ADAPTER pAd);
6054 VOID RTUSBBulkOutRTSFrame(
6055 IN PRTMP_ADAPTER pAd);
6057 VOID RTUSBCancelPendingBulkInIRP(
6058 IN PRTMP_ADAPTER pAd);
6060 VOID RTUSBCancelPendingIRPs(
6061 IN PRTMP_ADAPTER pAd);
6063 VOID RTUSBBulkOutMLMEPacket(
6064 IN PRTMP_ADAPTER pAd,
6065 IN UCHAR Index);
6067 VOID RTUSBBulkOutPsPoll(
6068 IN PRTMP_ADAPTER pAd);
6070 VOID RTUSBCleanUpMLMEBulkOutQueue(
6071 IN PRTMP_ADAPTER pAd);
6073 VOID RTUSBKickBulkOut(
6074 IN PRTMP_ADAPTER pAd);
6076 VOID RTUSBBulkReceive(
6077 IN PRTMP_ADAPTER pAd);
6079 VOID DoBulkIn(
6080 IN RTMP_ADAPTER *pAd);
6082 VOID RTUSBInitRxDesc(
6083 IN PRTMP_ADAPTER pAd,
6084 IN PRX_CONTEXT pRxContext);
6087 // Function Prototype in rtusb_io.c
6089 NTSTATUS RTUSBMultiRead(
6090 IN PRTMP_ADAPTER pAd,
6091 IN USHORT Offset,
6092 OUT PUCHAR pData,
6093 IN USHORT length);
6095 NTSTATUS RTUSBMultiWrite(
6096 IN PRTMP_ADAPTER pAd,
6097 IN USHORT Offset,
6098 IN PUCHAR pData,
6099 IN USHORT length);
6101 NTSTATUS RTUSBMultiWrite_OneByte(
6102 IN PRTMP_ADAPTER pAd,
6103 IN USHORT Offset,
6104 IN PUCHAR pData);
6106 NTSTATUS RTUSBReadBBPRegister(
6107 IN PRTMP_ADAPTER pAd,
6108 IN UCHAR Id,
6109 IN PUCHAR pValue);
6111 NTSTATUS RTUSBWriteBBPRegister(
6112 IN PRTMP_ADAPTER pAd,
6113 IN UCHAR Id,
6114 IN UCHAR Value);
6116 NTSTATUS RTUSBWriteRFRegister(
6117 IN PRTMP_ADAPTER pAd,
6118 IN UINT32 Value);
6120 NTSTATUS RTUSB_VendorRequest(
6121 IN PRTMP_ADAPTER pAd,
6122 IN UINT32 TransferFlags,
6123 IN UCHAR ReservedBits,
6124 IN UCHAR Request,
6125 IN USHORT Value,
6126 IN USHORT Index,
6127 IN PVOID TransferBuffer,
6128 IN UINT32 TransferBufferLength);
6130 NTSTATUS RTUSBReadEEPROM(
6131 IN PRTMP_ADAPTER pAd,
6132 IN USHORT Offset,
6133 OUT PUCHAR pData,
6134 IN USHORT length);
6136 NTSTATUS RTUSBWriteEEPROM(
6137 IN PRTMP_ADAPTER pAd,
6138 IN USHORT Offset,
6139 IN PUCHAR pData,
6140 IN USHORT length);
6142 VOID RTUSBPutToSleep(
6143 IN PRTMP_ADAPTER pAd);
6145 NTSTATUS RTUSBWakeUp(
6146 IN PRTMP_ADAPTER pAd);
6148 VOID RTUSBInitializeCmdQ(
6149 IN PCmdQ cmdq);
6151 NDIS_STATUS RTUSBEnqueueCmdFromNdis(
6152 IN PRTMP_ADAPTER pAd,
6153 IN NDIS_OID Oid,
6154 IN BOOLEAN SetInformation,
6155 IN PVOID pInformationBuffer,
6156 IN UINT32 InformationBufferLength);
6158 NDIS_STATUS RTUSBEnqueueInternalCmd(
6159 IN PRTMP_ADAPTER pAd,
6160 IN NDIS_OID Oid,
6161 IN PVOID pInformationBuffer,
6162 IN UINT32 InformationBufferLength);
6164 VOID RTUSBDequeueCmd(
6165 IN PCmdQ cmdq,
6166 OUT PCmdQElmt *pcmdqelmt);
6168 INT RTUSBCmdThread(
6169 IN OUT PVOID Context);
6171 INT TimerQThread(
6172 IN OUT PVOID Context);
6174 RT2870_TIMER_ENTRY *RT2870_TimerQ_Insert(
6175 IN RTMP_ADAPTER *pAd,
6176 IN RALINK_TIMER_STRUCT *pTimer);
6178 BOOLEAN RT2870_TimerQ_Remove(
6179 IN RTMP_ADAPTER *pAd,
6180 IN RALINK_TIMER_STRUCT *pTimer);
6182 void RT2870_TimerQ_Exit(
6183 IN RTMP_ADAPTER *pAd);
6185 void RT2870_TimerQ_Init(
6186 IN RTMP_ADAPTER *pAd);
6188 VOID RT2870_BssBeaconExit(
6189 IN RTMP_ADAPTER *pAd);
6191 VOID RT2870_BssBeaconStop(
6192 IN RTMP_ADAPTER *pAd);
6194 VOID RT2870_BssBeaconStart(
6195 IN RTMP_ADAPTER * pAd);
6197 VOID RT2870_BssBeaconInit(
6198 IN RTMP_ADAPTER *pAd);
6200 VOID RT2870_WatchDog(
6201 IN RTMP_ADAPTER *pAd);
6203 NTSTATUS RTUSBWriteMACRegister(
6204 IN PRTMP_ADAPTER pAd,
6205 IN USHORT Offset,
6206 IN UINT32 Value);
6208 NTSTATUS RTUSBReadMACRegister(
6209 IN PRTMP_ADAPTER pAd,
6210 IN USHORT Offset,
6211 OUT PUINT32 pValue);
6213 NTSTATUS RTUSBSingleWrite(
6214 IN RTMP_ADAPTER *pAd,
6215 IN USHORT Offset,
6216 IN USHORT Value);
6218 NTSTATUS RTUSBFirmwareRun(
6219 IN PRTMP_ADAPTER pAd);
6221 NTSTATUS RTUSBFirmwareWrite(
6222 IN PRTMP_ADAPTER pAd,
6223 IN PUCHAR pFwImage,
6224 IN ULONG FwLen);
6226 NTSTATUS RTUSBFirmwareOpmode(
6227 IN PRTMP_ADAPTER pAd,
6228 OUT PUINT32 pValue);
6230 NTSTATUS RTUSBVenderReset(
6231 IN PRTMP_ADAPTER pAd);
6233 VOID CMDHandler(
6234 IN PRTMP_ADAPTER pAd);
6237 NDIS_STATUS CreateThreads(
6238 IN struct net_device *net_dev );
6241 VOID MacTableInitialize(
6242 IN PRTMP_ADAPTER pAd);
6244 VOID MlmeSetPsm(
6245 IN PRTMP_ADAPTER pAd,
6246 IN USHORT psm);
6248 NDIS_STATUS RTMPWPAAddKeyProc(
6249 IN PRTMP_ADAPTER pAd,
6250 IN PVOID pBuf);
6252 VOID AsicRxAntEvalAction(
6253 IN PRTMP_ADAPTER pAd);
6255 NDIS_STATUS RTMPCheckRxError(
6256 IN PRTMP_ADAPTER pAd,
6257 IN PHEADER_802_11 pHeader,
6258 IN PRXWI_STRUC pRxWI,
6259 IN PRT28XX_RXD_STRUC pRxINFO);
6261 INT MlmeThread(
6262 IN PVOID Context);
6265 // Function Prototype in rtusb_data.c
6267 NDIS_STATUS RTUSBFreeDescriptorRequest(
6268 IN PRTMP_ADAPTER pAd,
6269 IN UCHAR BulkOutPipeId,
6270 IN UINT32 NumberRequired);
6273 BOOLEAN RTUSBNeedQueueBackForAgg(
6274 IN RTMP_ADAPTER *pAd,
6275 IN UCHAR BulkOutPipeId);
6278 VOID RTMPWriteTxInfo(
6279 IN PRTMP_ADAPTER pAd,
6280 IN PTXINFO_STRUC pTxInfo,
6281 IN USHORT USBDMApktLen,
6282 IN BOOLEAN bWiv,
6283 IN UCHAR QueueSel,
6284 IN UCHAR NextValid,
6285 IN UCHAR TxBurst);
6288 // Function Prototype in cmm_data_2870.c
6290 USHORT RtmpUSB_WriteSubTxResource(
6291 IN PRTMP_ADAPTER pAd,
6292 IN TX_BLK *pTxBlk,
6293 IN BOOLEAN bIsLast,
6294 OUT USHORT *FreeNumber);
6296 USHORT RtmpUSB_WriteSingleTxResource(
6297 IN PRTMP_ADAPTER pAd,
6298 IN TX_BLK *pTxBlk,
6299 IN BOOLEAN bIsLast,
6300 OUT USHORT *FreeNumber);
6302 USHORT RtmpUSB_WriteFragTxResource(
6303 IN PRTMP_ADAPTER pAd,
6304 IN TX_BLK *pTxBlk,
6305 IN UCHAR fragNum,
6306 OUT USHORT *FreeNumber);
6308 USHORT RtmpUSB_WriteMultiTxResource(
6309 IN PRTMP_ADAPTER pAd,
6310 IN TX_BLK *pTxBlk,
6311 IN UCHAR frameNum,
6312 OUT USHORT *FreeNumber);
6314 VOID RtmpUSB_FinalWriteTxResource(
6315 IN PRTMP_ADAPTER pAd,
6316 IN TX_BLK *pTxBlk,
6317 IN USHORT totalMPDUSize,
6318 #ifdef RT2860
6319 IN USHORT FirstTxIdx);
6320 #endif
6321 IN USHORT TxIdx);
6323 VOID RtmpUSBDataLastTxIdx(
6324 IN PRTMP_ADAPTER pAd,
6325 IN UCHAR QueIdx,
6326 IN USHORT TxIdx);
6328 VOID RtmpUSBDataKickOut(
6329 IN PRTMP_ADAPTER pAd,
6330 IN TX_BLK *pTxBlk,
6331 IN UCHAR QueIdx);
6334 int RtmpUSBMgmtKickOut(
6335 IN RTMP_ADAPTER *pAd,
6336 IN UCHAR QueIdx,
6337 IN PNDIS_PACKET pPacket,
6338 IN PUCHAR pSrcBufVA,
6339 IN UINT SrcBufLen);
6341 VOID RtmpUSBNullFrameKickOut(
6342 IN RTMP_ADAPTER *pAd,
6343 IN UCHAR QueIdx,
6344 IN UCHAR *pNullFrame,
6345 IN UINT32 frameLen);
6347 VOID RT28xxUsbStaAsicForceWakeup(
6348 IN PRTMP_ADAPTER pAd,
6349 IN BOOLEAN bFromTx);
6351 VOID RT28xxUsbStaAsicSleepThenAutoWakeup(
6352 IN PRTMP_ADAPTER pAd,
6353 IN USHORT TbttNumToNextWakeUp);
6355 VOID RT28xxUsbMlmeRadioOn(
6356 IN PRTMP_ADAPTER pAd);
6358 VOID RT28xxUsbMlmeRadioOFF(
6359 IN PRTMP_ADAPTER pAd);
6360 #endif // RT2870 //
6362 INT RTMPShowCfgValue(
6363 IN PRTMP_ADAPTER pAd,
6364 IN PUCHAR pName,
6365 IN PUCHAR pBuf);
6367 PCHAR RTMPGetRalinkAuthModeStr(
6368 IN NDIS_802_11_AUTHENTICATION_MODE authMode);
6370 PCHAR RTMPGetRalinkEncryModeStr(
6371 IN USHORT encryMode);
6373 VOID AsicStaBbpTuning(
6374 IN PRTMP_ADAPTER pAd);
6376 #ifdef RT2860
6377 VOID AsicResetFromDMABusy(
6378 IN PRTMP_ADAPTER pAd);
6380 VOID AsicResetBBP(
6381 IN PRTMP_ADAPTER pAd);
6383 VOID AsicResetMAC(
6384 IN PRTMP_ADAPTER pAd);
6386 VOID AsicResetPBF(
6387 IN PRTMP_ADAPTER pAd);
6388 #endif
6389 #ifdef RT2870
6390 BOOLEAN StaAddMacTableEntry(
6391 IN PRTMP_ADAPTER pAd,
6392 IN PMAC_TABLE_ENTRY pEntry,
6393 IN UCHAR MaxSupportedRateIn500Kbps,
6394 IN HT_CAPABILITY_IE *pHtCapability,
6395 IN UCHAR HtCapabilityLen,
6396 IN USHORT CapabilityInfo);
6397 #endif
6399 void RTMP_IndicateMediaState(
6400 IN PRTMP_ADAPTER pAd);
6402 VOID ReSyncBeaconTime(
6403 IN PRTMP_ADAPTER pAd);
6405 VOID RTMPSetAGCInitValue(
6406 IN PRTMP_ADAPTER pAd,
6407 IN UCHAR BandWidth);
6409 int rt28xx_close(IN PNET_DEV dev);
6410 int rt28xx_open(IN PNET_DEV dev);
6412 __inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd)
6414 if (VIRTUAL_IF_NUM(pAd) == 0)
6416 if (rt28xx_open(pAd->net_dev) != 0)
6417 return -1;
6419 else
6422 VIRTUAL_IF_INC(pAd);
6423 return 0;
6426 __inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd)
6428 VIRTUAL_IF_DEC(pAd);
6429 if (VIRTUAL_IF_NUM(pAd) == 0)
6430 rt28xx_close(pAd->net_dev);
6431 return;
6435 #endif // __RTMP_H__