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 "link_list.h"
44 #include "spectrum_def.h"
47 #ifdef CONFIG_STA_SUPPORT
49 #endif // CONFIG_STA_SUPPORT //
51 //#define DBG_DIAGNOSE 1
53 #if defined(CONFIG_AP_SUPPORT) && defined(CONFIG_STA_SUPPORT)
54 #define IF_DEV_CONFIG_OPMODE_ON_AP(_pAd) if(_pAd->OpMode == OPMODE_AP)
55 #define IF_DEV_CONFIG_OPMODE_ON_STA(_pAd) if(_pAd->OpMode == OPMODE_STA)
57 #define IF_DEV_CONFIG_OPMODE_ON_AP(_pAd)
58 #define IF_DEV_CONFIG_OPMODE_ON_STA(_pAd)
61 #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++)
62 #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--)
63 #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt)
68 // NDIS Version definitions
70 #ifdef NDIS50_MINIPORT
71 #define RTMP_NDIS_MAJOR_VERSION 5
72 #define RTMP_NDIS_MINOR_VERSION 0
75 #ifdef NDIS51_MINIPORT
76 #define RTMP_NDIS_MAJOR_VERSION 5
77 #define RTMP_NDIS_MINOR_VERSION 1
80 extern char NIC_VENDOR_DESC[];
81 extern int NIC_VENDOR_DESC_LEN;
83 extern unsigned char SNAP_AIRONET[];
84 extern unsigned char CipherSuiteCiscoCCKM[];
85 extern unsigned char CipherSuiteCiscoCCKMLen;
86 extern unsigned char CipherSuiteCiscoCCKM24[];
87 extern unsigned char CipherSuiteCiscoCCKM24Len;
88 extern unsigned char CipherSuiteCCXTkip[];
89 extern unsigned char CipherSuiteCCXTkipLen;
90 extern unsigned char CISCO_OUI[];
91 extern UCHAR BaSizeArray[4];
93 extern UCHAR BROADCAST_ADDR[MAC_ADDR_LEN];
94 extern UCHAR MULTICAST_ADDR[MAC_ADDR_LEN];
95 extern UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN];
96 extern ULONG BIT32[32];
98 extern char* CipherName[];
99 extern char* MCSToMbps[];
100 extern UCHAR RxwiMCSToOfdmRate[12];
101 extern UCHAR SNAP_802_1H[6];
102 extern UCHAR SNAP_BRIDGE_TUNNEL[6];
103 extern UCHAR SNAP_AIRONET[8];
104 extern UCHAR CKIP_LLC_SNAP[8];
105 extern UCHAR EAPOL_LLC_SNAP[8];
106 extern UCHAR EAPOL[2];
108 extern UCHAR APPLE_TALK[2];
109 extern UCHAR RateIdToPlcpSignal[12]; // see IEEE802.11a-1999 p.14
110 extern UCHAR OfdmRateToRxwiMCS[];
111 extern UCHAR OfdmSignalToRateId[16] ;
112 extern UCHAR default_cwmin[4];
113 extern UCHAR default_cwmax[4];
114 extern UCHAR default_sta_aifsn[4];
115 extern UCHAR MapUserPriorityToAccessCategory[8];
117 extern USHORT RateUpPER[];
118 extern USHORT RateDownPER[];
119 extern UCHAR Phy11BNextRateDownward[];
120 extern UCHAR Phy11BNextRateUpward[];
121 extern UCHAR Phy11BGNextRateDownward[];
122 extern UCHAR Phy11BGNextRateUpward[];
123 extern UCHAR Phy11ANextRateDownward[];
124 extern UCHAR Phy11ANextRateUpward[];
125 extern CHAR RssiSafeLevelForTxRate[];
126 extern UCHAR RateIdToMbps[];
127 extern USHORT RateIdTo500Kbps[];
129 extern UCHAR CipherSuiteWpaNoneTkip[];
130 extern UCHAR CipherSuiteWpaNoneTkipLen;
132 extern UCHAR CipherSuiteWpaNoneAes[];
133 extern UCHAR CipherSuiteWpaNoneAesLen;
136 extern UCHAR SupRateIe;
137 extern UCHAR ExtRateIe;
139 #ifdef DOT11_N_SUPPORT
140 extern UCHAR HtCapIe;
141 extern UCHAR AddHtInfoIe;
142 extern UCHAR NewExtChanIe;
144 extern UCHAR ExtHtCapIe;
145 #endif // DOT11N_DRAFT3 //
146 #endif // DOT11_N_SUPPORT //
156 extern UCHAR WPA_OUI[];
157 extern UCHAR RSN_OUI[];
158 extern UCHAR WME_INFO_ELEM[];
159 extern UCHAR WME_PARM_ELEM[];
160 extern UCHAR Ccx2QosInfo[];
161 extern UCHAR Ccx2IeInfo[];
162 extern UCHAR RALINK_OUI[];
163 extern UCHAR PowerConstraintIE[];
166 extern UCHAR RateSwitchTable[];
167 extern UCHAR RateSwitchTable11B[];
168 extern UCHAR RateSwitchTable11G[];
169 extern UCHAR RateSwitchTable11BG[];
171 #ifdef DOT11_N_SUPPORT
172 extern UCHAR RateSwitchTable11BGN1S[];
173 extern UCHAR RateSwitchTable11BGN2S[];
174 extern UCHAR RateSwitchTable11BGN2SForABand[];
175 extern UCHAR RateSwitchTable11N1S[];
176 extern UCHAR RateSwitchTable11N2S[];
177 extern UCHAR RateSwitchTable11N2SForABand[];
179 #ifdef CONFIG_STA_SUPPORT
180 extern UCHAR PRE_N_HT_OUI[];
181 #endif // CONFIG_STA_SUPPORT //
182 #endif // DOT11_N_SUPPORT //
184 #define MAXSEQ (0xFFF)
187 typedef struct _ATE_INFO {
193 TXWI_STRUC TxWI; // TXWI
195 UCHAR Addr1[MAC_ADDR_LEN];
196 UCHAR Addr2[MAC_ADDR_LEN];
197 UCHAR Addr3[MAC_ADDR_LEN];
201 UINT32 TxDoneCount; // Tx DMA Done
204 BOOLEAN bQATxStart; // Have compiled QA in and use it to ATE tx.
205 BOOLEAN bQARxStart; // Have compiled QA in and use it to ATE rx.
206 BOOLEAN bFWLoading; // Reload firmware when ATE is done.
210 CHAR LastSNR0; // last received SNR
211 CHAR LastSNR1; // last received SNR for 2nd antenna
212 CHAR LastRssi0; // last received RSSI
213 CHAR LastRssi1; // last received RSSI for 2nd antenna
214 CHAR LastRssi2; // last received RSSI for 3rd antenna
215 CHAR AvgRssi0; // last 8 frames' average RSSI
216 CHAR AvgRssi1; // last 8 frames' average RSSI
217 CHAR AvgRssi2; // last 8 frames' average RSSI
218 SHORT AvgRssi0X8; // sum of last 8 frames' RSSI
219 SHORT AvgRssi1X8; // sum of last 8 frames' RSSI
220 SHORT AvgRssi2X8; // sum of last 8 frames' RSSI
222 UINT32 NumOfAvgRssiSample;
224 #ifdef RALINK_28xx_QA
226 USHORT HLen; // Header Length
227 USHORT PLen; // Pattern Length
228 UCHAR Header[32]; // Header buffer
229 UCHAR Pattern[32]; // Pattern buffer
230 USHORT DLen; // Data Length
251 //UINT32 Repeat; // Tx Cpu count
252 UCHAR TxStatus; // task Tx status // 0 --> task is idle, 1 --> task is running
253 #endif // RALINK_28xx_QA //
254 } ATE_INFO, *PATE_INFO;
256 #ifdef RALINK_28xx_QA
257 struct ate_racfghdr {
265 } __attribute__((packed));
266 #endif // RALINK_28xx_QA //
267 #endif // RALINK_ATE //
269 #ifdef DOT11_N_SUPPORT
270 struct reordering_mpdu
272 struct reordering_mpdu *next;
273 PNDIS_PACKET pPacket; /* coverted to 802.3 frame */
274 int Sequence; /* sequence number of MPDU */
278 struct reordering_list
280 struct reordering_mpdu *next;
284 struct reordering_mpdu_pool
288 struct reordering_list freelist;
290 #endif // DOT11_N_SUPPORT //
292 typedef struct _RSSI_SAMPLE {
293 CHAR LastRssi0; // last received RSSI
294 CHAR LastRssi1; // last received RSSI
295 CHAR LastRssi2; // last received RSSI
305 // Queue structure and macros
307 typedef struct _QUEUE_ENTRY {
308 struct _QUEUE_ENTRY *Next;
309 } QUEUE_ENTRY, *PQUEUE_ENTRY;
312 typedef struct _QUEUE_HEADER {
316 } QUEUE_HEADER, *PQUEUE_HEADER;
318 #define InitializeQueueHeader(QueueHeader) \
320 (QueueHeader)->Head = (QueueHeader)->Tail = NULL; \
321 (QueueHeader)->Number = 0; \
324 #define RemoveHeadQueue(QueueHeader) \
325 (QueueHeader)->Head; \
327 PQUEUE_ENTRY pNext; \
328 if ((QueueHeader)->Head != NULL) \
330 pNext = (QueueHeader)->Head->Next; \
331 (QueueHeader)->Head = pNext; \
333 (QueueHeader)->Tail = NULL; \
334 (QueueHeader)->Number--; \
338 #define InsertHeadQueue(QueueHeader, QueueEntry) \
340 ((PQUEUE_ENTRY)QueueEntry)->Next = (QueueHeader)->Head; \
341 (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \
342 if ((QueueHeader)->Tail == NULL) \
343 (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \
344 (QueueHeader)->Number++; \
347 #define InsertTailQueue(QueueHeader, QueueEntry) \
349 ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \
350 if ((QueueHeader)->Tail) \
351 (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \
353 (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \
354 (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \
355 (QueueHeader)->Number++; \
359 // Macros for flag and ref count operations
361 #define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
362 #define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
363 #define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0)
364 #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
365 #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
367 // Macro for power save flag.
368 #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F))
369 #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F))
370 #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0)
371 #define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0)
372 #define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F))
374 #define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F))
375 #define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F))
376 #define OPSTATUS_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.OpStatusFlags & (_F)) != 0)
378 #define CLIENT_STATUS_SET_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags |= (_F))
379 #define CLIENT_STATUS_CLEAR_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags &= ~(_F))
380 #define CLIENT_STATUS_TEST_FLAG(_pEntry,_F) (((_pEntry)->ClientStatusFlags & (_F)) != 0)
382 #define RX_FILTER_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter |= (_F))
383 #define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F))
384 #define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0)
386 #ifdef CONFIG_STA_SUPPORT
387 #define STA_NO_SECURITY_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11EncryptionDisabled)
388 #define STA_WEP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption1Enabled)
389 #define STA_TKIP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption2Enabled)
390 #define STA_AES_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)
392 #define STA_TGN_WIFI_ON(_p) (_p->StaCfg.bTGnWifiTest == TRUE)
393 #endif // CONFIG_STA_SUPPORT //
395 #define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
396 #define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
399 #define INC_RING_INDEX(_idx, _RingSize) \
401 (_idx) = (_idx+1) % (_RingSize); \
404 #define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 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 #ifdef DOT11_N_SUPPORT
441 // StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here.
442 #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \
444 _pAd->StaActive.SupportedHtPhy.ChannelWidth = _pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth; \
445 _pAd->StaActive.SupportedHtPhy.MimoPs = _pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs; \
446 _pAd->StaActive.SupportedHtPhy.GF = _pAd->MlmeAux.HtCapability.HtCapInfo.GF; \
447 _pAd->StaActive.SupportedHtPhy.ShortGIfor20 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20; \
448 _pAd->StaActive.SupportedHtPhy.ShortGIfor40 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40; \
449 _pAd->StaActive.SupportedHtPhy.TxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC; \
450 _pAd->StaActive.SupportedHtPhy.RxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC; \
451 _pAd->StaActive.SupportedHtPhy.ExtChanOffset = _pAd->MlmeAux.AddHtInfo.AddHtInfo.ExtChanOffset; \
452 _pAd->StaActive.SupportedHtPhy.RecomWidth = _pAd->MlmeAux.AddHtInfo.AddHtInfo.RecomWidth; \
453 _pAd->StaActive.SupportedHtPhy.OperaionMode = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode; \
454 _pAd->StaActive.SupportedHtPhy.NonGfPresent = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent; \
455 NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(UCHAR) * 16);\
458 #define COPY_AP_HTSETTINGS_FROM_BEACON(_pAd, _pHtCapability) \
460 _pAd->MacTab.Content[BSSID_WCID].AMsduSize = (UCHAR)(_pHtCapability->HtCapInfo.AMsduSize); \
461 _pAd->MacTab.Content[BSSID_WCID].MmpsMode= (UCHAR)(_pHtCapability->HtCapInfo.MimoPs); \
462 _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (UCHAR)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \
464 #endif // DOT11_N_SUPPORT //
467 // MACRO for 32-bit PCI register read / write
469 // Usage : RTMP_IO_READ32(
470 // PRTMP_ADAPTER pAd,
471 // ULONG Register_Offset,
475 // PRTMP_ADAPTER pAd,
476 // ULONG Register_Offset,
481 // BBP & RF are using indirect access. Before write any value into it.
482 // We have to make sure there is no outstanding command pending via checking busy bit.
484 #define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register
486 #define RTMP_RF_IO_WRITE32(_A, _V) \
488 PHY_CSR4_STRUC Value; \
490 if ((_A)->bPCIclkOff) \
495 RTMP_IO_READ32(_A, RF_CSR_CFG0, &Value.word); \
496 if (Value.field.Busy == IDLE) \
499 } while (BusyCnt < MAX_BUSY_COUNT); \
500 if (BusyCnt < MAX_BUSY_COUNT) \
502 RTMP_IO_WRITE32(_A, RF_CSR_CFG0, _V); \
506 #define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
508 BBP_CSR_CFG_STRUC BbpCsr; \
510 for (i=0; i<MAX_BUSY_COUNT; i++) \
512 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
513 if (BbpCsr.field.Busy == BUSY) \
518 BbpCsr.field.fRead = 1; \
519 BbpCsr.field.BBP_RW_MODE = 1; \
520 BbpCsr.field.Busy = 1; \
521 BbpCsr.field.RegNum = _I; \
522 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
523 for (k=0; k<MAX_BUSY_COUNT; k++) \
525 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
526 if (BbpCsr.field.Busy == IDLE) \
529 if ((BbpCsr.field.Busy == IDLE) && \
530 (BbpCsr.field.RegNum == _I)) \
532 *(_pV) = (UCHAR)BbpCsr.field.Value; \
536 if (BbpCsr.field.Busy == BUSY) \
538 DBGPRINT_ERR(("DFS BBP read R%d fail\n", _I)); \
539 *(_pV) = (_A)->BbpWriteLatch[_I]; \
543 //#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) {}
544 // Read BBP register by register's ID. Generate PER to test BA
545 #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
547 BBP_CSR_CFG_STRUC BbpCsr; \
549 if ((_A)->bPCIclkOff == FALSE) \
551 for (i=0; i<MAX_BUSY_COUNT; i++) \
553 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
554 if (BbpCsr.field.Busy == BUSY) \
559 BbpCsr.field.fRead = 1; \
560 BbpCsr.field.BBP_RW_MODE = 1; \
561 BbpCsr.field.Busy = 1; \
562 BbpCsr.field.RegNum = _I; \
563 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
564 AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
565 RTMPusecDelay(1000); \
566 for (k=0; k<MAX_BUSY_COUNT; k++) \
568 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
569 if (BbpCsr.field.Busy == IDLE) \
572 if ((BbpCsr.field.Busy == IDLE) && \
573 (BbpCsr.field.RegNum == _I)) \
575 *(_pV) = (UCHAR)BbpCsr.field.Value; \
579 if (BbpCsr.field.Busy == BUSY) \
581 DBGPRINT_ERR(("BBP read R%d=0x%x fail\n", _I, BbpCsr.word)); \
582 *(_pV) = (_A)->BbpWriteLatch[_I]; \
583 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
584 BbpCsr.field.Busy = 0; \
585 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
590 #define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \
592 BBP_CSR_CFG_STRUC BbpCsr; \
594 for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
596 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
597 if (BbpCsr.field.Busy == BUSY) \
600 BbpCsr.field.fRead = 0; \
601 BbpCsr.field.BBP_RW_MODE = 1; \
602 BbpCsr.field.Busy = 1; \
603 BbpCsr.field.Value = _V; \
604 BbpCsr.field.RegNum = _I; \
605 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
606 (_A)->BbpWriteLatch[_I] = _V; \
609 if (BusyCnt == MAX_BUSY_COUNT) \
611 DBGPRINT_ERR(("BBP write R%d fail\n", _I)); \
615 // Write BBP register by register's ID & value
616 #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \
618 BBP_CSR_CFG_STRUC BbpCsr; \
620 if ((_A)->bPCIclkOff == FALSE) \
622 for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
624 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
625 if (BbpCsr.field.Busy == BUSY) \
628 BbpCsr.field.fRead = 0; \
629 BbpCsr.field.BBP_RW_MODE = 1; \
630 BbpCsr.field.Busy = 1; \
631 BbpCsr.field.Value = _V; \
632 BbpCsr.field.RegNum = _I; \
633 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
634 AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
635 if (_A->OpMode == OPMODE_AP) \
636 RTMPusecDelay(1000); \
637 (_A)->BbpWriteLatch[_I] = _V; \
640 if (BusyCnt == MAX_BUSY_COUNT) \
642 DBGPRINT_ERR(("BBP write R%d=0x%x fail\n", _I, BbpCsr.word)); \
643 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
644 BbpCsr.field.Busy = 0; \
645 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
651 #define MAP_CHANNEL_ID_TO_KHZ(ch, khz) { \
654 case 1: khz = 2412000; break; \
655 case 2: khz = 2417000; break; \
656 case 3: khz = 2422000; break; \
657 case 4: khz = 2427000; break; \
658 case 5: khz = 2432000; break; \
659 case 6: khz = 2437000; break; \
660 case 7: khz = 2442000; break; \
661 case 8: khz = 2447000; break; \
662 case 9: khz = 2452000; break; \
663 case 10: khz = 2457000; break; \
664 case 11: khz = 2462000; break; \
665 case 12: khz = 2467000; break; \
666 case 13: khz = 2472000; break; \
667 case 14: khz = 2484000; break; \
668 case 36: /* UNII */ khz = 5180000; break; \
669 case 40: /* UNII */ khz = 5200000; break; \
670 case 44: /* UNII */ khz = 5220000; break; \
671 case 48: /* UNII */ khz = 5240000; break; \
672 case 52: /* UNII */ khz = 5260000; break; \
673 case 56: /* UNII */ khz = 5280000; break; \
674 case 60: /* UNII */ khz = 5300000; break; \
675 case 64: /* UNII */ khz = 5320000; break; \
676 case 149: /* UNII */ khz = 5745000; break; \
677 case 153: /* UNII */ khz = 5765000; break; \
678 case 157: /* UNII */ khz = 5785000; break; \
679 case 161: /* UNII */ khz = 5805000; break; \
680 case 165: /* UNII */ khz = 5825000; break; \
681 case 100: /* HiperLAN2 */ khz = 5500000; break; \
682 case 104: /* HiperLAN2 */ khz = 5520000; break; \
683 case 108: /* HiperLAN2 */ khz = 5540000; break; \
684 case 112: /* HiperLAN2 */ khz = 5560000; break; \
685 case 116: /* HiperLAN2 */ khz = 5580000; break; \
686 case 120: /* HiperLAN2 */ khz = 5600000; break; \
687 case 124: /* HiperLAN2 */ khz = 5620000; break; \
688 case 128: /* HiperLAN2 */ khz = 5640000; break; \
689 case 132: /* HiperLAN2 */ khz = 5660000; break; \
690 case 136: /* HiperLAN2 */ khz = 5680000; break; \
691 case 140: /* HiperLAN2 */ khz = 5700000; break; \
692 case 34: /* Japan MMAC */ khz = 5170000; break; \
693 case 38: /* Japan MMAC */ khz = 5190000; break; \
694 case 42: /* Japan MMAC */ khz = 5210000; break; \
695 case 46: /* Japan MMAC */ khz = 5230000; break; \
696 case 184: /* Japan */ khz = 4920000; break; \
697 case 188: /* Japan */ khz = 4940000; break; \
698 case 192: /* Japan */ khz = 4960000; break; \
699 case 196: /* Japan */ khz = 4980000; break; \
700 case 208: /* Japan, means J08 */ khz = 5040000; break; \
701 case 212: /* Japan, means J12 */ khz = 5060000; break; \
702 case 216: /* Japan, means J16 */ khz = 5080000; break; \
703 default: khz = 2412000; break; \
707 #define MAP_KHZ_TO_CHANNEL_ID(khz, ch) { \
710 case 2412000: ch = 1; break; \
711 case 2417000: ch = 2; break; \
712 case 2422000: ch = 3; break; \
713 case 2427000: ch = 4; break; \
714 case 2432000: ch = 5; break; \
715 case 2437000: ch = 6; break; \
716 case 2442000: ch = 7; break; \
717 case 2447000: ch = 8; break; \
718 case 2452000: ch = 9; break; \
719 case 2457000: ch = 10; break; \
720 case 2462000: ch = 11; break; \
721 case 2467000: ch = 12; break; \
722 case 2472000: ch = 13; break; \
723 case 2484000: ch = 14; break; \
724 case 5180000: ch = 36; /* UNII */ break; \
725 case 5200000: ch = 40; /* UNII */ break; \
726 case 5220000: ch = 44; /* UNII */ break; \
727 case 5240000: ch = 48; /* UNII */ break; \
728 case 5260000: ch = 52; /* UNII */ break; \
729 case 5280000: ch = 56; /* UNII */ break; \
730 case 5300000: ch = 60; /* UNII */ break; \
731 case 5320000: ch = 64; /* UNII */ break; \
732 case 5745000: ch = 149; /* UNII */ break; \
733 case 5765000: ch = 153; /* UNII */ break; \
734 case 5785000: ch = 157; /* UNII */ break; \
735 case 5805000: ch = 161; /* UNII */ break; \
736 case 5825000: ch = 165; /* UNII */ break; \
737 case 5500000: ch = 100; /* HiperLAN2 */ break; \
738 case 5520000: ch = 104; /* HiperLAN2 */ break; \
739 case 5540000: ch = 108; /* HiperLAN2 */ break; \
740 case 5560000: ch = 112; /* HiperLAN2 */ break; \
741 case 5580000: ch = 116; /* HiperLAN2 */ break; \
742 case 5600000: ch = 120; /* HiperLAN2 */ break; \
743 case 5620000: ch = 124; /* HiperLAN2 */ break; \
744 case 5640000: ch = 128; /* HiperLAN2 */ break; \
745 case 5660000: ch = 132; /* HiperLAN2 */ break; \
746 case 5680000: ch = 136; /* HiperLAN2 */ break; \
747 case 5700000: ch = 140; /* HiperLAN2 */ break; \
748 case 5170000: ch = 34; /* Japan MMAC */ break; \
749 case 5190000: ch = 38; /* Japan MMAC */ break; \
750 case 5210000: ch = 42; /* Japan MMAC */ break; \
751 case 5230000: ch = 46; /* Japan MMAC */ break; \
752 case 4920000: ch = 184; /* Japan */ break; \
753 case 4940000: ch = 188; /* Japan */ break; \
754 case 4960000: ch = 192; /* Japan */ break; \
755 case 4980000: ch = 196; /* Japan */ break; \
756 case 5040000: ch = 208; /* Japan, means J08 */ break; \
757 case 5060000: ch = 212; /* Japan, means J12 */ break; \
758 case 5080000: ch = 216; /* Japan, means J16 */ break; \
759 default: ch = 1; break; \
764 // Common fragment list structure - Identical to the scatter gather frag list structure
766 #define NIC_MAX_PHYS_BUF_COUNT 8
768 typedef struct _RTMP_SCATTER_GATHER_ELEMENT {
772 } RTMP_SCATTER_GATHER_ELEMENT, *PRTMP_SCATTER_GATHER_ELEMENT;
775 typedef struct _RTMP_SCATTER_GATHER_LIST {
776 ULONG NumberOfElements;
778 RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT];
779 } RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST;
782 // Some utility macros
785 #define min(_a, _b) (((_a) < (_b)) ? (_a) : (_b))
789 #define max(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
792 #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))))
794 #define INC_COUNTER64(Val) (Val.QuadPart++)
796 #define INFRA_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_INFRA_ON))
797 #define ADHOC_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_ADHOC_ON))
798 #define MONITOR_ON(_p) (((_p)->StaCfg.BssType) == BSS_MONITOR)
799 #define IDLE_ON(_p) (!INFRA_ON(_p) && !ADHOC_ON(_p))
801 // Check LEAP & CCKM flags
802 #define LEAP_ON(_p) (((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP)
803 #define LEAP_CCKM_ON(_p) ((((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg.LeapAuthInfo.CCKM == TRUE))
805 // if orginal Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required
806 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \
808 if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) \
810 _pExtraLlcSnapEncap = SNAP_802_1H; \
811 if (NdisEqualMemory(IPX, _pBufVA + 12, 2) || \
812 NdisEqualMemory(APPLE_TALK, _pBufVA + 12, 2)) \
814 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
819 _pExtraLlcSnapEncap = NULL; \
823 // New Define for new Tx Path.
824 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \
826 if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) \
828 _pExtraLlcSnapEncap = SNAP_802_1H; \
829 if (NdisEqualMemory(IPX, _pBufVA, 2) || \
830 NdisEqualMemory(APPLE_TALK, _pBufVA, 2)) \
832 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
837 _pExtraLlcSnapEncap = NULL; \
842 #define MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType) \
844 NdisMoveMemory(_p, _pMac1, MAC_ADDR_LEN); \
845 NdisMoveMemory((_p + MAC_ADDR_LEN), _pMac2, MAC_ADDR_LEN); \
846 NdisMoveMemory((_p + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \
849 // if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way.
850 // else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field
851 // else remove the LLC/SNAP field from the result Ethernet frame
852 // Patch for WHQL only, which did not turn on Netbios but use IPX within its payload
854 // _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO
855 // _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed
856 #define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \
860 _pRemovedLLCSNAP = NULL; \
861 if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \
862 NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) \
864 PUCHAR pProto = _pData + 6; \
866 if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \
867 NdisEqualMemory(SNAP_802_1H, _pData, 6)) \
869 LLC_Len[0] = (UCHAR)(_DataSize / 256); \
870 LLC_Len[1] = (UCHAR)(_DataSize % 256); \
871 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
875 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \
876 _pRemovedLLCSNAP = _pData; \
877 _DataSize -= LENGTH_802_1_H; \
878 _pData += LENGTH_802_1_H; \
883 LLC_Len[0] = (UCHAR)(_DataSize / 256); \
884 LLC_Len[1] = (UCHAR)(_DataSize % 256); \
885 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
889 #define SWITCH_AB( _pAA, _pBB) \
897 // Enqueue this frame to MLME engine
898 // We need to enqueue the whole frame because MLME need to pass data type
899 // information from 802.11 header
900 #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
902 UINT32 High32TSF, Low32TSF; \
903 RTMP_IO_READ32(_pAd, TSF_TIMER_DW1, &High32TSF); \
904 RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \
905 MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \
908 #define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \
909 NdisQueryBuffer(_NdisBuf, _ppVA, _pBufLen)
911 #define MAC_ADDR_EQUAL(pAddr1,pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), MAC_ADDR_LEN)
912 #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1==len2) && (RTMPEqualMemory(ssid1, ssid2, len1)))
915 // Check if it is Japan W53(ch52,56,60,64) channel.
917 #define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64))
919 #ifdef CONFIG_STA_SUPPORT
920 #define STA_PORT_SECURED(_pAd) \
922 _pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \
923 RTMP_SET_PSFLAG(_pAd, fRTMP_PS_CAN_GO_SLEEP); \
924 NdisAcquireSpinLock(&(_pAd)->MacTabLock); \
925 _pAd->MacTab.Content[BSSID_WCID].PortSecured = _pAd->StaCfg.PortSecured; \
926 NdisReleaseSpinLock(&(_pAd)->MacTabLock); \
928 #endif // CONFIG_STA_SUPPORT //
932 // Register set pair for initialzation register set definition
934 typedef struct _RTMP_REG_PAIR
938 } RTMP_REG_PAIR, *PRTMP_REG_PAIR;
940 typedef struct _REG_PAIR
944 } REG_PAIR, *PREG_PAIR;
947 // Register set pair for initialzation register set definition
949 typedef struct _RTMP_RF_REGS
956 } RTMP_RF_REGS, *PRTMP_RF_REGS;
958 typedef struct _FREQUENCY_ITEM {
963 } FREQUENCY_ITEM, *PFREQUENCY_ITEM;
966 // Data buffer for DMA operation, the buffer must be contiguous physical memory
967 // Both DMA to / from CPU use the same structure.
969 typedef struct _RTMP_DMABUF
972 PVOID AllocVa; // TxBuf virtual address
973 NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address
974 } RTMP_DMABUF, *PRTMP_DMABUF;
977 typedef union _HEADER_802_11_SEQ{
990 } HEADER_802_11_SEQ, *PHEADER_802_11_SEQ;
993 // Data buffer for DMA operation, the buffer must be contiguous physical memory
994 // Both DMA to / from CPU use the same structure.
996 typedef struct _RTMP_REORDERBUF
999 PVOID AllocVa; // TxBuf virtual address
1000 UCHAR Header802_3[14];
1001 HEADER_802_11_SEQ Sequence; //support compressed bitmap BA, so no consider fragment in BA
1005 NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address
1006 } RTMP_REORDERBUF, *PRTMP_REORDERBUF;
1009 // Control block (Descriptor) for all ring descriptor DMA operation, buffer must be
1010 // contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor
1011 // which won't be released, driver has to wait until upper layer return the packet
1012 // before giveing up this rx ring descriptor to ASIC. NDIS_BUFFER is assocaited pair
1013 // to describe the packet buffer. For Tx, NDIS_PACKET stored the tx packet descriptor
1014 // which driver should ACK upper layer when the tx is physically done or failed.
1016 typedef struct _RTMP_DMACB
1018 ULONG AllocSize; // Control block size
1019 PVOID AllocVa; // Control block virtual address
1020 NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address
1021 PNDIS_PACKET pNdisPacket;
1022 PNDIS_PACKET pNextNdisPacket;
1024 RTMP_DMABUF DmaBuf; // Associated DMA buffer structure
1025 } RTMP_DMACB, *PRTMP_DMACB;
1027 typedef struct _RTMP_TX_BUF
1031 ULONG AllocSize; // Control block size
1032 PVOID AllocVa; // Control block virtual address
1033 NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address
1034 } RTMP_TXBUF, *PRTMP_TXBUF;
1036 typedef struct _RTMP_RX_BUF
1040 RTMP_REORDERBUF MAP_RXBuf[MAX_RX_REORDERBUF];
1041 } RTMP_RXBUF, *PRTMP_RXBUF;
1042 typedef struct _RTMP_TX_RING
1044 RTMP_DMACB Cell[TX_RING_SIZE];
1047 UINT32 TxSwFreeIdx; // software next free tx index
1048 } RTMP_TX_RING, *PRTMP_TX_RING;
1050 typedef struct _RTMP_RX_RING
1052 RTMP_DMACB Cell[RX_RING_SIZE];
1055 INT32 RxSwReadIdx; // software next read index
1056 } RTMP_RX_RING, *PRTMP_RX_RING;
1058 typedef struct _RTMP_MGMT_RING
1060 RTMP_DMACB Cell[MGMT_RING_SIZE];
1063 UINT32 TxSwFreeIdx; // software next free tx index
1064 } RTMP_MGMT_RING, *PRTMP_MGMT_RING;
1067 // Statistic counter structure
1069 typedef struct _COUNTER_802_3
1072 ULONG GoodTransmits;
1079 ULONG RcvAlignmentErrors;
1081 ULONG MoreCollisions;
1083 } COUNTER_802_3, *PCOUNTER_802_3;
1085 typedef struct _COUNTER_802_11 {
1087 LARGE_INTEGER LastTransmittedFragmentCount;
1088 LARGE_INTEGER TransmittedFragmentCount;
1089 LARGE_INTEGER MulticastTransmittedFrameCount;
1090 LARGE_INTEGER FailedCount;
1091 LARGE_INTEGER RetryCount;
1092 LARGE_INTEGER MultipleRetryCount;
1093 LARGE_INTEGER RTSSuccessCount;
1094 LARGE_INTEGER RTSFailureCount;
1095 LARGE_INTEGER ACKFailureCount;
1096 LARGE_INTEGER FrameDuplicateCount;
1097 LARGE_INTEGER ReceivedFragmentCount;
1098 LARGE_INTEGER MulticastReceivedFrameCount;
1099 LARGE_INTEGER FCSErrorCount;
1100 } COUNTER_802_11, *PCOUNTER_802_11;
1102 typedef struct _COUNTER_RALINK {
1103 ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput
1104 ULONG LastReceivedByteCount;
1105 ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput
1106 ULONG BeenDisassociatedCount;
1107 ULONG BadCQIAutoRecoveryCount;
1108 ULONG PoorCQIRoamingCount;
1109 ULONG MgmtRingFullCount;
1110 ULONG RxCountSinceLastNULL;
1112 ULONG RxRingErrCount;
1114 ULONG TxRingErrCount;
1115 LARGE_INTEGER RealFcsErrCount;
1116 ULONG PendingNdisPacketCount;
1118 ULONG OneSecOsTxCount[NUM_OF_TX_RING];
1119 ULONG OneSecDmaDoneCount[NUM_OF_TX_RING];
1120 UINT32 OneSecTxDoneCount;
1121 ULONG OneSecRxCount;
1122 UINT32 OneSecTxAggregationCount;
1123 UINT32 OneSecRxAggregationCount;
1125 UINT32 OneSecFrameDuplicateCount;
1128 UINT32 OneSecTxNoRetryOkCount;
1129 UINT32 OneSecTxRetryOkCount;
1130 UINT32 OneSecTxFailCount;
1131 UINT32 OneSecFalseCCACnt; // CCA error count, for debug purpose, might move to global counter
1132 UINT32 OneSecRxOkCnt; // RX without error
1133 UINT32 OneSecRxOkDataCnt; // unicast-to-me DATA frame count
1134 UINT32 OneSecRxFcsErrCnt; // CRC error
1135 UINT32 OneSecBeaconSentCnt;
1136 UINT32 LastOneSecTotalTxCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount
1137 UINT32 LastOneSecRxOkDataCnt; // OneSecRxOkDataCnt
1140 ULONG TxNonAggCount;
1141 ULONG TxAgg1MPDUCount;
1142 ULONG TxAgg2MPDUCount;
1143 ULONG TxAgg3MPDUCount;
1144 ULONG TxAgg4MPDUCount;
1145 ULONG TxAgg5MPDUCount;
1146 ULONG TxAgg6MPDUCount;
1147 ULONG TxAgg7MPDUCount;
1148 ULONG TxAgg8MPDUCount;
1149 ULONG TxAgg9MPDUCount;
1150 ULONG TxAgg10MPDUCount;
1151 ULONG TxAgg11MPDUCount;
1152 ULONG TxAgg12MPDUCount;
1153 ULONG TxAgg13MPDUCount;
1154 ULONG TxAgg14MPDUCount;
1155 ULONG TxAgg15MPDUCount;
1156 ULONG TxAgg16MPDUCount;
1158 LARGE_INTEGER TransmittedOctetsInAMSDU;
1159 LARGE_INTEGER TransmittedAMSDUCount;
1160 LARGE_INTEGER ReceivedOctesInAMSDUCount;
1161 LARGE_INTEGER ReceivedAMSDUCount;
1162 LARGE_INTEGER TransmittedAMPDUCount;
1163 LARGE_INTEGER TransmittedMPDUsInAMPDUCount;
1164 LARGE_INTEGER TransmittedOctetsInAMPDUCount;
1165 LARGE_INTEGER MPDUInReceivedAMPDUCount;
1166 } COUNTER_RALINK, *PCOUNTER_RALINK;
1168 typedef struct _PID_COUNTER {
1169 ULONG TxAckRequiredCount; // CRC error
1171 ULONG TxSuccessCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount
1172 ULONG LastSuccessRate;
1173 } PID_COUNTER, *PPID_COUNTER;
1175 typedef struct _COUNTER_DRS {
1176 // to record the each TX rate's quality. 0 is best, the bigger the worse.
1177 USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
1178 UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH];
1179 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
1180 ULONG CurrTxRateStableTime; // # of second in current TX rate
1181 BOOLEAN fNoisyEnvironment;
1182 BOOLEAN fLastSecAccordingRSSI;
1183 UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down
1184 UCHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction
1185 ULONG LastTxOkCount;
1186 } COUNTER_DRS, *PCOUNTER_DRS;
1189 // Arcfour Structure Added by PaulWu
1191 typedef struct _ARCFOUR
1196 } ARCFOURCONTEXT, *PARCFOURCONTEXT;
1198 // MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI too. just copy to TXWI.
1199 typedef struct _RECEIVE_SETTING {
1200 #ifdef RT_BIG_ENDIAN
1204 USHORT STBC:2; //SPACE
1206 USHORT Mode:2; //channel bandwidth 20MHz or 40 MHz
1207 USHORT NumOfRX:2; // MIMO. WE HAVE 3R
1209 USHORT NumOfRX:2; // MIMO. WE HAVE 3R
1210 USHORT Mode:2; //channel bandwidth 20MHz or 40 MHz
1212 USHORT STBC:2; //SPACE
1217 } RECEIVE_SETTING, *PRECEIVE_SETTING;
1219 // Shared key data structure
1220 typedef struct _WEP_KEY {
1221 UCHAR KeyLen; // Key length for each key, 0: entry is invalid
1222 UCHAR Key[MAX_LEN_OF_KEY]; // right now we implement 4 keys, 128 bits max
1223 } WEP_KEY, *PWEP_KEY;
1225 typedef struct _CIPHER_KEY {
1226 UCHAR Key[16]; // right now we implement 4 keys, 128 bits max
1227 UCHAR RxMic[8]; // make alignment
1229 UCHAR TxTsc[6]; // 48bit TSC value
1230 UCHAR RxTsc[6]; // 48bit TSC value
1231 UCHAR CipherAlg; // 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128
1233 #ifdef CONFIG_STA_SUPPORT
1235 #endif // CONFIG_STA_SUPPORT //
1236 // Key length for each key, 0: entry is invalid
1237 UCHAR Type; // Indicate Pairwise/Group when reporting MIC error
1238 } CIPHER_KEY, *PCIPHER_KEY;
1240 typedef struct _BBP_TUNING_STRUCT {
1242 UCHAR FalseCcaCountUpperBound; // 100 per sec
1243 UCHAR FalseCcaCountLowerBound; // 10 per sec
1244 UCHAR R17LowerBound; // specified in E2PROM
1245 UCHAR R17UpperBound; // 0x68 according to David Tung
1246 UCHAR CurrentR17Value;
1247 } BBP_TUNING, *PBBP_TUNING;
1249 typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT {
1250 UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status
1251 UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2
1252 UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2
1253 UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4
1254 UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4
1255 SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2
1256 SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4
1257 SHORT Pair1LastAvgRssi; //
1258 SHORT Pair2LastAvgRssi; //
1259 ULONG RcvPktNumWhenEvaluate;
1260 BOOLEAN FirstPktArrivedWhenEvaluate;
1261 RALINK_TIMER_STRUCT RxAntDiversityTimer;
1262 } SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY;
1264 typedef struct _LEAP_AUTH_INFO {
1265 BOOLEAN Enabled; //Ture: Enable LEAP Authentication
1266 BOOLEAN CCKM; //Ture: Use Fast Reauthentication with CCKM
1268 UCHAR UserName[256]; //LEAP, User name
1270 UCHAR Password[256]; //LEAP, User Password
1272 } LEAP_AUTH_INFO, *PLEAP_AUTH_INFO;
1275 UCHAR Addr[MAC_ADDR_LEN];
1276 UCHAR ErrorCode[2]; //00 01-Invalid authentication type
1277 //00 02-Authentication timeout
1278 //00 03-Challenge from AP failed
1279 //00 04-Challenge to AP failed
1281 } ROGUEAP_ENTRY, *PROGUEAP_ENTRY;
1285 ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE];
1286 } ROGUEAP_TABLE, *PROGUEAP_TABLE;
1292 } CCK_TX_POWER_CALIBRATE, *PCCK_TX_POWER_CALIBRATE;
1295 // Receive Tuple Cache Format
1297 typedef struct _TUPLE_CACHE {
1299 UCHAR MacAddress[MAC_ADDR_LEN];
1302 } TUPLE_CACHE, *PTUPLE_CACHE;
1305 // Fragment Frame structure
1307 typedef struct _FRAGMENT_FRAME {
1308 PNDIS_PACKET pFragPacket;
1312 ULONG Flags; // Some extra frame information. bit 0: LLC presented
1313 } FRAGMENT_FRAME, *PFRAGMENT_FRAME;
1317 // Packet information for NdisQueryPacket
1319 typedef struct _PACKET_INFO {
1320 UINT PhysicalBufferCount; // Physical breaks of buffer descripor chained
1321 UINT BufferCount ; // Number of Buffer descriptor chained
1322 UINT TotalPacketLength ; // Self explained
1323 PNDIS_BUFFER pFirstBuffer; // Pointer to first buffer descriptor
1324 } PACKET_INFO, *PPACKET_INFO;
1327 // Tkip Key structure which RC4 key & MIC calculation
1329 typedef struct _TKIP_KEY_INFO {
1330 UINT nBytesInM; // # bytes in M for MICKEY
1333 ULONG K0; // for MICKEY Low
1334 ULONG K1; // for MICKEY Hig
1335 ULONG L; // Current state for MICKEY
1336 ULONG R; // Current state for MICKEY
1337 ULONG M; // Message accumulator for MICKEY
1340 } TKIP_KEY_INFO, *PTKIP_KEY_INFO;
1343 // Private / Misc data, counters for driver internal use
1345 typedef struct __PRIVATE_STRUC {
1346 UINT SystemResetCnt; // System reset counter
1347 UINT TxRingFullCnt; // Tx ring full occurrance number
1348 UINT PhyRxErrCnt; // PHY Rx error count, for debug purpose, might move to global counter
1349 // Variables for WEP encryption / decryption in rtmp_wep.c
1351 ARCFOURCONTEXT WEPCONTEXT;
1355 } PRIVATE_STRUC, *PPRIVATE_STRUC;
1357 // structure to tune BBP R66 (BBP TUNING)
1358 typedef struct _BBP_R66_TUNING {
1360 USHORT FalseCcaLowerThreshold; // default 100
1361 USHORT FalseCcaUpperThreshold; // default 512
1363 UCHAR R66CurrentValue;
1364 BOOLEAN R66LowerUpperSelect; //Before LinkUp, Used LowerBound or UpperBound as R66 value.
1365 } BBP_R66_TUNING, *PBBP_R66_TUNING;
1367 // structure to store channel TX power
1368 typedef struct _CHANNEL_TX_POWER {
1369 USHORT RemainingTimeForUse; //unit: sec
1371 #ifdef DOT11N_DRAFT3
1372 BOOLEAN bEffectedChannel; // For BW 40 operating in 2.4GHz , the "effected channel" is the channel that is covered in 40Mhz.
1373 #endif // DOT11N_DRAFT3 //
1378 } CHANNEL_TX_POWER, *PCHANNEL_TX_POWER;
1380 // structure to store 802.11j channel TX power
1381 typedef struct _CHANNEL_11J_TX_POWER {
1383 UCHAR BW; // BW_10 or BW_20
1386 USHORT RemainingTimeForUse; //unit: sec
1387 } CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER;
1389 typedef enum _ABGBAND_STATE_ {
1395 typedef struct _MLME_STRUCT {
1396 #ifdef CONFIG_STA_SUPPORT
1397 // STA state machines
1398 STATE_MACHINE CntlMachine;
1399 STATE_MACHINE AssocMachine;
1400 STATE_MACHINE AuthMachine;
1401 STATE_MACHINE AuthRspMachine;
1402 STATE_MACHINE SyncMachine;
1403 STATE_MACHINE WpaPskMachine;
1404 STATE_MACHINE LeapMachine;
1405 STATE_MACHINE AironetMachine;
1406 STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE];
1407 STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE];
1408 STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE];
1409 STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE];
1410 STATE_MACHINE_FUNC WpaPskFunc[WPA_PSK_FUNC_SIZE];
1411 STATE_MACHINE_FUNC AironetFunc[AIRONET_FUNC_SIZE];
1412 #endif // CONFIG_STA_SUPPORT //
1413 STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE];
1415 STATE_MACHINE ActMachine;
1418 #ifdef QOS_DLS_SUPPORT
1419 STATE_MACHINE DlsMachine;
1420 STATE_MACHINE_FUNC DlsFunc[DLS_FUNC_SIZE];
1421 #endif // QOS_DLS_SUPPORT //
1426 ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming
1427 ULONG Now32; // latch the value of NdisGetSystemUpTime()
1428 ULONG LastSendNULLpsmTime;
1431 NDIS_SPIN_LOCK TaskLock;
1436 RALINK_TIMER_STRUCT PeriodicTimer;
1437 RALINK_TIMER_STRUCT APSDPeriodicTimer;
1438 RALINK_TIMER_STRUCT LinkDownTimer;
1439 RALINK_TIMER_STRUCT LinkUpTimer;
1440 UCHAR bPsPollTimerRunning;
1441 RALINK_TIMER_STRUCT PsPollTimer;
1442 RALINK_TIMER_STRUCT RadioOnOffTimer;
1443 ULONG PeriodicRound;
1444 ULONG OneSecPeriodicRound;
1447 BOOLEAN bLowThroughput;
1448 BOOLEAN bEnableAutoAntennaCheck;
1449 RALINK_TIMER_STRUCT RxAntEvalTimer;
1452 } MLME_STRUCT, *PMLME_STRUCT;
1454 // structure for radar detection and channel switch
1455 typedef struct _RADAR_DETECT_STRUCT {
1456 UCHAR CSCount; //Channel switch counter
1457 UCHAR CSPeriod; //Channel switch period (beacon count)
1458 UCHAR RDCount; //Radar detection counter
1459 UCHAR RDMode; //Radar Detection mode
1460 UCHAR RDDurRegion; //Radar detection duration region
1467 ULONG InServiceMonitorCount; // unit: sec
1468 UINT8 DfsSessionTime;
1471 UINT8 LongPulseRadarTh;
1472 } RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT;
1474 #ifdef CARRIER_DETECTION_SUPPORT
1475 typedef enum CD_STATE_n
1482 typedef struct CARRIER_DETECTION_s
1485 UINT8 CDSessionTime;
1488 } CARRIER_DETECTION, *PCARRIER_DETECTION;
1489 #endif // CARRIER_DETECTION_SUPPORT //
1491 typedef enum _REC_BLOCKACK_STATUS
1495 Recipient_HandleRes,
1497 } REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS;
1499 typedef enum _ORI_BLOCKACK_STATUS
1505 } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS;
1507 #ifdef DOT11_N_SUPPORT
1508 typedef struct _BA_ORI_ENTRY{
1513 // Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header.
1515 USHORT TimeOutValue;
1516 ORI_BLOCKACK_STATUS ORI_BA_Status;
1517 RALINK_TIMER_STRUCT ORIBATimer;
1519 } BA_ORI_ENTRY, *PBA_ORI_ENTRY;
1521 typedef struct _BA_REC_ENTRY {
1524 UCHAR BAWinSize; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU.
1526 USHORT TimeOutValue;
1527 RALINK_TIMER_STRUCT RECBATimer;
1528 ULONG LastIndSeqAtTimer;
1531 REC_BLOCKACK_STATUS REC_BA_Status;
1532 NDIS_SPIN_LOCK RxReRingLock; // Rx Ring spinlock
1534 struct reordering_list list;
1535 } BA_REC_ENTRY, *PBA_REC_ENTRY;
1539 ULONG numAsRecipient; // I am recipient of numAsRecipient clients. These client are in the BARecEntry[]
1540 ULONG numAsOriginator; // I am originator of numAsOriginator clients. These clients are in the BAOriEntry[]
1541 BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE];
1542 BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE];
1543 } BA_TABLE, *PBA_TABLE;
1545 //For QureyBATableOID use;
1546 typedef struct PACKED _OID_BA_REC_ENTRY{
1547 UCHAR MACAddr[MAC_ADDR_LEN];
1548 UCHAR BaBitmap; // if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize
1551 REC_BLOCKACK_STATUS REC_BA_Status[8];
1552 } OID_BA_REC_ENTRY, *POID_BA_REC_ENTRY;
1554 //For QureyBATableOID use;
1555 typedef struct PACKED _OID_BA_ORI_ENTRY{
1556 UCHAR MACAddr[MAC_ADDR_LEN];
1557 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
1560 ORI_BLOCKACK_STATUS ORI_BA_Status[8];
1561 } OID_BA_ORI_ENTRY, *POID_BA_ORI_ENTRY;
1563 typedef struct _QUERYBA_TABLE{
1564 OID_BA_ORI_ENTRY BAOriEntry[32];
1565 OID_BA_REC_ENTRY BARecEntry[32];
1566 UCHAR OriNum;// Number of below BAOriEntry
1567 UCHAR RecNum;// Number of below BARecEntry
1568 } QUERYBA_TABLE, *PQUERYBA_TABLE;
1570 typedef union _BACAP_STRUC {
1571 #ifdef RT_BIG_ENDIAN
1574 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.
1575 UINT32 bHtAdhoc:1; // adhoc can use ht rate.
1576 UINT32 MMPSmode:2; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable
1577 UINT32 AmsduSize:1; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935};
1578 UINT32 AmsduEnable:1; //Enable AMSDU transmisstion
1579 UINT32 MpduDensity:3;
1580 UINT32 Policy:2; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use
1581 UINT32 AutoBA:1; // automatically BA
1582 UINT32 TxBAWinLimit:8;
1583 UINT32 RxBAWinLimit:8;
1587 UINT32 RxBAWinLimit:8;
1588 UINT32 TxBAWinLimit:8;
1589 UINT32 AutoBA:1; // automatically BA
1590 UINT32 Policy:2; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use
1591 UINT32 MpduDensity:3;
1592 UINT32 AmsduEnable:1; //Enable AMSDU transmisstion
1593 UINT32 AmsduSize:1; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935};
1594 UINT32 MMPSmode:2; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable
1595 UINT32 bHtAdhoc:1; // adhoc can use ht rate.
1596 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.
1601 } BACAP_STRUC, *PBACAP_STRUC;
1602 #endif // DOT11_N_SUPPORT //
1604 //This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic)
1605 typedef struct _IOT_STRUC {
1607 UCHAR ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[0]
1608 UCHAR RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[1]
1609 ULONG OneSecInWindowCount;
1610 ULONG OneSecFrameDuplicateCount;
1611 ULONG OneSecOutWindowCount;
1616 BOOLEAN bRTSLongProtOn;
1617 #ifdef CONFIG_STA_SUPPORT
1618 BOOLEAN bLastAtheros;
1619 BOOLEAN bCurrentAtheros;
1620 BOOLEAN bNowAtherosBurstOn;
1621 BOOLEAN bNextDisableRxBA;
1623 #endif // CONFIG_STA_SUPPORT //
1624 } IOT_STRUC, *PIOT_STRUC;
1626 // This is the registry setting for 802.11n transmit setting. Used in advanced page.
1627 typedef union _REG_TRANSMIT_SETTING {
1628 #ifdef RT_BIG_ENDIAN
1634 UINT32 STBC:1; //SPACE
1636 UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz
1637 UINT32 TxBF:1; // 3*3
1644 UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz
1646 UINT32 STBC:1; //SPACE
1654 } REG_TRANSMIT_SETTING, *PREG_TRANSMIT_SETTING;
1656 typedef union _DESIRED_TRANSMIT_SETTING {
1657 #ifdef RT_BIG_ENDIAN
1660 USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode.
1662 USHORT MCS:7; // MCS
1666 USHORT MCS:7; // MCS
1668 USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode.
1673 } DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING;
1676 BOOLEAN IsRecipient;
1677 UCHAR MACAddr[MAC_ADDR_LEN];
1681 BOOLEAN bAllTid; // If True, delete all TID for BA sessions with this MACaddr.
1682 } OID_ADD_BA_ENTRY, *POID_ADD_BA_ENTRY;
1685 // Multiple SSID structure
1687 #define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */
1688 #define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */
1690 /* clear bcmc TIM bit */
1691 #define WLAN_MR_TIM_BCMC_CLEAR(apidx) \
1692 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] &= ~BIT8[0];
1694 /* set bcmc TIM bit */
1695 #define WLAN_MR_TIM_BCMC_SET(apidx) \
1696 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] |= BIT8[0];
1698 /* clear a station PS TIM bit */
1699 #define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, wcid) \
1700 { UCHAR tim_offset = wcid >> 3; \
1701 UCHAR bit_offset = wcid & 0x7; \
1702 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); }
1704 /* set a station PS TIM bit */
1705 #define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \
1706 { UCHAR tim_offset = wcid >> 3; \
1707 UCHAR bit_offset = wcid & 0x7; \
1708 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; }
1711 typedef struct _MULTISSID_STRUCT {
1712 UCHAR Bssid[MAC_ADDR_LEN];
1714 CHAR Ssid[MAX_LEN_OF_SSID];
1715 USHORT CapabilityInfo;
1719 NDIS_802_11_AUTHENTICATION_MODE AuthMode;
1720 NDIS_802_11_WEP_STATUS WepStatus;
1721 NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
1722 WPA_MIX_PAIR_CIPHER WpaMixPairCipher;
1726 ULONG ReceivedByteCount;
1727 ULONG TransmittedByteCount;
1731 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
1732 RT_HT_PHY_INFO DesiredHtPhyInfo;
1733 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting. this is for reading registry setting only. not useful.
1734 BOOLEAN bAutoTxRateSwitch;
1738 UCHAR TxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11, ...
1739 UCHAR DesiredRates[MAX_LEN_OF_SUPPORTED_RATES];// OID_802_11_DESIRED_RATES
1740 UCHAR DesiredRatesIndex;
1741 UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1743 UCHAR TimBitmaps[WLAN_MAX_NUM_OF_TIM];
1753 NDIS_802_11_PRIVACY_FILTER PrivacyFilter;
1754 UCHAR BANClass3Data;
1755 ULONG IsolateInterStaTraffic;
1758 UCHAR RSN_IE[2][MAX_LEN_OF_RSNIE];
1761 UCHAR TimIELocationInBeacon;
1762 UCHAR CapabilityInfoLocationInBeacon;
1763 // outgoing BEACON frame buffer and corresponding TXWI
1764 // PTXWI_STRUC BeaconTxWI; //
1765 CHAR BeaconBuf[MAX_BEACON_SIZE]; // NOTE: BeaconBuf should be 4-byte aligned
1768 UINT16 StationKeepAliveTime; // unit: second
1771 USHORT VLAN_Priority;
1773 RT_802_11_ACL AccessControlList;
1776 BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM
1777 BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS
1779 UCHAR DlsPTK[64]; // Due to windows dirver count on meetinghouse to handle 4-way shake
1781 // For 802.1x daemon setting per BSS
1782 UCHAR radius_srv_num;
1783 RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM];
1786 unsigned int mylinkid;
1790 UINT32 RcvdConflictSsidCount;
1791 UINT32 RcvdSpoofedAssocRespCount;
1792 UINT32 RcvdSpoofedReassocRespCount;
1793 UINT32 RcvdSpoofedProbeRespCount;
1794 UINT32 RcvdSpoofedBeaconCount;
1795 UINT32 RcvdSpoofedDisassocCount;
1796 UINT32 RcvdSpoofedAuthCount;
1797 UINT32 RcvdSpoofedDeauthCount;
1798 UINT32 RcvdSpoofedUnknownMgmtCount;
1799 UINT32 RcvdReplayAttackCount;
1801 CHAR RssiOfRcvdConflictSsid;
1802 CHAR RssiOfRcvdSpoofedAssocResp;
1803 CHAR RssiOfRcvdSpoofedReassocResp;
1804 CHAR RssiOfRcvdSpoofedProbeResp;
1805 CHAR RssiOfRcvdSpoofedBeacon;
1806 CHAR RssiOfRcvdSpoofedDisassoc;
1807 CHAR RssiOfRcvdSpoofedAuth;
1808 CHAR RssiOfRcvdSpoofedDeauth;
1809 CHAR RssiOfRcvdSpoofedUnknownMgmt;
1810 CHAR RssiOfRcvdReplayAttack;
1814 } MULTISSID_STRUCT, *PMULTISSID_STRUCT;
1818 #ifdef DOT11N_DRAFT3
1819 typedef enum _BSS2040COEXIST_FLAG{
1820 BSS_2040_COEXIST_DISABLE = 0,
1821 BSS_2040_COEXIST_TIMER_FIRED = 1,
1822 BSS_2040_COEXIST_INFO_SYNC = 2,
1823 BSS_2040_COEXIST_INFO_NOTIFY = 4,
1824 }BSS2040COEXIST_FLAG;
1825 #endif // DOT11N_DRAFT3 //
1827 // configuration common to OPMODE_AP as well as OPMODE_STA
1828 typedef struct _COMMON_CONFIG {
1830 BOOLEAN bCountryFlag;
1831 UCHAR CountryCode[3];
1833 UCHAR CountryRegion; // Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel
1834 UCHAR CountryRegionForABand; // Enum of country region for A band
1835 UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED
1836 USHORT Dsifs; // in units of usec
1837 ULONG PacketFilter; // Packet filter for receiving
1839 CHAR Ssid[MAX_LEN_OF_SSID]; // NOT NULL-terminated
1840 UCHAR SsidLen; // the actual ssid length in used
1841 UCHAR LastSsidLen; // the actual ssid length in used
1842 CHAR LastSsid[MAX_LEN_OF_SSID]; // NOT NULL-terminated
1843 UCHAR LastBssid[MAC_ADDR_LEN];
1845 UCHAR Bssid[MAC_ADDR_LEN];
1846 USHORT BeaconPeriod;
1848 UCHAR CentralChannel; // Central Channel when using 40MHz is indicating. not real channel.
1850 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
1852 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
1854 UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; // OID_802_11_DESIRED_RATES
1855 UCHAR MaxDesiredRate;
1856 UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES];
1858 ULONG BasicRateBitmap; // backup basic ratebitmap
1860 BOOLEAN bAPSDCapable;
1861 BOOLEAN bInServicePeriod;
1866 BOOLEAN bNeedSendTriggerFrame;
1867 BOOLEAN bAPSDForcePowerSave; // Force power save mode, should only use in APSD-STAUT
1868 ULONG TriggerTimerCount;
1870 UCHAR BBPCurrentBW; // BW_10, BW_20, BW_40
1871 REG_TRANSMIT_SETTING RegTransmitSetting; //registry transmit setting. this is for reading registry setting only. not useful.
1872 UCHAR TxRate; // Same value to fill in TXD. TxRate is 6-bit
1873 UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1874 UCHAR TxRateIndex; // Tx rate index in RateSwitchTable
1875 UCHAR TxRateTableSize; // Valid Tx rate table size in RateSwitchTable
1876 UCHAR MinTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1877 UCHAR RtsRate; // RATE_xxx
1878 HTTRANSMIT_SETTING MlmeTransmit; // MGMT frame PHY rate setting when operatin at Ht rate.
1879 UCHAR MlmeRate; // RATE_xxx, used to send MLME frames
1880 UCHAR BasicMlmeRate; // Default Rate for sending MLME frames
1882 USHORT RtsThreshold; // in unit of BYTE
1883 USHORT FragmentThreshold; // in unit of BYTE
1885 UCHAR TxPower; // in unit of mW
1886 ULONG TxPowerPercentage; // 0~100 %
1887 ULONG TxPowerDefault; // keep for TxPowerPercentage
1889 #ifdef DOT11_N_SUPPORT
1890 BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0
1891 BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0
1892 #endif // DOT11_N_SUPPORT //
1893 IOT_STRUC IOTestParm; // 802.11n InterOpbility Test Parameter;
1894 ULONG TxPreamble; // Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto
1895 BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable
1896 ULONG UseBGProtection; // 0: auto, 1: always use, 2: always not use
1897 BOOLEAN bUseShortSlotTime; // 0: disable, 1 - use short slot (9us)
1898 BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST, 0: disable TX PACKET BURST
1899 BOOLEAN bAggregationCapable; // 1: enable TX aggregation when the peer supports it
1900 BOOLEAN bPiggyBackCapable; // 1: enable TX piggy-back according MAC's version
1901 BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec.
1902 ULONG DisableOLBCDetect; // 0: enable OLBC detect; 1 disable OLBC detect
1904 #ifdef DOT11_N_SUPPORT
1906 #endif // DOT11_N_SUPPORT //
1907 BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM
1908 QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP
1909 EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP
1910 QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP
1911 UCHAR AckPolicy[4]; // ACK policy of the specified AC. see ACK_xxx
1912 #ifdef CONFIG_STA_SUPPORT
1913 BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS
1914 #endif // CONFIG_STA_SUPPORT //
1915 // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular
1916 // BOOLEAN control, either ON or OFF. These flags should always be accessed via
1917 // OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros.
1918 // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition
1919 ULONG OpStatusFlags;
1921 BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff.
1922 ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode.
1924 // IEEE802.11H--DFS.
1925 RADAR_DETECT_STRUCT RadarDetect;
1927 #ifdef CARRIER_DETECTION_SUPPORT
1928 CARRIER_DETECTION CarrierDetect;
1929 #endif // CARRIER_DETECTION_SUPPORT //
1931 #ifdef DOT11_N_SUPPORT
1933 UCHAR BASize; // USer desired BAWindowSize. Should not exceed our max capability
1934 //RT_HT_CAPABILITY SupportedHtPhy;
1935 RT_HT_CAPABILITY DesiredHtPhy;
1936 HT_CAPABILITY_IE HtCapability;
1937 ADD_HT_INFO_IE AddHTInfo; // Useful as AP.
1938 //This IE is used with channel switch announcement element when changing to a new 40MHz.
1939 //This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp.
1940 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
1942 #ifdef DOT11N_DRAFT3
1943 UCHAR Bss2040CoexistFlag; // bit 0: bBssCoexistTimerRunning, bit 1: NeedSyncAddHtInfo.
1944 RALINK_TIMER_STRUCT Bss2040CoexistTimer;
1946 //This IE is used for 20/40 BSS Coexistence.
1947 BSS_2040_COEXIST_IE BSS2040CoexistInfo;
1948 // ====== 11n D3.0 =======================>
1949 USHORT Dot11OBssScanPassiveDwell; // Unit : TU. 5~1000
1950 USHORT Dot11OBssScanActiveDwell; // Unit : TU. 10~1000
1951 USHORT Dot11BssWidthTriggerScanInt; // Unit : Second
1952 USHORT Dot11OBssScanPassiveTotalPerChannel; // Unit : TU. 200~10000
1953 USHORT Dot11OBssScanActiveTotalPerChannel; // Unit : TU. 20~10000
1954 USHORT Dot11BssWidthChanTranDelayFactor;
1955 USHORT Dot11OBssScanActivityThre; // Unit : percentage
1957 ULONG Dot11BssWidthChanTranDelay; // multiple of (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor)
1958 ULONG CountDownCtr; // CountDown Counter from (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor)
1960 NDIS_SPIN_LOCK TriggerEventTabLock;
1961 BSS_2040_COEXIST_IE LastBSSCoexist2040;
1962 BSS_2040_COEXIST_IE BSSCoexist2040;
1963 TRIGGER_EVENT_TAB TriggerEventTab;
1964 UCHAR ChannelListIdx;
1965 // <====== 11n D3.0 =======================
1966 BOOLEAN bOverlapScanning;
1967 #endif // DOT11N_DRAFT3 //
1970 BOOLEAN bMIMOPSEnable;
1972 BOOLEAN bDisableReordering;
1973 BOOLEAN bForty_Mhz_Intolerant;
1974 BOOLEAN bExtChannelSwitchAnnouncement;
1975 BOOLEAN bRcvBSSWidthTriggerEvents;
1976 ULONG LastRcvBSSWidthTriggerEventsTime;
1979 #endif // DOT11_N_SUPPORT //
1981 // Enable wireless event
1982 BOOLEAN bWirelessEvent;
1983 BOOLEAN bWiFiTest; // Enable this parameter for WiFi test
1985 // Tx & Rx Stream number selection
1989 // transmit phy mode, trasmit rate for Multicast.
1990 #ifdef MCAST_RATE_SPECIFIC
1991 UCHAR McastTransmitMcs;
1992 UCHAR McastTransmitPhyMode;
1993 #endif // MCAST_RATE_SPECIFIC //
1995 BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled
1999 NDIS_SPIN_LOCK MeasureReqTabLock;
2000 PMEASURE_REQ_TAB pMeasureReqTab;
2002 NDIS_SPIN_LOCK TpcReqTabLock;
2003 PTPC_REQ_TAB pTpcReqTab;
2005 // transmit phy mode, trasmit rate for Multicast.
2006 #ifdef MCAST_RATE_SPECIFIC
2007 HTTRANSMIT_SETTING MCastPhyMode;
2008 #endif // MCAST_RATE_SPECIFIC //
2011 UINT16 DefineMaxTxPwr;
2012 #endif // SINGLE_SKU //
2015 } COMMON_CONFIG, *PCOMMON_CONFIG;
2018 #ifdef CONFIG_STA_SUPPORT
2019 /* Modified by Wu Xi-Kun 4/21/2006 */
2020 // STA configuration and status
2021 typedef struct _STA_ADMIN_CONFIG {
2023 // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe
2024 // the user intended configuration, but not necessary fully equal to the final
2025 // settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either
2026 // AP or IBSS holder).
2027 // Once initialized, user configuration can only be changed via OID_xxx
2028 UCHAR BssType; // BSS_INFRA or BSS_ADHOC
2029 USHORT AtimWin; // used when starting a new IBSS
2032 // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe
2033 // the user intended configuration, and should be always applied to the final
2034 // settings in ACTIVE BSS without compromising with the BSS holder.
2035 // Once initialized, user configuration can only be changed via OID_xxx
2037 UCHAR RssiTriggerMode; // RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD
2038 USHORT DefaultListenCount; // default listen count;
2039 ULONG WindowsPowerMode; // Power mode for AC power
2040 ULONG WindowsBatteryPowerMode; // Power mode for battery if exists
2041 BOOLEAN bWindowsACCAMEnable; // Enable CAM power mode when AC on
2042 BOOLEAN bAutoReconnect; // Set to TRUE when setting OID_802_11_SSID with no matching BSSID
2043 ULONG WindowsPowerProfile; // Windows power profile, for NDIS5.1 PnP
2045 // MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1)
2046 USHORT Psm; // power management mode (PWR_ACTIVE|PWR_SAVE)
2047 USHORT DisassocReason;
2048 UCHAR DisassocSta[MAC_ADDR_LEN];
2049 USHORT DeauthReason;
2050 UCHAR DeauthSta[MAC_ADDR_LEN];
2051 USHORT AuthFailReason;
2052 UCHAR AuthFailSta[MAC_ADDR_LEN];
2054 NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X
2055 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
2056 NDIS_802_11_WEP_STATUS WepStatus;
2057 NDIS_802_11_WEP_STATUS OrigWepStatus; // Original wep status set from OID
2059 // Add to support different cipher suite for WPA2/WPA mode
2060 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite
2061 NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite
2062 BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites
2063 USHORT RsnCapability;
2065 NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
2067 UCHAR PMK[32]; // WPA PSK mode PMK
2068 UCHAR PTK[64]; // WPA PSK mode PTK
2069 UCHAR GTK[32]; // GTK from authenticator
2070 BSSID_INFO SavedPMK[PMKID_NO];
2071 UINT SavedPMKNum; // Saved PMKID number
2076 // WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED
2079 // For WPA countermeasures
2080 ULONG LastMicErrorTime; // record last MIC error time
2081 ULONG MicErrCnt; // Should be 0, 1, 2, then reset to zero (after disassoiciation).
2082 BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred.
2083 // For WPA-PSK supplicant state
2084 WPA_STATE WpaState; // Default is SS_NOTUSE and handled by microsoft 802.1x
2085 UCHAR ReplayCounter[8];
2086 UCHAR ANonce[32]; // ANonce for WPA-PSK from aurhenticator
2087 UCHAR SNonce[32]; // SNonce for WPA-PSK
2089 UCHAR LastSNR0; // last received BEACON's SNR
2090 UCHAR LastSNR1; // last received BEACON's SNR for 2nd antenna
2091 RSSI_SAMPLE RssiSample;
2092 ULONG NumOfAvgRssiSample;
2094 ULONG LastBeaconRxTime; // OS's timestamp of the last BEACON RX time
2095 ULONG Last11bBeaconRxTime; // OS's timestamp of the last 11B BEACON RX time
2096 ULONG Last11gBeaconRxTime; // OS's timestamp of the last 11G BEACON RX time
2097 ULONG Last20NBeaconRxTime; // OS's timestamp of the last 20MHz N BEACON RX time
2099 ULONG LastScanTime; // Record last scan time for issue BSSID_SCAN_LIST
2100 ULONG ScanCnt; // Scan counts since most recent SSID, BSSID, SCAN OID request
2101 BOOLEAN bSwRadio; // Software controlled Radio On/Off, TRUE: On
2102 BOOLEAN bHwRadio; // Hardware controlled Radio On/Off, TRUE: On
2103 BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state
2104 BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled
2105 BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation
2107 BOOLEAN AdhocBOnlyJoined; // Indicate Adhoc B Join.
2108 BOOLEAN AdhocBGJoined; // Indicate Adhoc B/G Join.
2109 BOOLEAN Adhoc20NJoined; // Indicate Adhoc 20MHz N Join.
2111 // New for WPA, windows want us to to keep association information and
2112 // Fixed IEs from last association response
2113 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
2114 USHORT ReqVarIELen; // Length of next VIE include EID & Length
2115 UCHAR ReqVarIEs[MAX_VIE_LEN]; // The content saved here should be little-endian format.
2116 USHORT ResVarIELen; // Length of next VIE include EID & Length
2117 UCHAR ResVarIEs[MAX_VIE_LEN];
2120 UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be little-endian format.
2122 // New variables used for CCX 1.0
2124 BOOLEAN bCkipCmicOn;
2126 UCHAR GIV[3]; //for CCX iv
2131 LEAP_AUTH_INFO LeapAuthInfo;
2133 UCHAR NetworkChallenge[8];
2134 UCHAR NetworkChallengeResponse[24];
2135 UCHAR PeerChallenge[8];
2137 UCHAR PeerChallengeResponse[24];
2138 UCHAR SessionKey[16]; //Network session keys (NSK)
2139 RALINK_TIMER_STRUCT LeapAuthTimer;
2140 ROGUEAP_TABLE RogueApTab; //Cisco CCX1 Rogue AP Detection
2142 // New control flags for CCX
2143 CCX_CONTROL CCXControl; // Master administration state
2144 BOOLEAN CCXEnable; // Actual CCX state
2145 UCHAR CCXScanChannel; // Selected channel for CCX beacon request
2146 USHORT CCXScanTime; // Time out to wait for beacon and probe response
2147 UCHAR CCXReqType; // Current processing CCX request type
2148 BSS_TABLE CCXBssTab; // BSS Table
2149 UCHAR FrameReportBuf[2048]; // Buffer for creating frame report
2150 USHORT FrameReportLen; // Current Frame report length
2151 ULONG CLBusyBytes; // Save the total bytes received durning channel load scan time
2152 USHORT RPIDensity[8]; // Array for RPI density collection
2153 // Start address of each BSS table within FrameReportBuf
2154 // It's important to update the RxPower of the corresponding Bss
2155 USHORT BssReportOffset[MAX_LEN_OF_BSS_TABLE];
2156 USHORT BeaconToken; // Token for beacon report
2157 ULONG LastBssIndex; // Most current reported Bss index
2158 RM_REQUEST_ACTION MeasurementRequest[16]; // Saved measurement request
2159 UCHAR RMReqCnt; // Number of measurement request saved.
2160 UCHAR CurrentRMReqIdx; // Number of measurement request saved.
2161 BOOLEAN ParallelReq; // Parallel measurement, only one request performed,
2162 // It must be the same channel with maximum duration
2163 USHORT ParallelDuration; // Maximum duration for parallel measurement
2164 UCHAR ParallelChannel; // Only one channel with parallel measurement
2165 USHORT IAPPToken; // IAPP dialog token
2166 UCHAR CCXQosECWMin; // Cisco QOS ECWMin for AC 0
2167 UCHAR CCXQosECWMax; // Cisco QOS ECWMax for AC 0
2168 // Hack for channel load and noise histogram parameters
2169 UCHAR NHFactor; // Parameter for Noise histogram
2170 UCHAR CLFactor; // Parameter for channel load
2172 UCHAR KRK[16]; //Key Refresh Key.
2173 UCHAR BTK[32]; //Base Transient Key
2174 BOOLEAN CCKMLinkUpFlag;
2175 ULONG CCKMRN; //(Re)Association request number.
2176 LARGE_INTEGER CCKMBeaconAtJoinTimeStamp; //TSF timer for Re-assocaite to the new AP
2177 UCHAR AironetCellPowerLimit; //in dBm
2178 UCHAR AironetIPAddress[4]; //eg. 192.168.1.1
2179 BOOLEAN CCXAdjacentAPReportFlag; //flag for determining report Assoc Lost time
2180 CHAR CCXAdjacentAPSsid[MAX_LEN_OF_SSID]; //Adjacent AP's SSID report
2181 UCHAR CCXAdjacentAPSsidLen; // the actual ssid length in used
2182 UCHAR CCXAdjacentAPBssid[MAC_ADDR_LEN]; //Adjacent AP's BSSID report
2183 USHORT CCXAdjacentAPChannel;
2184 ULONG CCXAdjacentAPLinkDownTime; //for Spec S32.
2186 RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer;
2187 BOOLEAN StaQuickResponeForRateUpTimerRunning;
2189 UCHAR DtimCount; // 0.. DtimPeriod-1
2190 UCHAR DtimPeriod; // default = 3
2192 #ifdef QOS_DLS_SUPPORT
2193 RT_802_11_DLS DLSEntry[MAX_NUM_OF_DLS_ENTRY];
2194 UCHAR DlsReplayCounter[8];
2195 #endif // QOS_DLS_SUPPORT //
2196 ////////////////////////////////////////////////////////////////////////////////////////
2197 // This is only for WHQL test.
2199 ////////////////////////////////////////////////////////////////////////////////////////
2201 RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer;
2203 BOOLEAN bFastRoaming; // 0:disable fast roaming, 1:enable fast roaming
2204 CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value.
2206 #ifdef WPA_SUPPLICANT_SUPPORT
2208 BOOLEAN IEEE8021x_required_keys;
2209 CIPHER_KEY DesireSharedKey[4]; // Record user desired WEP keys
2210 UCHAR DesireSharedKeyId;
2212 // 0: driver ignores wpa_supplicant
2213 // 1: wpa_supplicant initiates scanning and AP selection
2214 // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters
2215 UCHAR WpaSupplicantUP;
2216 UCHAR WpaSupplicantScanCount;
2217 #endif // WPA_SUPPLICANT_SUPPORT //
2222 BOOLEAN bTGnWifiTest;
2223 BOOLEAN bScanReqIsFromWebUI;
2225 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
2226 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting;
2227 RT_HT_PHY_INFO DesiredHtPhyInfo;
2228 BOOLEAN bAutoTxRateSwitch;
2232 #ifdef EXT_BUILD_CHANNEL_LIST
2233 UCHAR IEEE80211dClientMode;
2234 UCHAR StaOriCountryCode[3];
2235 UCHAR StaOriGeography;
2236 #endif // EXT_BUILD_CHANNEL_LIST //
2237 } STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG;
2239 // This data structure keep the current active BSS/IBSS's configuration that this STA
2240 // had agreed upon joining the network. Which means these parameters are usually decided
2241 // by the BSS/IBSS creator instead of user configuration. Data in this data structurre
2242 // is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE.
2243 // Normally, after SCAN or failed roaming attempts, we need to recover back to
2244 // the current active settings.
2245 typedef struct _STA_ACTIVE_CONFIG {
2247 USHORT AtimWin; // in kusec; IBSS parameter set element
2248 USHORT CapabilityInfo;
2249 USHORT CfpMaxDuration;
2252 // Copy supported rate from desired AP's beacon. We are trying to match
2253 // AP's supported and extended rate settings.
2254 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
2255 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
2258 // Copy supported ht from desired AP's beacon. We are trying to match
2259 RT_HT_PHY_INFO SupportedPhyInfo;
2260 RT_HT_CAPABILITY SupportedHtPhy;
2261 } STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG;
2262 #endif // CONFIG_STA_SUPPORT //
2264 // ----------- start of AP --------------------------
2265 // AUTH-RSP State Machine Aux data structure
2266 typedef struct _AP_MLME_AUX {
2267 UCHAR Addr[MAC_ADDR_LEN];
2269 CHAR Challenge[CIPHER_TEXT_LEN];
2270 } AP_MLME_AUX, *PAP_MLME_AUX;
2272 // structure to define WPA Group Key Rekey Interval
2273 typedef struct PACKED _RT_802_11_WPA_REKEY {
2274 ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
2275 ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets
2276 } RT_WPA_REKEY,*PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY;
2278 typedef struct _MAC_TABLE_ENTRY {
2279 //Choose 1 from ValidAsWDS and ValidAsCLI to validize.
2280 BOOLEAN ValidAsCLI; // Sta mode, set this TRUE after Linkup,too.
2281 BOOLEAN ValidAsWDS; // This is WDS Entry. only for AP mode.
2282 BOOLEAN ValidAsApCli; //This is a AP-Client entry, only for AP mode which enable AP-Client functions.
2283 BOOLEAN ValidAsMesh;
2284 BOOLEAN ValidAsDls; // This is DLS Entry. only for STA mode.
2286 BOOLEAN bIAmBadAtheros; // Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection.
2288 UCHAR EnqueueEapolStartTimerRunning; // Enqueue EAPoL-Start for triggering EAP SM
2290 // record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB
2291 UCHAR CMTimerRunning;
2292 UCHAR apidx; // MBSS number
2294 UCHAR RSN_IE[MAX_LEN_OF_RSNIE];
2295 UCHAR ANonce[LEN_KEY_DESC_NONCE];
2296 UCHAR R_Counter[LEN_KEY_DESC_REPLAY];
2299 RALINK_TIMER_STRUCT RetryTimer;
2300 RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; // A timer which enqueue EAPoL-Start for triggering PSK SM
2301 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
2302 NDIS_802_11_WEP_STATUS WepStatus;
2303 AP_WPA_STATE WpaState;
2306 NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X
2307 CIPHER_KEY PairwiseKey;
2310 UCHAR PMKID[LEN_PMKID];
2313 UCHAR Addr[MAC_ADDR_LEN];
2316 AUTH_STATE AuthState; // for SHARED KEY authentication state machine used only
2317 BOOLEAN IsReassocSta; // Indicate whether this is a reassociation procedure
2319 USHORT CapabilityInfo;
2321 ULONG NoDataIdleCount;
2322 UINT16 StationKeepAliveCount; // unit: second
2324 QUEUE_HEADER PsQueue;
2326 UINT32 StaConnectTime; // the live time of this station since associated with AP
2329 #ifdef DOT11_N_SUPPORT
2331 USHORT NoBADataCountDown;
2333 UINT32 CachedBuf[16]; // UINT (4 bytes) for alignment
2334 UINT TxBFCount; // 3*3
2335 #endif // DOT11_N_SUPPORT //
2337 UINT DebugFIFOCount;
2342 //====================================================
2343 //WDS entry needs these
2344 // rt2860 add this. if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab
2345 UINT MatchWDSTabIdx;
2346 UCHAR MaxSupportedRate;
2348 UCHAR CurrTxRateIndex;
2349 // to record the each TX rate's quality. 0 is best, the bigger the worse.
2350 USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
2351 UINT32 OneSecTxNoRetryOkCount;
2352 UINT32 OneSecTxRetryOkCount;
2353 UINT32 OneSecTxFailCount;
2354 UINT32 ContinueTxFailCnt;
2355 UINT32 CurrTxRateStableTime; // # of second in current TX rate
2356 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
2357 //====================================================
2361 #ifdef CONFIG_STA_SUPPORT
2362 #ifdef QOS_DLS_SUPPORT
2363 UINT MatchDlsEntryIdx; // indicate the index in pAd->StaCfg.DLSEntry
2364 #endif // QOS_DLS_SUPPORT //
2365 #endif // CONFIG_STA_SUPPORT //
2367 BOOLEAN fNoisyEnvironment;
2368 BOOLEAN fLastSecAccordingRSSI;
2369 UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down
2370 CHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction
2371 ULONG LastTxOkCount;
2372 UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH];
2374 // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular
2375 // BOOLEAN control, either ON or OFF. These flags should always be accessed via
2376 // CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros.
2377 // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED
2378 ULONG ClientStatusFlags;
2380 // TODO: Shall we move that to DOT11_N_SUPPORT???
2381 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
2383 #ifdef DOT11_N_SUPPORT
2384 // HT EWC MIMO-N used parameters
2385 USHORT RXBAbitmap; // fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format
2386 USHORT TXBAbitmap; // This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI
2387 USHORT TXAutoBAbitmap;
2388 USHORT BADeclineBitmap;
2389 USHORT BARecWcidArray[NUM_OF_TID]; // The mapping wcid of recipient session. if RXBAbitmap bit is masked
2390 USHORT BAOriWcidArray[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked
2391 USHORT BAOriSequence[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked
2393 // 802.11n features.
2395 UCHAR MaxRAmpduFactor;
2397 UCHAR MmpsMode; // MIMO power save more.
2399 HT_CAPABILITY_IE HTCapability;
2401 #ifdef DOT11N_DRAFT3
2402 UCHAR BSS2040CoexistenceMgmtSupport;
2403 #endif // DOT11N_DRAFT3 //
2404 #endif // DOT11_N_SUPPORT //
2406 BOOLEAN bAutoTxRateSwitch;
2409 struct _MAC_TABLE_ENTRY *pNext;
2410 USHORT TxSeq[NUM_OF_TID];
2411 USHORT NonQosDataSeq;
2413 RSSI_SAMPLE RssiSample;
2415 UINT32 TXMCSExpected[16];
2416 UINT32 TXMCSSuccessful[16];
2417 UINT32 TXMCSFailed[16];
2418 UINT32 TXMCSAutoFallBack[16][16];
2419 } MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY;
2421 typedef struct _MAC_TABLE {
2423 MAC_TABLE_ENTRY *Hash[HASH_TABLE_SIZE];
2424 MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE];
2425 QUEUE_HEADER McastPsQueue;
2427 BOOLEAN fAnyStationInPsm;
2428 BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip.
2429 BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP
2430 #ifdef DOT11_N_SUPPORT
2431 BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/
2432 BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF.
2433 BOOLEAN fAnyStation20Only; // Check if any Station can't support GF.
2434 BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic
2435 BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS
2436 #endif // DOT11_N_SUPPORT //
2437 } MAC_TABLE, *PMAC_TABLE;
2439 #ifdef DOT11_N_SUPPORT
2440 #define IS_HT_STA(_pMacEntry) \
2441 (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX)
2443 #define IS_HT_RATE(_pMacEntry) \
2444 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
2446 #define PEER_IS_HT_RATE(_pMacEntry) \
2447 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
2448 #endif // DOT11_N_SUPPORT //
2450 typedef struct _WDS_ENTRY {
2452 UCHAR Addr[MAC_ADDR_LEN];
2453 ULONG NoDataIdleCount;
2454 struct _WDS_ENTRY *pNext;
2455 } WDS_ENTRY, *PWDS_ENTRY;
2457 typedef struct _WDS_TABLE_ENTRY {
2459 UCHAR WdsAddr[MAC_ADDR_LEN];
2460 WDS_ENTRY *Hash[HASH_TABLE_SIZE];
2461 WDS_ENTRY Content[MAX_LEN_OF_MAC_TABLE];
2462 UCHAR MaxSupportedRate;
2464 USHORT TxQuality[MAX_LEN_OF_SUPPORTED_RATES];
2465 USHORT OneSecTxOkCount;
2466 USHORT OneSecTxRetryOkCount;
2467 USHORT OneSecTxFailCount;
2468 ULONG CurrTxRateStableTime; // # of second in current TX rate
2469 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
2470 } WDS_TABLE_ENTRY, *PWDS_TABLE_ENTRY;
2472 typedef struct _RT_802_11_WDS_ENTRY {
2476 UCHAR PeerWdsAddr[MAC_ADDR_LEN];
2477 UCHAR MacTabMatchWCID; // ASIC
2478 NDIS_802_11_WEP_STATUS WepStatus;
2481 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;
2482 RT_HT_PHY_INFO DesiredHtPhyInfo;
2483 BOOLEAN bAutoTxRateSwitch;
2484 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting.
2485 } RT_802_11_WDS_ENTRY, *PRT_802_11_WDS_ENTRY;
2487 typedef struct _WDS_TABLE {
2490 RT_802_11_WDS_ENTRY WdsEntry[MAX_WDS_ENTRY];
2491 } WDS_TABLE, *PWDS_TABLE;
2493 typedef struct _APCLI_STRUCT {
2496 unsigned int mylinkid;
2498 BOOLEAN Enable; // Set it as 1 if the apcli interface was configured to "1" or by iwpriv cmd "ApCliEnable"
2499 BOOLEAN Valid; // Set it as 1 if the apcli interface associated success to remote AP.
2500 UCHAR MacTabWCID; //WCID value, which point to the entry of ASIC Mac table.
2502 CHAR Ssid[MAX_LEN_OF_SSID];
2505 CHAR CfgSsid[MAX_LEN_OF_SSID];
2506 UCHAR CfgApCliBssid[ETH_LENGTH_OF_ADDRESS];
2507 UCHAR CurrentAddress[ETH_LENGTH_OF_ADDRESS];
2509 ULONG ApCliRcvBeaconTime;
2511 ULONG CtrlCurrState;
2512 ULONG SyncCurrState;
2513 ULONG AuthCurrState;
2514 ULONG AssocCurrState;
2515 ULONG WpaPskCurrState;
2520 ULONG ClientStatusFlags;
2523 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
2524 NDIS_802_11_WEP_STATUS WepStatus;
2526 // Add to support different cipher suite for WPA2/WPA mode
2527 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite
2528 NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite
2529 BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites
2530 USHORT RsnCapability;
2532 UCHAR PSK[100]; // reserve PSK key material
2534 UCHAR PMK[32]; // WPA PSK mode PMK
2535 UCHAR GTK[32]; // GTK from authenticator
2537 CIPHER_KEY SharedKey[SHARE_KEY_NUM];
2540 // store RSN_IE built by driver
2541 UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be convert to little-endian format.
2544 // For WPA countermeasures
2545 ULONG LastMicErrorTime; // record last MIC error time
2546 BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred.
2548 // For WPA-PSK supplicant state
2549 UCHAR SNonce[32]; // SNonce for WPA-PSK
2550 UCHAR GNonce[32]; // GNonce for WPA-PSK from authenticator
2552 #ifdef WSC_AP_SUPPORT
2553 WSC_CTRL WscControl;
2554 #endif // WSC_AP_SUPPORT //
2556 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;
2557 RT_HT_PHY_INFO DesiredHtPhyInfo;
2558 BOOLEAN bAutoTxRateSwitch;
2559 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting.
2560 } APCLI_STRUCT, *PAPCLI_STRUCT;
2562 // ----------- end of AP ----------------------------
2565 typedef struct _BLOCK_QUEUE_ENTRY
2567 BOOLEAN SwTxQueueBlockFlag;
2568 LIST_HEADER NetIfList;
2569 } BLOCK_QUEUE_ENTRY, *PBLOCK_QUEUE_ENTRY;
2570 #endif // BLOCK_NET_IF //
2575 BOOLEAN bGreenField;
2581 typedef struct _INF_PCI_CONFIG
2583 PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use
2586 typedef struct _INF_USB_CONFIG
2588 UINT BulkInEpAddr; // bulk-in endpoint address
2589 UINT BulkOutEpAddr[6]; // bulk-out endpoint address
2593 #ifdef IKANOS_VX_1X0
2594 typedef void (*IkanosWlanTxCbFuncP)(void *, void *);
2596 struct IKANOS_TX_INFO
2598 struct net_device *netdev;
2599 IkanosWlanTxCbFuncP *fp;
2601 #endif // IKANOS_VX_1X0 //
2604 typedef struct _NINDO_CTRL_BLOCK {
2606 RT_NINTENDO_TABLE DS_TABLE;
2609 spinlock_t NINTENDO_TABLE_Lock;
2611 NDIS_SPIN_LOCK NINTENDO_TABLE_Lock;
2612 #endif // CHIP25XX //
2614 UCHAR NINTENDO_UP_BUFFER[512];
2616 CIPHER_KEY Local_SharedKey;
2617 UCHAR Local_bHideSsid;
2618 UCHAR Local_AuthMode;
2619 UCHAR Local_WepStatus;
2620 USHORT Local_CapabilityInfo;
2622 #endif // NINTENDO_AP //
2626 #define DIAGNOSE_TIME 10 // 10 sec
2627 typedef struct _RtmpDiagStrcut_
2628 { // Diagnosis Related element
2629 unsigned char inited;
2631 unsigned char ArrayStartIdx;
2632 unsigned char ArrayCurIdx;
2634 USHORT TxDataCnt[DIAGNOSE_TIME];
2635 USHORT TxFailCnt[DIAGNOSE_TIME];
2636 USHORT TxDescCnt[DIAGNOSE_TIME][24]; // 3*3 // TxDesc queue length in scale of 0~14, >=15
2637 USHORT TxMcsCnt[DIAGNOSE_TIME][24]; // 3*3
2638 USHORT TxSWQueCnt[DIAGNOSE_TIME][9]; // TxSwQueue length in scale of 0, 1, 2, 3, 4, 5, 6, 7, >=8
2640 USHORT TxAggCnt[DIAGNOSE_TIME];
2641 USHORT TxNonAggCnt[DIAGNOSE_TIME];
2642 USHORT TxAMPDUCnt[DIAGNOSE_TIME][24]; // 3*3 // 10 sec, TxDMA APMDU Aggregation count in range from 0 to 15, in setp of 1.
2643 USHORT TxRalinkCnt[DIAGNOSE_TIME]; // TxRalink Aggregation Count in 1 sec scale.
2644 USHORT TxAMSDUCnt[DIAGNOSE_TIME]; // TxAMSUD Aggregation Count in 1 sec scale.
2647 USHORT RxDataCnt[DIAGNOSE_TIME]; // Rx Total Data count.
2648 USHORT RxCrcErrCnt[DIAGNOSE_TIME];
2649 USHORT RxMcsCnt[DIAGNOSE_TIME][24]; // 3*3
2651 #endif // DBG_DIAGNOSE //
2655 // The miniport adapter structure
2657 typedef struct _RTMP_ADAPTER
2659 PVOID OS_Cookie; // save specific structure relative to OS
2663 USHORT LnkCtrlBitMask;
2664 USHORT RLnkCtrlConfiguration;
2665 USHORT RLnkCtrlOffset;
2666 USHORT HostLnkCtrlConfiguration;
2667 USHORT HostLnkCtrlOffset;
2668 USHORT PCIePowerSaveLevel;
2669 BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace..
2670 ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count.
2671 USHORT ThisTbttNumToNextWakeUp;
2672 ULONG SameRxByteCount;
2675 /*****************************************************************************************/
2676 /* PCI related parameters */
2677 /*****************************************************************************************/
2678 PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use
2680 UINT int_enable_reg;
2681 UINT int_disable_mask;
2685 RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; // Shared memory of all 1st pre-allocated TxBuf associated with each TXD
2686 RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors
2687 RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors
2688 RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA
2691 NDIS_SPIN_LOCK irq_lock;
2696 /*****************************************************************************************/
2697 /* Both PCI/USB related parameters */
2698 /*****************************************************************************************/
2701 /*****************************************************************************************/
2702 /* Tx related parameters */
2703 /*****************************************************************************************/
2704 BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once
2705 NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING];
2708 // resource for software backlog queues
2709 QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA
2710 NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; // TxSwQueue spinlock
2712 RTMP_DMABUF MgmtDescRing; // Shared memory for MGMT descriptors
2713 RTMP_MGMT_RING MgmtRing;
2714 NDIS_SPIN_LOCK MgmtRingLock; // Prio Ring spinlock
2717 /*****************************************************************************************/
2718 /* Rx related parameters */
2719 /*****************************************************************************************/
2721 RTMP_RX_RING RxRing;
2722 NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock
2726 /*****************************************************************************************/
2727 /* ASIC related parameters */
2728 /*****************************************************************************************/
2729 UINT32 MACVersion; // MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101)..
2731 // ---------------------------
2733 // ---------------------------
2734 ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused
2735 UCHAR EEPROMAddressNum; // 93c46=6 93c66=8
2736 USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS];
2737 ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused.
2739 // ---------------------------
2741 // ---------------------------
2742 UCHAR BbpWriteLatch[140]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID
2743 UCHAR BbpRssiToDbmDelta;
2744 BBP_R66_TUNING BbpTuning;
2746 // ----------------------------
2748 // ----------------------------
2749 UCHAR RfIcType; // RFIC_xxx
2750 ULONG RfFreqOffset; // Frequency offset for channel switching
2751 RTMP_RF_REGS LatchRfRegs; // latch th latest RF programming value since RF IC doesn't support READ
2753 EEPROM_ANTENNA_STRUC Antenna; // Since ANtenna definition is different for a & g. We need to save it for future reference.
2754 EEPROM_NIC_CONFIG2_STRUC NicConfig2;
2756 // This soft Rx Antenna Diversity mechanism is used only when user set
2757 // RX Antenna = DIVERSITY ON
2758 SOFT_RX_ANT_DIVERSITY RxAnt;
2761 CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; // Store Tx power value for all channels.
2762 CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; // list all supported channels for site survey
2763 CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; // 802.11j channel and bw
2764 CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; // list all supported channels for site survey
2766 UCHAR ChannelListNum; // number of channel in ChannelList[]
2769 ULONG Tx20MPwrCfgABand[5];
2770 ULONG Tx20MPwrCfgGBand[5];
2771 ULONG Tx40MPwrCfgABand[5];
2772 ULONG Tx40MPwrCfgGBand[5];
2774 BOOLEAN bAutoTxAgcA; // Enable driver auto Tx Agc control
2775 UCHAR TssiRefA; // Store Tssi reference value as 25 temperature.
2776 UCHAR TssiPlusBoundaryA[5]; // Tssi boundary for increase Tx power to compensate.
2777 UCHAR TssiMinusBoundaryA[5]; // Tssi boundary for decrease Tx power to compensate.
2778 UCHAR TxAgcStepA; // Store Tx TSSI delta increment / decrement value
2779 CHAR TxAgcCompensateA; // Store the compensation (TxAgcStep * (idx-1))
2781 BOOLEAN bAutoTxAgcG; // Enable driver auto Tx Agc control
2782 UCHAR TssiRefG; // Store Tssi reference value as 25 temperature.
2783 UCHAR TssiPlusBoundaryG[5]; // Tssi boundary for increase Tx power to compensate.
2784 UCHAR TssiMinusBoundaryG[5]; // Tssi boundary for decrease Tx power to compensate.
2785 UCHAR TxAgcStepG; // Store Tx TSSI delta increment / decrement value
2786 CHAR TxAgcCompensateG; // Store the compensation (TxAgcStep * (idx-1))
2788 //+++For RT2870, the parameteres is start from BGRssiOffset1 ~ BGRssiOffset3
2789 CHAR BGRssiOffset0; // Store B/G RSSI#0 Offset value on EEPROM 0x46h
2790 CHAR BGRssiOffset1; // Store B/G RSSI#1 Offset value
2791 CHAR BGRssiOffset2; // Store B/G RSSI#2 Offset value
2794 //+++For RT2870, the parameteres is start from ARssiOffset1 ~ ARssiOffset3
2795 CHAR ARssiOffset0; // Store A RSSI#0 Offset value on EEPROM 0x4Ah
2796 CHAR ARssiOffset1; // Store A RSSI#1 Offset value
2797 CHAR ARssiOffset2; // Store A RSSI#2 Offset value
2800 CHAR BLNAGain; // Store B/G external LNA#0 value on EEPROM 0x44h
2801 CHAR ALNAGain0; // Store A external LNA#0 value for ch36~64
2802 CHAR ALNAGain1; // Store A external LNA#1 value for ch100~128
2803 CHAR ALNAGain2; // Store A external LNA#2 value for ch132~165
2805 // ----------------------------
2807 // ----------------------------
2808 MCU_LEDCS_STRUC LedCntl;
2809 USHORT Led1; // read from EEPROM 0x3c
2810 USHORT Led2; // EEPROM 0x3e
2811 USHORT Led3; // EEPROM 0x40
2812 UCHAR LedIndicatorStregth;
2813 UCHAR RssiSingalstrengthOffet;
2814 BOOLEAN bLedOnScanning;
2817 /*****************************************************************************************/
2818 /* 802.11 related parameters */
2819 /*****************************************************************************************/
2820 // outgoing BEACON frame buffer and corresponding TXD
2821 TXWI_STRUC BeaconTxWI;
2823 USHORT BeaconOffset[HW_BEACON_MAX_COUNT];
2825 // pre-build PS-POLL and NULL frame upon link up. for efficiency purpose.
2826 PSPOLL_FRAME PsPollFrame;
2827 HEADER_802_11 NullFrame;
2829 //=========AP===========
2832 //=======STA===========
2833 #ifdef CONFIG_STA_SUPPORT
2834 /* Modified by Wu Xi-Kun 4/21/2006 */
2835 // -----------------------------------------------
2836 // STA specific configuration & operation status
2837 // used only when pAd->OpMode == OPMODE_STA
2838 // -----------------------------------------------
2839 STA_ADMIN_CONFIG StaCfg; // user desired settings
2840 STA_ACTIVE_CONFIG StaActive; // valid only when ADHOC_ON(pAd) || INFRA_ON(pAd)
2841 CHAR nickname[IW_ESSID_MAX_SIZE+1]; // nickname, only used in the iwconfig i/f
2842 NDIS_MEDIA_STATE PreMediaState;
2843 #endif // CONFIG_STA_SUPPORT //
2845 //=======Common===========
2846 // OP mode: either AP or STA
2847 UCHAR OpMode; // OPMODE_STA, OPMODE_AP
2849 NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected
2851 // MAT related parameters
2853 // configuration: read from Registry & E2PROM
2854 BOOLEAN bLocalAdminMAC; // Use user changed MAC
2855 UCHAR PermanentAddress[MAC_ADDR_LEN]; // Factory default MAC address
2856 UCHAR CurrentAddress[MAC_ADDR_LEN]; // User changed MAC address
2858 // ------------------------------------------------------
2859 // common configuration to both OPMODE_STA and OPMODE_AP
2860 // ------------------------------------------------------
2861 COMMON_CONFIG CommonCfg;
2864 // AP needs those vaiables for site survey feature.
2865 MLME_AUX MlmeAux; // temporary settings used during MLME state machine
2866 BSS_TABLE ScanTab; // store the latest SCAN result
2868 //About MacTab, the sta driver will use #0 and #1 for multicast and AP.
2869 MAC_TABLE MacTab; // ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table.
2870 NDIS_SPIN_LOCK MacTabLock;
2872 #ifdef DOT11_N_SUPPORT
2874 #endif // DOT11_N_SUPPORT //
2875 NDIS_SPIN_LOCK BATabLock;
2876 RALINK_TIMER_STRUCT RECBATimer;
2878 // encryption/decryption KEY tables
2879 CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; // STA always use SharedKey[BSS0][0..3]
2881 // RX re-assembly buffer for fragmentation
2882 FRAGMENT_FRAME FragFrame; // Frame storage for fragment frame
2885 COUNTER_802_3 Counters8023; // 802.3 counters
2886 COUNTER_802_11 WlanCounters; // 802.11 MIB counters
2887 COUNTER_RALINK RalinkCounters; // Ralink propriety counters
2888 COUNTER_DRS DrsCounters; // counters for Dynamic TX Rate Switching
2889 PRIVATE_STRUC PrivateInfo; // Private information & counters
2891 // flags, see fRTMP_ADAPTER_xxx flags
2892 ULONG Flags; // Represent current device status
2893 ULONG PSFlags; // Power Save operation flag.
2895 // current TX sequence #
2903 // Control disconnect / connect event generation
2904 //+++Didn't used anymore
2909 //+++Used only for Station
2910 BOOLEAN bConfigChanged; // Config Change flag for the same SSID setting
2913 ULONG ExtraInfo; // Extra information for displaying status
2914 ULONG SystemErrorBitmap; // b0: E2PROM version error
2916 //+++Didn't used anymore
2917 ULONG MacIcVersion; // MAC/BBP serial interface issue solved after ver.D
2920 // ---------------------------
2922 // ---------------------------
2923 RT_802_11_EVENT_TABLE EventTab;
2928 /*****************************************************************************************/
2929 /* Statistic related parameters */
2930 /*****************************************************************************************/
2932 BOOLEAN bUpdateBcnCntDone;
2933 ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition
2934 // ----------------------------
2936 // ----------------------------
2937 BOOLEAN bBanAllBaSetup;
2938 BOOLEAN bPromiscuous;
2940 // ----------------------------
2941 // rt2860c emulation-use Parameters
2942 // ----------------------------
2945 ULONG cfendaccu[30];
2946 ULONG bacontent[16];
2947 ULONG rxint[RX_RING_SIZE+1];
2950 BOOLEAN bForcePrintTX;
2951 BOOLEAN bForcePrintRX;
2952 BOOLEAN bDisablescanning; //defined in RT2870 USB
2953 BOOLEAN bStaFifoTest;
2954 BOOLEAN bProtectionTest;
2956 BOOLEAN bGenOneHCCA;
2957 BOOLEAN bBroadComHT;
2958 //+++Following add from RT2870 USB.
2960 ULONG BulkOutComplete;
2961 ULONG BulkOutCompleteOther;
2962 ULONG BulkOutCompleteCancel; // seems not use now?
2964 ULONG BulkInComplete;
2965 ULONG BulkInCompleteFail;
2968 struct wificonf WIFItestbed;
2972 #endif // RALINK_ATE //
2974 #ifdef DOT11_N_SUPPORT
2975 struct reordering_mpdu_pool mpdu_blk_pool;
2976 #endif // DOT11_N_SUPPORT //
2978 ULONG OneSecondnonBEpackets; // record non BE packets per second
2980 #if WIRELESS_EXT >= 12
2981 struct iw_statistics iw_stats;
2984 struct net_device_stats stats;
2987 BLOCK_QUEUE_ENTRY blockQueueTab[NUM_OF_TX_RING];
2988 #endif // BLOCK_NET_IF //
2992 #ifdef MULTIPLE_CARD_SUPPORT
2994 UCHAR MC_FileName[256];
2995 #endif // MULTIPLE_CARD_SUPPORT //
2997 ULONG TbttTickCount;
2998 #ifdef PCI_MSI_SUPPORT
3000 #endif // PCI_MSI_SUPPORT //
3005 #define TIME_BASE (1000000/OS_HZ)
3006 #define TIME_ONE_SECOND (1000000/TIME_BASE)
3007 UCHAR flg_be_adjust;
3008 ULONG be_adjust_last_time;
3011 NINDO_CTRL_BLOCK nindo_ctrl_block;
3012 #endif // NINTENDO_AP //
3015 #ifdef IKANOS_VX_1X0
3016 struct IKANOS_TX_INFO IkanosTxInfo;
3017 struct IKANOS_TX_INFO IkanosRxInfo[MAX_MBSSID_NUM + MAX_WDS_ENTRY + MAX_APCLI_NUM + MAX_MESH_NUM];
3018 #endif // IKANOS_VX_1X0 //
3022 RtmpDiagStruct DiagStruct;
3023 #endif // DBG_DIAGNOSE //
3026 UINT8 PM_FlgSuspend;
3027 } RTMP_ADAPTER, *PRTMP_ADAPTER;
3030 // Cisco IAPP format
3032 typedef struct _CISCO_IAPP_CONTENT_
3034 USHORT Length; //IAPP Length
3035 UCHAR MessageType; //IAPP type
3036 UCHAR FunctionCode; //IAPP function type
3037 UCHAR DestinaionMAC[MAC_ADDR_LEN];
3038 UCHAR SourceMAC[MAC_ADDR_LEN];
3039 USHORT Tag; //Tag(element IE) - Adjacent AP report
3040 USHORT TagLength; //Length of element not including 4 byte header
3041 UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00
3042 UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point
3045 UCHAR Ssid[MAX_LEN_OF_SSID];
3046 USHORT Seconds; //Seconds that the client has been disassociated.
3047 } CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT;
3049 #define DELAYINTMASK 0x0003fffb
3050 #define INTMASK 0x0003fffb
3051 #define IndMask 0x0003fffc
3052 #define RxINT 0x00000005 // Delayed Rx or indivi rx
3053 #define TxDataInt 0x000000fa // Delayed Tx or indivi tx
3054 #define TxMgmtInt 0x00000102 // Delayed Tx or indivi tx
3055 #define TxCoherent 0x00020000 // tx coherent
3056 #define RxCoherent 0x00010000 // rx coherent
3057 #define McuCommand 0x00000200 // mcu
3058 #define PreTBTTInt 0x00001000 // Pre-TBTT interrupt
3059 #define TBTTInt 0x00000800 // TBTT interrupt
3060 #define GPTimeOutInt 0x00008000 // GPtimeout interrupt
3061 #define AutoWakeupInt 0x00004000 // AutoWakeupInt interrupt
3062 #define FifoStaFullInt 0x00002000 // fifo statistics full interrupt
3065 typedef struct _RX_BLK_
3067 RT28XX_RXD_STRUC RxD;
3069 PHEADER_802_11 pHeader;
3070 PNDIS_PACKET pRxPacket;
3074 UCHAR UserPriority; // for calculate TKIP MIC using
3078 #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag)
3079 #define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag)
3080 #define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag))
3083 #define fRX_WDS 0x0001
3084 #define fRX_AMSDU 0x0002
3085 #define fRX_ARALINK 0x0004
3086 #define fRX_HTC 0x0008
3087 #define fRX_PAD 0x0010
3088 #define fRX_AMPDU 0x0020
3089 #define fRX_QOS 0x0040
3090 #define fRX_INFRA 0x0080
3091 #define fRX_EAP 0x0100
3092 #define fRX_MESH 0x0200
3093 #define fRX_APCLI 0x0400
3094 #define fRX_DLS 0x0800
3095 #define fRX_WPI 0x1000
3097 #define LENGTH_AMSDU_SUBFRAMEHEAD 14
3098 #define LENGTH_ARALINK_SUBFRAMEHEAD 14
3099 #define LENGTH_ARALINK_HEADER_FIELD 2
3101 #define TX_UNKOWN_FRAME 0x00
3102 #define TX_MCAST_FRAME 0x01
3103 #define TX_LEGACY_FRAME 0x02
3104 #define TX_AMPDU_FRAME 0x04
3105 #define TX_AMSDU_FRAME 0x08
3106 #define TX_RALINK_FRAME 0x10
3107 #define TX_FRAG_FRAME 0x20
3110 // Currently the sizeof(TX_BLK) is 148 bytes.
3111 typedef struct _TX_BLK_
3114 UCHAR TxFrameType; // Indicate the Transmission type of the all frames in one batch
3115 UCHAR TotalFrameNum; // Total frame number want to send-out in one batch
3116 USHORT TotalFragNum; // Total frame fragments required in one batch
3117 USHORT TotalFrameLen; // Total length of all frames want to send-out in one batch
3119 QUEUE_HEADER TxPacketList;
3120 MAC_TABLE_ENTRY *pMacEntry; // NULL: packet with 802.11 RA field is multicast/broadcast address
3121 HTTRANSMIT_SETTING *pTransmit;
3123 // Following structure used for the characteristics of a specific packet.
3124 PNDIS_PACKET pPacket;
3125 PUCHAR pSrcBufHeader; // Reference to the head of sk_buff->data
3126 PUCHAR pSrcBufData; // Reference to the sk_buff->data, will changed depends on hanlding progresss
3127 UINT SrcBufLen; // Length of packet payload which not including Layer 2 header
3128 PUCHAR pExtraLlcSnapEncap; // NULL means no extra LLC/SNAP is required
3129 UCHAR HeaderBuf[80]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP
3130 UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding
3131 UCHAR HdrPadLen; // recording Header Padding Length;
3132 UCHAR apidx; // The interface associated to this packet
3133 UCHAR Wcid; // The MAC entry associated to this packet
3134 UCHAR UserPriority; // priority class of packet
3135 UCHAR FrameGap; // what kind of IFS this packet use
3136 UCHAR MpduReqNum; // number of fragments of this frame
3137 UCHAR TxRate; // TODO: Obsoleted? Should change to MCS?
3138 UCHAR CipherAlg; // cipher alogrithm
3143 USHORT Flags; //See following definitions for detail.
3145 //YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer.
3146 ULONG Priv; // Hardware specific value saved in here.
3150 #define fTX_bRtsRequired 0x0001 // Indicate if need send RTS frame for protection. Not used in RT2860/RT2870.
3151 #define fTX_bAckRequired 0x0002 // the packet need ack response
3152 #define fTX_bPiggyBack 0x0004 // Legacy device use Piggback or not
3153 #define fTX_bHTRate 0x0008 // allow to use HT rate
3154 #define fTX_bForceNonQoS 0x0010 // force to transmit frame without WMM-QoS in HT mode
3155 #define fTX_bAllowFrag 0x0020 // allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment
3156 #define fTX_bMoreData 0x0040 // there are more data packets in PowerSave Queue
3157 #define fTX_bWMM 0x0080 // QOS Data
3159 #define fTX_bClearEAPFrame 0x0100
3161 #define TX_BLK_ASSIGN_FLAG(_pTxBlk, _flag, value) \
3164 (_pTxBlk->Flags |= _flag) \
3166 (_pTxBlk->Flags &= ~(_flag)) \
3169 #define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag)
3170 #define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0)
3171 #define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag))
3177 //------------------------------------------------------------------------------------------
3181 // Enable & Disable NIC interrupt via writing interrupt mask register
3182 // Since it use ADAPTER structure, it have to be put after structure definition.
3184 __inline VOID NICDisableInterrupt(
3185 IN PRTMP_ADAPTER pAd)
3187 RTMP_IO_WRITE32(pAd, INT_MASK_CSR, 0x0); // 0: disable
3188 //RTMP_IO_WRITE32(pAd, PBF_INT_ENA, 0x0); // 0x418 is for firmware . SW doesn't handle here.
3189 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
3192 __inline VOID NICEnableInterrupt(
3193 IN PRTMP_ADAPTER pAd)
3196 // Flag "fOP_STATUS_DOZE" On, means ASIC put to sleep, else means ASIC WakeUp
3197 // To prevent System hang, we should enalbe the interrupt when
3198 // ASIC is already Wake Up.
3200 // RT2661 => when ASIC is sleeping, MAC register cannot be read and written.
3201 // RT2860 => when ASIC is sleeping, MAC register can be read and written.
3202 //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
3204 RTMP_IO_WRITE32(pAd, INT_MASK_CSR, pAd->int_enable_reg /*DELAYINTMASK*/); // 1:enable
3207 // DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n"));
3209 //RTMP_IO_WRITE32(pAd, PBF_INT_ENA, 0x00000030); // 1 : enable
3210 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
3213 #ifdef RT_BIG_ENDIAN
3214 static inline VOID WriteBackToDescriptor(
3217 IN BOOLEAN DoEncrypt,
3218 IN ULONG DescriptorType)
3222 p1 = ((UINT32 *)Dest);
3223 p2 = ((UINT32 *)Src);
3228 *(p1+1) = *(p2+1); // Word 1; this must be written back last
3232 ========================================================================
3234 Routine Description:
3235 Endian conversion of Tx/Rx descriptor .
3238 pAd Pointer to our adapter
3239 pData Pointer to Tx/Rx descriptor
3240 DescriptorType Direction of the frame
3246 Call this function when read or update descriptor
3247 ========================================================================
3249 static inline VOID RTMPWIEndianChange(
3251 IN ULONG DescriptorType)
3256 size = ((DescriptorType == TYPE_TXWI) ? TXWI_SIZE : RXWI_SIZE);
3258 if(DescriptorType == TYPE_TXWI)
3260 *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); // Byte 0~3
3261 *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData+4))); // Byte 4~7
3265 for(i=0; i < size/4 ; i++)
3266 *(((UINT32 *)pData) +i) = SWAP32(*(((UINT32 *)pData)+i));
3271 ========================================================================
3273 Routine Description:
3274 Endian conversion of Tx/Rx descriptor .
3277 pAd Pointer to our adapter
3278 pData Pointer to Tx/Rx descriptor
3279 DescriptorType Direction of the frame
3285 Call this function when read or update descriptor
3286 ========================================================================
3288 static inline VOID RTMPDescriptorEndianChange(
3290 IN ULONG DescriptorType)
3292 *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); // Byte 0~3
3293 *((UINT32 *)(pData + 8)) = SWAP32(*((UINT32 *)(pData+8))); // Byte 8~11
3294 *((UINT32 *)(pData +12)) = SWAP32(*((UINT32 *)(pData + 12))); // Byte 12~15
3295 *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData + 4))); // Byte 4~7, this must be swapped last
3299 ========================================================================
3301 Routine Description:
3302 Endian conversion of all kinds of 802.11 frames .
3305 pAd Pointer to our adapter
3306 pData Pointer to the 802.11 frame structure
3307 Dir Direction of the frame
3308 FromRxDoneInt Caller is from RxDone interrupt
3314 Call this function when read or update buffer data
3315 ========================================================================
3317 static inline VOID RTMPFrameEndianChange(
3318 IN PRTMP_ADAPTER pAd,
3321 IN BOOLEAN FromRxDoneInt)
3323 PHEADER_802_11 pFrame;
3326 // swab 16 bit fields - Frame Control field
3329 *(USHORT *)pData = SWAP16(*(USHORT *)pData);
3332 pFrame = (PHEADER_802_11) pData;
3333 pMacHdr = (PUCHAR) pFrame;
3335 // swab 16 bit fields - Duration/ID field
3336 *(USHORT *)(pMacHdr + 2) = SWAP16(*(USHORT *)(pMacHdr + 2));
3338 // swab 16 bit fields - Sequence Control field
3339 *(USHORT *)(pMacHdr + 22) = SWAP16(*(USHORT *)(pMacHdr + 22));
3341 if(pFrame->FC.Type == BTYPE_MGMT)
3343 switch(pFrame->FC.SubType)
3345 case SUBTYPE_ASSOC_REQ:
3346 case SUBTYPE_REASSOC_REQ:
3347 // swab 16 bit fields - CapabilityInfo field
3348 pMacHdr += sizeof(HEADER_802_11);
3349 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3351 // swab 16 bit fields - Listen Interval field
3353 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3356 case SUBTYPE_ASSOC_RSP:
3357 case SUBTYPE_REASSOC_RSP:
3358 // swab 16 bit fields - CapabilityInfo field
3359 pMacHdr += sizeof(HEADER_802_11);
3360 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3362 // swab 16 bit fields - Status Code field
3364 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3366 // swab 16 bit fields - AID field
3368 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3372 // If from APHandleRxDoneInterrupt routine, it is still a encrypt format.
3373 // The convertion is delayed to RTMPHandleDecryptionDoneInterrupt.
3374 if(!FromRxDoneInt && pFrame->FC.Wep == 1)
3378 // swab 16 bit fields - Auth Alg No. field
3379 pMacHdr += sizeof(HEADER_802_11);
3380 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3382 // swab 16 bit fields - Auth Seq No. field
3384 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3386 // swab 16 bit fields - Status Code field
3388 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3392 case SUBTYPE_BEACON:
3393 case SUBTYPE_PROBE_RSP:
3394 // swab 16 bit fields - BeaconInterval field
3395 pMacHdr += (sizeof(HEADER_802_11) + TIMESTAMP_LEN);
3396 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3398 // swab 16 bit fields - CapabilityInfo field
3399 pMacHdr += sizeof(USHORT);
3400 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3403 case SUBTYPE_DEAUTH:
3404 case SUBTYPE_DISASSOC:
3405 // swab 16 bit fields - Reason code field
3406 pMacHdr += sizeof(HEADER_802_11);
3407 *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr);
3411 else if( pFrame->FC.Type == BTYPE_DATA )
3414 else if(pFrame->FC.Type == BTYPE_CNTL)
3416 switch(pFrame->FC.SubType)
3418 case SUBTYPE_BLOCK_ACK_REQ:
3420 PFRAME_BA_REQ pBAReq = (PFRAME_BA_REQ)pFrame;
3421 *(USHORT *)(&pBAReq->BARControl) = SWAP16(*(USHORT *)(&pBAReq->BARControl));
3422 pBAReq->BAStartingSeq.word = SWAP16(pBAReq->BAStartingSeq.word);
3425 case SUBTYPE_BLOCK_ACK:
3426 // For Block Ack packet, the HT_CONTROL field is in the same offset with Addr3
3427 *(UINT32 *)(&pFrame->Addr3[0]) = SWAP32(*(UINT32 *)(&pFrame->Addr3[0]));
3431 //For ACK packet, the HT_CONTROL field is in the same offset with Addr2
3432 *(UINT32 *)(&pFrame->Addr2[0])= SWAP32(*(UINT32 *)(&pFrame->Addr2[0]));
3438 DBGPRINT(RT_DEBUG_ERROR,("Invalid Frame Type!!!\n"));
3441 // swab 16 bit fields - Frame Control
3442 if(Dir == DIR_WRITE)
3444 *(USHORT *)pData = SWAP16(*(USHORT *)pData);
3447 #endif // RT_BIG_ENDIAN //
3450 static inline VOID ConvertMulticastIP2MAC(
3452 IN PUCHAR *ppMacAddr,
3453 IN UINT16 ProtoType)
3455 if (pIpAddr == NULL)
3458 if (ppMacAddr == NULL || *ppMacAddr == NULL)
3464 // memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS);
3465 *(*ppMacAddr) = 0x33;
3466 *(*ppMacAddr + 1) = 0x33;
3467 *(*ppMacAddr + 2) = pIpAddr[12];
3468 *(*ppMacAddr + 3) = pIpAddr[13];
3469 *(*ppMacAddr + 4) = pIpAddr[14];
3470 *(*ppMacAddr + 5) = pIpAddr[15];
3475 // memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS);
3476 *(*ppMacAddr) = 0x01;
3477 *(*ppMacAddr + 1) = 0x00;
3478 *(*ppMacAddr + 2) = 0x5e;
3479 *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f;
3480 *(*ppMacAddr + 4) = pIpAddr[2];
3481 *(*ppMacAddr + 5) = pIpAddr[3];
3488 BOOLEAN RTMPCheckForHang(
3489 IN NDIS_HANDLE MiniportAdapterContext
3493 IN NDIS_HANDLE MiniportAdapterContext
3497 // Private routines in rtmp_init.c
3499 NDIS_STATUS RTMPAllocAdapterBlock(
3501 OUT PRTMP_ADAPTER *ppAdapter
3504 NDIS_STATUS RTMPAllocTxRxRingMemory(
3505 IN PRTMP_ADAPTER pAd
3508 NDIS_STATUS RTMPFindAdapter(
3509 IN PRTMP_ADAPTER pAd,
3510 IN NDIS_HANDLE WrapperConfigurationContext
3513 NDIS_STATUS RTMPReadParametersHook(
3514 IN PRTMP_ADAPTER pAd
3517 VOID RTMPFreeAdapter(
3518 IN PRTMP_ADAPTER pAd
3521 NDIS_STATUS NICReadRegParameters(
3522 IN PRTMP_ADAPTER pAd,
3523 IN NDIS_HANDLE WrapperConfigurationContext
3527 VOID NICReadEEPROMParameters(
3528 IN PRTMP_ADAPTER pAd,
3529 IN PUCHAR mac_addr);
3531 VOID NICInitAsicFromEEPROM(
3532 IN PRTMP_ADAPTER pAd);
3534 VOID NICInitTxRxRingAndBacklogQueue(
3535 IN PRTMP_ADAPTER pAd);
3537 NDIS_STATUS NICInitializeAdapter(
3538 IN PRTMP_ADAPTER pAd,
3539 IN BOOLEAN bHardReset);
3541 NDIS_STATUS NICInitializeAsic(
3542 IN PRTMP_ADAPTER pAd,
3543 IN BOOLEAN bHardReset);
3545 VOID NICRestoreBBPValue(
3546 IN PRTMP_ADAPTER pAd);
3549 IN PRTMP_ADAPTER pAd);
3551 VOID RTMPRingCleanUp(
3552 IN PRTMP_ADAPTER pAd,
3556 IN PRTMP_ADAPTER pAd);
3558 NDIS_STATUS DbgSendPacket(
3559 IN PRTMP_ADAPTER pAd,
3560 IN PNDIS_PACKET pPacket);
3563 IN PRTMP_ADAPTER pAd);
3565 VOID NICResetFromError(
3566 IN PRTMP_ADAPTER pAd);
3568 VOID NICEraseFirmware(
3569 IN PRTMP_ADAPTER pAd);
3571 NDIS_STATUS NICLoadFirmware(
3572 IN PRTMP_ADAPTER pAd);
3574 NDIS_STATUS NICLoadRateSwitchingParams(
3575 IN PRTMP_ADAPTER pAd);
3577 BOOLEAN NICCheckForHang(
3578 IN PRTMP_ADAPTER pAd);
3580 VOID NICUpdateFifoStaCounters(
3581 IN PRTMP_ADAPTER pAd);
3583 VOID NICUpdateRawCounters(
3584 IN PRTMP_ADAPTER pAd);
3586 ULONG RTMPNotAllZero(
3590 VOID RTMPZeroMemory(
3594 ULONG RTMPCompareMemory(
3599 VOID RTMPMoveMemory(
3612 VOID RTMPPatchMacBbpBug(
3613 IN PRTMP_ADAPTER pAd);
3615 VOID RTMPPatchCardBus(
3616 IN PRTMP_ADAPTER pAdapter);
3618 VOID RTMPPatchRalinkCardBus(
3619 IN PRTMP_ADAPTER pAdapter,
3622 ULONG RTMPReadCBConfig(
3628 VOID RTMPWriteCBConfig(
3636 IN PRTMP_ADAPTER pAd,
3637 IN PRALINK_TIMER_STRUCT pTimer,
3638 IN PVOID pTimerFunc,
3643 IN PRALINK_TIMER_STRUCT pTimer,
3648 IN PRALINK_TIMER_STRUCT pTimer,
3651 VOID RTMPCancelTimer(
3652 IN PRALINK_TIMER_STRUCT pTimer,
3653 OUT BOOLEAN *pCancelled);
3656 IN PRTMP_ADAPTER pAd,
3659 VOID RTMPSetSignalLED(
3660 IN PRTMP_ADAPTER pAd,
3661 IN NDIS_802_11_RSSI Dbm);
3663 VOID RTMPEnableRxTx(
3664 IN PRTMP_ADAPTER pAd);
3667 // prototype in action.c
3669 VOID ActionStateMachineInit(
3670 IN PRTMP_ADAPTER pAd,
3671 IN STATE_MACHINE *S,
3672 OUT STATE_MACHINE_FUNC Trans[]);
3674 VOID MlmeADDBAAction(
3675 IN PRTMP_ADAPTER pAd,
3676 IN MLME_QUEUE_ELEM *Elem);
3678 VOID MlmeDELBAAction(
3679 IN PRTMP_ADAPTER pAd,
3680 IN MLME_QUEUE_ELEM *Elem);
3683 IN PRTMP_ADAPTER pAd,
3684 IN MLME_QUEUE_ELEM *Elem);
3686 VOID MlmeInvalidAction(
3687 IN PRTMP_ADAPTER pAd,
3688 IN MLME_QUEUE_ELEM *Elem);
3691 IN PRTMP_ADAPTER pAd,
3692 IN MLME_QUEUE_ELEM *Elem);
3694 #ifdef DOT11_N_SUPPORT
3695 VOID PeerAddBAReqAction(
3696 IN PRTMP_ADAPTER pAd,
3697 IN MLME_QUEUE_ELEM *Elem);
3699 VOID PeerAddBARspAction(
3700 IN PRTMP_ADAPTER pAd,
3701 IN MLME_QUEUE_ELEM *Elem);
3703 VOID PeerDelBAAction(
3704 IN PRTMP_ADAPTER pAd,
3705 IN MLME_QUEUE_ELEM *Elem);
3708 IN PRTMP_ADAPTER pAd,
3709 IN MLME_QUEUE_ELEM *Elem);
3710 #endif // DOT11_N_SUPPORT //
3712 VOID SendPSMPAction(
3713 IN PRTMP_ADAPTER pAd,
3718 #ifdef DOT11N_DRAFT3
3719 VOID SendBSS2040CoexistMgmtAction(
3720 IN PRTMP_ADAPTER pAd,
3725 VOID SendNotifyBWActionFrame(
3726 IN PRTMP_ADAPTER pAd,
3730 BOOLEAN ChannelSwitchSanityCheck(
3731 IN PRTMP_ADAPTER pAd,
3733 IN UCHAR NewChannel,
3734 IN UCHAR Secondary);
3736 VOID ChannelSwitchAction(
3737 IN PRTMP_ADAPTER pAd,
3740 IN UCHAR Secondary);
3742 ULONG BuildIntolerantChannelRep(
3743 IN PRTMP_ADAPTER pAd,
3746 VOID Update2040CoexistFrameAndNotify(
3747 IN PRTMP_ADAPTER pAd,
3749 IN BOOLEAN bAddIntolerantCha);
3751 VOID Send2040CoexistAction(
3752 IN PRTMP_ADAPTER pAd,
3754 IN BOOLEAN bAddIntolerantCha);
3755 #endif // DOT11N_DRAFT3 //
3758 IN PRTMP_ADAPTER pAd,
3759 IN MLME_QUEUE_ELEM *Elem);
3761 VOID PeerPublicAction(
3762 IN PRTMP_ADAPTER pAd,
3763 IN MLME_QUEUE_ELEM *Elem);
3765 #ifdef CONFIG_STA_SUPPORT
3766 VOID StaPublicAction(
3767 IN PRTMP_ADAPTER pAd,
3768 IN UCHAR Bss2040Coexist);
3769 #endif // CONFIG_STA_SUPPORT //
3772 VOID PeerBSSTranAction(
3773 IN PRTMP_ADAPTER pAd,
3774 IN MLME_QUEUE_ELEM *Elem);
3776 #ifdef DOT11_N_SUPPORT
3778 IN PRTMP_ADAPTER pAd,
3779 IN MLME_QUEUE_ELEM *Elem);
3780 #endif // DOT11_N_SUPPORT //
3783 IN PRTMP_ADAPTER pAd,
3784 IN MLME_QUEUE_ELEM *Elem);
3786 #ifdef QOS_DLS_SUPPORT
3788 IN PRTMP_ADAPTER pAd,
3789 IN MLME_QUEUE_ELEM *Elem);
3790 #endif // QOS_DLS_SUPPORT //
3792 #ifdef CONFIG_STA_SUPPORT
3793 #ifdef QOS_DLS_SUPPORT
3795 IN PRTMP_ADAPTER pAd,
3796 IN OUT MLME_DLS_REQ_STRUCT *pDlsReq,
3797 IN PRT_802_11_DLS pDls,
3799 #endif // QOS_DLS_SUPPORT //
3800 #endif // CONFIG_STA_SUPPORT //
3802 #ifdef DOT11_N_SUPPORT
3803 VOID RECBATimerTimeout(
3804 IN PVOID SystemSpecific1,
3805 IN PVOID FunctionContext,
3806 IN PVOID SystemSpecific2,
3807 IN PVOID SystemSpecific3);
3809 VOID ORIBATimerTimeout(
3810 IN PRTMP_ADAPTER pAd);
3812 VOID SendRefreshBAR(
3813 IN PRTMP_ADAPTER pAd,
3814 IN MAC_TABLE_ENTRY *pEntry);
3815 #endif // DOT11_N_SUPPORT //
3818 IN PRTMP_ADAPTER pAd,
3819 IN OUT PHEADER_802_11 pHdr80211,
3825 IN PRTMP_ADAPTER pAd,
3826 IN OUT PFRAME_BAR pCntlBar,
3830 VOID InsertActField(
3831 IN PRTMP_ADAPTER pAd,
3832 OUT PUCHAR pFrameBuf,
3833 OUT PULONG pFrameLen,
3837 BOOLEAN QosBADataParse(
3838 IN PRTMP_ADAPTER pAd,
3840 IN PUCHAR p8023Header,
3844 IN UCHAR DataOffset,
3846 IN UINT CurRxIndex);
3848 #ifdef DOT11_N_SUPPORT
3849 BOOLEAN CntlEnqueueForRecv(
3850 IN PRTMP_ADAPTER pAd,
3853 IN PFRAME_BA_REQ pMsg);
3855 VOID BaAutoManSwitch(
3856 IN PRTMP_ADAPTER pAd);
3857 #endif // DOT11_N_SUPPORT //
3860 IN PRTMP_ADAPTER pAd,
3861 IN UCHAR BatRecIdx);
3864 // Private routines in rtmp_data.c
3866 BOOLEAN RTMPHandleRxDoneInterrupt(
3867 IN PRTMP_ADAPTER pAd);
3869 VOID RTMPHandleTxDoneInterrupt(
3870 IN PRTMP_ADAPTER pAd);
3872 BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(
3873 IN PRTMP_ADAPTER pAd,
3874 IN INT_SOURCE_CSR_STRUC TxRingBitmap);
3876 VOID RTMPHandleMgmtRingDmaDoneInterrupt(
3877 IN PRTMP_ADAPTER pAd);
3879 VOID RTMPHandleTBTTInterrupt(
3880 IN PRTMP_ADAPTER pAd);
3882 VOID RTMPHandlePreTBTTInterrupt(
3883 IN PRTMP_ADAPTER pAd);
3885 void RTMPHandleTwakeupInterrupt(
3886 IN PRTMP_ADAPTER pAd);
3888 VOID RTMPHandleRxCoherentInterrupt(
3889 IN PRTMP_ADAPTER pAd);
3891 BOOLEAN TxFrameIsAggregatible(
3892 IN PRTMP_ADAPTER pAd,
3893 IN PUCHAR pPrevAddr1,
3894 IN PUCHAR p8023hdr);
3896 BOOLEAN PeerIsAggreOn(
3897 IN PRTMP_ADAPTER pAd,
3899 IN PMAC_TABLE_ENTRY pMacEntry);
3901 NDIS_STATUS Sniff2BytesFromNdisBuffer(
3902 IN PNDIS_BUFFER pFirstBuffer,
3903 IN UCHAR DesiredOffset,
3907 NDIS_STATUS STASendPacket(
3908 IN PRTMP_ADAPTER pAd,
3909 IN PNDIS_PACKET pPacket);
3911 VOID STASendPackets(
3912 IN NDIS_HANDLE MiniportAdapterContext,
3913 IN PPNDIS_PACKET ppPacketArray,
3914 IN UINT NumberOfPackets);
3916 VOID RTMPDeQueuePacket(
3917 IN PRTMP_ADAPTER pAd,
3918 IN BOOLEAN bIntContext,
3920 IN UCHAR Max_Tx_Packets);
3922 NDIS_STATUS RTMPHardTransmit(
3923 IN PRTMP_ADAPTER pAd,
3924 IN PNDIS_PACKET pPacket,
3926 OUT PULONG pFreeTXDLeft);
3928 NDIS_STATUS STAHardTransmit(
3929 IN PRTMP_ADAPTER pAd,
3933 VOID STARxEAPOLFrameIndicate(
3934 IN PRTMP_ADAPTER pAd,
3935 IN MAC_TABLE_ENTRY *pEntry,
3937 IN UCHAR FromWhichBSSID);
3939 NDIS_STATUS RTMPFreeTXDRequest(
3940 IN PRTMP_ADAPTER pAd,
3942 IN UCHAR NumberRequired,
3943 IN PUCHAR FreeNumberIs);
3945 NDIS_STATUS MlmeHardTransmit(
3946 IN PRTMP_ADAPTER pAd,
3948 IN PNDIS_PACKET pPacket);
3950 NDIS_STATUS MlmeHardTransmitMgmtRing(
3951 IN PRTMP_ADAPTER pAd,
3953 IN PNDIS_PACKET pPacket);
3955 NDIS_STATUS MlmeHardTransmitTxRing(
3956 IN PRTMP_ADAPTER pAd,
3958 IN PNDIS_PACKET pPacket);
3960 USHORT RTMPCalcDuration(
3961 IN PRTMP_ADAPTER pAd,
3966 IN PRTMP_ADAPTER pAd,
3967 IN PTXWI_STRUC pTxWI,
3970 IN BOOLEAN InsTimestamp,
3973 IN BOOLEAN NSeq, // HW new a sequence.
3982 IN HTTRANSMIT_SETTING *pTransmit);
3985 VOID RTMPWriteTxWI_Data(
3986 IN PRTMP_ADAPTER pAd,
3987 IN OUT PTXWI_STRUC pTxWI,
3991 VOID RTMPWriteTxWI_Cache(
3992 IN PRTMP_ADAPTER pAd,
3993 IN OUT PTXWI_STRUC pTxWI,
3996 VOID RTMPWriteTxDescriptor(
3997 IN PRTMP_ADAPTER pAd,
4002 VOID RTMPSuspendMsduTransmission(
4003 IN PRTMP_ADAPTER pAd);
4005 VOID RTMPResumeMsduTransmission(
4006 IN PRTMP_ADAPTER pAd);
4008 NDIS_STATUS MiniportMMRequest(
4009 IN PRTMP_ADAPTER pAd,
4014 VOID RTMPSendNullFrame(
4015 IN PRTMP_ADAPTER pAd,
4017 IN BOOLEAN bQosNull);
4019 VOID RTMPSendDisassociationFrame(
4020 IN PRTMP_ADAPTER pAd);
4022 VOID RTMPSendRTSFrame(
4023 IN PRTMP_ADAPTER pAd,
4025 IN unsigned int NextMpduSize,
4028 IN USHORT AckDuration,
4033 NDIS_STATUS RTMPApplyPacketFilter(
4034 IN PRTMP_ADAPTER pAd,
4035 IN PRT28XX_RXD_STRUC pRxD,
4036 IN PHEADER_802_11 pHeader);
4038 PQUEUE_HEADER RTMPCheckTxSwQueue(
4039 IN PRTMP_ADAPTER pAd,
4042 #ifdef CONFIG_STA_SUPPORT
4043 VOID RTMPReportMicError(
4044 IN PRTMP_ADAPTER pAd,
4045 IN PCIPHER_KEY pWpaKey);
4047 VOID WpaMicFailureReportFrame(
4048 IN PRTMP_ADAPTER pAd,
4049 IN MLME_QUEUE_ELEM *Elem);
4051 VOID WpaDisassocApAndBlockAssoc(
4052 IN PVOID SystemSpecific1,
4053 IN PVOID FunctionContext,
4054 IN PVOID SystemSpecific2,
4055 IN PVOID SystemSpecific3);
4056 #endif // CONFIG_STA_SUPPORT //
4058 NDIS_STATUS RTMPCloneNdisPacket(
4059 IN PRTMP_ADAPTER pAd,
4060 IN BOOLEAN pInsAMSDUHdr,
4061 IN PNDIS_PACKET pInPacket,
4062 OUT PNDIS_PACKET *ppOutPacket);
4064 NDIS_STATUS RTMPAllocateNdisPacket(
4065 IN PRTMP_ADAPTER pAd,
4066 IN PNDIS_PACKET *pPacket,
4072 VOID RTMPFreeNdisPacket(
4073 IN PRTMP_ADAPTER pAd,
4074 IN PNDIS_PACKET pPacket);
4076 BOOLEAN RTMPFreeTXDUponTxDmaDone(
4077 IN PRTMP_ADAPTER pAd,
4080 BOOLEAN RTMPCheckDHCPFrame(
4081 IN PRTMP_ADAPTER pAd,
4082 IN PNDIS_PACKET pPacket);
4085 BOOLEAN RTMPCheckEtherType(
4086 IN PRTMP_ADAPTER pAd,
4087 IN PNDIS_PACKET pPacket);
4090 VOID RTMPCckBbpTuning(
4091 IN PRTMP_ADAPTER pAd,
4095 // Private routines in rtmp_wep.c
4097 VOID RTMPInitWepEngine(
4098 IN PRTMP_ADAPTER pAd,
4104 VOID RTMPEncryptData(
4105 IN PRTMP_ADAPTER pAd,
4110 BOOLEAN RTMPDecryptData(
4111 IN PRTMP_ADAPTER pAdapter,
4116 BOOLEAN RTMPSoftDecryptWEP(
4117 IN PRTMP_ADAPTER pAd,
4119 IN ULONG DataByteCnt,
4120 IN PCIPHER_KEY pGroupKey);
4123 IN PRTMP_ADAPTER pAd,
4127 IN PARCFOURCONTEXT Ctx,
4132 IN PARCFOURCONTEXT Ctx);
4134 VOID ARCFOUR_DECRYPT(
4135 IN PARCFOURCONTEXT Ctx,
4140 VOID ARCFOUR_ENCRYPT(
4141 IN PARCFOURCONTEXT Ctx,
4146 VOID WPAARCFOUR_ENCRYPT(
4147 IN PARCFOURCONTEXT Ctx,
4152 UINT RTMP_CALC_FCS32(
4161 // Asic/RF/BBP related functions
4163 VOID AsicAdjustTxPower(
4164 IN PRTMP_ADAPTER pAd);
4166 VOID AsicUpdateProtect(
4167 IN PRTMP_ADAPTER pAd,
4168 IN USHORT OperaionMode,
4170 IN BOOLEAN bDisableBGProtect,
4171 IN BOOLEAN bNonGFExist);
4173 VOID AsicSwitchChannel(
4174 IN PRTMP_ADAPTER pAd,
4178 VOID AsicLockChannel(
4179 IN PRTMP_ADAPTER pAd,
4182 VOID AsicAntennaSelect(
4183 IN PRTMP_ADAPTER pAd,
4186 VOID AsicAntennaSetting(
4187 IN PRTMP_ADAPTER pAd,
4188 IN ABGBAND_STATE BandState);
4190 VOID AsicRfTuningExec(
4191 IN PVOID SystemSpecific1,
4192 IN PVOID FunctionContext,
4193 IN PVOID SystemSpecific2,
4194 IN PVOID SystemSpecific3);
4196 #ifdef CONFIG_STA_SUPPORT
4197 VOID AsicSleepThenAutoWakeup(
4198 IN PRTMP_ADAPTER pAd,
4199 IN USHORT TbttNumToNextWakeUp);
4201 VOID AsicForceSleep(
4202 IN PRTMP_ADAPTER pAd);
4204 VOID AsicForceWakeup(
4205 IN PRTMP_ADAPTER pAd,
4207 #endif // CONFIG_STA_SUPPORT //
4210 IN PRTMP_ADAPTER pAd,
4213 VOID AsicSetMcastWC(
4214 IN PRTMP_ADAPTER pAd);
4216 VOID AsicDelWcidTab(
4217 IN PRTMP_ADAPTER pAd,
4221 IN PRTMP_ADAPTER pAd);
4223 VOID AsicDisableRDG(
4224 IN PRTMP_ADAPTER pAd);
4226 VOID AsicDisableSync(
4227 IN PRTMP_ADAPTER pAd);
4229 VOID AsicEnableBssSync(
4230 IN PRTMP_ADAPTER pAd);
4232 VOID AsicEnableIbssSync(
4233 IN PRTMP_ADAPTER pAd);
4235 VOID AsicSetEdcaParm(
4236 IN PRTMP_ADAPTER pAd,
4237 IN PEDCA_PARM pEdcaParm);
4239 VOID AsicSetSlotTime(
4240 IN PRTMP_ADAPTER pAd,
4241 IN BOOLEAN bUseShortSlotTime);
4243 VOID AsicAddSharedKeyEntry(
4244 IN PRTMP_ADAPTER pAd,
4252 VOID AsicRemoveSharedKeyEntry(
4253 IN PRTMP_ADAPTER pAd,
4257 VOID AsicUpdateWCIDAttribute(
4258 IN PRTMP_ADAPTER pAd,
4262 IN BOOLEAN bUsePairewiseKeyTable);
4264 VOID AsicUpdateWCIDIVEIV(
4265 IN PRTMP_ADAPTER pAd,
4270 VOID AsicUpdateRxWCIDTable(
4271 IN PRTMP_ADAPTER pAd,
4275 VOID AsicAddKeyEntry(
4276 IN PRTMP_ADAPTER pAd,
4280 IN PCIPHER_KEY pCipherKey,
4281 IN BOOLEAN bUsePairewiseKeyTable,
4284 VOID AsicAddPairwiseKeyEntry(
4285 IN PRTMP_ADAPTER pAd,
4288 IN CIPHER_KEY *pCipherKey);
4290 VOID AsicRemovePairwiseKeyEntry(
4291 IN PRTMP_ADAPTER pAd,
4295 BOOLEAN AsicSendCommandToMcu(
4296 IN PRTMP_ADAPTER pAd,
4302 BOOLEAN AsicCheckCommanOk(
4303 IN PRTMP_ADAPTER pAd,
4306 VOID MacAddrRandomBssid(
4307 IN PRTMP_ADAPTER pAd,
4310 VOID MgtMacHeaderInit(
4311 IN PRTMP_ADAPTER pAd,
4312 IN OUT PHEADER_802_11 pHdr80211,
4319 IN PRTMP_ADAPTER pAd);
4322 IN PRTMP_ADAPTER pAd);
4328 #ifdef DOT11_N_SUPPORT
4330 IN PRTMP_ADAPTER pAd,
4332 #endif // DOT11_N_SUPPORT //
4334 ULONG BssTableSearch(
4339 ULONG BssSsidTableSearch(
4346 ULONG BssTableSearchWithSSID(
4353 VOID BssTableDeleteEntry(
4354 IN OUT PBSS_TABLE pTab,
4358 #ifdef DOT11_N_SUPPORT
4359 VOID BATableDeleteORIEntry(
4360 IN OUT PRTMP_ADAPTER pAd,
4361 IN BA_ORI_ENTRY *pBAORIEntry);
4363 VOID BATableDeleteRECEntry(
4364 IN OUT PRTMP_ADAPTER pAd,
4365 IN BA_REC_ENTRY *pBARECEntry);
4367 VOID BATableTearORIEntry(
4368 IN OUT PRTMP_ADAPTER pAd,
4371 IN BOOLEAN bForceDelete,
4374 VOID BATableTearRECEntry(
4375 IN OUT PRTMP_ADAPTER pAd,
4379 #endif // DOT11_N_SUPPORT //
4382 IN PRTMP_ADAPTER pAd,
4383 OUT PBSS_ENTRY pBss,
4388 IN USHORT BeaconPeriod,
4391 IN USHORT CapabilityInfo,
4393 IN UCHAR SupRateLen,
4395 IN UCHAR ExtRateLen,
4396 IN HT_CAPABILITY_IE *pHtCapability,
4397 IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
4398 IN UCHAR HtCapabilityLen,
4399 IN UCHAR AddHtInfoLen,
4400 IN UCHAR NewExtChanOffset,
4403 IN LARGE_INTEGER TimeStamp,
4405 IN PEDCA_PARM pEdcaParm,
4406 IN PQOS_CAPABILITY_PARM pQosCapability,
4407 IN PQBSS_LOAD_PARM pQbssLoad,
4408 IN USHORT LengthVIE,
4409 IN PNDIS_802_11_VARIABLE_IEs pVIE);
4411 ULONG BssTableSetEntry(
4412 IN PRTMP_ADAPTER pAd,
4413 OUT PBSS_TABLE pTab,
4418 IN USHORT BeaconPeriod,
4421 IN USHORT CapabilityInfo,
4423 IN UCHAR SupRateLen,
4425 IN UCHAR ExtRateLen,
4426 IN HT_CAPABILITY_IE *pHtCapability,
4427 IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
4428 IN UCHAR HtCapabilityLen,
4429 IN UCHAR AddHtInfoLen,
4430 IN UCHAR NewExtChanOffset,
4433 IN LARGE_INTEGER TimeStamp,
4435 IN PEDCA_PARM pEdcaParm,
4436 IN PQOS_CAPABILITY_PARM pQosCapability,
4437 IN PQBSS_LOAD_PARM pQbssLoad,
4438 IN USHORT LengthVIE,
4439 IN PNDIS_802_11_VARIABLE_IEs pVIE);
4441 #ifdef DOT11_N_SUPPORT
4442 VOID BATableInsertEntry(
4443 IN PRTMP_ADAPTER pAd,
4445 IN USHORT TimeOutValue,
4446 IN USHORT StartingSeq,
4449 IN UCHAR OriginatorStatus,
4450 IN BOOLEAN IsRecipient);
4452 #ifdef DOT11N_DRAFT3
4453 VOID Bss2040CoexistTimeOut(
4454 IN PVOID SystemSpecific1,
4455 IN PVOID FunctionContext,
4456 IN PVOID SystemSpecific2,
4457 IN PVOID SystemSpecific3);
4461 IN PRTMP_ADAPTER pAd);
4463 ULONG TriEventTableSetEntry(
4464 IN PRTMP_ADAPTER pAd,
4465 OUT TRIGGER_EVENT_TAB *Tab,
4467 IN HT_CAPABILITY_IE *pHtCapability,
4468 IN UCHAR HtCapabilityLen,
4470 IN UCHAR ChannelNo);
4472 VOID TriEventCounterMaintenance(
4473 IN PRTMP_ADAPTER pAd);
4474 #endif // DOT11N_DRAFT3 //
4475 #endif // DOT11_N_SUPPORT //
4477 VOID BssTableSsidSort(
4478 IN PRTMP_ADAPTER pAd,
4479 OUT BSS_TABLE *OutTab,
4483 VOID BssTableSortByRssi(
4484 IN OUT BSS_TABLE *OutTab);
4486 VOID BssCipherParse(
4487 IN OUT PBSS_ENTRY pBss);
4489 NDIS_STATUS MlmeQueueInit(
4490 IN MLME_QUEUE *Queue);
4492 VOID MlmeQueueDestroy(
4493 IN MLME_QUEUE *Queue);
4495 BOOLEAN MlmeEnqueue(
4496 IN PRTMP_ADAPTER pAd,
4502 BOOLEAN MlmeEnqueueForRecv(
4503 IN PRTMP_ADAPTER pAd,
4505 IN ULONG TimeStampHigh,
4506 IN ULONG TimeStampLow,
4515 BOOLEAN MlmeDequeue(
4516 IN MLME_QUEUE *Queue,
4517 OUT MLME_QUEUE_ELEM **Elem);
4519 VOID MlmeRestartStateMachine(
4520 IN PRTMP_ADAPTER pAd);
4522 BOOLEAN MlmeQueueEmpty(
4523 IN MLME_QUEUE *Queue);
4525 BOOLEAN MlmeQueueFull(
4526 IN MLME_QUEUE *Queue);
4528 BOOLEAN MsgTypeSubst(
4529 IN PRTMP_ADAPTER pAd,
4530 IN PFRAME_802_11 pFrame,
4534 VOID StateMachineInit(
4535 IN STATE_MACHINE *Sm,
4536 IN STATE_MACHINE_FUNC Trans[],
4539 IN STATE_MACHINE_FUNC DefFunc,
4543 VOID StateMachineSetAction(
4544 IN STATE_MACHINE *S,
4547 IN STATE_MACHINE_FUNC F);
4549 VOID StateMachinePerformAction(
4550 IN PRTMP_ADAPTER pAd,
4551 IN STATE_MACHINE *S,
4552 IN MLME_QUEUE_ELEM *Elem);
4555 IN PRTMP_ADAPTER pAd,
4556 IN MLME_QUEUE_ELEM *Elem);
4558 VOID AssocStateMachineInit(
4559 IN PRTMP_ADAPTER pAd,
4560 IN STATE_MACHINE *Sm,
4561 OUT STATE_MACHINE_FUNC Trans[]);
4563 VOID ReassocTimeout(
4564 IN PVOID SystemSpecific1,
4565 IN PVOID FunctionContext,
4566 IN PVOID SystemSpecific2,
4567 IN PVOID SystemSpecific3);
4570 IN PVOID SystemSpecific1,
4571 IN PVOID FunctionContext,
4572 IN PVOID SystemSpecific2,
4573 IN PVOID SystemSpecific3);
4575 VOID DisassocTimeout(
4576 IN PVOID SystemSpecific1,
4577 IN PVOID FunctionContext,
4578 IN PVOID SystemSpecific2,
4579 IN PVOID SystemSpecific3);
4581 //----------------------------------------------
4582 VOID MlmeDisassocReqAction(
4583 IN PRTMP_ADAPTER pAd,
4584 IN MLME_QUEUE_ELEM *Elem);
4586 VOID MlmeAssocReqAction(
4587 IN PRTMP_ADAPTER pAd,
4588 IN MLME_QUEUE_ELEM *Elem);
4590 VOID MlmeReassocReqAction(
4591 IN PRTMP_ADAPTER pAd,
4592 IN MLME_QUEUE_ELEM *Elem);
4594 VOID MlmeDisassocReqAction(
4595 IN PRTMP_ADAPTER pAd,
4596 IN MLME_QUEUE_ELEM *Elem);
4598 VOID PeerAssocRspAction(
4599 IN PRTMP_ADAPTER pAd,
4600 IN MLME_QUEUE_ELEM *Elem);
4602 VOID PeerReassocRspAction(
4603 IN PRTMP_ADAPTER pAd,
4604 IN MLME_QUEUE_ELEM *Elem);
4606 VOID PeerDisassocAction(
4607 IN PRTMP_ADAPTER pAd,
4608 IN MLME_QUEUE_ELEM *Elem);
4610 VOID DisassocTimeoutAction(
4611 IN PRTMP_ADAPTER pAd,
4612 IN MLME_QUEUE_ELEM *Elem);
4614 VOID AssocTimeoutAction(
4615 IN PRTMP_ADAPTER pAd,
4616 IN MLME_QUEUE_ELEM *Elem);
4618 VOID ReassocTimeoutAction(
4619 IN PRTMP_ADAPTER pAd,
4620 IN MLME_QUEUE_ELEM *Elem);
4623 IN PRTMP_ADAPTER pAd,
4626 VOID SwitchBetweenWepAndCkip(
4627 IN PRTMP_ADAPTER pAd);
4629 VOID InvalidStateWhenAssoc(
4630 IN PRTMP_ADAPTER pAd,
4631 IN MLME_QUEUE_ELEM *Elem);
4633 VOID InvalidStateWhenReassoc(
4634 IN PRTMP_ADAPTER pAd,
4635 IN MLME_QUEUE_ELEM *Elem);
4637 VOID InvalidStateWhenDisassociate(
4638 IN PRTMP_ADAPTER pAd,
4639 IN MLME_QUEUE_ELEM *Elem);
4643 IN PRTMP_ADAPTER pAd);
4645 VOID ComposeNullFrame(
4646 IN PRTMP_ADAPTER pAd);
4649 IN PRTMP_ADAPTER pAd,
4651 IN USHORT CapabilityInfo,
4654 IN UCHAR SupRateLen,
4656 IN UCHAR ExtRateLen,
4657 IN PEDCA_PARM pEdcaParm,
4658 IN HT_CAPABILITY_IE *pHtCapability,
4659 IN UCHAR HtCapabilityLen,
4660 IN ADD_HT_INFO_IE *pAddHtInfo);
4662 VOID AuthStateMachineInit(
4663 IN PRTMP_ADAPTER pAd,
4664 IN PSTATE_MACHINE sm,
4665 OUT STATE_MACHINE_FUNC Trans[]);
4668 IN PVOID SystemSpecific1,
4669 IN PVOID FunctionContext,
4670 IN PVOID SystemSpecific2,
4671 IN PVOID SystemSpecific3);
4673 VOID MlmeAuthReqAction(
4674 IN PRTMP_ADAPTER pAd,
4675 IN MLME_QUEUE_ELEM *Elem);
4677 VOID PeerAuthRspAtSeq2Action(
4678 IN PRTMP_ADAPTER pAd,
4679 IN MLME_QUEUE_ELEM *Elem);
4681 VOID PeerAuthRspAtSeq4Action(
4682 IN PRTMP_ADAPTER pAd,
4683 IN MLME_QUEUE_ELEM *Elem);
4685 VOID AuthTimeoutAction(
4686 IN PRTMP_ADAPTER pAd,
4687 IN MLME_QUEUE_ELEM *Elem);
4690 IN PRTMP_ADAPTER pAd,
4693 VOID MlmeDeauthReqAction(
4694 IN PRTMP_ADAPTER pAd,
4695 IN MLME_QUEUE_ELEM *Elem);
4697 VOID InvalidStateWhenAuth(
4698 IN PRTMP_ADAPTER pAd,
4699 IN MLME_QUEUE_ELEM *Elem);
4701 //=============================================
4703 VOID AuthRspStateMachineInit(
4704 IN PRTMP_ADAPTER pAd,
4705 IN PSTATE_MACHINE Sm,
4706 IN STATE_MACHINE_FUNC Trans[]);
4708 VOID PeerDeauthAction(
4709 IN PRTMP_ADAPTER pAd,
4710 IN MLME_QUEUE_ELEM *Elem);
4712 VOID PeerAuthSimpleRspGenAndSend(
4713 IN PRTMP_ADAPTER pAd,
4714 IN PHEADER_802_11 pHdr80211,
4721 // Private routines in dls.c
4724 #ifdef CONFIG_STA_SUPPORT
4725 #ifdef QOS_DLS_SUPPORT
4726 void DlsStateMachineInit(
4727 IN PRTMP_ADAPTER pAd,
4728 IN STATE_MACHINE *Sm,
4729 OUT STATE_MACHINE_FUNC Trans[]);
4731 VOID MlmeDlsReqAction(
4732 IN PRTMP_ADAPTER pAd,
4733 IN MLME_QUEUE_ELEM *Elem);
4735 VOID PeerDlsReqAction(
4736 IN PRTMP_ADAPTER pAd,
4737 IN MLME_QUEUE_ELEM *Elem);
4739 VOID PeerDlsRspAction(
4740 IN PRTMP_ADAPTER pAd,
4741 IN MLME_QUEUE_ELEM *Elem);
4743 VOID MlmeDlsTearDownAction(
4744 IN PRTMP_ADAPTER pAd,
4745 IN MLME_QUEUE_ELEM *Elem);
4747 VOID PeerDlsTearDownAction(
4748 IN PRTMP_ADAPTER pAd,
4749 IN MLME_QUEUE_ELEM *Elem);
4751 VOID RTMPCheckDLSTimeOut(
4752 IN PRTMP_ADAPTER pAd);
4754 BOOLEAN RTMPRcvFrameDLSCheck(
4755 IN PRTMP_ADAPTER pAd,
4756 IN PHEADER_802_11 pHeader,
4758 IN PRT28XX_RXD_STRUC pRxD);
4760 INT RTMPCheckDLSFrame(
4761 IN PRTMP_ADAPTER pAd,
4764 VOID RTMPSendDLSTearDownFrame(
4765 IN PRTMP_ADAPTER pAd,
4768 NDIS_STATUS RTMPSendSTAKeyRequest(
4769 IN PRTMP_ADAPTER pAd,
4772 NDIS_STATUS RTMPSendSTAKeyHandShake(
4773 IN PRTMP_ADAPTER pAd,
4776 VOID DlsTimeoutAction(
4777 IN PVOID SystemSpecific1,
4778 IN PVOID FunctionContext,
4779 IN PVOID SystemSpecific2,
4780 IN PVOID SystemSpecific3);
4782 BOOLEAN MlmeDlsReqSanity(
4783 IN PRTMP_ADAPTER pAd,
4786 OUT PRT_802_11_DLS *pDLS,
4787 OUT PUSHORT pReason);
4789 INT Set_DlsEntryInfo_Display_Proc(
4790 IN PRTMP_ADAPTER pAd,
4793 MAC_TABLE_ENTRY *MacTableInsertDlsEntry(
4794 IN PRTMP_ADAPTER pAd,
4796 IN UINT DlsEntryIdx);
4798 BOOLEAN MacTableDeleteDlsEntry(
4799 IN PRTMP_ADAPTER pAd,
4803 MAC_TABLE_ENTRY *DlsEntryTableLookup(
4804 IN PRTMP_ADAPTER pAd,
4806 IN BOOLEAN bResetIdelCount);
4808 MAC_TABLE_ENTRY *DlsEntryTableLookupByWcid(
4809 IN PRTMP_ADAPTER pAd,
4812 IN BOOLEAN bResetIdelCount);
4814 INT Set_DlsAddEntry_Proc(
4815 IN PRTMP_ADAPTER pAd,
4818 INT Set_DlsTearDownEntry_Proc(
4819 IN PRTMP_ADAPTER pAd,
4821 #endif // QOS_DLS_SUPPORT //
4822 #endif // CONFIG_STA_SUPPORT //
4824 #ifdef QOS_DLS_SUPPORT
4825 BOOLEAN PeerDlsReqSanity(
4826 IN PRTMP_ADAPTER pAd,
4831 OUT USHORT *pCapabilityInfo,
4832 OUT USHORT *pDlsTimeout,
4833 OUT UCHAR *pRatesLen,
4835 OUT UCHAR *pHtCapabilityLen,
4836 OUT HT_CAPABILITY_IE *pHtCapability);
4838 BOOLEAN PeerDlsRspSanity(
4839 IN PRTMP_ADAPTER pAd,
4844 OUT USHORT *pCapabilityInfo,
4845 OUT USHORT *pStatus,
4846 OUT UCHAR *pRatesLen,
4848 OUT UCHAR *pHtCapabilityLen,
4849 OUT HT_CAPABILITY_IE *pHtCapability);
4851 BOOLEAN PeerDlsTearDownSanity(
4852 IN PRTMP_ADAPTER pAd,
4857 OUT USHORT *pReason);
4858 #endif // QOS_DLS_SUPPORT //
4860 //========================================
4862 VOID SyncStateMachineInit(
4863 IN PRTMP_ADAPTER pAd,
4864 IN STATE_MACHINE *Sm,
4865 OUT STATE_MACHINE_FUNC Trans[]);
4868 IN PVOID SystemSpecific1,
4869 IN PVOID FunctionContext,
4870 IN PVOID SystemSpecific2,
4871 IN PVOID SystemSpecific3);
4874 IN PVOID SystemSpecific1,
4875 IN PVOID FunctionContext,
4876 IN PVOID SystemSpecific2,
4877 IN PVOID SystemSpecific3);
4879 VOID MlmeScanReqAction(
4880 IN PRTMP_ADAPTER pAd,
4881 IN MLME_QUEUE_ELEM *Elem);
4883 VOID InvalidStateWhenScan(
4884 IN PRTMP_ADAPTER pAd,
4885 IN MLME_QUEUE_ELEM *Elem);
4887 VOID InvalidStateWhenJoin(
4888 IN PRTMP_ADAPTER pAd,
4889 IN MLME_QUEUE_ELEM *Elem);
4891 VOID InvalidStateWhenStart(
4892 IN PRTMP_ADAPTER pAd,
4893 IN MLME_QUEUE_ELEM *Elem);
4896 IN PRTMP_ADAPTER pAd,
4897 IN MLME_QUEUE_ELEM *Elem);
4899 VOID EnqueueProbeRequest(
4900 IN PRTMP_ADAPTER pAd);
4902 BOOLEAN ScanRunning(
4903 IN PRTMP_ADAPTER pAd);
4904 //=========================================
4907 IN PRTMP_ADAPTER pAd,
4908 IN STATE_MACHINE *S,
4909 OUT STATE_MACHINE_FUNC Trans[]);
4911 VOID MlmeCntlMachinePerformAction(
4912 IN PRTMP_ADAPTER pAd,
4913 IN STATE_MACHINE *S,
4914 IN MLME_QUEUE_ELEM *Elem);
4917 IN PRTMP_ADAPTER pAd,
4918 IN MLME_QUEUE_ELEM *Elem);
4920 VOID CntlOidScanProc(
4921 IN PRTMP_ADAPTER pAd,
4922 IN MLME_QUEUE_ELEM *Elem);
4924 VOID CntlOidSsidProc(
4925 IN PRTMP_ADAPTER pAd,
4926 IN MLME_QUEUE_ELEM * Elem);
4928 VOID CntlOidRTBssidProc(
4929 IN PRTMP_ADAPTER pAd,
4930 IN MLME_QUEUE_ELEM * Elem);
4932 VOID CntlMlmeRoamingProc(
4933 IN PRTMP_ADAPTER pAd,
4934 IN MLME_QUEUE_ELEM * Elem);
4936 VOID CntlWaitDisassocProc(
4937 IN PRTMP_ADAPTER pAd,
4938 IN MLME_QUEUE_ELEM *Elem);
4940 VOID CntlWaitJoinProc(
4941 IN PRTMP_ADAPTER pAd,
4942 IN MLME_QUEUE_ELEM *Elem);
4944 VOID CntlWaitReassocProc(
4945 IN PRTMP_ADAPTER pAd,
4946 IN MLME_QUEUE_ELEM *Elem);
4948 VOID CntlWaitStartProc(
4949 IN PRTMP_ADAPTER pAd,
4950 IN MLME_QUEUE_ELEM *Elem);
4952 VOID CntlWaitAuthProc(
4953 IN PRTMP_ADAPTER pAd,
4954 IN MLME_QUEUE_ELEM *Elem);
4956 VOID CntlWaitAuthProc2(
4957 IN PRTMP_ADAPTER pAd,
4958 IN MLME_QUEUE_ELEM *Elem);
4960 VOID CntlWaitAssocProc(
4961 IN PRTMP_ADAPTER pAd,
4962 IN MLME_QUEUE_ELEM *Elem);
4964 #ifdef QOS_DLS_SUPPORT
4965 VOID CntlOidDLSSetupProc(
4966 IN PRTMP_ADAPTER pAd,
4967 IN MLME_QUEUE_ELEM *Elem);
4968 #endif // QOS_DLS_SUPPORT //
4971 IN PRTMP_ADAPTER pAd,
4975 IN PRTMP_ADAPTER pAd,
4976 IN BOOLEAN IsReqFromAP);
4978 VOID IterateOnBssTab(
4979 IN PRTMP_ADAPTER pAd);
4981 VOID IterateOnBssTab2(
4982 IN PRTMP_ADAPTER pAd);;
4985 IN PRTMP_ADAPTER pAd,
4986 IN OUT MLME_JOIN_REQ_STRUCT *JoinReq,
4990 IN PRTMP_ADAPTER pAd,
4991 IN OUT MLME_ASSOC_REQ_STRUCT *AssocReq,
4993 IN USHORT CapabilityInfo,
4995 IN USHORT ListenIntv);
4998 IN PRTMP_ADAPTER pAd,
4999 IN OUT MLME_SCAN_REQ_STRUCT *ScanReq,
5005 VOID DisassocParmFill(
5006 IN PRTMP_ADAPTER pAd,
5007 IN OUT MLME_DISASSOC_REQ_STRUCT *DisassocReq,
5012 IN PRTMP_ADAPTER pAd,
5013 IN OUT MLME_START_REQ_STRUCT *StartReq,
5018 IN PRTMP_ADAPTER pAd,
5019 IN OUT MLME_AUTH_REQ_STRUCT *AuthReq,
5024 IN PRTMP_ADAPTER pAd);
5026 VOID EnqueueBeaconFrame(
5027 IN PRTMP_ADAPTER pAd);
5029 VOID MlmeJoinReqAction(
5030 IN PRTMP_ADAPTER pAd,
5031 IN MLME_QUEUE_ELEM *Elem);
5033 VOID MlmeScanReqAction(
5034 IN PRTMP_ADAPTER pAd,
5035 IN MLME_QUEUE_ELEM *Elem);
5037 VOID MlmeStartReqAction(
5038 IN PRTMP_ADAPTER pAd,
5039 IN MLME_QUEUE_ELEM *Elem);
5041 VOID ScanTimeoutAction(
5042 IN PRTMP_ADAPTER pAd,
5043 IN MLME_QUEUE_ELEM *Elem);
5045 VOID BeaconTimeoutAtJoinAction(
5046 IN PRTMP_ADAPTER pAd,
5047 IN MLME_QUEUE_ELEM *Elem);
5049 VOID PeerBeaconAtScanAction(
5050 IN PRTMP_ADAPTER pAd,
5051 IN MLME_QUEUE_ELEM *Elem);
5053 VOID PeerBeaconAtJoinAction(
5054 IN PRTMP_ADAPTER pAd,
5055 IN MLME_QUEUE_ELEM *Elem);
5058 IN PRTMP_ADAPTER pAd,
5059 IN MLME_QUEUE_ELEM *Elem);
5061 VOID PeerProbeReqAction(
5062 IN PRTMP_ADAPTER pAd,
5063 IN MLME_QUEUE_ELEM *Elem);
5065 VOID ScanNextChannel(
5066 IN PRTMP_ADAPTER pAd);
5068 ULONG MakeIbssBeacon(
5069 IN PRTMP_ADAPTER pAd);
5071 VOID CCXAdjacentAPReport(
5072 IN PRTMP_ADAPTER pAd);
5074 BOOLEAN MlmeScanReqSanity(
5075 IN PRTMP_ADAPTER pAd,
5081 OUT UCHAR *ScanType);
5083 BOOLEAN PeerBeaconAndProbeRspSanity(
5084 IN PRTMP_ADAPTER pAd,
5087 IN UCHAR MsgChannel,
5091 OUT UCHAR *pSsidLen,
5092 OUT UCHAR *pBssType,
5093 OUT USHORT *pBeaconPeriod,
5094 OUT UCHAR *pChannel,
5095 OUT UCHAR *pNewChannel,
5096 OUT LARGE_INTEGER *pTimestamp,
5097 OUT CF_PARM *pCfParm,
5098 OUT USHORT *pAtimWin,
5099 OUT USHORT *pCapabilityInfo,
5101 OUT UCHAR *pDtimCount,
5102 OUT UCHAR *pDtimPeriod,
5103 OUT UCHAR *pBcastFlag,
5104 OUT UCHAR *pMessageToMe,
5105 OUT UCHAR SupRate[],
5106 OUT UCHAR *pSupRateLen,
5107 OUT UCHAR ExtRate[],
5108 OUT UCHAR *pExtRateLen,
5109 OUT UCHAR *pCkipFlag,
5110 OUT UCHAR *pAironetCellPowerLimit,
5111 OUT PEDCA_PARM pEdcaParm,
5112 OUT PQBSS_LOAD_PARM pQbssLoad,
5113 OUT PQOS_CAPABILITY_PARM pQosCapability,
5114 OUT ULONG *pRalinkIe,
5115 OUT UCHAR *pHtCapabilityLen,
5116 #ifdef CONFIG_STA_SUPPORT
5117 OUT UCHAR *pPreNHtCapabilityLen,
5118 #endif // CONFIG_STA_SUPPORT //
5119 OUT HT_CAPABILITY_IE *pHtCapability,
5120 OUT UCHAR *AddHtInfoLen,
5121 OUT ADD_HT_INFO_IE *AddHtInfo,
5122 OUT UCHAR *NewExtChannel,
5123 OUT USHORT *LengthVIE,
5124 OUT PNDIS_802_11_VARIABLE_IEs pVIE);
5126 BOOLEAN PeerAddBAReqActionSanity(
5127 IN PRTMP_ADAPTER pAd,
5132 BOOLEAN PeerAddBARspActionSanity(
5133 IN PRTMP_ADAPTER pAd,
5137 BOOLEAN PeerDelBAActionSanity(
5138 IN PRTMP_ADAPTER pAd,
5143 BOOLEAN MlmeAssocReqSanity(
5144 IN PRTMP_ADAPTER pAd,
5148 OUT USHORT *CapabilityInfo,
5150 OUT USHORT *ListenIntv);
5152 BOOLEAN MlmeAuthReqSanity(
5153 IN PRTMP_ADAPTER pAd,
5160 BOOLEAN MlmeStartReqSanity(
5161 IN PRTMP_ADAPTER pAd,
5165 OUT UCHAR *Ssidlen);
5167 BOOLEAN PeerAuthSanity(
5168 IN PRTMP_ADAPTER pAd,
5175 OUT CHAR ChlgText[]);
5177 BOOLEAN PeerAssocRspSanity(
5178 IN PRTMP_ADAPTER pAd,
5182 OUT USHORT *pCapabilityInfo,
5183 OUT USHORT *pStatus,
5185 OUT UCHAR SupRate[],
5186 OUT UCHAR *pSupRateLen,
5187 OUT UCHAR ExtRate[],
5188 OUT UCHAR *pExtRateLen,
5189 OUT HT_CAPABILITY_IE *pHtCapability,
5190 OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
5191 OUT UCHAR *pHtCapabilityLen,
5192 OUT UCHAR *pAddHtInfoLen,
5193 OUT UCHAR *pNewExtChannelOffset,
5194 OUT PEDCA_PARM pEdcaParm,
5195 OUT UCHAR *pCkipFlag);
5197 BOOLEAN PeerDisassocSanity(
5198 IN PRTMP_ADAPTER pAd,
5202 OUT USHORT *Reason);
5204 BOOLEAN PeerWpaMessageSanity(
5205 IN PRTMP_ADAPTER pAd,
5206 IN PEAPOL_PACKET pMsg,
5209 IN MAC_TABLE_ENTRY *pEntry);
5211 BOOLEAN PeerDeauthSanity(
5212 IN PRTMP_ADAPTER pAd,
5216 OUT USHORT *Reason);
5218 BOOLEAN PeerProbeReqSanity(
5219 IN PRTMP_ADAPTER pAd,
5224 OUT UCHAR *pSsidLen);
5230 OUT UCHAR *BcastFlag,
5231 OUT UCHAR *DtimCount,
5232 OUT UCHAR *DtimPeriod,
5233 OUT UCHAR *MessageToMe);
5235 UCHAR ChannelSanity(
5236 IN PRTMP_ADAPTER pAd,
5239 NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(
5240 IN PBSS_ENTRY pBss);
5242 BOOLEAN MlmeDelBAReqSanity(
5243 IN PRTMP_ADAPTER pAd,
5247 BOOLEAN MlmeAddBAReqSanity(
5248 IN PRTMP_ADAPTER pAd,
5253 ULONG MakeOutgoingFrame(
5255 OUT ULONG *Length, ...);
5258 IN PRTMP_ADAPTER pAd,
5262 IN PRTMP_ADAPTER pAd);
5264 VOID AsicUpdateAutoFallBackTable(
5265 IN PRTMP_ADAPTER pAd,
5268 VOID MlmePeriodicExec(
5269 IN PVOID SystemSpecific1,
5270 IN PVOID FunctionContext,
5271 IN PVOID SystemSpecific2,
5272 IN PVOID SystemSpecific3);
5275 IN PVOID SystemSpecific1,
5276 IN PVOID FunctionContext,
5277 IN PVOID SystemSpecific2,
5278 IN PVOID SystemSpecific3);
5281 IN PVOID SystemSpecific1,
5282 IN PVOID FunctionContext,
5283 IN PVOID SystemSpecific2,
5284 IN PVOID SystemSpecific3);
5286 VOID STAMlmePeriodicExec(
5290 IN PRTMP_ADAPTER pAd);
5292 VOID MlmeAutoReconnectLastSSID(
5293 IN PRTMP_ADAPTER pAd);
5295 BOOLEAN MlmeValidateSSID(
5299 VOID MlmeCheckForRoaming(
5300 IN PRTMP_ADAPTER pAd,
5303 VOID MlmeCheckForFastRoaming(
5304 IN PRTMP_ADAPTER pAd,
5307 VOID MlmeDynamicTxRateSwitching(
5308 IN PRTMP_ADAPTER pAd);
5311 IN PRTMP_ADAPTER pAd,
5312 IN PMAC_TABLE_ENTRY pEntry,
5313 IN PRTMP_TX_RATE_SWITCH pTxRate);
5315 VOID MlmeSelectTxRateTable(
5316 IN PRTMP_ADAPTER pAd,
5317 IN PMAC_TABLE_ENTRY pEntry,
5319 IN PUCHAR pTableSize,
5320 IN PUCHAR pInitTxRateIdx);
5322 VOID MlmeCalculateChannelQuality(
5323 IN PRTMP_ADAPTER pAd,
5326 VOID MlmeCheckPsmChange(
5327 IN PRTMP_ADAPTER pAd,
5331 IN PRTMP_ADAPTER pAd,
5334 VOID MlmeSetTxPreamble(
5335 IN PRTMP_ADAPTER pAd,
5336 IN USHORT TxPreamble);
5338 VOID UpdateBasicRateBitmap(
5339 IN PRTMP_ADAPTER pAd);
5341 VOID MlmeUpdateTxRates(
5342 IN PRTMP_ADAPTER pAd,
5346 #ifdef DOT11_N_SUPPORT
5347 VOID MlmeUpdateHtTxRates(
5348 IN PRTMP_ADAPTER pAd,
5350 #endif // DOT11_N_SUPPORT //
5352 VOID RTMPCheckRates(
5353 IN PRTMP_ADAPTER pAd,
5354 IN OUT UCHAR SupRate[],
5355 IN OUT UCHAR *SupRateLen);
5357 #ifdef CONFIG_STA_SUPPORT
5358 BOOLEAN RTMPCheckChannel(
5359 IN PRTMP_ADAPTER pAd,
5360 IN UCHAR CentralChannel,
5362 #endif // CONFIG_STA_SUPPORT //
5364 BOOLEAN RTMPCheckHt(
5365 IN PRTMP_ADAPTER pAd,
5367 IN OUT HT_CAPABILITY_IE *pHtCapability,
5368 IN OUT ADD_HT_INFO_IE *pAddHtInfo);
5370 VOID StaQuickResponeForRateUpExec(
5371 IN PVOID SystemSpecific1,
5372 IN PVOID FunctionContext,
5373 IN PVOID SystemSpecific2,
5374 IN PVOID SystemSpecific3);
5376 VOID AsicBbpTuning1(
5377 IN PRTMP_ADAPTER pAd);
5379 VOID AsicBbpTuning2(
5380 IN PRTMP_ADAPTER pAd);
5382 VOID RTMPUpdateMlmeRate(
5383 IN PRTMP_ADAPTER pAd);
5386 IN PRTMP_ADAPTER pAd,
5391 VOID AsicEvaluateRxAnt(
5392 IN PRTMP_ADAPTER pAd);
5394 VOID AsicRxAntEvalTimeout(
5395 IN PVOID SystemSpecific1,
5396 IN PVOID FunctionContext,
5397 IN PVOID SystemSpecific2,
5398 IN PVOID SystemSpecific3);
5400 VOID APSDPeriodicExec(
5401 IN PVOID SystemSpecific1,
5402 IN PVOID FunctionContext,
5403 IN PVOID SystemSpecific2,
5404 IN PVOID SystemSpecific3);
5406 BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(
5407 IN PRTMP_ADAPTER pAd,
5408 IN PMAC_TABLE_ENTRY pEntry);
5410 UCHAR RTMPStaFixedTxMode(
5411 IN PRTMP_ADAPTER pAd,
5412 IN PMAC_TABLE_ENTRY pEntry);
5414 VOID RTMPUpdateLegacyTxSetting(
5415 UCHAR fixed_tx_mode,
5416 PMAC_TABLE_ENTRY pEntry);
5418 BOOLEAN RTMPAutoRateSwitchCheck(
5419 IN PRTMP_ADAPTER pAd);
5421 NDIS_STATUS MlmeInit(
5422 IN PRTMP_ADAPTER pAd);
5425 IN PRTMP_ADAPTER pAd);
5428 IN PRTMP_ADAPTER pAd);
5430 VOID MlmeResetRalinkCounters(
5431 IN PRTMP_ADAPTER pAd);
5433 VOID BuildChannelList(
5434 IN PRTMP_ADAPTER pAd);
5437 IN PRTMP_ADAPTER pAd);
5440 IN PRTMP_ADAPTER pAd,
5443 VOID ChangeToCellPowerLimit(
5444 IN PRTMP_ADAPTER pAd,
5445 IN UCHAR AironetCellPowerLimit);
5448 IN PRTMP_ADAPTER pAd,
5452 IN PRTMP_ADAPTER pAd,
5456 IN PRTMP_ADAPTER pAd);
5459 IN PRTMP_ADAPTER pAd,
5464 IN PRTMP_ADAPTER pAd);
5467 IN PRTMP_ADAPTER pAd);
5470 IN PRTMP_ADAPTER pAd);
5472 USHORT RTMP_EEPROM_READ16(
5473 IN PRTMP_ADAPTER pAd,
5476 VOID RTMP_EEPROM_WRITE16(
5477 IN PRTMP_ADAPTER pAd,
5482 // Prototypes of function definition in rtmp_tkip.c
5484 VOID RTMPInitTkipEngine(
5485 IN PRTMP_ADAPTER pAd,
5494 VOID RTMPInitMICEngine(
5495 IN PRTMP_ADAPTER pAd,
5499 IN UCHAR UserPriority,
5502 BOOLEAN RTMPTkipCompareMICValue(
5503 IN PRTMP_ADAPTER pAd,
5508 IN UCHAR UserPriority,
5511 VOID RTMPCalculateMICValue(
5512 IN PRTMP_ADAPTER pAd,
5513 IN PNDIS_PACKET pPacket,
5515 IN PCIPHER_KEY pKey,
5518 BOOLEAN RTMPTkipCompareMICValueWithLLC(
5519 IN PRTMP_ADAPTER pAd,
5527 VOID RTMPTkipAppendByte(
5528 IN PTKIP_KEY_INFO pTkip,
5531 VOID RTMPTkipAppend(
5532 IN PTKIP_KEY_INFO pTkip,
5536 VOID RTMPTkipGetMIC(
5537 IN PTKIP_KEY_INFO pTkip);
5539 BOOLEAN RTMPSoftDecryptTKIP(
5540 IN PRTMP_ADAPTER pAd,
5542 IN ULONG DataByteCnt,
5543 IN UCHAR UserPriority,
5544 IN PCIPHER_KEY pWpaKey);
5546 BOOLEAN RTMPSoftDecryptAES(
5547 IN PRTMP_ADAPTER pAd,
5549 IN ULONG DataByteCnt,
5550 IN PCIPHER_KEY pWpaKey);
5553 // Prototypes of function definition in cmm_info.c
5555 NDIS_STATUS RTMPWPARemoveKeyProc(
5556 IN PRTMP_ADAPTER pAd,
5559 VOID RTMPWPARemoveAllKeys(
5560 IN PRTMP_ADAPTER pAd);
5562 BOOLEAN RTMPCheckStrPrintAble(
5566 VOID RTMPSetPhyMode(
5567 IN PRTMP_ADAPTER pAd,
5570 VOID RTMPUpdateHTIE(
5571 IN RT_HT_CAPABILITY *pRtHt,
5573 OUT HT_CAPABILITY_IE *pHtCapability,
5574 OUT ADD_HT_INFO_IE *pAddHtInfo);
5576 VOID RTMPAddWcidAttributeEntry(
5577 IN PRTMP_ADAPTER pAd,
5581 IN MAC_TABLE_ENTRY *pEntry);
5583 CHAR *GetEncryptType(
5589 VOID RTMPIoctlGetSiteSurvey(
5590 IN PRTMP_ADAPTER pAdapter,
5591 IN struct iwreq *wrq);
5593 VOID RTMPIoctlGetMacTable(
5594 IN PRTMP_ADAPTER pAd,
5595 IN struct iwreq *wrq);
5597 VOID RTMPIndicateWPA2Status(
5598 IN PRTMP_ADAPTER pAdapter);
5600 VOID RTMPOPModeSwitching(
5601 IN PRTMP_ADAPTER pAd);
5603 #ifdef CONFIG_STA_SUPPORT
5604 VOID RTMPAddBSSIDCipher(
5605 IN PRTMP_ADAPTER pAd,
5607 IN PNDIS_802_11_KEY pKey,
5608 IN UCHAR CipherAlg);
5609 #endif // CONFIG_STA_SUPPORT //
5611 #ifdef DOT11_N_SUPPORT
5613 IN PRTMP_ADAPTER pAd,
5614 IN OID_SET_HT_PHYMODE *pHTPhyMode);
5616 VOID RTMPSetIndividualHT(
5617 IN PRTMP_ADAPTER pAd,
5619 #endif // DOT11_N_SUPPORT //
5621 VOID RTMPSendWirelessEvent(
5622 IN PRTMP_ADAPTER pAd,
5623 IN USHORT Event_flag,
5628 VOID NICUpdateCntlCounters(
5629 IN PRTMP_ADAPTER pAd,
5630 IN PHEADER_802_11 pHeader,
5632 IN PRXWI_STRUC pRxWI);
5634 // prototype in wpa.c
5636 BOOLEAN WpaMsgTypeSubst(
5640 VOID WpaPskStateMachineInit(
5641 IN PRTMP_ADAPTER pAd,
5642 IN STATE_MACHINE *S,
5643 OUT STATE_MACHINE_FUNC Trans[]);
5645 VOID WpaEAPOLKeyAction(
5646 IN PRTMP_ADAPTER pAd,
5647 IN MLME_QUEUE_ELEM *Elem);
5649 VOID WpaPairMsg1Action(
5650 IN PRTMP_ADAPTER pAd,
5651 IN MLME_QUEUE_ELEM *Elem);
5653 VOID WpaPairMsg3Action(
5654 IN PRTMP_ADAPTER pAd,
5655 IN MLME_QUEUE_ELEM *Elem);
5657 VOID WpaGroupMsg1Action(
5658 IN PRTMP_ADAPTER pAd,
5659 IN MLME_QUEUE_ELEM *Elem);
5661 VOID WpaMacHeaderInit(
5662 IN PRTMP_ADAPTER pAd,
5663 IN OUT PHEADER_802_11 pHdr80211,
5667 VOID Wpa2PairMsg1Action(
5668 IN PRTMP_ADAPTER pAd,
5669 IN MLME_QUEUE_ELEM *Elem);
5671 VOID Wpa2PairMsg3Action(
5672 IN PRTMP_ADAPTER pAd,
5673 IN MLME_QUEUE_ELEM *Elem);
5675 BOOLEAN ParseKeyData(
5676 IN PRTMP_ADAPTER pAd,
5678 IN UCHAR KeyDataLen,
5679 IN UCHAR bPairewise);
5681 VOID RTMPToWirelessSta(
5682 IN PRTMP_ADAPTER pAd,
5683 IN PUCHAR pHeader802_3,
5687 IN BOOLEAN is4wayFrame);
5715 IN PRTMP_ADAPTER pAd,
5725 IN PRTMP_ADAPTER pAd,
5730 // prototype in aironet.c
5732 VOID AironetStateMachineInit(
5733 IN PRTMP_ADAPTER pAd,
5734 IN STATE_MACHINE *S,
5735 OUT STATE_MACHINE_FUNC Trans[]);
5737 VOID AironetMsgAction(
5738 IN PRTMP_ADAPTER pAd,
5739 IN MLME_QUEUE_ELEM *Elem);
5741 VOID AironetRequestAction(
5742 IN PRTMP_ADAPTER pAd,
5743 IN MLME_QUEUE_ELEM *Elem);
5745 VOID ChannelLoadRequestAction(
5746 IN PRTMP_ADAPTER pAd,
5749 VOID NoiseHistRequestAction(
5750 IN PRTMP_ADAPTER pAd,
5753 VOID BeaconRequestAction(
5754 IN PRTMP_ADAPTER pAd,
5757 VOID AironetReportAction(
5758 IN PRTMP_ADAPTER pAd,
5759 IN MLME_QUEUE_ELEM *Elem);
5761 VOID ChannelLoadReportAction(
5762 IN PRTMP_ADAPTER pAd,
5765 VOID NoiseHistReportAction(
5766 IN PRTMP_ADAPTER pAd,
5769 VOID AironetFinalReportAction(
5770 IN PRTMP_ADAPTER pAd);
5772 VOID BeaconReportAction(
5773 IN PRTMP_ADAPTER pAd,
5776 VOID AironetAddBeaconReport(
5777 IN PRTMP_ADAPTER pAd,
5779 IN PMLME_QUEUE_ELEM pElem);
5781 VOID AironetCreateBeaconReportFromBssTable(
5782 IN PRTMP_ADAPTER pAd);
5784 VOID DBGPRINT_TX_RING(
5785 IN PRTMP_ADAPTER pAd,
5788 VOID DBGPRINT_RX_RING(
5789 IN PRTMP_ADAPTER pAd);
5792 IN PRTMP_ADAPTER pAd,
5794 IN UCHAR RssiNumber);
5797 #ifdef DOT11N_DRAFT3
5798 VOID BuildEffectedChannelList(
5799 IN PRTMP_ADAPTER pAd);
5800 #endif // DOT11N_DRAFT3 //
5803 VOID APAsicEvaluateRxAnt(
5804 IN PRTMP_ADAPTER pAd);
5807 VOID APAsicRxAntEvalTimeout(
5808 IN PRTMP_ADAPTER pAd);
5811 // function prototype in cmm_wpa.c
5813 BOOLEAN RTMPCheckWPAframe(
5814 IN PRTMP_ADAPTER pAd,
5815 IN PMAC_TABLE_ENTRY pEntry,
5817 IN ULONG DataByteCount,
5818 IN UCHAR FromWhichBSSID);
5820 VOID AES_GTK_KEY_UNWRAP(
5822 OUT UCHAR *plaintext,
5824 IN UCHAR *ciphertext);
5826 BOOLEAN RTMPCheckRSNIE(
5827 IN PRTMP_ADAPTER pAd,
5830 IN MAC_TABLE_ENTRY *pEntry,
5833 BOOLEAN RTMPParseEapolKeyData(
5834 IN PRTMP_ADAPTER pAd,
5836 IN UCHAR KeyDataLen,
5837 IN UCHAR GroupKeyIndex,
5840 IN MAC_TABLE_ENTRY *pEntry);
5842 VOID ConstructEapolMsg(
5843 IN PRTMP_ADAPTER pAd,
5844 IN UCHAR PeerAuthMode,
5845 IN UCHAR PeerWepStatus,
5846 IN UCHAR MyGroupKeyWepStatus,
5848 IN UCHAR DefaultKeyIdx,
5849 IN UCHAR *ReplayCounter,
5856 OUT PEAPOL_PACKET pMsg);
5859 IN PRTMP_ADAPTER pAd,
5860 IN UCHAR PeerWepStatus,
5862 OUT PEAPOL_PACKET pMsg);
5864 NDIS_STATUS RTMPSoftDecryptBroadCastData(
5865 IN PRTMP_ADAPTER pAd,
5867 IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher,
5868 IN PCIPHER_KEY pShard_key);
5870 VOID ConstructEapolKeyData(
5871 IN PRTMP_ADAPTER pAd,
5872 IN UCHAR PeerAuthMode,
5873 IN UCHAR PeerWepStatus,
5874 IN UCHAR GroupKeyWepStatus,
5876 IN UCHAR DefaultKeyIdx,
5877 IN BOOLEAN bWPA2Capable,
5882 OUT PEAPOL_PACKET pMsg);
5885 IN PRTMP_ADAPTER pAd,
5891 // function prototype in ap_wpa.c
5894 BOOLEAN APWpaMsgTypeSubst(
5898 MAC_TABLE_ENTRY *PACInquiry(
5899 IN PRTMP_ADAPTER pAd,
5902 BOOLEAN RTMPCheckMcast(
5903 IN PRTMP_ADAPTER pAd,
5904 IN PEID_STRUCT eid_ptr,
5905 IN MAC_TABLE_ENTRY *pEntry);
5907 BOOLEAN RTMPCheckUcast(
5908 IN PRTMP_ADAPTER pAd,
5909 IN PEID_STRUCT eid_ptr,
5910 IN MAC_TABLE_ENTRY *pEntry);
5912 BOOLEAN RTMPCheckAUTH(
5913 IN PRTMP_ADAPTER pAd,
5914 IN PEID_STRUCT eid_ptr,
5915 IN MAC_TABLE_ENTRY *pEntry);
5917 VOID WPAStart4WayHS(
5918 IN PRTMP_ADAPTER pAd,
5919 IN MAC_TABLE_ENTRY *pEntry,
5920 IN ULONG TimeInterval);
5922 VOID WPAStart2WayGroupHS(
5923 IN PRTMP_ADAPTER pAd,
5924 IN MAC_TABLE_ENTRY *pEntry);
5926 VOID APWpaEAPPacketAction(
5927 IN PRTMP_ADAPTER pAd,
5928 IN MLME_QUEUE_ELEM *Elem);
5930 VOID APWpaEAPOLStartAction(
5931 IN PRTMP_ADAPTER pAd,
5932 IN MLME_QUEUE_ELEM *Elem);
5934 VOID APWpaEAPOLLogoffAction(
5935 IN PRTMP_ADAPTER pAd,
5936 IN MLME_QUEUE_ELEM *Elem);
5938 VOID APWpaEAPOLKeyAction(
5939 IN PRTMP_ADAPTER pAd,
5940 IN MLME_QUEUE_ELEM *Elem);
5942 VOID APWpaEAPOLASFAlertAction(
5943 IN PRTMP_ADAPTER pAd,
5944 IN MLME_QUEUE_ELEM *Elem);
5946 VOID HandleCounterMeasure(
5947 IN PRTMP_ADAPTER pAd,
5948 IN MAC_TABLE_ENTRY *pEntry);
5950 VOID PeerPairMsg2Action(
5951 IN PRTMP_ADAPTER pAd,
5952 IN MAC_TABLE_ENTRY *pEntry,
5953 IN MLME_QUEUE_ELEM *Elem);
5955 VOID PeerPairMsg4Action(
5956 IN PRTMP_ADAPTER pAd,
5957 IN MAC_TABLE_ENTRY *pEntry,
5958 IN MLME_QUEUE_ELEM *Elem);
5961 IN PVOID SystemSpecific1,
5962 IN PVOID FunctionContext,
5963 IN PVOID SystemSpecific2,
5964 IN PVOID SystemSpecific3);
5967 IN PVOID SystemSpecific1,
5968 IN PVOID FunctionContext,
5969 IN PVOID SystemSpecific2,
5970 IN PVOID SystemSpecific3);
5972 VOID EnqueueStartForPSKExec(
5973 IN PVOID SystemSpecific1,
5974 IN PVOID FunctionContext,
5975 IN PVOID SystemSpecific2,
5976 IN PVOID SystemSpecific3);
5978 VOID RTMPHandleSTAKey(
5979 IN PRTMP_ADAPTER pAdapter,
5980 IN MAC_TABLE_ENTRY *pEntry,
5981 IN MLME_QUEUE_ELEM *Elem);
5983 VOID PeerGroupMsg2Action(
5984 IN PRTMP_ADAPTER pAd,
5985 IN PMAC_TABLE_ENTRY pEntry,
5989 VOID PairDisAssocAction(
5990 IN PRTMP_ADAPTER pAd,
5991 IN PMAC_TABLE_ENTRY pEntry,
5994 VOID MlmeDeAuthAction(
5995 IN PRTMP_ADAPTER pAd,
5996 IN PMAC_TABLE_ENTRY pEntry,
5999 VOID GREKEYPeriodicExec(
6000 IN PVOID SystemSpecific1,
6001 IN PVOID FunctionContext,
6002 IN PVOID SystemSpecific2,
6003 IN PVOID SystemSpecific3);
6025 IN PRTMP_ADAPTER pAd,
6028 VOID AES_GTK_KEY_WRAP(
6030 IN UCHAR *plaintext,
6032 OUT UCHAR *ciphertext);
6035 IN PRTMP_ADAPTER pAdapter,
6039 VOID APToWirelessSta(
6040 IN PRTMP_ADAPTER pAd,
6041 IN MAC_TABLE_ENTRY *pEntry,
6042 IN PUCHAR pHeader802_3,
6046 IN BOOLEAN bClearFrame);
6048 VOID RTMPAddPMKIDCache(
6049 IN PRTMP_ADAPTER pAd,
6055 INT RTMPSearchPMKIDCache(
6056 IN PRTMP_ADAPTER pAd,
6060 VOID RTMPDeletePMKIDCache(
6061 IN PRTMP_ADAPTER pAd,
6065 VOID RTMPMaintainPMKIDCache(
6066 IN PRTMP_ADAPTER pAd);
6068 VOID RTMPSendTriggerFrame(
6069 IN PRTMP_ADAPTER pAd,
6073 IN BOOLEAN bQosNull);
6077 VOID RTMP_SetPeriodicTimer(
6078 IN NDIS_MINIPORT_TIMER *pTimer,
6079 IN unsigned long timeout);
6081 VOID RTMP_OS_Init_Timer(
6082 IN PRTMP_ADAPTER pAd,
6083 IN NDIS_MINIPORT_TIMER *pTimer,
6084 IN TIMER_FUNCTION function,
6087 VOID RTMP_OS_Add_Timer(
6088 IN NDIS_MINIPORT_TIMER *pTimer,
6089 IN unsigned long timeout);
6091 VOID RTMP_OS_Mod_Timer(
6092 IN NDIS_MINIPORT_TIMER *pTimer,
6093 IN unsigned long timeout);
6096 VOID RTMP_OS_Del_Timer(
6097 IN NDIS_MINIPORT_TIMER *pTimer,
6098 OUT BOOLEAN *pCancelled);
6101 VOID RTMP_OS_Release_Packet(
6102 IN PRTMP_ADAPTER pAd,
6103 IN PQUEUE_ENTRY pEntry);
6108 NDIS_STATUS os_alloc_mem(
6109 IN PRTMP_ADAPTER pAd,
6113 NDIS_STATUS os_free_mem(
6114 IN PRTMP_ADAPTER pAd,
6118 void RTMP_AllocateSharedMemory(
6119 IN PRTMP_ADAPTER pAd,
6122 OUT PVOID *VirtualAddress,
6123 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
6125 VOID RTMPFreeTxRxRingMemory(
6126 IN PRTMP_ADAPTER pAd);
6128 NDIS_STATUS AdapterBlockAllocateMemory(
6132 void RTMP_AllocateTxDescMemory(
6133 IN PRTMP_ADAPTER pAd,
6137 OUT PVOID *VirtualAddress,
6138 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
6140 void RTMP_AllocateFirstTxBuffer(
6141 IN PRTMP_ADAPTER pAd,
6145 OUT PVOID *VirtualAddress,
6146 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
6148 void RTMP_AllocateMgmtDescMemory(
6149 IN PRTMP_ADAPTER pAd,
6152 OUT PVOID *VirtualAddress,
6153 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
6155 void RTMP_AllocateRxDescMemory(
6156 IN PRTMP_ADAPTER pAd,
6159 OUT PVOID *VirtualAddress,
6160 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
6162 PNDIS_PACKET RTMP_AllocateRxPacketBuffer(
6163 IN PRTMP_ADAPTER pAd,
6166 OUT PVOID *VirtualAddress,
6167 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
6169 PNDIS_PACKET RTMP_AllocateTxPacketBuffer(
6170 IN PRTMP_ADAPTER pAd,
6173 OUT PVOID *VirtualAddress);
6175 PNDIS_PACKET RTMP_AllocateFragPacketBuffer(
6176 IN PRTMP_ADAPTER pAd,
6179 void RTMP_QueryPacketInfo(
6180 IN PNDIS_PACKET pPacket,
6181 OUT PACKET_INFO *pPacketInfo,
6182 OUT PUCHAR *pSrcBufVA,
6183 OUT UINT *pSrcBufLen);
6185 void RTMP_QueryNextPacketInfo(
6186 IN PNDIS_PACKET *ppPacket,
6187 OUT PACKET_INFO *pPacketInfo,
6188 OUT PUCHAR *pSrcBufVA,
6189 OUT UINT *pSrcBufLen);
6192 BOOLEAN RTMP_FillTxBlkInfo(
6193 IN RTMP_ADAPTER *pAd,
6197 PRTMP_SCATTER_GATHER_LIST
6198 rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST *sg);
6201 void announce_802_3_packet(
6202 IN PRTMP_ADAPTER pAd,
6203 IN PNDIS_PACKET pPacket);
6206 UINT BA_Reorder_AMSDU_Annnounce(
6207 IN PRTMP_ADAPTER pAd,
6208 IN PNDIS_PACKET pPacket);
6211 UINT Handle_AMSDU_Packet(
6212 IN PRTMP_ADAPTER pAd,
6215 IN UCHAR FromWhichBSSID);
6218 void convert_802_11_to_802_3_packet(
6219 IN PRTMP_ADAPTER pAd,
6220 IN PNDIS_PACKET pPacket,
6224 IN UCHAR FromWhichBSSID);
6227 PNET_DEV get_netdev_from_bssid(
6228 IN PRTMP_ADAPTER pAd,
6229 IN UCHAR FromWhichBSSID);
6232 PNDIS_PACKET duplicate_pkt(
6233 IN PRTMP_ADAPTER pAd,
6234 IN PUCHAR pHeader802_3,
6238 IN UCHAR FromWhichBSSID);
6241 PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(
6242 IN PRTMP_ADAPTER pAd,
6243 IN PNDIS_PACKET pOldPkt);
6245 PNDIS_PACKET duplicate_pkt_with_VLAN(
6246 IN PRTMP_ADAPTER pAd,
6247 IN PUCHAR pHeader802_3,
6251 IN UCHAR FromWhichBSSID);
6253 PNDIS_PACKET duplicate_pkt_with_WPI(
6254 IN PRTMP_ADAPTER pAd,
6255 IN PNDIS_PACKET pPacket,
6256 IN UINT32 ext_head_len,
6257 IN UINT32 ext_tail_len);
6259 UCHAR VLAN_8023_Header_Copy(
6260 IN PRTMP_ADAPTER pAd,
6261 IN PUCHAR pHeader802_3,
6264 IN UCHAR FromWhichBSSID);
6266 #ifdef DOT11_N_SUPPORT
6267 void ba_flush_reordering_timeout_mpdus(
6268 IN PRTMP_ADAPTER pAd,
6269 IN PBA_REC_ENTRY pBAEntry,
6273 VOID BAOriSessionSetUp(
6274 IN PRTMP_ADAPTER pAd,
6275 IN MAC_TABLE_ENTRY *pEntry,
6279 IN BOOLEAN isForced);
6281 VOID BASessionTearDownALL(
6282 IN OUT PRTMP_ADAPTER pAd,
6284 #endif // DOT11_N_SUPPORT //
6286 BOOLEAN OS_Need_Clone_Packet(void);
6289 VOID build_tx_packet(
6290 IN PRTMP_ADAPTER pAd,
6291 IN PNDIS_PACKET pPacket,
6296 VOID BAOriSessionTearDown(
6297 IN OUT PRTMP_ADAPTER pAd,
6300 IN BOOLEAN bPassive,
6301 IN BOOLEAN bForceSend);
6303 VOID BARecSessionTearDown(
6304 IN OUT PRTMP_ADAPTER pAd,
6307 IN BOOLEAN bPassive);
6309 BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num);
6310 void ba_reordering_resource_release(PRTMP_ADAPTER pAd);
6312 ULONG AutoChBssInsertEntry(
6313 IN PRTMP_ADAPTER pAd,
6320 void AutoChBssTableInit(
6321 IN PRTMP_ADAPTER pAd);
6323 void ChannelInfoInit(
6324 IN PRTMP_ADAPTER pAd);
6326 void AutoChBssTableDestroy(
6327 IN PRTMP_ADAPTER pAd);
6329 void ChannelInfoDestroy(
6330 IN PRTMP_ADAPTER pAd);
6332 UCHAR New_ApAutoSelectChannel(
6333 IN PRTMP_ADAPTER pAd);
6335 BOOLEAN rtstrmactohex(
6339 BOOLEAN rtstrcasecmp(
6343 char *rtstrstruncasecmp(
6349 IN const char * s2);
6353 IN const char * ct);
6357 unsigned int *addr);
6359 ////////// common ioctl functions //////////
6360 INT Set_DriverVersion_Proc(
6361 IN PRTMP_ADAPTER pAd,
6364 INT Set_CountryRegion_Proc(
6365 IN PRTMP_ADAPTER pAd,
6368 INT Set_CountryRegionABand_Proc(
6369 IN PRTMP_ADAPTER pAd,
6372 INT Set_WirelessMode_Proc(
6373 IN PRTMP_ADAPTER pAd,
6376 INT Set_Channel_Proc(
6377 IN PRTMP_ADAPTER pAd,
6380 INT Set_ShortSlot_Proc(
6381 IN PRTMP_ADAPTER pAd,
6384 INT Set_TxPower_Proc(
6385 IN PRTMP_ADAPTER pAd,
6388 INT Set_BGProtection_Proc(
6389 IN PRTMP_ADAPTER pAd,
6392 INT Set_TxPreamble_Proc(
6393 IN PRTMP_ADAPTER pAd,
6396 INT Set_RTSThreshold_Proc(
6397 IN PRTMP_ADAPTER pAd,
6400 INT Set_FragThreshold_Proc(
6401 IN PRTMP_ADAPTER pAd,
6404 INT Set_TxBurst_Proc(
6405 IN PRTMP_ADAPTER pAd,
6408 #ifdef AGGREGATION_SUPPORT
6409 INT Set_PktAggregate_Proc(
6410 IN PRTMP_ADAPTER pAd,
6414 INT Set_IEEE80211H_Proc(
6415 IN PRTMP_ADAPTER pAd,
6420 IN PRTMP_ADAPTER pAd,
6424 INT Show_DescInfo_Proc(
6425 IN PRTMP_ADAPTER pAd,
6428 INT Set_ResetStatCounter_Proc(
6429 IN PRTMP_ADAPTER pAd,
6432 #ifdef DOT11_N_SUPPORT
6433 INT Set_BASetup_Proc(
6434 IN PRTMP_ADAPTER pAd,
6437 INT Set_BADecline_Proc(
6438 IN PRTMP_ADAPTER pAd,
6441 INT Set_BAOriTearDown_Proc(
6442 IN PRTMP_ADAPTER pAd,
6445 INT Set_BARecTearDown_Proc(
6446 IN PRTMP_ADAPTER pAd,
6450 IN PRTMP_ADAPTER pAd,
6454 IN PRTMP_ADAPTER pAd,
6458 IN PRTMP_ADAPTER pAd,
6461 INT Set_HtOpMode_Proc(
6462 IN PRTMP_ADAPTER pAd,
6465 INT Set_HtStbc_Proc(
6466 IN PRTMP_ADAPTER pAd,
6470 IN PRTMP_ADAPTER pAd,
6473 INT Set_HtExtcha_Proc(
6474 IN PRTMP_ADAPTER pAd,
6477 INT Set_HtMpduDensity_Proc(
6478 IN PRTMP_ADAPTER pAd,
6481 INT Set_HtBaWinSize_Proc(
6482 IN PRTMP_ADAPTER pAd,
6486 IN PRTMP_ADAPTER pAd,
6489 INT Set_HtLinkAdapt_Proc(
6490 IN PRTMP_ADAPTER pAd,
6493 INT Set_HtAmsdu_Proc(
6494 IN PRTMP_ADAPTER pAd,
6497 INT Set_HtAutoBa_Proc(
6498 IN PRTMP_ADAPTER pAd,
6501 INT Set_HtProtect_Proc(
6502 IN PRTMP_ADAPTER pAd,
6505 INT Set_HtMimoPs_Proc(
6506 IN PRTMP_ADAPTER pAd,
6510 INT Set_ForceShortGI_Proc(
6511 IN PRTMP_ADAPTER pAd,
6514 INT Set_ForceGF_Proc(
6515 IN PRTMP_ADAPTER pAd,
6519 IN PRTMP_ADAPTER pAd);
6521 INT Set_SendPSMPAction_Proc(
6522 IN PRTMP_ADAPTER pAd,
6525 INT Set_HtMIMOPSmode_Proc(
6526 IN PRTMP_ADAPTER pAd,
6530 INT Set_HtTxBASize_Proc(
6531 IN PRTMP_ADAPTER pAd,
6533 #endif // DOT11_N_SUPPORT //
6537 #ifdef CONFIG_STA_SUPPORT
6539 VOID RTMPSendDLSTearDownFrame(
6540 IN PRTMP_ADAPTER pAd,
6543 #ifdef DOT11_N_SUPPORT
6546 IN PRTMP_ADAPTER pAd,
6547 OUT PQUERYBA_TABLE pBAT);
6548 #endif // DOT11_N_SUPPORT //
6550 #ifdef WPA_SUPPLICANT_SUPPORT
6551 INT WpaCheckEapCode(
6552 IN PRTMP_ADAPTER pAd,
6557 VOID WpaSendMicFailureToWpaSupplicant(
6558 IN PRTMP_ADAPTER pAd,
6559 IN BOOLEAN bUnicast);
6561 VOID SendAssocIEsToWpaSupplicant(
6562 IN PRTMP_ADAPTER pAd);
6563 #endif // WPA_SUPPLICANT_SUPPORT //
6565 #ifdef NATIVE_WPA_SUPPLICANT_SUPPORT
6566 int wext_notify_event_assoc(
6567 IN RTMP_ADAPTER *pAd);
6568 #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
6570 #endif // CONFIG_STA_SUPPORT //
6574 #ifdef DOT11_N_SUPPORT
6575 VOID Handle_BSS_Width_Trigger_Events(
6576 IN PRTMP_ADAPTER pAd);
6578 void build_ext_channel_switch_ie(
6579 IN PRTMP_ADAPTER pAd,
6580 IN HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE *pIE);
6581 #endif // DOT11_N_SUPPORT //
6584 BOOLEAN APRxDoneInterruptHandle(
6585 IN PRTMP_ADAPTER pAd);
6587 BOOLEAN STARxDoneInterruptHandle(
6588 IN PRTMP_ADAPTER pAd,
6591 #ifdef DOT11_N_SUPPORT
6592 // AMPDU packet indication
6593 VOID Indicate_AMPDU_Packet(
6594 IN PRTMP_ADAPTER pAd,
6596 IN UCHAR FromWhichBSSID);
6598 // AMSDU packet indication
6599 VOID Indicate_AMSDU_Packet(
6600 IN PRTMP_ADAPTER pAd,
6602 IN UCHAR FromWhichBSSID);
6603 #endif // DOT11_N_SUPPORT //
6605 // Normal legacy Rx packet indication
6606 VOID Indicate_Legacy_Packet(
6607 IN PRTMP_ADAPTER pAd,
6609 IN UCHAR FromWhichBSSID);
6611 VOID Indicate_EAPOL_Packet(
6612 IN PRTMP_ADAPTER pAd,
6614 IN UCHAR FromWhichBSSID);
6616 void update_os_packet_info(
6617 IN PRTMP_ADAPTER pAd,
6619 IN UCHAR FromWhichBSSID);
6621 void wlan_802_11_to_802_3_packet(
6622 IN PRTMP_ADAPTER pAd,
6624 IN PUCHAR pHeader802_3,
6625 IN UCHAR FromWhichBSSID);
6627 UINT deaggregate_AMSDU_announce(
6628 IN PRTMP_ADAPTER pAd,
6629 PNDIS_PACKET pPacket,
6634 #ifdef CONFIG_STA_SUPPORT
6635 // remove LLC and get 802_3 Header
6636 #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \
6638 PUCHAR _pRemovedLLCSNAP = NULL, _pDA, _pSA; \
6640 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) \
6642 _pDA = _pRxBlk->pHeader->Addr3; \
6643 _pSA = (PUCHAR)_pRxBlk->pHeader + sizeof(HEADER_802_11); \
6647 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_INFRA)) \
6649 _pDA = _pRxBlk->pHeader->Addr1; \
6650 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_DLS)) \
6651 _pSA = _pRxBlk->pHeader->Addr2; \
6653 _pSA = _pRxBlk->pHeader->Addr3; \
6657 _pDA = _pRxBlk->pHeader->Addr1; \
6658 _pSA = _pRxBlk->pHeader->Addr2; \
6662 CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \
6663 _pRxBlk->DataSize, _pRemovedLLCSNAP); \
6665 #endif // CONFIG_STA_SUPPORT //
6668 BOOLEAN APFowardWirelessStaToWirelessSta(
6669 IN PRTMP_ADAPTER pAd,
6670 IN PNDIS_PACKET pPacket,
6671 IN ULONG FromWhichBSSID);
6673 VOID Announce_or_Forward_802_3_Packet(
6674 IN PRTMP_ADAPTER pAd,
6675 IN PNDIS_PACKET pPacket,
6676 IN UCHAR FromWhichBSSID);
6678 VOID Sta_Announce_or_Forward_802_3_Packet(
6679 IN PRTMP_ADAPTER pAd,
6680 IN PNDIS_PACKET pPacket,
6681 IN UCHAR FromWhichBSSID);
6684 #ifdef CONFIG_STA_SUPPORT
6685 #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\
6686 Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS);
6687 //announce_802_3_packet(_pAd, _pPacket);
6688 #endif // CONFIG_STA_SUPPORT //
6691 PNDIS_PACKET DuplicatePacket(
6692 IN PRTMP_ADAPTER pAd,
6693 IN PNDIS_PACKET pPacket,
6694 IN UCHAR FromWhichBSSID);
6697 PNDIS_PACKET ClonePacket(
6698 IN PRTMP_ADAPTER pAd,
6699 IN PNDIS_PACKET pPacket,
6704 // Normal, AMPDU or AMSDU
6705 VOID CmmRxnonRalinkFrameIndicate(
6706 IN PRTMP_ADAPTER pAd,
6708 IN UCHAR FromWhichBSSID);
6710 VOID CmmRxRalinkFrameIndicate(
6711 IN PRTMP_ADAPTER pAd,
6712 IN MAC_TABLE_ENTRY *pEntry,
6714 IN UCHAR FromWhichBSSID);
6716 VOID Update_Rssi_Sample(
6717 IN PRTMP_ADAPTER pAd,
6718 IN RSSI_SAMPLE *pRssi,
6719 IN PRXWI_STRUC pRxWI);
6721 PNDIS_PACKET GetPacketFromRxRing(
6722 IN PRTMP_ADAPTER pAd,
6723 OUT PRT28XX_RXD_STRUC pSaveRxD,
6724 OUT BOOLEAN *pbReschedule,
6725 IN OUT UINT32 *pRxPending);
6727 PNDIS_PACKET RTMPDeFragmentDataFrame(
6728 IN PRTMP_ADAPTER pAd,
6731 ////////////////////////////////////////
6739 typedef struct _DefaultKeyIdxValue
6743 } DefaultKeyIdxValue, *PDefaultKeyIdxValue;
6747 #ifdef CONFIG_STA_SUPPORT
6749 DIDmsg_lnxind_wlansniffrm = 0x00000044,
6750 DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044,
6751 DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044,
6752 DIDmsg_lnxind_wlansniffrm_channel = 0x00030044,
6753 DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044,
6754 DIDmsg_lnxind_wlansniffrm_sq = 0x00050044,
6755 DIDmsg_lnxind_wlansniffrm_signal = 0x00060044,
6756 DIDmsg_lnxind_wlansniffrm_noise = 0x00070044,
6757 DIDmsg_lnxind_wlansniffrm_rate = 0x00080044,
6758 DIDmsg_lnxind_wlansniffrm_istx = 0x00090044,
6759 DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044
6762 P80211ENUM_msgitem_status_no_value = 0x00
6765 P80211ENUM_truth_false = 0x00,
6766 P80211ENUM_truth_true = 0x01
6769 /* Definition from madwifi */
6775 } p80211item_uint32_t;
6780 #define WLAN_DEVNAMELEN_MAX 16
6781 UINT8 devname[WLAN_DEVNAMELEN_MAX];
6782 p80211item_uint32_t hosttime;
6783 p80211item_uint32_t mactime;
6784 p80211item_uint32_t channel;
6785 p80211item_uint32_t rssi;
6786 p80211item_uint32_t sq;
6787 p80211item_uint32_t signal;
6788 p80211item_uint32_t noise;
6789 p80211item_uint32_t rate;
6790 p80211item_uint32_t istx;
6791 p80211item_uint32_t frmlen;
6792 } wlan_ng_prism2_header;
6794 /* The radio capture header precedes the 802.11 header. */
6795 typedef struct PACKED _ieee80211_radiotap_header {
6796 UINT8 it_version; /* Version 0. Only increases
6797 * for drastic changes,
6798 * introduction of compatible
6799 * new fields does not count.
6802 UINT16 it_len; /* length of the whole
6803 * header in bytes, including
6804 * it_version, it_pad,
6805 * it_len, and data fields.
6807 UINT32 it_present; /* A bitmap telling which
6808 * fields are present. Set bit 31
6809 * (0x80000000) to extend the
6810 * bitmap by another 32 bits.
6811 * Additional extensions are made
6812 * by setting bit 31.
6814 }ieee80211_radiotap_header ;
6816 enum ieee80211_radiotap_type {
6817 IEEE80211_RADIOTAP_TSFT = 0,
6818 IEEE80211_RADIOTAP_FLAGS = 1,
6819 IEEE80211_RADIOTAP_RATE = 2,
6820 IEEE80211_RADIOTAP_CHANNEL = 3,
6821 IEEE80211_RADIOTAP_FHSS = 4,
6822 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
6823 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
6824 IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
6825 IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
6826 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
6827 IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
6828 IEEE80211_RADIOTAP_ANTENNA = 11,
6829 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
6830 IEEE80211_RADIOTAP_DB_ANTNOISE = 13
6833 #define WLAN_RADIOTAP_PRESENT ( \
6834 (1 << IEEE80211_RADIOTAP_TSFT) | \
6835 (1 << IEEE80211_RADIOTAP_FLAGS) | \
6836 (1 << IEEE80211_RADIOTAP_RATE) | \
6839 typedef struct _wlan_radiotap_header {
6840 ieee80211_radiotap_header wt_ihdr;
6844 } wlan_radiotap_header;
6845 /* Definition from madwifi */
6847 void send_monitor_packets(
6848 IN PRTMP_ADAPTER pAd,
6851 #if WIRELESS_EXT >= 12
6852 // This function will be called when query /proc
6853 struct iw_statistics *rt28xx_get_wireless_stats(
6854 IN struct net_device *net_dev);
6857 VOID RTMPSetDesiredRates(
6858 IN PRTMP_ADAPTER pAdapter,
6860 #endif // CONFIG_STA_SUPPORT //
6862 INT Set_FixedTxMode_Proc(
6863 IN PRTMP_ADAPTER pAd,
6866 #ifdef CONFIG_APSTA_MIXED_SUPPORT
6867 INT Set_OpMode_Proc(
6868 IN PRTMP_ADAPTER pAd,
6870 #endif // CONFIG_APSTA_MIXED_SUPPORT //
6872 static inline char* GetPhyMode(
6882 #ifdef DOT11_N_SUPPORT
6886 case MODE_HTGREENFIELD:
6888 #endif // DOT11_N_SUPPORT //
6895 static inline char* GetBW(
6905 #ifdef DOT11_N_SUPPORT
6908 #endif // DOT11_N_SUPPORT //
6915 VOID RT28xxThreadTerminate(
6916 IN RTMP_ADAPTER *pAd);
6918 BOOLEAN RT28XXChipsetCheck(
6921 BOOLEAN RT28XXNetDevInit(
6923 IN struct net_device *net_dev,
6924 IN RTMP_ADAPTER *pAd);
6926 BOOLEAN RT28XXProbePostConfig(
6928 IN RTMP_ADAPTER *pAd,
6931 VOID RT28XXDMADisable(
6932 IN RTMP_ADAPTER *pAd);
6934 VOID RT28XXDMAEnable(
6935 IN RTMP_ADAPTER *pAd);
6937 VOID RT28xx_UpdateBeaconToAsic(
6938 IN RTMP_ADAPTER * pAd,
6941 IN ULONG UpdatePos);
6944 IN struct net_device *net_dev,
6945 IN OUT struct ifreq *rq,
6949 #ifdef CONFIG_STA_SUPPORT
6950 INT rt28xx_sta_ioctl(
6951 IN struct net_device *net_dev,
6952 IN OUT struct ifreq *rq,
6954 #endif // CONFIG_STA_SUPPORT //
6956 BOOLEAN RT28XXSecurityKeyAdd(
6957 IN PRTMP_ADAPTER pAd,
6960 IN MAC_TABLE_ENTRY *pEntry);
6962 ////////////////////////////////////////
6963 PNDIS_PACKET GetPacketFromRxRing(
6964 IN PRTMP_ADAPTER pAd,
6965 OUT PRT28XX_RXD_STRUC pSaveRxD,
6966 OUT BOOLEAN *pbReschedule,
6967 IN OUT UINT32 *pRxPending);
6970 void kill_thread_task(PRTMP_ADAPTER pAd);
6972 void tbtt_tasklet(unsigned long data);
6975 // Function Prototype in cmm_data_2860.c
6977 USHORT RtmpPCI_WriteTxResource(
6978 IN PRTMP_ADAPTER pAd,
6981 OUT USHORT *FreeNumber);
6983 USHORT RtmpPCI_WriteSingleTxResource(
6984 IN PRTMP_ADAPTER pAd,
6987 OUT USHORT *FreeNumber);
6989 USHORT RtmpPCI_WriteMultiTxResource(
6990 IN PRTMP_ADAPTER pAd,
6993 OUT USHORT *FreeNumber);
6995 USHORT RtmpPCI_WriteFragTxResource(
6996 IN PRTMP_ADAPTER pAd,
6999 OUT USHORT *FreeNumber);
7001 USHORT RtmpPCI_WriteSubTxResource(
7002 IN PRTMP_ADAPTER pAd,
7005 OUT USHORT *FreeNumber);
7007 VOID RtmpPCI_FinalWriteTxResource(
7008 IN PRTMP_ADAPTER pAd,
7010 IN USHORT totalMPDUSize,
7011 IN USHORT FirstTxIdx);
7013 VOID RtmpPCIDataLastTxIdx(
7014 IN PRTMP_ADAPTER pAd,
7016 IN USHORT LastTxIdx);
7018 VOID RtmpPCIDataKickOut(
7019 IN PRTMP_ADAPTER pAd,
7024 int RtmpPCIMgmtKickOut(
7025 IN RTMP_ADAPTER *pAd,
7027 IN PNDIS_PACKET pPacket,
7028 IN PUCHAR pSrcBufVA,
7032 NDIS_STATUS RTMPCheckRxError(
7033 IN PRTMP_ADAPTER pAd,
7034 IN PHEADER_802_11 pHeader,
7035 IN PRXWI_STRUC pRxWI,
7036 IN PRT28XX_RXD_STRUC pRxD);
7038 #ifdef CONFIG_STA_SUPPORT
7039 VOID RTMPInitPCIeLinkCtrlValue(
7040 IN PRTMP_ADAPTER pAd);
7042 VOID RTMPFindHostPCIDev(
7043 IN PRTMP_ADAPTER pAd);
7045 VOID RTMPPCIeLinkCtrlValueRestore(
7046 IN PRTMP_ADAPTER pAd,
7049 VOID RTMPPCIeLinkCtrlSetting(
7050 IN PRTMP_ADAPTER pAd,
7053 VOID RT28xxPciAsicRadioOff(
7054 IN PRTMP_ADAPTER pAd,
7056 IN USHORT TbttNumToNextWakeUp);
7058 BOOLEAN RT28xxPciAsicRadioOn(
7059 IN PRTMP_ADAPTER pAd,
7062 VOID RT28xxPciStaAsicForceWakeup(
7063 IN PRTMP_ADAPTER pAd,
7066 VOID RT28xxPciStaAsicSleepThenAutoWakeup(
7067 IN PRTMP_ADAPTER pAd,
7068 IN USHORT TbttNumToNextWakeUp);
7070 VOID PsPollWakeExec(
7071 IN PVOID SystemSpecific1,
7072 IN PVOID FunctionContext,
7073 IN PVOID SystemSpecific2,
7074 IN PVOID SystemSpecific3);
7077 IN PVOID SystemSpecific1,
7078 IN PVOID FunctionContext,
7079 IN PVOID SystemSpecific2,
7080 IN PVOID SystemSpecific3);
7081 #endif // CONFIG_STA_SUPPORT //
7083 VOID RT28xxPciMlmeRadioOn(
7084 IN PRTMP_ADAPTER pAd);
7086 VOID RT28xxPciMlmeRadioOFF(
7087 IN PRTMP_ADAPTER pAd);
7089 VOID AsicTurnOffRFClk(
7090 IN PRTMP_ADAPTER pAd,
7093 VOID AsicTurnOnRFClk(
7094 IN PRTMP_ADAPTER pAd,
7098 ////////////////////////////////////////
7101 IN RTMP_ADAPTER *pAd);
7103 UINT32 QBSS_LoadElementAppend(
7104 IN RTMP_ADAPTER *pAd,
7107 VOID QBSS_LoadUpdate(
7108 IN RTMP_ADAPTER *pAd);
7110 ///////////////////////////////////////
7111 INT RTMPShowCfgValue(
7112 IN PRTMP_ADAPTER pAd,
7116 PCHAR RTMPGetRalinkAuthModeStr(
7117 IN NDIS_802_11_AUTHENTICATION_MODE authMode);
7119 PCHAR RTMPGetRalinkEncryModeStr(
7120 IN USHORT encryMode);
7121 //////////////////////////////////////
7123 #ifdef CONFIG_STA_SUPPORT
7124 VOID AsicStaBbpTuning(
7125 IN PRTMP_ADAPTER pAd);
7127 VOID AsicResetFromDMABusy(
7128 IN PRTMP_ADAPTER pAd);
7131 IN PRTMP_ADAPTER pAd);
7134 IN PRTMP_ADAPTER pAd);
7137 IN PRTMP_ADAPTER pAd);
7138 #endif // CONFIG_STA_SUPPORT //
7140 void RTMP_IndicateMediaState(
7141 IN PRTMP_ADAPTER pAd);
7143 VOID ReSyncBeaconTime(
7144 IN PRTMP_ADAPTER pAd);
7146 VOID RTMPSetAGCInitValue(
7147 IN PRTMP_ADAPTER pAd,
7148 IN UCHAR BandWidth);
7150 int rt28xx_close(IN PNET_DEV dev);
7151 int rt28xx_open(IN PNET_DEV dev);
7153 __inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd)
7155 extern VOID MeshMakeBeacon(IN PRTMP_ADAPTER pAd, IN UCHAR idx);
7156 extern VOID MeshUpdateBeaconFrame(IN PRTMP_ADAPTER pAd, IN UCHAR idx);
7158 if (VIRTUAL_IF_NUM(pAd) == 0)
7160 if (rt28xx_open(pAd->net_dev) != 0)
7166 VIRTUAL_IF_INC(pAd);
7170 __inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd)
7172 VIRTUAL_IF_DEC(pAd);
7173 if (VIRTUAL_IF_NUM(pAd) == 0)
7174 rt28xx_close(pAd->net_dev);
7179 #endif // __RTMP_H__