2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
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. *
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. *
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. *
25 *************************************************************************
31 Miniport generic portion header file
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
43 #include "spectrum_def.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)
52 ////////////////////////////////////////////////////////////////////////////
53 // The TX_BUFFER structure forms the transmitted USB packet to the device
54 ////////////////////////////////////////////////////////////////////////////
55 typedef struct __TX_BUFFER
{
57 UCHAR WirelessPacket
[TX_BUFFER_NORMSIZE
];
58 HEADER_802_11 NullFrame
;
59 PSPOLL_FRAME PsPollPacket
;
62 UCHAR Aggregation
[4]; //Buffer for save Aggregation size.
63 } TX_BUFFER
, *PTX_BUFFER
;
65 typedef struct __HTTX_BUFFER
{
67 UCHAR WirelessPacket
[MAX_TXBULK_SIZE
];
68 HEADER_802_11 NullFrame
;
69 PSPOLL_FRAME PsPollPacket
;
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
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.
92 BOOLEAN bAggregatible
;
93 UCHAR Header_802_3
[LENGTH_802_3
];
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
116 BOOLEAN bCopySavePad
;
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
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
;
136 PIRP pIrp
;//used to cancel pending bulk in.
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
145 NDIS_SPIN_LOCK RxContextLock
;
146 dma_addr_t data_dma
; // urb dma on linux
147 } RX_CONTEXT
, *PRX_CONTEXT
;
152 // NDIS Version definitions
154 #ifdef NDIS50_MINIPORT
155 #define RTMP_NDIS_MAJOR_VERSION 5
156 #define RTMP_NDIS_MINOR_VERSION 0
159 #ifdef NDIS51_MINIPORT
160 #define RTMP_NDIS_MAJOR_VERSION 5
161 #define RTMP_NDIS_MINOR_VERSION 1
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];
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
;
220 extern UCHAR SupRateIe
;
221 extern UCHAR ExtRateIe
;
223 extern UCHAR HtCapIe
;
224 extern UCHAR AddHtInfoIe
;
225 extern UCHAR NewExtChanIe
;
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 */
269 struct reordering_list
271 struct reordering_mpdu
*next
;
275 struct reordering_mpdu_pool
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
295 // Queue structure and macros
297 typedef struct _QUEUE_ENTRY
{
298 struct _QUEUE_ENTRY
*Next
;
299 } QUEUE_ENTRY
, *PQUEUE_ENTRY
;
302 typedef struct _QUEUE_HEADER
{
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; \
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); \
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))
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))
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); \
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))
398 #define IS_RT3090(_pAd) 0
400 #define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30700000)
402 #define IS_RT3071(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30710000)
403 #define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000)
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); \
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
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) \
432 while (++_tsc[i] == 0x0) \
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,
473 // PRTMP_ADAPTER pAd,
474 // ULONG Register_Offset,
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
485 #define RTMP_RF_IO_WRITE32(_A, _V) \
487 PHY_CSR4_STRUC Value; \
489 if ((_A)->bPCIclkOff) \
494 RTMP_IO_READ32(_A, RF_CSR_CFG0, &Value.word); \
495 if (Value.field.Busy == IDLE) \
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; \
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) \
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) \
528 if ((BbpCsr.field.Busy == IDLE) && \
529 (BbpCsr.field.RegNum == _I)) \
531 *(_pV) = (UCHAR)BbpCsr.field.Value; \
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; \
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) \
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) \
571 if ((BbpCsr.field.Busy == IDLE) && \
572 (BbpCsr.field.RegNum == _I)) \
574 *(_pV) = (UCHAR)BbpCsr.field.Value; \
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; \
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) \
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; \
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; \
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) \
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; \
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); \
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)
658 #define MAP_CHANNEL_ID_TO_KHZ(ch, khz) { \
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) { \
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
{
779 } RTMP_SCATTER_GATHER_ELEMENT
, *PRTMP_SCATTER_GATHER_ELEMENT
;
782 typedef struct _RTMP_SCATTER_GATHER_LIST
{
783 ULONG NumberOfElements
;
785 RTMP_SCATTER_GATHER_ELEMENT Elements
[NIC_MAX_PHYS_BUF_COUNT
];
786 } RTMP_SCATTER_GATHER_LIST
, *PRTMP_SCATTER_GATHER_LIST
;
789 // Some utility macros
792 #define min(_a, _b) (((_a) < (_b)) ? (_a) : (_b))
796 #define max(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
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; \
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; \
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
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) \
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); \
882 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \
883 _pRemovedLLCSNAP = _pData; \
884 _DataSize -= LENGTH_802_1_H; \
885 _pData += LENGTH_802_1_H; \
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) \
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
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); \
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); \
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) \
930 if (_pAd->RxAnt.EvaluatePeriod == 0) \
932 UsedAnt = _pAd->RxAnt.Pair1PrimaryRxAnt; \
933 AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \
935 AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \
937 AvgRssi = _rssi1 << 3; \
938 _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \
942 UsedAnt = _pAd->RxAnt.Pair1SecondaryRxAnt; \
943 AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \
944 if ((AvgRssi < 0) && (_pAd->RxAnt.FirstPktArrivedWhenEvaluate)) \
945 AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \
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))
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); \
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); \
988 // Register set pair for initialzation register set definition
990 typedef struct _RTMP_REG_PAIR
994 } RTMP_REG_PAIR
, *PRTMP_REG_PAIR
;
996 typedef struct _REG_PAIR
1000 } REG_PAIR
, *PREG_PAIR
;
1003 // Register set pair for initialzation register set definition
1005 typedef struct _RTMP_RF_REGS
1012 } RTMP_RF_REGS
, *PRTMP_RF_REGS
;
1014 typedef struct _FREQUENCY_ITEM
{
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
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
{
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
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
1055 NDIS_PHYSICAL_ADDRESS AllocPa
; // TxBuf physical address
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
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
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
];
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
];
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
];
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
1126 ULONG GoodTransmits
;
1133 ULONG RcvAlignmentErrors
;
1135 ULONG MoreCollisions
;
1137 } COUNTER_802_3
, *PCOUNTER_802_3
;
1139 typedef struct _COUNTER_802_11
{
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
1159 ULONG LastReceivedByteCount
;
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
;
1168 ULONG RxRingErrCount
;
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
;
1184 ULONG OneSecTransmittedByteCount
; // both successful and failure, used to calculate TX throughput
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
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
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
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
1262 USHORT STBC
:2; //SPACE
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
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
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
{
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
1299 UCHAR EvaluateStableCnt
;
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
1318 UCHAR UserName
[256]; //LEAP, User name
1320 UCHAR Password
[256]; //LEAP, User Password
1322 } LEAP_AUTH_INFO
, *PLEAP_AUTH_INFO
;
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
1331 } ROGUEAP_ENTRY
, *PROGUEAP_ENTRY
;
1335 ROGUEAP_ENTRY RogueApEntry
[MAX_LEN_OF_BSS_TABLE
];
1336 } ROGUEAP_TABLE
, *PROGUEAP_TABLE
;
1342 } CCK_TX_POWER_CALIBRATE
, *PCCK_TX_POWER_CALIBRATE
;
1345 // Receive Tuple Cache Format
1347 typedef struct _TUPLE_CACHE
{
1349 UCHAR MacAddress
[MAC_ADDR_LEN
];
1352 } TUPLE_CACHE
, *PTUPLE_CACHE
;
1355 // Fragment Frame structure
1357 typedef struct _FRAGMENT_FRAME
{
1358 PNDIS_PACKET pFragPacket
;
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
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
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
1401 ARCFOURCONTEXT WEPCONTEXT
;
1405 } PRIVATE_STRUC
, *PPRIVATE_STRUC
;
1407 // structure to tune BBP R66 (BBP TUNING)
1408 typedef struct _BBP_R66_TUNING
{
1410 USHORT FalseCcaLowerThreshold
; // default 100
1411 USHORT FalseCcaUpperThreshold
; // default 512
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
1425 } CHANNEL_TX_POWER
, *PCHANNEL_TX_POWER
;
1427 // structure to store 802.11j channel TX power
1428 typedef struct _CHANNEL_11J_TX_POWER
{
1430 UCHAR BW
; // BW_10 or BW_20
1433 USHORT RemainingTimeForUse
; //unit: sec
1434 } CHANNEL_11J_TX_POWER
, *PCHANNEL_11J_TX_POWER
;
1436 typedef enum _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
];
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
;
1467 NDIS_SPIN_LOCK TaskLock
;
1472 RALINK_TIMER_STRUCT PeriodicTimer
;
1473 RALINK_TIMER_STRUCT APSDPeriodicTimer
;
1474 RALINK_TIMER_STRUCT LinkDownTimer
;
1475 RALINK_TIMER_STRUCT LinkUpTimer
;
1477 UCHAR bPsPollTimerRunning
;
1478 RALINK_TIMER_STRUCT PsPollTimer
;
1479 RALINK_TIMER_STRUCT RadioOnOffTimer
;
1481 ULONG PeriodicRound
;
1482 ULONG OneSecPeriodicRound
;
1485 BOOLEAN bLowThroughput
;
1486 BOOLEAN bEnableAutoAntennaCheck
;
1487 RALINK_TIMER_STRUCT RxAntEvalTimer
;
1490 UCHAR CaliBW40RfR24
;
1491 UCHAR CaliBW20RfR24
;
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
1508 ULONG InServiceMonitorCount
; // unit: sec
1509 UINT8 DfsSessionTime
;
1512 UINT8 LongPulseRadarTh
;
1513 } RADAR_DETECT_STRUCT
, *PRADAR_DETECT_STRUCT
;
1515 typedef enum _REC_BLOCKACK_STATUS
1519 Recipient_HandleRes
,
1521 } REC_BLOCKACK_STATUS
, *PREC_BLOCKACK_STATUS
;
1523 typedef enum _ORI_BLOCKACK_STATUS
1529 } ORI_BLOCKACK_STATUS
, *PORI_BLOCKACK_STATUS
;
1531 typedef struct _BA_ORI_ENTRY
{
1536 // Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header.
1538 USHORT TimeOutValue
;
1539 ORI_BLOCKACK_STATUS ORI_BA_Status
;
1540 RALINK_TIMER_STRUCT ORIBATimer
;
1542 } BA_ORI_ENTRY
, *PBA_ORI_ENTRY
;
1544 typedef struct _BA_REC_ENTRY
{
1547 UCHAR BAWinSize
; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU.
1549 USHORT TimeOutValue
;
1550 RALINK_TIMER_STRUCT RECBATimer
;
1551 ULONG LastIndSeqAtTimer
;
1554 REC_BLOCKACK_STATUS REC_BA_Status
;
1555 NDIS_SPIN_LOCK RxReRingLock
; // Rx Ring spinlock
1557 struct reordering_list list
;
1558 } BA_REC_ENTRY
, *PBA_REC_ENTRY
;
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
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
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
{
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.
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
{
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
;
1622 BOOLEAN bRTSLongProtOn
;
1623 BOOLEAN bLastAtheros
;
1624 BOOLEAN bCurrentAtheros
;
1625 BOOLEAN bNowAtherosBurstOn
;
1626 BOOLEAN bNextDisableRxBA
;
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
{
1635 UINT32 BW
:1; //channel bandwidth 20MHz or 40 MHz
1637 UINT32 STBC
:1; //SPACE
1644 } REG_TRANSMIT_SETTING
, *PREG_TRANSMIT_SETTING
;
1646 typedef union _DESIRED_TRANSMIT_SETTING
{
1648 USHORT MCS
:7; // MCS
1650 USHORT FixedTxMode
:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode.
1654 } DESIRED_TRANSMIT_SETTING
, *PDESIRED_TRANSMIT_SETTING
;
1657 BOOLEAN IsRecipient
;
1658 UCHAR MACAddr
[MAC_ADDR_LEN
];
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]; }
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
;
1705 typedef struct _MULTISSID_STRUCT
{
1706 UCHAR Bssid
[MAC_ADDR_LEN
];
1708 CHAR Ssid
[MAX_LEN_OF_SSID
];
1709 USHORT CapabilityInfo
;
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
;
1720 ULONG ReceivedByteCount
;
1721 ULONG TransmittedByteCount
;
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
;
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
];
1747 NDIS_802_11_PRIVACY_FILTER PrivacyFilter
;
1748 UCHAR BANClass3Data
;
1749 ULONG IsolateInterStaTraffic
;
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
1762 UINT16 StationKeepAliveTime
; // unit: second
1765 USHORT VLAN_Priority
;
1767 RT_802_11_ACL AccessControlList
;
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
];
1780 unsigned int mylinkid
;
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
;
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];
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
;
1831 UCHAR CentralChannel
; // Central Channel when using 40MHz is indicating. not real channel.
1833 UCHAR SupRate
[MAX_LEN_OF_SUPPORTED_RATES
];
1835 UCHAR ExtRate
[MAX_LEN_OF_SUPPORTED_RATES
];
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
;
1849 BOOLEAN bNeedSendTriggerFrame
;
1850 BOOLEAN bAPSDForcePowerSave
; // Force power save mode, should only use in APSD-STAUT
1851 ULONG TriggerTimerCount
;
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
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
;
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
1917 BOOLEAN bMIMOPSEnable
;
1919 BOOLEAN bDisableReordering
;
1920 BOOLEAN bForty_Mhz_Intolerant
;
1921 BOOLEAN bExtChannelSwitchAnnouncement
;
1922 BOOLEAN bRcvBSSWidthTriggerEvents
;
1923 ULONG LastRcvBSSWidthTriggerEventsTime
;
1927 // Enable wireless event
1928 BOOLEAN bWirelessEvent
;
1929 BOOLEAN bWiFiTest
; // Enable this parameter for WiFi test
1931 // Tx & Rx Stream number selection
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
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
;
1951 BEACON_SYNC_STRUCT
*pBeaconSync
;
1952 RALINK_TIMER_STRUCT BeaconUpdateTimer
;
1953 UINT32 BeaconAdjust
;
1954 UINT32 BeaconFactor
;
1955 UINT32 BeaconRemain
;
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
{
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
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
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
2028 // WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED
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
2059 BOOLEAN AdhocBOnlyJoined
; // Indicate Adhoc B Join.
2060 BOOLEAN AdhocBGJoined
; // Indicate Adhoc B/G Join.
2061 BOOLEAN Adhoc20NJoined
; // Indicate Adhoc 20MHz N Join.
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
];
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
2076 BOOLEAN bCkipCmicOn
;
2078 UCHAR GIV
[3]; //for CCX iv
2083 LEAP_AUTH_INFO LeapAuthInfo
;
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.
2147 ////////////////////////////////////////////////////////////////////////////////////////
2149 RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer
;
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.
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
;
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
;
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
{
2189 USHORT AtimWin
; // in kusec; IBSS parameter set element
2190 USHORT CapabilityInfo
;
2191 USHORT CfpMaxDuration
;
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
];
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
;
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
;
2214 // ----------- start of AP --------------------------
2215 // AUTH-RSP State Machine Aux data structure
2216 typedef struct _AP_MLME_AUX
{
2217 UCHAR Addr
[MAC_ADDR_LEN
];
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.
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
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
2244 UCHAR RSN_IE
[MAX_LEN_OF_RSNIE
];
2245 UCHAR ANonce
[LEN_KEY_DESC_NONCE
];
2246 UCHAR R_Counter
[LEN_KEY_DESC_REPLAY
];
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
;
2256 NDIS_802_11_PRIVACY_FILTER PrivacyFilter
; // PrivacyFilter enum for 802.1X
2257 CIPHER_KEY PairwiseKey
;
2260 UCHAR PMKID
[LEN_PMKID
];
2263 UCHAR Addr
[MAC_ADDR_LEN
];
2266 AUTH_STATE AuthState
; // for SHARED KEY authentication state machine used only
2267 BOOLEAN IsReassocSta
; // Indicate whether this is a reassociation procedure
2269 USHORT CapabilityInfo
;
2271 ULONG NoDataIdleCount
;
2272 UINT16 StationKeepAliveCount
; // unit: second
2274 QUEUE_HEADER PsQueue
;
2276 UINT32 StaConnectTime
; // the live time of this station since associated with AP
2279 USHORT NoBADataCountDown
;
2281 UINT32 CachedBuf
[16]; // UINT (4 bytes) for alignment
2282 UINT TxBFCount
; // 3*3
2284 UINT DebugFIFOCount
;
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
;
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.
2332 UCHAR MaxRAmpduFactor
;
2334 UCHAR MmpsMode
; // MIMO power save more.
2336 HT_CAPABILITY_IE HTCapability
;
2338 BOOLEAN bAutoTxRateSwitch
;
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];
2352 ULONG LastBeaconRxTime
;
2354 } MAC_TABLE_ENTRY
, *PMAC_TABLE_ENTRY
;
2356 typedef struct _MAC_TABLE
{
2358 MAC_TABLE_ENTRY
*Hash
[HASH_TABLE_SIZE
];
2359 MAC_TABLE_ENTRY Content
[MAX_LEN_OF_MAC_TABLE
];
2360 QUEUE_HEADER McastPsQueue
;
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
2366 BOOLEAN fAllStationAsRalink
; // Check if all stations are ralink-chipset
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
{
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
{
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
;
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
{
2410 UCHAR PeerWdsAddr
[MAC_ADDR_LEN
];
2411 UCHAR MacTabMatchWCID
; // ASIC
2412 NDIS_802_11_WEP_STATUS WepStatus
;
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
{
2424 RT_802_11_WDS_ENTRY WdsEntry
[MAX_WDS_ENTRY
];
2425 } WDS_TABLE
, *PWDS_TABLE
;
2427 typedef struct _APCLI_STRUCT
{
2430 unsigned int mylinkid
;
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.
2436 CHAR Ssid
[MAX_LEN_OF_SSID
];
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
;
2454 ULONG ClientStatusFlags
;
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
2468 UCHAR PMK
[32]; // WPA PSK mode PMK
2469 UCHAR GTK
[32]; // GTK from authenticator
2471 CIPHER_KEY SharedKey
[SHARE_KEY_NUM
];
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.
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 ----------------------------
2497 BOOLEAN bGreenField
;
2503 typedef struct _INF_PCI_CONFIG
2505 PUCHAR CSRBaseAddress
; // PCI MMIO Base Address, all access will use
2508 typedef struct _INF_USB_CONFIG
2510 UINT BulkInEpAddr
; // bulk-in endpoint address
2511 UINT BulkOutEpAddr
[6]; // bulk-out endpoint address
2518 // The miniport adapter structure
2520 typedef struct _RTMP_ADAPTER
2522 PVOID OS_Cookie
; // save specific structure relative to OS
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
;
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
2555 NDIS_SPIN_LOCK irq_lock
;
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
2567 USHORT BulkOutMaxPacketSize
;
2568 USHORT BulkInMaxPacketSize
;
2570 //======Control Flags
2571 LONG PendingIoCount
;
2573 BOOLEAN bUsbTxBulkAggre
; // Flags for bulk out data priority
2576 //======Timer Thread
2577 RT2870_TIMER_QUEUE TimerQ
;
2578 NDIS_SPIN_LOCK TimerQLock
;
2583 NDIS_SPIN_LOCK CmdQLock
; // CmdQLock spinlock
2585 BOOLEAN TimerFunc_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
;
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
];
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];
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 /*****************************************************************************************/
2641 RTMP_RX_RING RxRing
;
2642 NDIS_SPIN_LOCK RxRingLock
; // Rx Ring spinlock
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
2656 /*****************************************************************************************/
2657 /* ASIC related parameters */
2658 /*****************************************************************************************/
2659 UINT32 MACVersion
; // MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101)..
2661 // ---------------------------
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
];
2668 BOOLEAN EepromAccess
;
2670 ULONG FirmwareVersion
; // byte 0: Minor version, byte 1: Major version, otherwise unused.
2672 // ---------------------------
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 // ----------------------------
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
;
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[]
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
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
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 // ----------------------------
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
;
2750 /*****************************************************************************************/
2751 /* 802.11 related parameters */
2752 /*****************************************************************************************/
2753 // outgoing BEACON frame buffer and corresponding TXD
2754 TXWI_STRUC BeaconTxWI
;
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
;
2763 TX_CONTEXT BeaconContext
[BEACON_RING_SIZE
];
2764 TX_CONTEXT NullContext
;
2765 TX_CONTEXT PsPollContext
;
2766 TX_CONTEXT RTSContext
;
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
;
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
;
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
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
2832 ULONG PSFlags
; // Power Save operation flag.
2835 // current TX sequence #
2838 // Control disconnect / connect event generation
2839 //+++Didn't used anymore
2844 //+++Used only for Station
2845 BOOLEAN bConfigChanged
; // Config Change flag for the same SSID setting
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
2855 // ---------------------------
2857 // ---------------------------
2858 RT_802_11_EVENT_TABLE EventTab
;
2863 /*****************************************************************************************/
2864 /* Statistic related parameters */
2865 /*****************************************************************************************/
2867 ULONG BulkOutDataOneSecCount
;
2868 ULONG BulkInDataOneSecCount
;
2869 ULONG BulkLastOneSecCount
; // BulkOutDataOneSecCount + BulkInDataOneSecCount
2870 ULONG watchDogRxCnt
;
2871 ULONG watchDogRxOverFlowCnt
;
2872 ULONG watchDogTxPendingCnt
[NUM_OF_TX_RING
];
2875 BOOLEAN bUpdateBcnCntDone
;
2876 ULONG watchDogMacDeadlock
; // prevent MAC/BBP into deadlock condition
2877 // ----------------------------
2879 // ----------------------------
2880 BOOLEAN bBanAllBaSetup
;
2881 BOOLEAN bPromiscuous
;
2883 // ----------------------------
2884 // rt2860c emulation-use Parameters
2885 // ----------------------------
2888 ULONG cfendaccu
[30];
2889 ULONG bacontent
[16];
2890 ULONG rxint
[RX_RING_SIZE
+1];
2893 BOOLEAN bForcePrintTX
;
2894 BOOLEAN bForcePrintRX
;
2895 BOOLEAN bDisablescanning
; //defined in RT2870 USB
2896 BOOLEAN bStaFifoTest
;
2897 BOOLEAN bProtectionTest
;
2899 BOOLEAN bGenOneHCCA
;
2900 BOOLEAN bBroadComHT
;
2901 //+++Following add from RT2870 USB.
2903 ULONG BulkOutComplete
;
2904 ULONG BulkOutCompleteOther
;
2905 ULONG BulkOutCompleteCancel
; // seems not use now?
2907 ULONG BulkInComplete
;
2908 ULONG BulkInCompleteFail
;
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
2924 #endif // PCI_MSI_SUPPORT //
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
;
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
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
;
2983 PHEADER_802_11 pHeader
;
2984 PNDIS_PACKET pRxPacket
;
2988 UCHAR UserPriority
; // for calculate TKIP MIC using
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_
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
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.
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) \
3078 (_pTxBlk->Flags |= _flag) \
3080 (_pTxBlk->Flags &= ~(_flag)) \
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 //------------------------------------------------------------------------------------------
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
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(
3129 IN PUCHAR
*ppMacAddr
,
3130 IN UINT16 ProtoType
)
3132 if (pIpAddr
== NULL
)
3135 if (ppMacAddr
== NULL
|| *ppMacAddr
== NULL
)
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];
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];
3167 // Private routines in rtmp_init.c
3169 NDIS_STATUS
RTMPAllocAdapterBlock(
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
3192 VOID
NICInitRT30xxRFRegisters(
3193 IN PRTMP_ADAPTER pAd
);
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
);
3214 VOID
NICRestoreBBPValue(
3215 IN PRTMP_ADAPTER pAd
);
3218 IN PRTMP_ADAPTER pAd
);
3220 VOID
RTMPRingCleanUp(
3221 IN PRTMP_ADAPTER pAd
,
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(
3252 VOID
RTMPZeroMemory(
3256 ULONG
RTMPCompareMemory(
3261 VOID
RTMPMoveMemory(
3274 VOID
RTMPPatchMacBbpBug(
3275 IN PRTMP_ADAPTER pAd
);
3278 IN PRTMP_ADAPTER pAd
,
3279 IN PRALINK_TIMER_STRUCT pTimer
,
3280 IN PVOID pTimerFunc
,
3285 IN PRALINK_TIMER_STRUCT pTimer
,
3290 IN PRALINK_TIMER_STRUCT pTimer
,
3293 VOID
RTMPCancelTimer(
3294 IN PRALINK_TIMER_STRUCT pTimer
,
3295 OUT BOOLEAN
*pCancelled
);
3298 IN PRTMP_ADAPTER pAd
,
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
);
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
);
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
);
3349 IN PRTMP_ADAPTER pAd
,
3350 IN MLME_QUEUE_ELEM
*Elem
);
3352 VOID
SendPSMPAction(
3353 IN PRTMP_ADAPTER pAd
,
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
);
3366 IN PRTMP_ADAPTER pAd
,
3367 IN MLME_QUEUE_ELEM
*Elem
);
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
);
3387 IN PRTMP_ADAPTER pAd
,
3388 IN OUT PHEADER_802_11 pHdr80211
,
3394 IN PRTMP_ADAPTER pAd
,
3395 IN OUT PFRAME_BAR pCntlBar
,
3399 VOID
InsertActField(
3400 IN PRTMP_ADAPTER pAd
,
3401 OUT PUCHAR pFrameBuf
,
3402 OUT PULONG pFrameLen
,
3406 BOOLEAN
CntlEnqueueForRecv(
3407 IN PRTMP_ADAPTER pAd
,
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
,
3445 IN PMAC_TABLE_ENTRY pMacEntry
);
3447 NDIS_STATUS
Sniff2BytesFromNdisBuffer(
3448 IN PNDIS_BUFFER pFirstBuffer
,
3449 IN UCHAR DesiredOffset
,
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
,
3466 IN UCHAR Max_Tx_Packets
);
3468 NDIS_STATUS
RTMPHardTransmit(
3469 IN PRTMP_ADAPTER pAd
,
3470 IN PNDIS_PACKET pPacket
,
3472 OUT PULONG pFreeTXDLeft
);
3474 NDIS_STATUS
STAHardTransmit(
3475 IN PRTMP_ADAPTER pAd
,
3479 VOID
STARxEAPOLFrameIndicate(
3480 IN PRTMP_ADAPTER pAd
,
3481 IN MAC_TABLE_ENTRY
*pEntry
,
3483 IN UCHAR FromWhichBSSID
);
3485 NDIS_STATUS
RTMPFreeTXDRequest(
3486 IN PRTMP_ADAPTER pAd
,
3488 IN UCHAR NumberRequired
,
3489 IN PUCHAR FreeNumberIs
);
3491 NDIS_STATUS
MlmeHardTransmit(
3492 IN PRTMP_ADAPTER pAd
,
3494 IN PNDIS_PACKET pPacket
);
3496 NDIS_STATUS
MlmeHardTransmitMgmtRing(
3497 IN PRTMP_ADAPTER pAd
,
3499 IN PNDIS_PACKET pPacket
);
3501 NDIS_STATUS
MlmeHardTransmitTxRing(
3502 IN PRTMP_ADAPTER pAd
,
3504 IN PNDIS_PACKET pPacket
);
3506 USHORT
RTMPCalcDuration(
3507 IN PRTMP_ADAPTER pAd
,
3512 IN PRTMP_ADAPTER pAd
,
3513 IN PTXWI_STRUC pTxWI
,
3516 IN BOOLEAN InsTimestamp
,
3519 IN BOOLEAN NSeq
, // HW new a sequence.
3528 IN HTTRANSMIT_SETTING
*pTransmit
);
3531 VOID
RTMPWriteTxWI_Data(
3532 IN PRTMP_ADAPTER pAd
,
3533 IN OUT PTXWI_STRUC pTxWI
,
3537 VOID
RTMPWriteTxWI_Cache(
3538 IN PRTMP_ADAPTER pAd
,
3539 IN OUT PTXWI_STRUC pTxWI
,
3542 VOID
RTMPWriteTxDescriptor(
3543 IN PRTMP_ADAPTER pAd
,
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
,
3560 VOID
RTMPSendNullFrame(
3561 IN PRTMP_ADAPTER pAd
,
3563 IN BOOLEAN bQosNull
);
3565 VOID
RTMPSendDisassociationFrame(
3566 IN PRTMP_ADAPTER pAd
);
3568 VOID
RTMPSendRTSFrame(
3569 IN PRTMP_ADAPTER pAd
,
3571 IN
unsigned int NextMpduSize
,
3574 IN USHORT AckDuration
,
3578 PQUEUE_HEADER
RTMPCheckTxSwQueue(
3579 IN PRTMP_ADAPTER pAd
,
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
,
3610 VOID
RTMPFreeNdisPacket(
3611 IN PRTMP_ADAPTER pAd
,
3612 IN PNDIS_PACKET pPacket
);
3614 BOOLEAN
RTMPFreeTXDUponTxDmaDone(
3615 IN PRTMP_ADAPTER pAd
,
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
,
3638 VOID
RTMPEncryptData(
3639 IN PRTMP_ADAPTER pAd
,
3644 BOOLEAN
RTMPSoftDecryptWEP(
3645 IN PRTMP_ADAPTER pAd
,
3647 IN ULONG DataByteCnt
,
3648 IN PCIPHER_KEY pGroupKey
);
3651 IN PRTMP_ADAPTER pAd
,
3655 IN PARCFOURCONTEXT Ctx
,
3660 IN PARCFOURCONTEXT Ctx
);
3662 VOID
ARCFOUR_DECRYPT(
3663 IN PARCFOURCONTEXT Ctx
,
3668 VOID
ARCFOUR_ENCRYPT(
3669 IN PARCFOURCONTEXT Ctx
,
3674 VOID
WPAARCFOUR_ENCRYPT(
3675 IN PARCFOURCONTEXT Ctx
,
3680 UINT
RTMP_CALC_FCS32(
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
,
3698 IN BOOLEAN bDisableBGProtect
,
3699 IN BOOLEAN bNonGFExist
);
3701 VOID
AsicSwitchChannel(
3702 IN PRTMP_ADAPTER pAd
,
3706 VOID
AsicLockChannel(
3707 IN PRTMP_ADAPTER pAd
,
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
,
3729 IN BOOLEAN bFromTx
);
3733 IN PRTMP_ADAPTER pAd
,
3736 VOID
AsicSetMcastWC(
3737 IN PRTMP_ADAPTER pAd
);
3739 VOID
AsicDelWcidTab(
3740 IN PRTMP_ADAPTER pAd
,
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
,
3775 VOID
AsicRemoveSharedKeyEntry(
3776 IN PRTMP_ADAPTER pAd
,
3780 VOID
AsicUpdateWCIDAttribute(
3781 IN PRTMP_ADAPTER pAd
,
3785 IN BOOLEAN bUsePairewiseKeyTable
);
3787 VOID
AsicUpdateWCIDIVEIV(
3788 IN PRTMP_ADAPTER pAd
,
3793 VOID
AsicUpdateRxWCIDTable(
3794 IN PRTMP_ADAPTER pAd
,
3798 VOID
AsicAddKeyEntry(
3799 IN PRTMP_ADAPTER pAd
,
3803 IN PCIPHER_KEY pCipherKey
,
3804 IN BOOLEAN bUsePairewiseKeyTable
,
3807 VOID
AsicAddPairwiseKeyEntry(
3808 IN PRTMP_ADAPTER pAd
,
3811 IN CIPHER_KEY
*pCipherKey
);
3813 VOID
AsicRemovePairwiseKeyEntry(
3814 IN PRTMP_ADAPTER pAd
,
3818 BOOLEAN
AsicSendCommandToMcu(
3819 IN PRTMP_ADAPTER pAd
,
3825 BOOLEAN
AsicCheckCommanOk(
3826 IN PRTMP_ADAPTER pAd
,
3829 VOID
MacAddrRandomBssid(
3830 IN PRTMP_ADAPTER pAd
,
3833 VOID
MgtMacHeaderInit(
3834 IN PRTMP_ADAPTER pAd
,
3835 IN OUT PHEADER_802_11 pHdr80211
,
3842 IN PRTMP_ADAPTER pAd
);
3845 IN PRTMP_ADAPTER pAd
);
3852 IN PRTMP_ADAPTER pAd
,
3855 ULONG
BssTableSearch(
3860 ULONG
BssSsidTableSearch(
3867 ULONG
BssTableSearchWithSSID(
3874 VOID
BssTableDeleteEntry(
3875 IN OUT PBSS_TABLE pTab
,
3879 VOID
BATableDeleteORIEntry(
3880 IN OUT PRTMP_ADAPTER pAd
,
3881 IN BA_ORI_ENTRY
*pBAORIEntry
);
3884 IN PRTMP_ADAPTER pAd
,
3885 OUT PBSS_ENTRY pBss
,
3890 IN USHORT BeaconPeriod
,
3893 IN USHORT CapabilityInfo
,
3895 IN UCHAR SupRateLen
,
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
,
3905 IN LARGE_INTEGER TimeStamp
,
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
,
3920 IN USHORT BeaconPeriod
,
3923 IN USHORT CapabilityInfo
,
3925 IN UCHAR SupRateLen
,
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
,
3935 IN LARGE_INTEGER TimeStamp
,
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
,
3946 IN USHORT TimeOutValue
,
3947 IN USHORT StartingSeq
,
3950 IN UCHAR OriginatorStatus
,
3951 IN BOOLEAN IsRecipient
);
3953 VOID
BssTableSsidSort(
3954 IN PRTMP_ADAPTER pAd
,
3955 OUT BSS_TABLE
*OutTab
,
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
,
3978 BOOLEAN
MlmeEnqueueForRecv(
3979 IN PRTMP_ADAPTER pAd
,
3981 IN ULONG TimeStampHigh
,
3982 IN ULONG TimeStampLow
,
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
,
4010 VOID
StateMachineInit(
4011 IN STATE_MACHINE
*Sm
,
4012 IN STATE_MACHINE_FUNC Trans
[],
4015 IN STATE_MACHINE_FUNC DefFunc
,
4019 VOID
StateMachineSetAction(
4020 IN STATE_MACHINE
*S
,
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
);
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
);
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
);
4095 IN PRTMP_ADAPTER pAd
,
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
);
4114 VOID
MlmeCntlConfirm(
4115 IN PRTMP_ADAPTER pAd
,
4121 IN PRTMP_ADAPTER pAd
);
4123 VOID
ComposeNullFrame(
4124 IN PRTMP_ADAPTER pAd
);
4127 IN PRTMP_ADAPTER pAd
,
4129 IN USHORT CapabilityInfo
,
4132 IN UCHAR SupRateLen
,
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
[]);
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
);
4168 IN PRTMP_ADAPTER pAd
,
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
,
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
[]);
4210 IN PVOID SystemSpecific1
,
4211 IN PVOID FunctionContext
,
4212 IN PVOID SystemSpecific2
,
4213 IN PVOID SystemSpecific3
);
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 //=========================================
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
);
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
);
4299 IN PRTMP_ADAPTER pAd
,
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
);;
4313 IN PRTMP_ADAPTER pAd
,
4314 IN OUT MLME_JOIN_REQ_STRUCT
*JoinReq
,
4318 IN PRTMP_ADAPTER pAd
,
4319 IN OUT MLME_ASSOC_REQ_STRUCT
*AssocReq
,
4321 IN USHORT CapabilityInfo
,
4323 IN USHORT ListenIntv
);
4326 IN PRTMP_ADAPTER pAd
,
4327 IN OUT MLME_SCAN_REQ_STRUCT
*ScanReq
,
4333 VOID
DisassocParmFill(
4334 IN PRTMP_ADAPTER pAd
,
4335 IN OUT MLME_DISASSOC_REQ_STRUCT
*DisassocReq
,
4340 IN PRTMP_ADAPTER pAd
,
4341 IN OUT MLME_START_REQ_STRUCT
*StartReq
,
4346 IN PRTMP_ADAPTER pAd
,
4347 IN OUT MLME_AUTH_REQ_STRUCT
*AuthReq
,
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
);
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
,
4409 OUT UCHAR
*ScanType
);
4411 BOOLEAN
PeerBeaconAndProbeRspSanity(
4412 IN PRTMP_ADAPTER pAd
,
4415 IN UCHAR MsgChannel
,
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
,
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
,
4458 BOOLEAN
PeerAddBARspActionSanity(
4459 IN PRTMP_ADAPTER pAd
,
4463 BOOLEAN
PeerDelBAActionSanity(
4464 IN PRTMP_ADAPTER pAd
,
4469 BOOLEAN
MlmeAssocReqSanity(
4470 IN PRTMP_ADAPTER pAd
,
4474 OUT USHORT
*CapabilityInfo
,
4476 OUT USHORT
*ListenIntv
);
4478 BOOLEAN
MlmeAuthReqSanity(
4479 IN PRTMP_ADAPTER pAd
,
4486 BOOLEAN
MlmeStartReqSanity(
4487 IN PRTMP_ADAPTER pAd
,
4491 OUT UCHAR
*Ssidlen
);
4493 BOOLEAN
PeerAuthSanity(
4494 IN PRTMP_ADAPTER pAd
,
4501 OUT CHAR ChlgText
[]);
4503 BOOLEAN
PeerAssocRspSanity(
4504 IN PRTMP_ADAPTER pAd
,
4508 OUT USHORT
*pCapabilityInfo
,
4509 OUT USHORT
*pStatus
,
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
,
4528 OUT USHORT
*Reason
);
4530 BOOLEAN
PeerDeauthSanity(
4531 IN PRTMP_ADAPTER pAd
,
4535 OUT USHORT
*Reason
);
4537 BOOLEAN
PeerProbeReqSanity(
4538 IN PRTMP_ADAPTER pAd
,
4543 OUT UCHAR
*pSsidLen
);
4549 OUT UCHAR
*BcastFlag
,
4550 OUT UCHAR
*DtimCount
,
4551 OUT UCHAR
*DtimPeriod
,
4552 OUT UCHAR
*MessageToMe
);
4554 UCHAR
ChannelSanity(
4555 IN PRTMP_ADAPTER pAd
,
4558 NDIS_802_11_NETWORK_TYPE
NetworkTypeInUseSanity(
4559 IN PBSS_ENTRY pBss
);
4561 BOOLEAN
MlmeDelBAReqSanity(
4562 IN PRTMP_ADAPTER pAd
,
4566 BOOLEAN
MlmeAddBAReqSanity(
4567 IN PRTMP_ADAPTER pAd
,
4572 ULONG
MakeOutgoingFrame(
4574 OUT ULONG
*Length
, ...);
4577 IN PRTMP_ADAPTER pAd
,
4581 IN PRTMP_ADAPTER pAd
);
4583 VOID
AsicUpdateAutoFallBackTable(
4584 IN PRTMP_ADAPTER pAd
,
4587 VOID
MlmePeriodicExec(
4588 IN PVOID SystemSpecific1
,
4589 IN PVOID FunctionContext
,
4590 IN PVOID SystemSpecific2
,
4591 IN PVOID SystemSpecific3
);
4594 IN PVOID SystemSpecific1
,
4595 IN PVOID FunctionContext
,
4596 IN PVOID SystemSpecific2
,
4597 IN PVOID SystemSpecific3
);
4599 VOID
STAMlmePeriodicExec(
4603 IN PRTMP_ADAPTER pAd
);
4605 VOID
MlmeAutoReconnectLastSSID(
4606 IN PRTMP_ADAPTER pAd
);
4608 BOOLEAN
MlmeValidateSSID(
4612 VOID
MlmeCheckForRoaming(
4613 IN PRTMP_ADAPTER pAd
,
4616 VOID
MlmeCheckForFastRoaming(
4617 IN PRTMP_ADAPTER pAd
,
4620 VOID
MlmeDynamicTxRateSwitching(
4621 IN PRTMP_ADAPTER pAd
);
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
,
4632 IN PUCHAR pTableSize
,
4633 IN PUCHAR pInitTxRateIdx
);
4635 VOID
MlmeCalculateChannelQuality(
4636 IN PRTMP_ADAPTER pAd
,
4639 VOID
MlmeCheckPsmChange(
4640 IN PRTMP_ADAPTER pAd
,
4644 IN PRTMP_ADAPTER pAd
,
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
,
4659 VOID
MlmeUpdateHtTxRates(
4660 IN PRTMP_ADAPTER pAd
,
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
,
4673 BOOLEAN
RTMPCheckHt(
4674 IN PRTMP_ADAPTER pAd
,
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
);
4689 IN PRTMP_ADAPTER pAd
,
4695 IN PRTMP_ADAPTER pAd
,
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
);
4732 IN PRTMP_ADAPTER pAd
);
4735 IN PRTMP_ADAPTER pAd
);
4737 VOID
MlmeResetRalinkCounters(
4738 IN PRTMP_ADAPTER pAd
);
4740 VOID
BuildChannelList(
4741 IN PRTMP_ADAPTER pAd
);
4744 IN PRTMP_ADAPTER pAd
);
4747 IN PRTMP_ADAPTER pAd
,
4750 VOID
ChangeToCellPowerLimit(
4751 IN PRTMP_ADAPTER pAd
,
4752 IN UCHAR AironetCellPowerLimit
);
4754 USHORT
RTMP_EEPROM_READ16(
4755 IN PRTMP_ADAPTER pAd
,
4758 VOID
RTMP_EEPROM_WRITE16(
4759 IN PRTMP_ADAPTER pAd
,
4764 // Prototypes of function definition in rtmp_tkip.c
4766 VOID
RTMPInitTkipEngine(
4767 IN PRTMP_ADAPTER pAd
,
4776 VOID
RTMPInitMICEngine(
4777 IN PRTMP_ADAPTER pAd
,
4781 IN UCHAR UserPriority
,
4784 BOOLEAN
RTMPTkipCompareMICValue(
4785 IN PRTMP_ADAPTER pAd
,
4790 IN UCHAR UserPriority
,
4793 VOID
RTMPCalculateMICValue(
4794 IN PRTMP_ADAPTER pAd
,
4795 IN PNDIS_PACKET pPacket
,
4797 IN PCIPHER_KEY pKey
,
4800 BOOLEAN
RTMPTkipCompareMICValueWithLLC(
4801 IN PRTMP_ADAPTER pAd
,
4809 VOID
RTMPTkipAppendByte(
4810 IN PTKIP_KEY_INFO pTkip
,
4813 VOID
RTMPTkipAppend(
4814 IN PTKIP_KEY_INFO pTkip
,
4818 VOID
RTMPTkipGetMIC(
4819 IN PTKIP_KEY_INFO pTkip
);
4821 BOOLEAN
RTMPSoftDecryptTKIP(
4822 IN PRTMP_ADAPTER pAd
,
4824 IN ULONG DataByteCnt
,
4825 IN UCHAR UserPriority
,
4826 IN PCIPHER_KEY pWpaKey
);
4828 BOOLEAN
RTMPSoftDecryptAES(
4829 IN PRTMP_ADAPTER pAd
,
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
,
4841 VOID
RTMPWPARemoveAllKeys(
4842 IN PRTMP_ADAPTER pAd
);
4844 BOOLEAN
RTMPCheckStrPrintAble(
4848 VOID
RTMPSetPhyMode(
4849 IN PRTMP_ADAPTER pAd
,
4852 VOID
RTMPUpdateHTIE(
4853 IN RT_HT_CAPABILITY
*pRtHt
,
4855 OUT HT_CAPABILITY_IE
*pHtCapability
,
4856 OUT ADD_HT_INFO_IE
*pAddHtInfo
);
4858 VOID
RTMPAddWcidAttributeEntry(
4859 IN PRTMP_ADAPTER pAd
,
4863 IN MAC_TABLE_ENTRY
*pEntry
);
4865 CHAR
*GetEncryptType(
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
,
4882 IN PNDIS_802_11_KEY pKey
,
4883 IN UCHAR CipherAlg
);
4886 IN PRTMP_ADAPTER pAd
,
4887 IN OID_SET_HT_PHYMODE
*pHTPhyMode
);
4889 VOID
RTMPSetIndividualHT(
4890 IN PRTMP_ADAPTER pAd
,
4893 VOID
RTMPSendWirelessEvent(
4894 IN PRTMP_ADAPTER pAd
,
4895 IN USHORT Event_flag
,
4901 // prototype in wpa.c
4903 BOOLEAN
WpaMsgTypeSubst(
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
,
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
,
4945 IN UCHAR KeyDataLen
,
4946 IN UCHAR bPairewise
);
4948 VOID
RTMPToWirelessSta(
4949 IN PRTMP_ADAPTER pAd
,
4950 IN PUCHAR pHeader802_3
,
4954 IN BOOLEAN is4wayFrame
);
4982 IN PRTMP_ADAPTER pAd
,
4992 IN PRTMP_ADAPTER pAd
,
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
,
5016 VOID
NoiseHistRequestAction(
5017 IN PRTMP_ADAPTER pAd
,
5020 VOID
BeaconRequestAction(
5021 IN PRTMP_ADAPTER pAd
,
5024 VOID
AironetReportAction(
5025 IN PRTMP_ADAPTER pAd
,
5026 IN MLME_QUEUE_ELEM
*Elem
);
5028 VOID
ChannelLoadReportAction(
5029 IN PRTMP_ADAPTER pAd
,
5032 VOID
NoiseHistReportAction(
5033 IN PRTMP_ADAPTER pAd
,
5036 VOID
AironetFinalReportAction(
5037 IN PRTMP_ADAPTER pAd
);
5039 VOID
BeaconReportAction(
5040 IN PRTMP_ADAPTER pAd
,
5043 VOID
AironetAddBeaconReport(
5044 IN PRTMP_ADAPTER pAd
,
5046 IN PMLME_QUEUE_ELEM pElem
);
5048 VOID
AironetCreateBeaconReportFromBssTable(
5049 IN PRTMP_ADAPTER pAd
);
5052 IN PRTMP_ADAPTER pAd
,
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
,
5063 IN ULONG DataByteCount
,
5064 IN UCHAR FromWhichBSSID
);
5066 VOID
AES_GTK_KEY_UNWRAP(
5068 OUT UCHAR
*plaintext
,
5070 IN UCHAR
*ciphertext
);
5073 IN PRTMP_ADAPTER pAd
,
5079 // function prototype in ap_wpa.c
5082 VOID
HandleCounterMeasure(
5083 IN PRTMP_ADAPTER pAd
,
5084 IN MAC_TABLE_ENTRY
*pEntry
);
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
,
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
);
5118 NDIS_STATUS
os_alloc_mem(
5119 IN PRTMP_ADAPTER pAd
,
5123 NDIS_STATUS
os_free_mem(
5124 IN PRTMP_ADAPTER pAd
,
5128 void RTMP_AllocateSharedMemory(
5129 IN PRTMP_ADAPTER pAd
,
5132 OUT PVOID
*VirtualAddress
,
5133 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress
);
5135 VOID
RTMPFreeTxRxRingMemory(
5136 IN PRTMP_ADAPTER pAd
);
5138 NDIS_STATUS
AdapterBlockAllocateMemory(
5142 void RTMP_AllocateTxDescMemory(
5143 IN PRTMP_ADAPTER pAd
,
5147 OUT PVOID
*VirtualAddress
,
5148 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress
);
5150 void RTMP_AllocateFirstTxBuffer(
5151 IN PRTMP_ADAPTER pAd
,
5155 OUT PVOID
*VirtualAddress
,
5156 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress
);
5158 void RTMP_AllocateMgmtDescMemory(
5159 IN PRTMP_ADAPTER pAd
,
5162 OUT PVOID
*VirtualAddress
,
5163 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress
);
5165 void RTMP_AllocateRxDescMemory(
5166 IN PRTMP_ADAPTER pAd
,
5169 OUT PVOID
*VirtualAddress
,
5170 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress
);
5172 PNDIS_PACKET
RTMP_AllocateRxPacketBuffer(
5173 IN PRTMP_ADAPTER pAd
,
5176 OUT PVOID
*VirtualAddress
,
5177 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress
);
5179 PNDIS_PACKET
RTMP_AllocateTxPacketBuffer(
5180 IN PRTMP_ADAPTER pAd
,
5183 OUT PVOID
*VirtualAddress
);
5185 PNDIS_PACKET
RTMP_AllocateFragPacketBuffer(
5186 IN PRTMP_ADAPTER pAd
,
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
,
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
,
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
,
5244 VOID
BAOriSessionSetUp(
5245 IN PRTMP_ADAPTER pAd
,
5246 IN MAC_TABLE_ENTRY
*pEntry
,
5250 IN BOOLEAN isForced
);
5252 VOID
BASessionTearDownALL(
5253 IN OUT PRTMP_ADAPTER pAd
,
5256 BOOLEAN
OS_Need_Clone_Packet(void);
5259 VOID
build_tx_packet(
5260 IN PRTMP_ADAPTER pAd
,
5261 IN PNDIS_PACKET pPacket
,
5266 VOID
BAOriSessionTearDown(
5267 IN OUT PRTMP_ADAPTER pAd
,
5270 IN BOOLEAN bPassive
,
5271 IN BOOLEAN bForceSend
);
5273 VOID
BARecSessionTearDown(
5274 IN OUT PRTMP_ADAPTER pAd
,
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(
5286 BOOLEAN
rtstrcasecmp(
5290 char *rtstrstruncasecmp(
5296 IN
const char * s2
);
5300 IN
const char * ct
);
5304 unsigned int *addr
);
5306 ////////// common ioctl functions //////////
5307 INT
Set_DriverVersion_Proc(
5308 IN PRTMP_ADAPTER pAd
,
5311 INT
Set_CountryRegion_Proc(
5312 IN PRTMP_ADAPTER pAd
,
5315 INT
Set_CountryRegionABand_Proc(
5316 IN PRTMP_ADAPTER pAd
,
5319 INT
Set_WirelessMode_Proc(
5320 IN PRTMP_ADAPTER pAd
,
5323 INT
Set_Channel_Proc(
5324 IN PRTMP_ADAPTER pAd
,
5327 INT
Set_ShortSlot_Proc(
5328 IN PRTMP_ADAPTER pAd
,
5331 INT
Set_TxPower_Proc(
5332 IN PRTMP_ADAPTER pAd
,
5335 INT
Set_BGProtection_Proc(
5336 IN PRTMP_ADAPTER pAd
,
5339 INT
Set_TxPreamble_Proc(
5340 IN PRTMP_ADAPTER pAd
,
5343 INT
Set_RTSThreshold_Proc(
5344 IN PRTMP_ADAPTER pAd
,
5347 INT
Set_FragThreshold_Proc(
5348 IN PRTMP_ADAPTER pAd
,
5351 INT
Set_TxBurst_Proc(
5352 IN PRTMP_ADAPTER pAd
,
5355 #ifdef AGGREGATION_SUPPORT
5356 INT
Set_PktAggregate_Proc(
5357 IN PRTMP_ADAPTER pAd
,
5361 INT
Set_IEEE80211H_Proc(
5362 IN PRTMP_ADAPTER pAd
,
5367 IN PRTMP_ADAPTER pAd
,
5371 INT
Show_DescInfo_Proc(
5372 IN PRTMP_ADAPTER pAd
,
5375 INT
Set_ResetStatCounter_Proc(
5376 IN PRTMP_ADAPTER pAd
,
5379 INT
Set_BASetup_Proc(
5380 IN PRTMP_ADAPTER pAd
,
5383 INT
Set_BADecline_Proc(
5384 IN PRTMP_ADAPTER pAd
,
5387 INT
Set_BAOriTearDown_Proc(
5388 IN PRTMP_ADAPTER pAd
,
5391 INT
Set_BARecTearDown_Proc(
5392 IN PRTMP_ADAPTER pAd
,
5396 IN PRTMP_ADAPTER pAd
,
5400 IN PRTMP_ADAPTER pAd
,
5404 IN PRTMP_ADAPTER pAd
,
5407 INT
Set_HtOpMode_Proc(
5408 IN PRTMP_ADAPTER pAd
,
5411 INT
Set_HtStbc_Proc(
5412 IN PRTMP_ADAPTER pAd
,
5416 IN PRTMP_ADAPTER pAd
,
5419 INT
Set_HtExtcha_Proc(
5420 IN PRTMP_ADAPTER pAd
,
5423 INT
Set_HtMpduDensity_Proc(
5424 IN PRTMP_ADAPTER pAd
,
5427 INT
Set_HtBaWinSize_Proc(
5428 IN PRTMP_ADAPTER pAd
,
5432 IN PRTMP_ADAPTER pAd
,
5435 INT
Set_HtLinkAdapt_Proc(
5436 IN PRTMP_ADAPTER pAd
,
5439 INT
Set_HtAmsdu_Proc(
5440 IN PRTMP_ADAPTER pAd
,
5443 INT
Set_HtAutoBa_Proc(
5444 IN PRTMP_ADAPTER pAd
,
5447 INT
Set_HtProtect_Proc(
5448 IN PRTMP_ADAPTER pAd
,
5451 INT
Set_HtMimoPs_Proc(
5452 IN PRTMP_ADAPTER pAd
,
5456 INT
Set_ForceShortGI_Proc(
5457 IN PRTMP_ADAPTER pAd
,
5460 INT
Set_ForceGF_Proc(
5461 IN PRTMP_ADAPTER pAd
,
5465 IN PRTMP_ADAPTER pAd
);
5467 INT
Set_SendPSMPAction_Proc(
5468 IN PRTMP_ADAPTER pAd
,
5471 INT
Set_HtMIMOPSmode_Proc(
5472 IN PRTMP_ADAPTER pAd
,
5476 INT
Set_HtTxBASize_Proc(
5477 IN PRTMP_ADAPTER pAd
,
5480 INT
WpaCheckEapCode(
5481 IN PRTMP_ADAPTER pAd
,
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
,
5497 // AMPDU packet indication
5498 VOID
Indicate_AMPDU_Packet(
5499 IN PRTMP_ADAPTER pAd
,
5501 IN UCHAR FromWhichBSSID
);
5503 // AMSDU packet indication
5504 VOID
Indicate_AMSDU_Packet(
5505 IN PRTMP_ADAPTER pAd
,
5507 IN UCHAR FromWhichBSSID
);
5509 // Normal legacy Rx packet indication
5510 VOID
Indicate_Legacy_Packet(
5511 IN PRTMP_ADAPTER pAd
,
5513 IN UCHAR FromWhichBSSID
);
5515 VOID
Indicate_EAPOL_Packet(
5516 IN PRTMP_ADAPTER pAd
,
5518 IN UCHAR FromWhichBSSID
);
5520 void update_os_packet_info(
5521 IN PRTMP_ADAPTER pAd
,
5523 IN UCHAR FromWhichBSSID
);
5525 void wlan_802_11_to_802_3_packet(
5526 IN PRTMP_ADAPTER pAd
,
5528 IN PUCHAR pHeader802_3
,
5529 IN UCHAR FromWhichBSSID
);
5531 UINT
deaggregate_AMSDU_announce(
5532 IN PRTMP_ADAPTER pAd
,
5533 PNDIS_PACKET pPacket
,
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); \
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; \
5555 _pSA = _pRxBlk->pHeader->Addr3; \
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
,
5590 // Normal, AMPDU or AMSDU
5591 VOID
CmmRxnonRalinkFrameIndicate(
5592 IN PRTMP_ADAPTER pAd
,
5594 IN UCHAR FromWhichBSSID
);
5596 VOID
CmmRxRalinkFrameIndicate(
5597 IN PRTMP_ADAPTER pAd
,
5598 IN MAC_TABLE_ENTRY
*pEntry
,
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
,
5611 ////////////////////////////////////////
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
5626 P80211ENUM_msgitem_status_no_value
= 0x00
5629 P80211ENUM_truth_false
= 0x00,
5630 P80211ENUM_truth_true
= 0x01
5633 /* Definition from madwifi */
5639 } p80211item_uint32_t
;
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.
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
;
5708 } wlan_radiotap_header
;
5709 /* Definition from madwifi */
5711 void send_monitor_packets(
5712 IN PRTMP_ADAPTER pAd
,
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
,
5723 INT
Set_FixedTxMode_Proc(
5724 IN PRTMP_ADAPTER pAd
,
5727 static inline char* GetPhyMode(
5740 case MODE_HTGREENFIELD
:
5748 static inline char* GetBW(
5766 VOID
RT28xxThreadTerminate(
5767 IN RTMP_ADAPTER
*pAd
);
5769 BOOLEAN
RT28XXChipsetCheck(
5772 BOOLEAN
RT28XXNetDevInit(
5774 IN
struct net_device
*net_dev
,
5775 IN RTMP_ADAPTER
*pAd
);
5777 BOOLEAN
RT28XXProbePostConfig(
5779 IN RTMP_ADAPTER
*pAd
,
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
,
5792 IN ULONG UpdatePos
);
5794 INT
rt28xx_sta_ioctl(
5795 IN
struct net_device
*net_dev
,
5796 IN OUT
struct ifreq
*rq
,
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
);
5813 // Function Prototype in cmm_data_2860.c
5815 USHORT
RtmpPCI_WriteTxResource(
5816 IN PRTMP_ADAPTER pAd
,
5819 OUT USHORT
*FreeNumber
);
5821 USHORT
RtmpPCI_WriteSingleTxResource(
5822 IN PRTMP_ADAPTER pAd
,
5825 OUT USHORT
*FreeNumber
);
5827 USHORT
RtmpPCI_WriteMultiTxResource(
5828 IN PRTMP_ADAPTER pAd
,
5831 OUT USHORT
*FreeNumber
);
5833 USHORT
RtmpPCI_WriteFragTxResource(
5834 IN PRTMP_ADAPTER pAd
,
5837 OUT USHORT
*FreeNumber
);
5839 USHORT
RtmpPCI_WriteSubTxResource(
5840 IN PRTMP_ADAPTER pAd
,
5843 OUT USHORT
*FreeNumber
);
5845 VOID
RtmpPCI_FinalWriteTxResource(
5846 IN PRTMP_ADAPTER pAd
,
5848 IN USHORT totalMPDUSize
,
5849 IN USHORT FirstTxIdx
);
5851 VOID
RtmpPCIDataLastTxIdx(
5852 IN PRTMP_ADAPTER pAd
,
5854 IN USHORT LastTxIdx
);
5856 VOID
RtmpPCIDataKickOut(
5857 IN PRTMP_ADAPTER pAd
,
5862 int RtmpPCIMgmtKickOut(
5863 IN RTMP_ADAPTER
*pAd
,
5865 IN PNDIS_PACKET pPacket
,
5866 IN PUCHAR pSrcBufVA
,
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
,
5886 VOID
RTMPPCIeLinkCtrlSetting(
5887 IN PRTMP_ADAPTER pAd
,
5890 VOID
RT28xxPciAsicRadioOff(
5891 IN PRTMP_ADAPTER pAd
,
5893 IN USHORT TbttNumToNextWakeUp
);
5895 BOOLEAN
RT28xxPciAsicRadioOn(
5896 IN PRTMP_ADAPTER pAd
,
5899 VOID
RT28xxPciStaAsicForceWakeup(
5900 IN PRTMP_ADAPTER pAd
,
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
);
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
);
5926 VOID
AsicTurnOffRFClk(
5927 IN PRTMP_ADAPTER pAd
,
5930 VOID
AsicTurnOnRFClk(
5931 IN PRTMP_ADAPTER pAd
,
5934 NTSTATUS
RT30xxWriteRFRegister(
5935 IN PRTMP_ADAPTER pAd
,
5939 NTSTATUS
RT30xxReadRFRegister(
5940 IN PRTMP_ADAPTER pAd
,
5944 UCHAR
eFuseReadRegisters(
5945 IN PRTMP_ADAPTER pAd
,
5950 VOID
eFuseReadPhysical(
5951 IN PRTMP_ADAPTER pAd
,
5952 IN PUSHORT lpInBuffer
,
5953 IN ULONG nInBufferSize
,
5954 OUT PUSHORT lpOutBuffer
,
5955 IN ULONG nOutBufferSize
5959 IN PRTMP_ADAPTER pAd
,
5964 VOID
eFusePhysicalWriteRegisters(
5965 IN PRTMP_ADAPTER pAd
,
5970 NTSTATUS
eFuseWriteRegisters(
5971 IN PRTMP_ADAPTER pAd
,
5976 VOID
eFuseWritePhysical(
5977 IN PRTMP_ADAPTER pAd
,
5979 ULONG nInBufferSize
,
5981 ULONG nOutBufferSize
5984 NTSTATUS
eFuseWrite(
5985 IN PRTMP_ADAPTER pAd
,
5990 INT
set_eFuseGetFreeBlockCount_Proc(
5991 IN PRTMP_ADAPTER pAd
,
5994 INT
set_eFusedump_Proc(
5995 IN PRTMP_ADAPTER pAd
,
5998 INT
set_eFuseLoadFromBin_Proc(
5999 IN PRTMP_ADAPTER pAd
,
6002 NTSTATUS
eFuseWriteRegistersFromBin(
6003 IN PRTMP_ADAPTER pAd
,
6008 VOID
eFusePhysicalReadRegisters(
6009 IN PRTMP_ADAPTER pAd
,
6014 VOID
RT30xxLoadRFNormalModeSetup(
6015 IN PRTMP_ADAPTER pAd
);
6017 VOID
RT30xxLoadRFSleepModeSetup(
6018 IN PRTMP_ADAPTER pAd
);
6020 VOID
RT30xxReverseRFSleepModeSetup(
6021 IN PRTMP_ADAPTER pAd
);
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
,
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
,
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
);
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
,
6095 NTSTATUS
RTUSBMultiWrite(
6096 IN PRTMP_ADAPTER pAd
,
6101 NTSTATUS
RTUSBMultiWrite_OneByte(
6102 IN PRTMP_ADAPTER pAd
,
6106 NTSTATUS
RTUSBReadBBPRegister(
6107 IN PRTMP_ADAPTER pAd
,
6111 NTSTATUS
RTUSBWriteBBPRegister(
6112 IN PRTMP_ADAPTER pAd
,
6116 NTSTATUS
RTUSBWriteRFRegister(
6117 IN PRTMP_ADAPTER pAd
,
6120 NTSTATUS
RTUSB_VendorRequest(
6121 IN PRTMP_ADAPTER pAd
,
6122 IN UINT32 TransferFlags
,
6123 IN UCHAR ReservedBits
,
6127 IN PVOID TransferBuffer
,
6128 IN UINT32 TransferBufferLength
);
6130 NTSTATUS
RTUSBReadEEPROM(
6131 IN PRTMP_ADAPTER pAd
,
6136 NTSTATUS
RTUSBWriteEEPROM(
6137 IN PRTMP_ADAPTER pAd
,
6142 VOID
RTUSBPutToSleep(
6143 IN PRTMP_ADAPTER pAd
);
6145 NTSTATUS
RTUSBWakeUp(
6146 IN PRTMP_ADAPTER pAd
);
6148 VOID
RTUSBInitializeCmdQ(
6151 NDIS_STATUS
RTUSBEnqueueCmdFromNdis(
6152 IN PRTMP_ADAPTER pAd
,
6154 IN BOOLEAN SetInformation
,
6155 IN PVOID pInformationBuffer
,
6156 IN UINT32 InformationBufferLength
);
6158 NDIS_STATUS
RTUSBEnqueueInternalCmd(
6159 IN PRTMP_ADAPTER pAd
,
6161 IN PVOID pInformationBuffer
,
6162 IN UINT32 InformationBufferLength
);
6164 VOID
RTUSBDequeueCmd(
6166 OUT PCmdQElmt
*pcmdqelmt
);
6169 IN OUT PVOID Context
);
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
,
6208 NTSTATUS
RTUSBReadMACRegister(
6209 IN PRTMP_ADAPTER pAd
,
6211 OUT PUINT32 pValue
);
6213 NTSTATUS
RTUSBSingleWrite(
6214 IN RTMP_ADAPTER
*pAd
,
6218 NTSTATUS
RTUSBFirmwareRun(
6219 IN PRTMP_ADAPTER pAd
);
6221 NTSTATUS
RTUSBFirmwareWrite(
6222 IN PRTMP_ADAPTER pAd
,
6226 NTSTATUS
RTUSBFirmwareOpmode(
6227 IN PRTMP_ADAPTER pAd
,
6228 OUT PUINT32 pValue
);
6230 NTSTATUS
RTUSBVenderReset(
6231 IN PRTMP_ADAPTER pAd
);
6234 IN PRTMP_ADAPTER pAd
);
6237 NDIS_STATUS
CreateThreads(
6238 IN
struct net_device
*net_dev
);
6241 VOID
MacTableInitialize(
6242 IN PRTMP_ADAPTER pAd
);
6245 IN PRTMP_ADAPTER pAd
,
6248 NDIS_STATUS
RTMPWPAAddKeyProc(
6249 IN PRTMP_ADAPTER pAd
,
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
);
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
,
6288 // Function Prototype in cmm_data_2870.c
6290 USHORT
RtmpUSB_WriteSubTxResource(
6291 IN PRTMP_ADAPTER pAd
,
6294 OUT USHORT
*FreeNumber
);
6296 USHORT
RtmpUSB_WriteSingleTxResource(
6297 IN PRTMP_ADAPTER pAd
,
6300 OUT USHORT
*FreeNumber
);
6302 USHORT
RtmpUSB_WriteFragTxResource(
6303 IN PRTMP_ADAPTER pAd
,
6306 OUT USHORT
*FreeNumber
);
6308 USHORT
RtmpUSB_WriteMultiTxResource(
6309 IN PRTMP_ADAPTER pAd
,
6312 OUT USHORT
*FreeNumber
);
6314 VOID
RtmpUSB_FinalWriteTxResource(
6315 IN PRTMP_ADAPTER pAd
,
6317 IN USHORT totalMPDUSize
,
6319 IN USHORT FirstTxIdx
);
6323 VOID
RtmpUSBDataLastTxIdx(
6324 IN PRTMP_ADAPTER pAd
,
6328 VOID
RtmpUSBDataKickOut(
6329 IN PRTMP_ADAPTER pAd
,
6334 int RtmpUSBMgmtKickOut(
6335 IN RTMP_ADAPTER
*pAd
,
6337 IN PNDIS_PACKET pPacket
,
6338 IN PUCHAR pSrcBufVA
,
6341 VOID
RtmpUSBNullFrameKickOut(
6342 IN RTMP_ADAPTER
*pAd
,
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
);
6362 INT
RTMPShowCfgValue(
6363 IN PRTMP_ADAPTER pAd
,
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
);
6377 VOID
AsicResetFromDMABusy(
6378 IN PRTMP_ADAPTER pAd
);
6381 IN PRTMP_ADAPTER pAd
);
6384 IN PRTMP_ADAPTER pAd
);
6387 IN PRTMP_ADAPTER pAd
);
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
);
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)
6422 VIRTUAL_IF_INC(pAd
);
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
);
6435 #endif // __RTMP_H__