2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
31 Miniport generic portion header file
35 -------- ---------- ----------------------------------------------
36 Paul Lin 2002-08-01 created
37 James Tan 2002-09-06 modified (Revise NTCRegTable)
38 John Chang 2004-09-06 modified for RT2600
43 #include "spectrum_def.h"
44 #include "rtmp_dot11.h"
45 #include "rtmp_chip.h"
47 struct rt_rtmp_adapter
;
51 /*#define DBG_DIAGNOSE 1 */
53 /*+++Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */
54 #define MAX_DATAMM_RETRY 3
55 #define MGMT_USE_QUEUE_FLAG 0x80
56 /*---Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */
58 #define MAXSEQ (0xFFF)
60 extern unsigned char SNAP_AIRONET
[];
61 extern unsigned char CISCO_OUI
[];
62 extern u8 BaSizeArray
[4];
64 extern u8 BROADCAST_ADDR
[MAC_ADDR_LEN
];
65 extern u8 ZERO_MAC_ADDR
[MAC_ADDR_LEN
];
66 extern unsigned long BIT32
[32];
68 extern char *CipherName
[];
69 extern char *MCSToMbps
[];
70 extern u8 RxwiMCSToOfdmRate
[12];
71 extern u8 SNAP_802_1H
[6];
72 extern u8 SNAP_BRIDGE_TUNNEL
[6];
73 extern u8 SNAP_AIRONET
[8];
74 extern u8 CKIP_LLC_SNAP
[8];
75 extern u8 EAPOL_LLC_SNAP
[8];
78 extern u8 APPLE_TALK
[2];
79 extern u8 RateIdToPlcpSignal
[12]; /* see IEEE802.11a-1999 p.14 */
80 extern u8 OfdmRateToRxwiMCS
[];
81 extern u8 OfdmSignalToRateId
[16];
82 extern u8 default_cwmin
[4];
83 extern u8 default_cwmax
[4];
84 extern u8 default_sta_aifsn
[4];
85 extern u8 MapUserPriorityToAccessCategory
[8];
87 extern u16 RateUpPER
[];
88 extern u16 RateDownPER
[];
89 extern u8 Phy11BNextRateDownward
[];
90 extern u8 Phy11BNextRateUpward
[];
91 extern u8 Phy11BGNextRateDownward
[];
92 extern u8 Phy11BGNextRateUpward
[];
93 extern u8 Phy11ANextRateDownward
[];
94 extern u8 Phy11ANextRateUpward
[];
95 extern char RssiSafeLevelForTxRate
[];
96 extern u8 RateIdToMbps
[];
97 extern u16 RateIdTo500Kbps
[];
99 extern u8 CipherSuiteWpaNoneTkip
[];
100 extern u8 CipherSuiteWpaNoneTkipLen
;
102 extern u8 CipherSuiteWpaNoneAes
[];
103 extern u8 CipherSuiteWpaNoneAesLen
;
110 extern u8 AddHtInfoIe
;
111 extern u8 NewExtChanIe
;
124 extern u8 WAPI_OUI
[];
125 extern u8 WME_INFO_ELEM
[];
126 extern u8 WME_PARM_ELEM
[];
127 extern u8 Ccx2QosInfo
[];
128 extern u8 Ccx2IeInfo
[];
129 extern u8 RALINK_OUI
[];
130 extern u8 PowerConstraintIE
[];
132 extern u8 RateSwitchTable
[];
133 extern u8 RateSwitchTable11B
[];
134 extern u8 RateSwitchTable11G
[];
135 extern u8 RateSwitchTable11BG
[];
137 extern u8 RateSwitchTable11BGN1S
[];
138 extern u8 RateSwitchTable11BGN2S
[];
139 extern u8 RateSwitchTable11BGN2SForABand
[];
140 extern u8 RateSwitchTable11N1S
[];
141 extern u8 RateSwitchTable11N2S
[];
142 extern u8 RateSwitchTable11N2SForABand
[];
144 extern u8 PRE_N_HT_OUI
[];
146 struct rt_rssi_sample
{
147 char LastRssi0
; /* last received RSSI */
148 char LastRssi1
; /* last received RSSI */
149 char LastRssi2
; /* last received RSSI */
159 /* Queue structure and macros */
161 struct rt_queue_entry
;
163 struct rt_queue_entry
{
164 struct rt_queue_entry
*Next
;
167 /* Queue structure */
168 struct rt_queue_header
{
169 struct rt_queue_entry
*Head
;
170 struct rt_queue_entry
*Tail
;
171 unsigned long Number
;
174 #define InitializeQueueHeader(QueueHeader) \
176 (QueueHeader)->Head = (QueueHeader)->Tail = NULL; \
177 (QueueHeader)->Number = 0; \
180 #define RemoveHeadQueue(QueueHeader) \
181 (QueueHeader)->Head; \
183 struct rt_queue_entry *pNext; \
184 if ((QueueHeader)->Head != NULL) { \
185 pNext = (QueueHeader)->Head->Next; \
186 (QueueHeader)->Head->Next = NULL; \
187 (QueueHeader)->Head = pNext; \
189 (QueueHeader)->Tail = NULL; \
190 (QueueHeader)->Number--; \
194 #define InsertHeadQueue(QueueHeader, QueueEntry) \
196 ((struct rt_queue_entry *)QueueEntry)->Next = (QueueHeader)->Head; \
197 (QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \
198 if ((QueueHeader)->Tail == NULL) \
199 (QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \
200 (QueueHeader)->Number++; \
203 #define InsertTailQueue(QueueHeader, QueueEntry) \
205 ((struct rt_queue_entry *)QueueEntry)->Next = NULL; \
206 if ((QueueHeader)->Tail) \
207 (QueueHeader)->Tail->Next = (struct rt_queue_entry *)(QueueEntry); \
209 (QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \
210 (QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \
211 (QueueHeader)->Number++; \
214 #define InsertTailQueueAc(pAd, pEntry, QueueHeader, QueueEntry) \
216 ((struct rt_queue_entry *)QueueEntry)->Next = NULL; \
217 if ((QueueHeader)->Tail) \
218 (QueueHeader)->Tail->Next = (struct rt_queue_entry *)(QueueEntry); \
220 (QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \
221 (QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \
222 (QueueHeader)->Number++; \
226 /* Macros for flag and ref count operations */
228 #define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
229 #define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
230 #define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0)
231 #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
232 #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
233 /* Macro for power save flag. */
234 #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F))
235 #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F))
236 #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0)
237 #define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0)
238 #define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F))
240 #define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F))
241 #define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F))
242 #define OPSTATUS_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.OpStatusFlags & (_F)) != 0)
244 #define CLIENT_STATUS_SET_FLAG(_pEntry, _F) ((_pEntry)->ClientStatusFlags |= (_F))
245 #define CLIENT_STATUS_CLEAR_FLAG(_pEntry, _F) ((_pEntry)->ClientStatusFlags &= ~(_F))
246 #define CLIENT_STATUS_TEST_FLAG(_pEntry, _F) (((_pEntry)->ClientStatusFlags & (_F)) != 0)
248 #define RX_FILTER_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter |= (_F))
249 #define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F))
250 #define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0)
252 #define STA_NO_SECURITY_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11EncryptionDisabled)
253 #define STA_WEP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption1Enabled)
254 #define STA_TKIP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption2Enabled)
255 #define STA_AES_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)
257 #define STA_TGN_WIFI_ON(_p) (_p->StaCfg.bTGnWifiTest == TRUE)
259 #define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
260 #define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
262 #define INC_RING_INDEX(_idx, _RingSize) \
264 (_idx) = (_idx+1) % (_RingSize); \
267 /* StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here. */
268 #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \
270 _pAd->StaActive.SupportedHtPhy.ChannelWidth = _pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth; \
271 _pAd->StaActive.SupportedHtPhy.MimoPs = _pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs; \
272 _pAd->StaActive.SupportedHtPhy.GF = _pAd->MlmeAux.HtCapability.HtCapInfo.GF; \
273 _pAd->StaActive.SupportedHtPhy.ShortGIfor20 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20; \
274 _pAd->StaActive.SupportedHtPhy.ShortGIfor40 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40; \
275 _pAd->StaActive.SupportedHtPhy.TxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC; \
276 _pAd->StaActive.SupportedHtPhy.RxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC; \
277 _pAd->StaActive.SupportedHtPhy.ExtChanOffset = _pAd->MlmeAux.AddHtInfo.AddHtInfo.ExtChanOffset; \
278 _pAd->StaActive.SupportedHtPhy.RecomWidth = _pAd->MlmeAux.AddHtInfo.AddHtInfo.RecomWidth; \
279 _pAd->StaActive.SupportedHtPhy.OperaionMode = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode; \
280 _pAd->StaActive.SupportedHtPhy.NonGfPresent = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent; \
281 NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(u8) * 16);\
284 #define COPY_AP_HTSETTINGS_FROM_BEACON(_pAd, _pHtCapability) \
286 _pAd->MacTab.Content[BSSID_WCID].AMsduSize = (u8)(_pHtCapability->HtCapInfo.AMsduSize); \
287 _pAd->MacTab.Content[BSSID_WCID].MmpsMode = (u8)(_pHtCapability->HtCapInfo.MimoPs); \
288 _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (u8)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \
292 /* MACRO for 32-bit PCI register read / write */
294 /* Usage : RTMP_IO_READ32( */
295 /* struct rt_rtmp_adapter *pAd, */
296 /* unsigned long Register_Offset, */
297 /* unsigned long * pValue) */
299 /* RTMP_IO_WRITE32( */
300 /* struct rt_rtmp_adapter *pAd, */
301 /* unsigned long Register_Offset, */
302 /* unsigned long Value) */
306 /* Common fragment list structure - Identical to the scatter gather frag list structure */
308 /*#define struct rt_rtmp_sg_element SCATTER_GATHER_ELEMENT */
309 /*#define struct rt_rtmp_sg_element *PSCATTER_GATHER_ELEMENT */
310 #define NIC_MAX_PHYS_BUF_COUNT 8
312 struct rt_rtmp_sg_element
{
314 unsigned long Length
;
315 unsigned long *Reserved
;
318 struct rt_rtmp_sg_list
{
319 unsigned long NumberOfElements
;
320 unsigned long *Reserved
;
321 struct rt_rtmp_sg_element Elements
[NIC_MAX_PHYS_BUF_COUNT
];
325 /* Some utility macros */
328 #define min(_a, _b) (((_a) < (_b)) ? (_a) : (_b))
332 #define max(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
335 #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))))
337 #define INC_COUNTER64(Val) (Val.QuadPart++)
339 #define INFRA_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_INFRA_ON))
340 #define ADHOC_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_ADHOC_ON))
341 #define MONITOR_ON(_p) (((_p)->StaCfg.BssType) == BSS_MONITOR)
342 #define IDLE_ON(_p) (!INFRA_ON(_p) && !ADHOC_ON(_p))
344 /* Check LEAP & CCKM flags */
345 #define LEAP_ON(_p) (((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP)
346 #define LEAP_CCKM_ON(_p) ((((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg.LeapAuthInfo.CCKM == TRUE))
348 /* if orginal Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required */
349 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \
351 if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) { \
352 _pExtraLlcSnapEncap = SNAP_802_1H; \
353 if (NdisEqualMemory(IPX, _pBufVA + 12, 2) || \
354 NdisEqualMemory(APPLE_TALK, _pBufVA + 12, 2)) { \
355 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
359 _pExtraLlcSnapEncap = NULL; \
363 /* New Define for new Tx Path. */
364 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \
366 if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) { \
367 _pExtraLlcSnapEncap = SNAP_802_1H; \
368 if (NdisEqualMemory(IPX, _pBufVA, 2) || \
369 NdisEqualMemory(APPLE_TALK, _pBufVA, 2)) { \
370 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
374 _pExtraLlcSnapEncap = NULL; \
378 #define MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType) \
380 NdisMoveMemory(_p, _pMac1, MAC_ADDR_LEN); \
381 NdisMoveMemory((_p + MAC_ADDR_LEN), _pMac2, MAC_ADDR_LEN); \
382 NdisMoveMemory((_p + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \
385 /* if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way. */
386 /* else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field */
387 /* else remove the LLC/SNAP field from the result Ethernet frame */
388 /* Patch for WHQL only, which did not turn on Netbios but use IPX within its payload */
390 /* _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO */
391 /* _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed */
392 #define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \
396 _pRemovedLLCSNAP = NULL; \
397 if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \
398 NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) { \
399 u8 *pProto = _pData + 6; \
401 if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \
402 NdisEqualMemory(SNAP_802_1H, _pData, 6)) { \
403 LLC_Len[0] = (u8)(_DataSize / 256); \
404 LLC_Len[1] = (u8)(_DataSize % 256); \
405 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
408 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \
409 _pRemovedLLCSNAP = _pData; \
410 _DataSize -= LENGTH_802_1_H; \
411 _pData += LENGTH_802_1_H; \
415 LLC_Len[0] = (u8)(_DataSize / 256); \
416 LLC_Len[1] = (u8)(_DataSize % 256); \
417 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
421 /* Enqueue this frame to MLME engine */
422 /* We need to enqueue the whole frame because MLME need to pass data type */
423 /* information from 802.11 header */
425 #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
427 u32 High32TSF, Low32TSF; \
428 RTMP_IO_READ32(_pAd, TSF_TIMER_DW1, &High32TSF); \
429 RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \
430 MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (u8)_Rssi0, (u8)_Rssi1, (u8)_Rssi2, _FrameSize, _pFrame, (u8)_PlcpSignal); \
432 #endif /* RTMP_MAC_PCI // */
434 #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
436 u32 High32TSF = 0, Low32TSF = 0; \
437 MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (u8)_Rssi0, (u8)_Rssi1, (u8)_Rssi2, _FrameSize, _pFrame, (u8)_PlcpSignal); \
439 #endif /* RTMP_MAC_USB // */
441 #define MAC_ADDR_EQUAL(pAddr1, pAddr2) RTMPEqualMemory((void *)(pAddr1), (void *)(pAddr2), MAC_ADDR_LEN)
442 #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1 == len2) && (RTMPEqualMemory(ssid1, ssid2, len1)))
445 /* Check if it is Japan W53(ch52,56,60,64) channel. */
447 #define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64))
449 #define STA_EXTRA_SETTING(_pAd)
451 #define STA_PORT_SECURED(_pAd) \
454 (_pAd)->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \
455 NdisAcquireSpinLock(&((_pAd)->MacTabLock)); \
456 (_pAd)->MacTab.Content[BSSID_WCID].PortSecured = (_pAd)->StaCfg.PortSecured; \
457 (_pAd)->MacTab.Content[BSSID_WCID].PrivacyFilter = Ndis802_11PrivFilterAcceptAll;\
458 NdisReleaseSpinLock(&(_pAd)->MacTabLock); \
459 RTMPCancelTimer(&((_pAd)->Mlme.LinkDownTimer), &Cancelled);\
460 STA_EXTRA_SETTING(_pAd); \
464 /* Data buffer for DMA operation, the buffer must be contiguous physical memory */
465 /* Both DMA to / from CPU use the same structure. */
467 struct rt_rtmp_dmabuf
{
468 unsigned long AllocSize
;
469 void *AllocVa
; /* TxBuf virtual address */
470 dma_addr_t AllocPa
; /* TxBuf physical address */
474 /* Control block (Descriptor) for all ring descriptor DMA operation, buffer must be */
475 /* contiguous physical memory. char stored the binding Rx packet descriptor */
476 /* which won't be released, driver has to wait until upper layer return the packet */
477 /* before giveing up this rx ring descriptor to ASIC. NDIS_BUFFER is assocaited pair */
478 /* to describe the packet buffer. For Tx, char stored the tx packet descriptor */
479 /* which driver should ACK upper layer when the tx is physically done or failed. */
481 struct rt_rtmp_dmacb
{
482 unsigned long AllocSize
; /* Control block size */
483 void *AllocVa
; /* Control block virtual address */
484 dma_addr_t AllocPa
; /* Control block physical address */
486 void *pNextNdisPacket
;
488 struct rt_rtmp_dmabuf DmaBuf
; /* Associated DMA buffer structure */
491 struct rt_rtmp_tx_ring
{
492 struct rt_rtmp_dmacb Cell
[TX_RING_SIZE
];
495 u32 TxSwFreeIdx
; /* software next free tx index */
498 struct rt_rtmp_rx_ring
{
499 struct rt_rtmp_dmacb Cell
[RX_RING_SIZE
];
502 int RxSwReadIdx
; /* software next read index */
505 struct rt_rtmp_mgmt_ring
{
506 struct rt_rtmp_dmacb Cell
[MGMT_RING_SIZE
];
509 u32 TxSwFreeIdx
; /* software next free tx index */
513 /* Statistic counter structure */
515 struct rt_counter_802_3
{
517 unsigned long GoodTransmits
;
518 unsigned long GoodReceives
;
519 unsigned long TxErrors
;
520 unsigned long RxErrors
;
521 unsigned long RxNoBuffer
;
524 unsigned long RcvAlignmentErrors
;
525 unsigned long OneCollision
;
526 unsigned long MoreCollisions
;
530 struct rt_counter_802_11
{
531 unsigned long Length
;
532 LARGE_INTEGER LastTransmittedFragmentCount
;
533 LARGE_INTEGER TransmittedFragmentCount
;
534 LARGE_INTEGER MulticastTransmittedFrameCount
;
535 LARGE_INTEGER FailedCount
;
536 LARGE_INTEGER RetryCount
;
537 LARGE_INTEGER MultipleRetryCount
;
538 LARGE_INTEGER RTSSuccessCount
;
539 LARGE_INTEGER RTSFailureCount
;
540 LARGE_INTEGER ACKFailureCount
;
541 LARGE_INTEGER FrameDuplicateCount
;
542 LARGE_INTEGER ReceivedFragmentCount
;
543 LARGE_INTEGER MulticastReceivedFrameCount
;
544 LARGE_INTEGER FCSErrorCount
;
547 struct rt_counter_ralink
{
548 unsigned long TransmittedByteCount
; /* both successful and failure, used to calculate TX throughput */
549 unsigned long ReceivedByteCount
; /* both CRC okay and CRC error, used to calculate RX throughput */
550 unsigned long BeenDisassociatedCount
;
551 unsigned long BadCQIAutoRecoveryCount
;
552 unsigned long PoorCQIRoamingCount
;
553 unsigned long MgmtRingFullCount
;
554 unsigned long RxCountSinceLastNULL
;
555 unsigned long RxCount
;
556 unsigned long RxRingErrCount
;
557 unsigned long KickTxCount
;
558 unsigned long TxRingErrCount
;
559 LARGE_INTEGER RealFcsErrCount
;
560 unsigned long PendingNdisPacketCount
;
562 unsigned long OneSecOsTxCount
[NUM_OF_TX_RING
];
563 unsigned long OneSecDmaDoneCount
[NUM_OF_TX_RING
];
564 u32 OneSecTxDoneCount
;
565 unsigned long OneSecRxCount
;
566 u32 OneSecTxAggregationCount
;
567 u32 OneSecRxAggregationCount
;
568 u32 OneSecReceivedByteCount
;
569 u32 OneSecFrameDuplicateCount
;
571 u32 OneSecTransmittedByteCount
; /* both successful and failure, used to calculate TX throughput */
572 u32 OneSecTxNoRetryOkCount
;
573 u32 OneSecTxRetryOkCount
;
574 u32 OneSecTxFailCount
;
575 u32 OneSecFalseCCACnt
; /* CCA error count, for debug purpose, might move to global counter */
576 u32 OneSecRxOkCnt
; /* RX without error */
577 u32 OneSecRxOkDataCnt
; /* unicast-to-me DATA frame count */
578 u32 OneSecRxFcsErrCnt
; /* CRC error */
579 u32 OneSecBeaconSentCnt
;
580 u32 LastOneSecTotalTxCount
; /* OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount */
581 u32 LastOneSecRxOkDataCnt
; /* OneSecRxOkDataCnt */
582 unsigned long DuplicateRcv
;
583 unsigned long TxAggCount
;
584 unsigned long TxNonAggCount
;
585 unsigned long TxAgg1MPDUCount
;
586 unsigned long TxAgg2MPDUCount
;
587 unsigned long TxAgg3MPDUCount
;
588 unsigned long TxAgg4MPDUCount
;
589 unsigned long TxAgg5MPDUCount
;
590 unsigned long TxAgg6MPDUCount
;
591 unsigned long TxAgg7MPDUCount
;
592 unsigned long TxAgg8MPDUCount
;
593 unsigned long TxAgg9MPDUCount
;
594 unsigned long TxAgg10MPDUCount
;
595 unsigned long TxAgg11MPDUCount
;
596 unsigned long TxAgg12MPDUCount
;
597 unsigned long TxAgg13MPDUCount
;
598 unsigned long TxAgg14MPDUCount
;
599 unsigned long TxAgg15MPDUCount
;
600 unsigned long TxAgg16MPDUCount
;
602 LARGE_INTEGER TransmittedOctetsInAMSDU
;
603 LARGE_INTEGER TransmittedAMSDUCount
;
604 LARGE_INTEGER ReceivedOctesInAMSDUCount
;
605 LARGE_INTEGER ReceivedAMSDUCount
;
606 LARGE_INTEGER TransmittedAMPDUCount
;
607 LARGE_INTEGER TransmittedMPDUsInAMPDUCount
;
608 LARGE_INTEGER TransmittedOctetsInAMPDUCount
;
609 LARGE_INTEGER MPDUInReceivedAMPDUCount
;
612 struct rt_counter_drs
{
613 /* to record the each TX rate's quality. 0 is best, the bigger the worse. */
614 u16 TxQuality
[MAX_STEP_OF_TX_RATE_SWITCH
];
615 u8 PER
[MAX_STEP_OF_TX_RATE_SWITCH
];
616 u8 TxRateUpPenalty
; /* extra # of second penalty due to last unstable condition */
617 unsigned long CurrTxRateStableTime
; /* # of second in current TX rate */
618 BOOLEAN fNoisyEnvironment
;
619 BOOLEAN fLastSecAccordingRSSI
;
620 u8 LastSecTxRateChangeAction
; /* 0: no change, 1:rate UP, 2:rate down */
621 u8 LastTimeTxRateChangeAction
; /*Keep last time value of LastSecTxRateChangeAction */
622 unsigned long LastTxOkCount
;
625 /***************************************************************************
626 * security key related data structure
627 **************************************************************************/
628 struct rt_cipher_key
{
629 u8 Key
[16]; /* right now we implement 4 keys, 128 bits max */
630 u8 RxMic
[8]; /* make alignment */
632 u8 TxTsc
[6]; /* 48bit TSC value */
633 u8 RxTsc
[6]; /* 48bit TSC value */
634 u8 CipherAlg
; /* 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 */
637 /* Key length for each key, 0: entry is invalid */
638 u8 Type
; /* Indicate Pairwise/Group when reporting MIC error */
641 /* structure to define WPA Group Key Rekey Interval */
642 struct PACKED rt_802_11_wpa_rekey
{
643 unsigned long ReKeyMethod
; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */
644 unsigned long ReKeyInterval
; /* time-based: seconds, packet-based: kilo-packets */
648 /***************************************************************************
649 * RTUSB I/O related data structure
650 **************************************************************************/
651 struct rt_set_asic_wcid
{
652 unsigned long WCID
; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */
653 unsigned long SetTid
; /* time-based: seconds, packet-based: kilo-packets */
654 unsigned long DeleteTid
; /* time-based: seconds, packet-based: kilo-packets */
655 u8 Addr
[MAC_ADDR_LEN
]; /* avoid in interrupt when write key */
658 struct rt_set_asic_wcid_attri
{
659 unsigned long WCID
; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */
660 unsigned long Cipher
; /* ASIC Cipher definition */
661 u8 Addr
[ETH_LENGTH_OF_ADDRESS
];
664 /* for USB interface, avoid in interrupt when write key */
665 struct rt_add_pairwise_key_entry
{
667 u16 MacTabMatchWCID
; /* ASIC */
668 struct rt_cipher_key CipherKey
;
671 /* Cipher suite type for mixed mode group cipher, P802.11i-2004 */
672 typedef enum _RT_802_11_CIPHER_SUITE_TYPE
{
679 } RT_802_11_CIPHER_SUITE_TYPE
, *PRT_802_11_CIPHER_SUITE_TYPE
;
680 #endif /* RTMP_MAC_USB // */
682 struct rt_rogueap_entry
{
683 u8 Addr
[MAC_ADDR_LEN
];
684 u8 ErrorCode
[2]; /*00 01-Invalid authentication type */
685 /*00 02-Authentication timeout */
686 /*00 03-Challenge from AP failed */
687 /*00 04-Challenge to AP failed */
691 struct rt_rogueap_table
{
693 struct rt_rogueap_entry RogueApEntry
[MAX_LEN_OF_BSS_TABLE
];
697 /* Cisco IAPP format */
699 struct rt_cisco_iapp_content
{
700 u16 Length
; /*IAPP Length */
701 u8 MessageType
; /*IAPP type */
702 u8 FunctionCode
; /*IAPP function type */
703 u8 DestinaionMAC
[MAC_ADDR_LEN
];
704 u8 SourceMAC
[MAC_ADDR_LEN
];
705 u16 Tag
; /*Tag(element IE) - Adjacent AP report */
706 u16 TagLength
; /*Length of element not including 4 byte header */
707 u8 OUI
[4]; /*0x00, 0x40, 0x96, 0x00 */
708 u8 PreviousAP
[MAC_ADDR_LEN
]; /*MAC Address of access point */
711 u8 Ssid
[MAX_LEN_OF_SSID
];
712 u16 Seconds
; /*Seconds that the client has been disassociated. */
716 * Fragment Frame structure
718 struct rt_fragment_frame
{
720 unsigned long RxSize
;
723 unsigned long Flags
; /* Some extra frame information. bit 0: LLC presented */
727 /* Packet information for NdisQueryPacket */
729 struct rt_packet_info
{
730 u32 PhysicalBufferCount
; /* Physical breaks of buffer descripor chained */
731 u32 BufferCount
; /* Number of Buffer descriptor chained */
732 u32 TotalPacketLength
; /* Self explained */
733 char *pFirstBuffer
; /* Pointer to first buffer descriptor */
737 /* Arcfour Structure Added by PaulWu */
739 struct rt_arcfourcontext
{
746 /* Tkip Key structure which RC4 key & MIC calculation */
748 struct rt_tkip_key_info
{
749 u32 nBytesInM
; /* # bytes in M for MICKEY */
752 unsigned long K0
; /* for MICKEY Low */
753 unsigned long K1
; /* for MICKEY Hig */
754 unsigned long L
; /* Current state for MICKEY */
755 unsigned long R
; /* Current state for MICKEY */
756 unsigned long M
; /* Message accumulator for MICKEY */
762 /* Private / Misc data, counters for driver internal use */
765 u32 SystemResetCnt
; /* System reset counter */
766 u32 TxRingFullCnt
; /* Tx ring full occurrance number */
767 u32 PhyRxErrCnt
; /* PHY Rx error count, for debug purpose, might move to global counter */
768 /* Variables for WEP encryption / decryption in rtmp_wep.c */
770 struct rt_arcfourcontext WEPCONTEXT
;
772 struct rt_tkip_key_info Tx
;
773 struct rt_tkip_key_info Rx
;
776 /***************************************************************************
777 * Channel and BBP related data structures
778 **************************************************************************/
779 /* structure to tune BBP R66 (BBP TUNING) */
780 struct rt_bbp_r66_tuning
{
782 u16 FalseCcaLowerThreshold
; /* default 100 */
783 u16 FalseCcaUpperThreshold
; /* default 512 */
786 BOOLEAN R66LowerUpperSelect
; /*Before LinkUp, Used LowerBound or UpperBound as R66 value. */
789 /* structure to store channel TX power */
790 struct rt_channel_tx_power
{
791 u16 RemainingTimeForUse
; /*unit: sec */
799 /* structure to store 802.11j channel TX power */
800 struct rt_channel_11j_tx_power
{
802 u8 BW
; /* BW_10 or BW_20 */
805 u16 RemainingTimeForUse
; /*unit: sec */
808 struct rt_soft_rx_ant_diversity
{
809 u8 EvaluatePeriod
; /* 0:not evalute status, 1: evaluate status, 2: switching status */
810 u8 EvaluateStableCnt
;
811 u8 Pair1PrimaryRxAnt
; /* 0:Ant-E1, 1:Ant-E2 */
812 u8 Pair1SecondaryRxAnt
; /* 0:Ant-E1, 1:Ant-E2 */
813 u8 Pair2PrimaryRxAnt
; /* 0:Ant-E3, 1:Ant-E4 */
814 u8 Pair2SecondaryRxAnt
; /* 0:Ant-E3, 1:Ant-E4 */
815 short Pair1AvgRssi
[2]; /* AvgRssi[0]:E1, AvgRssi[1]:E2 */
816 short Pair2AvgRssi
[2]; /* AvgRssi[0]:E3, AvgRssi[1]:E4 */
817 short Pair1LastAvgRssi
; /* */
818 short Pair2LastAvgRssi
; /* */
819 unsigned long RcvPktNumWhenEvaluate
;
820 BOOLEAN FirstPktArrivedWhenEvaluate
;
821 struct rt_ralink_timer RxAntDiversityTimer
;
824 /***************************************************************************
825 * structure for radar detection and channel switch
826 **************************************************************************/
827 struct rt_radar_detect
{
828 /*BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h */
829 u8 CSCount
; /*Channel switch counter */
830 u8 CSPeriod
; /*Channel switch period (beacon count) */
831 u8 RDCount
; /*Radar detection counter */
832 u8 RDMode
; /*Radar Detection mode */
833 u8 RDDurRegion
; /*Radar detection duration region */
840 unsigned long InServiceMonitorCount
; /* unit: sec */
847 typedef enum _ABGBAND_STATE_
{
854 /* Power save method control */
855 typedef union _PS_CONTROL
{
857 unsigned long EnablePSinIdle
:1; /* Enable radio off when not connect to AP. radio on only when sitesurvey, */
858 unsigned long EnableNewPS
:1; /* Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe. */
859 unsigned long rt30xxPowerMode
:2; /* Power Level Mode for rt30xx chip */
860 unsigned long rt30xxFollowHostASPM
:1; /* Card Follows Host's setting for rt30xx chip. */
861 unsigned long rt30xxForceASPMTest
:1; /* Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. */
862 unsigned long rsv
:26; /* Radio Measurement Enable */
865 } PS_CONTROL
, *PPS_CONTROL
;
866 #endif /* RTMP_MAC_PCI // */
868 /***************************************************************************
869 * structure for MLME state machine
870 **************************************************************************/
872 /* STA state machines */
873 struct rt_state_machine CntlMachine
;
874 struct rt_state_machine AssocMachine
;
875 struct rt_state_machine AuthMachine
;
876 struct rt_state_machine AuthRspMachine
;
877 struct rt_state_machine SyncMachine
;
878 struct rt_state_machine WpaPskMachine
;
879 struct rt_state_machine LeapMachine
;
880 STATE_MACHINE_FUNC AssocFunc
[ASSOC_FUNC_SIZE
];
881 STATE_MACHINE_FUNC AuthFunc
[AUTH_FUNC_SIZE
];
882 STATE_MACHINE_FUNC AuthRspFunc
[AUTH_RSP_FUNC_SIZE
];
883 STATE_MACHINE_FUNC SyncFunc
[SYNC_FUNC_SIZE
];
884 STATE_MACHINE_FUNC ActFunc
[ACT_FUNC_SIZE
];
886 struct rt_state_machine ActMachine
;
888 /* common WPA state machine */
889 struct rt_state_machine WpaMachine
;
890 STATE_MACHINE_FUNC WpaFunc
[WPA_FUNC_SIZE
];
892 unsigned long ChannelQuality
; /* 0..100, Channel Quality Indication for Roaming */
893 unsigned long Now32
; /* latch the value of NdisGetSystemUpTime() */
894 unsigned long LastSendNULLpsmTime
;
898 struct rt_mlme_queue Queue
;
902 struct rt_ralink_timer PeriodicTimer
;
903 struct rt_ralink_timer APSDPeriodicTimer
;
904 struct rt_ralink_timer LinkDownTimer
;
905 struct rt_ralink_timer LinkUpTimer
;
907 u8 bPsPollTimerRunning
;
908 struct rt_ralink_timer PsPollTimer
;
909 struct rt_ralink_timer RadioOnOffTimer
;
910 #endif /* RTMP_MAC_PCI // */
911 unsigned long PeriodicRound
;
912 unsigned long OneSecPeriodicRound
;
915 BOOLEAN bLowThroughput
;
916 BOOLEAN bEnableAutoAntennaCheck
;
917 struct rt_ralink_timer RxAntEvalTimer
;
922 #endif /* RT30xx // */
925 struct rt_ralink_timer AutoWakeupTimer
;
926 BOOLEAN AutoWakeupTimerRunning
;
927 #endif /* RTMP_MAC_USB // */
930 /***************************************************************************
931 * 802.11 N related data structures
932 **************************************************************************/
933 struct reordering_mpdu
{
934 struct reordering_mpdu
*next
;
935 void *pPacket
; /* coverted to 802.3 frame */
936 int Sequence
; /* sequence number of MPDU */
940 struct reordering_list
{
941 struct reordering_mpdu
*next
;
945 struct reordering_mpdu_pool
{
948 struct reordering_list freelist
;
951 typedef enum _REC_BLOCKACK_STATUS
{
956 } REC_BLOCKACK_STATUS
, *PREC_BLOCKACK_STATUS
;
958 typedef enum _ORI_BLOCKACK_STATUS
{
963 } ORI_BLOCKACK_STATUS
, *PORI_BLOCKACK_STATUS
;
965 struct rt_ba_ori_entry
{
970 /* Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header. */
973 ORI_BLOCKACK_STATUS ORI_BA_Status
;
974 struct rt_ralink_timer ORIBATimer
;
978 struct rt_ba_rec_entry
{
981 u8 BAWinSize
; /* 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. */
983 /*u8 Curindidx; // the head in the RX reordering buffer */
985 /* u16 LastIndSeqAtTimer; */
987 struct rt_ralink_timer RECBATimer
;
988 unsigned long LastIndSeqAtTimer
;
989 unsigned long nDropPacket
;
990 unsigned long rcvSeq
;
991 REC_BLOCKACK_STATUS REC_BA_Status
;
992 /* u8 RxBufIdxUsed; */
993 /* corresponding virtual address for RX reordering packet storage. */
994 /*RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; */
995 spinlock_t RxReRingLock
; /* Rx Ring spinlock */
996 /* struct _BA_REC_ENTRY *pNext; */
998 struct reordering_list list
;
1001 struct rt_ba_table
{
1002 unsigned long numAsRecipient
; /* I am recipient of numAsRecipient clients. These client are in the BARecEntry[] */
1003 unsigned long numAsOriginator
; /* I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] */
1004 unsigned long numDoneOriginator
; /* count Done Originator sessions */
1005 struct rt_ba_ori_entry BAOriEntry
[MAX_LEN_OF_BA_ORI_TABLE
];
1006 struct rt_ba_rec_entry BARecEntry
[MAX_LEN_OF_BA_REC_TABLE
];
1009 /*For QureyBATableOID use; */
1010 struct PACKED rt_oid_ba_rec_entry
{
1011 u8 MACAddr
[MAC_ADDR_LEN
];
1012 u8 BaBitmap
; /* if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize */
1015 REC_BLOCKACK_STATUS REC_BA_Status
[8];
1018 /*For QureyBATableOID use; */
1019 struct PACKED rt_oid_ba_ori_entry
{
1020 u8 MACAddr
[MAC_ADDR_LEN
];
1021 u8 BaBitmap
; /* if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize, read ORI_BA_Status[TID] for status */
1024 ORI_BLOCKACK_STATUS ORI_BA_Status
[8];
1027 struct rt_queryba_table
{
1028 struct rt_oid_ba_ori_entry BAOriEntry
[32];
1029 struct rt_oid_ba_rec_entry BARecEntry
[32];
1030 u8 OriNum
; /* Number of below BAOriEntry */
1031 u8 RecNum
; /* Number of below BARecEntry */
1034 typedef union _BACAP_STRUC
{
1038 u32 AutoBA
:1; /* automatically BA */
1039 u32 Policy
:2; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use */
1041 u32 AmsduEnable
:1; /*Enable AMSDU transmisstion */
1042 u32 AmsduSize
:1; /* 0:3839, 1:7935 bytes. u32 MSDUSizeToBytes[] = { 3839, 7935}; */
1043 u32 MMPSmode
:2; /* MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable */
1044 u32 bHtAdhoc
:1; /* adhoc can use ht rate. */
1045 u32 b2040CoexistScanSup
:1; /*As Sta, support do 2040 coexistence scan for AP. As Ap, support monitor trigger event to check if can use BW 40MHz. */
1049 } BACAP_STRUC
, *PBACAP_STRUC
;
1051 struct rt_oid_add_ba_entry
{
1052 BOOLEAN IsRecipient
;
1053 u8 MACAddr
[MAC_ADDR_LEN
];
1057 BOOLEAN bAllTid
; /* If True, delete all TID for BA sessions with this MACaddr. */
1060 #define IS_HT_STA(_pMacEntry) \
1061 (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX)
1063 #define IS_HT_RATE(_pMacEntry) \
1064 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
1066 #define PEER_IS_HT_RATE(_pMacEntry) \
1067 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
1069 /*This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) */
1072 u8 ReorderTimeOutNum
[MAX_LEN_OF_BA_REC_TABLE
]; /* compare with threshold[0] */
1073 u8 RefreshNum
[MAX_LEN_OF_BA_REC_TABLE
]; /* compare with threshold[1] */
1074 unsigned long OneSecInWindowCount
;
1075 unsigned long OneSecFrameDuplicateCount
;
1076 unsigned long OneSecOutWindowCount
;
1081 BOOLEAN bRTSLongProtOn
;
1082 BOOLEAN bLastAtheros
;
1083 BOOLEAN bCurrentAtheros
;
1084 BOOLEAN bNowAtherosBurstOn
;
1085 BOOLEAN bNextDisableRxBA
;
1089 /* This is the registry setting for 802.11n transmit setting. Used in advanced page. */
1090 typedef union _REG_TRANSMIT_SETTING
{
1093 /*u32 MCS:7; // MCS */
1096 u32 BW
:1; /*channel bandwidth 20MHz or 40 MHz */
1098 u32 STBC
:1; /*SPACE */
1105 } REG_TRANSMIT_SETTING
, *PREG_TRANSMIT_SETTING
;
1107 typedef union _DESIRED_TRANSMIT_SETTING
{
1109 u16 MCS
:7; /* MCS */
1111 u16 FixedTxMode
:2; /* If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. */
1115 } DESIRED_TRANSMIT_SETTING
, *PDESIRED_TRANSMIT_SETTING
;
1118 /***************************************************************************
1119 * USB-based chip Beacon related data structures
1120 **************************************************************************/
1121 #define BEACON_BITMAP_MASK 0xff
1122 struct rt_beacon_sync
{
1123 u8 BeaconBuf
[HW_BEACON_MAX_COUNT
][HW_BEACON_OFFSET
];
1124 u8 BeaconTxWI
[HW_BEACON_MAX_COUNT
][TXWI_SIZE
];
1125 unsigned long TimIELocationInBeacon
[HW_BEACON_MAX_COUNT
];
1126 unsigned long CapabilityInfoLocationInBeacon
[HW_BEACON_MAX_COUNT
];
1127 BOOLEAN EnableBeacon
; /* trigger to enable beacon transmission. */
1128 u8 BeaconBitMap
; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. */
1129 u8 DtimBitOn
; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. */
1131 #endif /* RTMP_MAC_USB // */
1133 /***************************************************************************
1134 * Multiple SSID related data structures
1135 **************************************************************************/
1136 #define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */
1137 #define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */
1139 /* clear bcmc TIM bit */
1140 #define WLAN_MR_TIM_BCMC_CLEAR(apidx) \
1141 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] &= ~BIT8[0];
1143 /* set bcmc TIM bit */
1144 #define WLAN_MR_TIM_BCMC_SET(apidx) \
1145 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] |= BIT8[0];
1147 /* clear a station PS TIM bit */
1148 #define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, wcid) \
1149 { u8 tim_offset = wcid >> 3; \
1150 u8 bit_offset = wcid & 0x7; \
1151 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); }
1153 /* set a station PS TIM bit */
1154 #define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \
1155 { u8 tim_offset = wcid >> 3; \
1156 u8 bit_offset = wcid & 0x7; \
1157 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; }
1159 /* configuration common to OPMODE_AP as well as OPMODE_STA */
1160 struct rt_common_config
{
1162 BOOLEAN bCountryFlag
;
1165 u8 CountryRegion
; /* Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel */
1166 u8 CountryRegionForABand
; /* Enum of country region for A band */
1167 u8 PhyMode
; /* PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED */
1168 u16 Dsifs
; /* in units of usec */
1169 unsigned long PacketFilter
; /* Packet filter for receiving */
1172 char Ssid
[MAX_LEN_OF_SSID
]; /* NOT NULL-terminated */
1173 u8 SsidLen
; /* the actual ssid length in used */
1174 u8 LastSsidLen
; /* the actual ssid length in used */
1175 char LastSsid
[MAX_LEN_OF_SSID
]; /* NOT NULL-terminated */
1176 u8 LastBssid
[MAC_ADDR_LEN
];
1178 u8 Bssid
[MAC_ADDR_LEN
];
1181 u8 CentralChannel
; /* Central Channel when using 40MHz is indicating. not real channel. */
1183 u8 SupRate
[MAX_LEN_OF_SUPPORTED_RATES
];
1185 u8 ExtRate
[MAX_LEN_OF_SUPPORTED_RATES
];
1187 u8 DesireRate
[MAX_LEN_OF_SUPPORTED_RATES
]; /* OID_802_11_DESIRED_RATES */
1189 u8 ExpectedACKRate
[MAX_LEN_OF_SUPPORTED_RATES
];
1191 unsigned long BasicRateBitmap
; /* backup basic ratebitmap */
1193 BOOLEAN bAPSDCapable
;
1194 BOOLEAN bInServicePeriod
;
1200 /* because TSPEC can modify the APSD flag, we need to keep the APSD flag
1201 requested in association stage from the station;
1202 we need to recover the APSD flag after the TSPEC is deleted. */
1203 BOOLEAN bACMAPSDBackup
[4]; /* for delivery-enabled & trigger-enabled both */
1204 BOOLEAN bACMAPSDTr
[4]; /* no use */
1206 BOOLEAN bNeedSendTriggerFrame
;
1207 BOOLEAN bAPSDForcePowerSave
; /* Force power save mode, should only use in APSD-STAUT */
1208 unsigned long TriggerTimerCount
;
1210 u8 BBPCurrentBW
; /* BW_10, BW_20, BW_40 */
1211 /* move to MULTISSID_STRUCT for MBSS */
1212 /*HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. */
1213 REG_TRANSMIT_SETTING RegTransmitSetting
; /*registry transmit setting. this is for reading registry setting only. not useful. */
1214 /*u8 FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode */
1215 u8 TxRate
; /* Same value to fill in TXD. TxRate is 6-bit */
1216 u8 MaxTxRate
; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */
1217 u8 TxRateIndex
; /* Tx rate index in RateSwitchTable */
1218 u8 TxRateTableSize
; /* Valid Tx rate table size in RateSwitchTable */
1219 /*BOOLEAN bAutoTxRateSwitch; */
1220 u8 MinTxRate
; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */
1221 u8 RtsRate
; /* RATE_xxx */
1222 HTTRANSMIT_SETTING MlmeTransmit
; /* MGMT frame PHY rate setting when operatin at Ht rate. */
1223 u8 MlmeRate
; /* RATE_xxx, used to send MLME frames */
1224 u8 BasicMlmeRate
; /* Default Rate for sending MLME frames */
1226 u16 RtsThreshold
; /* in unit of BYTE */
1227 u16 FragmentThreshold
; /* in unit of BYTE */
1229 u8 TxPower
; /* in unit of mW */
1230 unsigned long TxPowerPercentage
; /* 0~100 % */
1231 unsigned long TxPowerDefault
; /* keep for TxPowerPercentage */
1234 BACAP_STRUC BACapability
; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */
1235 BACAP_STRUC REGBACapability
; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */
1237 struct rt_iot IOTestParm
; /* 802.11n InterOpbility Test Parameter; */
1238 unsigned long TxPreamble
; /* Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto */
1239 BOOLEAN bUseZeroToDisableFragment
; /* Microsoft use 0 as disable */
1240 unsigned long UseBGProtection
; /* 0: auto, 1: always use, 2: always not use */
1241 BOOLEAN bUseShortSlotTime
; /* 0: disable, 1 - use short slot (9us) */
1242 BOOLEAN bEnableTxBurst
; /* 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST */
1243 BOOLEAN bAggregationCapable
; /* 1: enable TX aggregation when the peer supports it */
1244 BOOLEAN bPiggyBackCapable
; /* 1: enable TX piggy-back according MAC's version */
1245 BOOLEAN bIEEE80211H
; /* 1: enable IEEE802.11h spec. */
1246 unsigned long DisableOLBCDetect
; /* 0: enable OLBC detect; 1 disable OLBC detect */
1250 BOOLEAN bWmmCapable
; /* 0:disable WMM, 1:enable WMM */
1251 struct rt_qos_capability_parm APQosCapability
; /* QOS capability of the current associated AP */
1252 struct rt_edca_parm APEdcaParm
; /* EDCA parameters of the current associated AP */
1253 struct rt_qbss_load_parm APQbssLoad
; /* QBSS load of the current associated AP */
1254 u8 AckPolicy
[4]; /* ACK policy of the specified AC. see ACK_xxx */
1255 BOOLEAN bDLSCapable
; /* 0:disable DLS, 1:enable DLS */
1256 /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */
1257 /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */
1258 /* OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. */
1259 /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition */
1260 unsigned long OpStatusFlags
;
1262 BOOLEAN NdisRadioStateOff
; /*For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. */
1263 ABGBAND_STATE BandState
; /* For setting BBP used on B/G or A mode. */
1265 /* IEEE802.11H--DFS. */
1266 struct rt_radar_detect RadarDetect
;
1269 u8 BASize
; /* USer desired BAWindowSize. Should not exceed our max capability */
1270 /*struct rt_ht_capability SupportedHtPhy; */
1271 struct rt_ht_capability DesiredHtPhy
;
1272 struct rt_ht_capability_ie HtCapability
;
1273 struct rt_add_ht_info_ie AddHTInfo
; /* Useful as AP. */
1274 /*This IE is used with channel switch announcement element when changing to a new 40MHz. */
1275 /*This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp. */
1276 struct rt_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 */
1279 BOOLEAN bMIMOPSEnable
;
1281 /*2008/11/05: KH add to support Antenna power-saving of AP<-- */
1282 BOOLEAN bGreenAPEnable
;
1283 /*2008/11/05: KH add to support Antenna power-saving of AP--> */
1284 BOOLEAN bDisableReordering
;
1285 BOOLEAN bForty_Mhz_Intolerant
;
1286 BOOLEAN bExtChannelSwitchAnnouncement
;
1287 BOOLEAN bRcvBSSWidthTriggerEvents
;
1288 unsigned long LastRcvBSSWidthTriggerEventsTime
;
1292 /* Enable wireless event */
1293 BOOLEAN bWirelessEvent
;
1294 BOOLEAN bWiFiTest
; /* Enable this parameter for WiFi test */
1296 /* Tx & Rx Stream number selection */
1300 BOOLEAN bHardwareRadio
; /* Hardware controlled Radio enabled */
1303 BOOLEAN bMultipleIRP
; /* Multiple Bulk IN flag */
1304 u8 NumOfBulkInIRP
; /* if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 */
1305 struct rt_ht_capability SupportedHtPhy
;
1306 unsigned long MaxPktOneTxBulk
;
1310 BOOLEAN IsUpdateBeacon
;
1311 struct rt_beacon_sync
*pBeaconSync
;
1312 struct rt_ralink_timer BeaconUpdateTimer
;
1316 #endif /* RTMP_MAC_USB // */
1318 spinlock_t MeasureReqTabLock
;
1319 struct rt_measure_req_tab
*pMeasureReqTab
;
1321 spinlock_t TpcReqTabLock
;
1322 struct rt_tpc_req_tab
*pTpcReqTab
;
1324 BOOLEAN PSPXlink
; /* 0: Disable. 1: Enable */
1326 #if defined(RT305x) || defined(RT30xx)
1327 /* request by Gary, for High Power issue */
1328 u8 HighPowerPatchDisabled
;
1331 BOOLEAN HT_DisallowTKIP
; /* Restrict the encryption type in 11n HT mode */
1334 /* Modified by Wu Xi-Kun 4/21/2006 */
1335 /* STA configuration and status */
1336 struct rt_sta_admin_config
{
1338 /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */
1339 /* the user intended configuration, but not necessary fully equal to the final */
1340 /* settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either */
1341 /* AP or IBSS holder). */
1342 /* Once initialized, user configuration can only be changed via OID_xxx */
1343 u8 BssType
; /* BSS_INFRA or BSS_ADHOC */
1344 u16 AtimWin
; /* used when starting a new IBSS */
1347 /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */
1348 /* the user intended configuration, and should be always applied to the final */
1349 /* settings in ACTIVE BSS without compromising with the BSS holder. */
1350 /* Once initialized, user configuration can only be changed via OID_xxx */
1352 u8 RssiTriggerMode
; /* RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD */
1353 u16 DefaultListenCount
; /* default listen count; */
1354 unsigned long WindowsPowerMode
; /* Power mode for AC power */
1355 unsigned long WindowsBatteryPowerMode
; /* Power mode for battery if exists */
1356 BOOLEAN bWindowsACCAMEnable
; /* Enable CAM power mode when AC on */
1357 BOOLEAN bAutoReconnect
; /* Set to TRUE when setting OID_802_11_SSID with no matching BSSID */
1358 unsigned long WindowsPowerProfile
; /* Windows power profile, for NDIS5.1 PnP */
1360 /* MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1) */
1361 u16 Psm
; /* power management mode (PWR_ACTIVE|PWR_SAVE) */
1363 u8 DisassocSta
[MAC_ADDR_LEN
];
1365 u8 DeauthSta
[MAC_ADDR_LEN
];
1367 u8 AuthFailSta
[MAC_ADDR_LEN
];
1369 NDIS_802_11_PRIVACY_FILTER PrivacyFilter
; /* PrivacyFilter enum for 802.1X */
1370 NDIS_802_11_AUTHENTICATION_MODE AuthMode
; /* This should match to whatever microsoft defined */
1371 NDIS_802_11_WEP_STATUS WepStatus
;
1372 NDIS_802_11_WEP_STATUS OrigWepStatus
; /* Original wep status set from OID */
1374 /* Add to support different cipher suite for WPA2/WPA mode */
1375 NDIS_802_11_ENCRYPTION_STATUS GroupCipher
; /* Multicast cipher suite */
1376 NDIS_802_11_ENCRYPTION_STATUS PairCipher
; /* Unicast cipher suite */
1377 BOOLEAN bMixCipher
; /* Indicate current Pair & Group use different cipher suites */
1380 NDIS_802_11_WEP_STATUS GroupKeyWepStatus
;
1382 u8 WpaPassPhrase
[64]; /* WPA PSK pass phrase */
1383 u32 WpaPassPhraseLen
; /* the length of WPA PSK pass phrase */
1384 u8 PMK
[32]; /* WPA PSK mode PMK */
1385 u8 PTK
[64]; /* WPA PSK mode PTK */
1386 u8 GTK
[32]; /* GTK from authenticator */
1387 struct rt_bssid_info SavedPMK
[PMKID_NO
];
1388 u32 SavedPMKNum
; /* Saved PMKID number */
1392 /* WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED */
1395 /* For WPA countermeasures */
1396 unsigned long LastMicErrorTime
; /* record last MIC error time */
1397 unsigned long MicErrCnt
; /* Should be 0, 1, 2, then reset to zero (after disassoiciation). */
1398 BOOLEAN bBlockAssoc
; /* Block associate attempt for 60 seconds after counter measure occurred. */
1399 /* For WPA-PSK supplicant state */
1400 WPA_STATE WpaState
; /* Default is SS_NOTUSE and handled by microsoft 802.1x */
1401 u8 ReplayCounter
[8];
1402 u8 ANonce
[32]; /* ANonce for WPA-PSK from aurhenticator */
1403 u8 SNonce
[32]; /* SNonce for WPA-PSK */
1405 u8 LastSNR0
; /* last received BEACON's SNR */
1406 u8 LastSNR1
; /* last received BEACON's SNR for 2nd antenna */
1407 struct rt_rssi_sample RssiSample
;
1408 unsigned long NumOfAvgRssiSample
;
1410 unsigned long LastBeaconRxTime
; /* OS's timestamp of the last BEACON RX time */
1411 unsigned long Last11bBeaconRxTime
; /* OS's timestamp of the last 11B BEACON RX time */
1412 unsigned long Last11gBeaconRxTime
; /* OS's timestamp of the last 11G BEACON RX time */
1413 unsigned long Last20NBeaconRxTime
; /* OS's timestamp of the last 20MHz N BEACON RX time */
1415 unsigned long LastScanTime
; /* Record last scan time for issue BSSID_SCAN_LIST */
1416 unsigned long ScanCnt
; /* Scan counts since most recent SSID, BSSID, SCAN OID request */
1417 BOOLEAN bSwRadio
; /* Software controlled Radio On/Off, TRUE: On */
1418 BOOLEAN bHwRadio
; /* Hardware controlled Radio On/Off, TRUE: On */
1419 BOOLEAN bRadio
; /* Radio state, And of Sw & Hw radio state */
1420 BOOLEAN bHardwareRadio
; /* Hardware controlled Radio enabled */
1421 BOOLEAN bShowHiddenSSID
; /* Show all known SSID in SSID list get operation */
1423 /* New for WPA, windows want us to keep association information and */
1424 /* Fixed IEs from last association response */
1425 struct rt_ndis_802_11_association_information AssocInfo
;
1426 u16 ReqVarIELen
; /* Length of next VIE include EID & Length */
1427 u8 ReqVarIEs
[MAX_VIE_LEN
]; /* The content saved here should be little-endian format. */
1428 u16 ResVarIELen
; /* Length of next VIE include EID & Length */
1429 u8 ResVarIEs
[MAX_VIE_LEN
];
1432 u8 RSN_IE
[MAX_LEN_OF_RSNIE
]; /* The content saved here should be little-endian format. */
1434 unsigned long CLBusyBytes
; /* Save the total bytes received durning channel load scan time */
1435 u16 RPIDensity
[8]; /* Array for RPI density collection */
1437 u8 RMReqCnt
; /* Number of measurement request saved. */
1438 u8 CurrentRMReqIdx
; /* Number of measurement request saved. */
1439 BOOLEAN ParallelReq
; /* Parallel measurement, only one request performed, */
1440 /* It must be the same channel with maximum duration */
1441 u16 ParallelDuration
; /* Maximum duration for parallel measurement */
1442 u8 ParallelChannel
; /* Only one channel with parallel measurement */
1443 u16 IAPPToken
; /* IAPP dialog token */
1444 /* Hack for channel load and noise histogram parameters */
1445 u8 NHFactor
; /* Parameter for Noise histogram */
1446 u8 CLFactor
; /* Parameter for channel load */
1448 struct rt_ralink_timer StaQuickResponeForRateUpTimer
;
1449 BOOLEAN StaQuickResponeForRateUpTimerRunning
;
1451 u8 DtimCount
; /* 0.. DtimPeriod-1 */
1452 u8 DtimPeriod
; /* default = 3 */
1454 /*////////////////////////////////////////////////////////////////////////////////////// */
1455 /* This is only for WHQL test. */
1457 /*////////////////////////////////////////////////////////////////////////////////////// */
1459 struct rt_ralink_timer WpaDisassocAndBlockAssocTimer
;
1461 BOOLEAN bAutoRoaming
; /* 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI */
1462 char dBmToRoam
; /* the condition to roam when receiving Rssi less than this value. It's negative value. */
1465 BOOLEAN IEEE8021x_required_keys
;
1466 struct rt_cipher_key DesireSharedKey
[4]; /* Record user desired WEP keys */
1467 u8 DesireSharedKeyId
;
1469 /* 0: driver ignores wpa_supplicant */
1470 /* 1: wpa_supplicant initiates scanning and AP selection */
1471 /* 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters */
1473 u8 WpaSupplicantScanCount
;
1474 BOOLEAN bRSN_IE_FromWpaSupplicant
;
1479 BOOLEAN bTGnWifiTest
;
1480 BOOLEAN bScanReqIsFromWebUI
;
1482 HTTRANSMIT_SETTING HTPhyMode
, MaxHTPhyMode
, MinHTPhyMode
; /* For transmit phy setting in TXWI. */
1483 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting
;
1484 struct rt_ht_phy_info DesiredHtPhyInfo
;
1485 BOOLEAN bAutoTxRateSwitch
;
1489 /* PS Control has 2 meanings for advanced power save function. */
1490 /* 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. */
1491 /* 2. EnableNewPS : will save more current in sleep or radio off mode. */
1492 PS_CONTROL PSControl
;
1493 #endif /* RTMP_MAC_PCI // */
1495 BOOLEAN bAutoConnectByBssid
;
1496 unsigned long BeaconLostTime
; /* seconds */
1497 BOOLEAN bForceTxBurst
; /* 1: force enble TX PACKET BURST, 0: disable */
1500 /* This data structure keep the current active BSS/IBSS's configuration that this STA */
1501 /* had agreed upon joining the network. Which means these parameters are usually decided */
1502 /* by the BSS/IBSS creator instead of user configuration. Data in this data structurre */
1503 /* is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE. */
1504 /* Normally, after SCAN or failed roaming attempts, we need to recover back to */
1505 /* the current active settings. */
1506 struct rt_sta_active_config
{
1508 u16 AtimWin
; /* in kusec; IBSS parameter set element */
1513 /* Copy supported rate from desired AP's beacon. We are trying to match */
1514 /* AP's supported and extended rate settings. */
1515 u8 SupRate
[MAX_LEN_OF_SUPPORTED_RATES
];
1516 u8 ExtRate
[MAX_LEN_OF_SUPPORTED_RATES
];
1519 /* Copy supported ht from desired AP's beacon. We are trying to match */
1520 struct rt_ht_phy_info SupportedPhyInfo
;
1521 struct rt_ht_capability SupportedHtPhy
;
1524 struct rt_mac_table_entry
;
1526 struct rt_mac_table_entry
{
1527 /*Choose 1 from ValidAsWDS and ValidAsCLI to validize. */
1528 BOOLEAN ValidAsCLI
; /* Sta mode, set this TRUE after Linkup,too. */
1529 BOOLEAN ValidAsWDS
; /* This is WDS Entry. only for AP mode. */
1530 BOOLEAN ValidAsApCli
; /*This is a AP-Client entry, only for AP mode which enable AP-Client functions. */
1531 BOOLEAN ValidAsMesh
;
1532 BOOLEAN ValidAsDls
; /* This is DLS Entry. only for STA mode. */
1534 BOOLEAN bIAmBadAtheros
; /* Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. */
1536 u8 EnqueueEapolStartTimerRunning
; /* Enqueue EAPoL-Start for triggering EAP SM */
1538 /* record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB */
1540 u8 apidx
; /* MBSS number */
1542 u8 RSN_IE
[MAX_LEN_OF_RSNIE
];
1543 u8 ANonce
[LEN_KEY_DESC_NONCE
];
1544 u8 SNonce
[LEN_KEY_DESC_NONCE
];
1545 u8 R_Counter
[LEN_KEY_DESC_REPLAY
];
1548 struct rt_ralink_timer RetryTimer
;
1549 struct rt_ralink_timer EnqueueStartForPSKTimer
; /* A timer which enqueue EAPoL-Start for triggering PSK SM */
1550 NDIS_802_11_AUTHENTICATION_MODE AuthMode
; /* This should match to whatever microsoft defined */
1551 NDIS_802_11_WEP_STATUS WepStatus
;
1552 NDIS_802_11_WEP_STATUS GroupKeyWepStatus
;
1553 AP_WPA_STATE WpaState
;
1556 NDIS_802_11_PRIVACY_FILTER PrivacyFilter
; /* PrivacyFilter enum for 802.1X */
1557 struct rt_cipher_key PairwiseKey
;
1560 u8 PMKID
[LEN_PMKID
];
1562 u8 Addr
[MAC_ADDR_LEN
];
1565 AUTH_STATE AuthState
; /* for SHARED KEY authentication state machine used only */
1566 BOOLEAN IsReassocSta
; /* Indicate whether this is a reassociation procedure */
1570 unsigned long NoDataIdleCount
;
1571 u16 StationKeepAliveCount
; /* unit: second */
1572 unsigned long PsQIdleCount
;
1573 struct rt_queue_header PsQueue
;
1575 u32 StaConnectTime
; /* the live time of this station since associated with AP */
1578 u16 NoBADataCountDown
;
1580 u32 CachedBuf
[16]; /* u32 (4 bytes) for alignment */
1581 u32 TxBFCount
; /* 3*3 */
1587 /*==================================================== */
1588 /*WDS entry needs these */
1589 /* if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab */
1591 u8 MaxSupportedRate
;
1594 /* to record the each TX rate's quality. 0 is best, the bigger the worse. */
1595 u16 TxQuality
[MAX_STEP_OF_TX_RATE_SWITCH
];
1596 /* u16 OneSecTxOkCount; */
1597 u32 OneSecTxNoRetryOkCount
;
1598 u32 OneSecTxRetryOkCount
;
1599 u32 OneSecTxFailCount
;
1600 u32 ContinueTxFailCnt
;
1601 u32 CurrTxRateStableTime
; /* # of second in current TX rate */
1602 u8 TxRateUpPenalty
; /* extra # of second penalty due to last unstable condition */
1603 /*==================================================== */
1605 BOOLEAN fNoisyEnvironment
;
1606 BOOLEAN fLastSecAccordingRSSI
;
1607 u8 LastSecTxRateChangeAction
; /* 0: no change, 1:rate UP, 2:rate down */
1608 char LastTimeTxRateChangeAction
; /*Keep last time value of LastSecTxRateChangeAction */
1609 unsigned long LastTxOkCount
;
1610 u8 PER
[MAX_STEP_OF_TX_RATE_SWITCH
];
1612 /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */
1613 /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */
1614 /* CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. */
1615 /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED */
1616 unsigned long ClientStatusFlags
;
1618 HTTRANSMIT_SETTING HTPhyMode
, MaxHTPhyMode
, MinHTPhyMode
; /* For transmit phy setting in TXWI. */
1620 /* HT EWC MIMO-N used parameters */
1621 u16 RXBAbitmap
; /* fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format */
1622 u16 TXBAbitmap
; /* This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI */
1624 u16 BADeclineBitmap
;
1625 u16 BARecWcidArray
[NUM_OF_TID
]; /* The mapping wcid of recipient session. if RXBAbitmap bit is masked */
1626 u16 BAOriWcidArray
[NUM_OF_TID
]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */
1627 u16 BAOriSequence
[NUM_OF_TID
]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */
1629 /* 802.11n features. */
1633 u8 MmpsMode
; /* MIMO power save more. */
1635 struct rt_ht_capability_ie HTCapability
;
1637 BOOLEAN bAutoTxRateSwitch
;
1640 struct rt_mac_table_entry
*pNext
;
1641 u16 TxSeq
[NUM_OF_TID
];
1644 struct rt_rssi_sample RssiSample
;
1646 u32 TXMCSExpected
[16];
1647 u32 TXMCSSuccessful
[16];
1648 u32 TXMCSFailed
[16];
1649 u32 TXMCSAutoFallBack
[16][16];
1651 unsigned long LastBeaconRxTime
;
1653 unsigned long AssocDeadLine
;
1656 struct rt_mac_table
{
1658 struct rt_mac_table_entry
*Hash
[HASH_TABLE_SIZE
];
1659 struct rt_mac_table_entry Content
[MAX_LEN_OF_MAC_TABLE
];
1660 struct rt_queue_header McastPsQueue
;
1661 unsigned long PsQIdleCount
;
1662 BOOLEAN fAnyStationInPsm
;
1663 BOOLEAN fAnyStationBadAtheros
; /* Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. */
1664 BOOLEAN fAnyTxOPForceDisable
; /* Check if it is necessary to disable BE TxOP */
1665 BOOLEAN fAllStationAsRalink
; /* Check if all stations are ralink-chipset */
1666 BOOLEAN fAnyStationIsLegacy
; /* Check if I use legacy rate to transmit to my BSS Station/ */
1667 BOOLEAN fAnyStationNonGF
; /* Check if any Station can't support GF. */
1668 BOOLEAN fAnyStation20Only
; /* Check if any Station can't support GF. */
1669 BOOLEAN fAnyStationMIMOPSDynamic
; /* Check if any Station is MIMO Dynamic */
1670 BOOLEAN fAnyBASession
; /* Check if there is BA session. Force turn on RTS/CTS */
1671 /*2008/10/28: KH add to support Antenna power-saving of AP<-- */
1672 /*2008/10/28: KH add to support Antenna power-saving of AP--> */
1677 BOOLEAN bGreenField
;
1680 struct rt_rtmp_dev_info
{
1682 RTMP_INF_TYPE infType
;
1685 struct rt_rtmp_chip_op
{
1686 /* Calibration access related callback functions */
1687 int (*eeinit
) (struct rt_rtmp_adapter
*pAd
); /* int (*eeinit)(struct rt_rtmp_adapter *pAd); */
1688 int (*eeread
) (struct rt_rtmp_adapter
*pAd
, u16 offset
, u16
*pValue
); /* int (*eeread)(struct rt_rtmp_adapter *pAd, int offset, u16 *pValue); */
1690 /* MCU related callback functions */
1691 int (*loadFirmware
) (struct rt_rtmp_adapter
*pAd
); /* int (*loadFirmware)(struct rt_rtmp_adapter *pAd); */
1692 int (*eraseFirmware
) (struct rt_rtmp_adapter
*pAd
); /* int (*eraseFirmware)(struct rt_rtmp_adapter *pAd); */
1693 int (*sendCommandToMcu
) (struct rt_rtmp_adapter
*pAd
, u8 cmd
, u8 token
, u8 arg0
, u8 arg1
);; /* int (*sendCommandToMcu)(struct rt_rtmp_adapter *pAd, u8 cmd, u8 token, u8 arg0, u8 arg1); */
1695 /* RF access related callback functions */
1696 struct rt_reg_pair
*pRFRegTable
;
1697 void (*AsicRfInit
) (struct rt_rtmp_adapter
*pAd
);
1698 void (*AsicRfTurnOn
) (struct rt_rtmp_adapter
*pAd
);
1699 void (*AsicRfTurnOff
) (struct rt_rtmp_adapter
*pAd
);
1700 void (*AsicReverseRfFromSleepMode
) (struct rt_rtmp_adapter
*pAd
);
1701 void (*AsicHaltAction
) (struct rt_rtmp_adapter
*pAd
);
1705 /* The miniport adapter structure */
1707 struct rt_rtmp_adapter
{
1708 void *OS_Cookie
; /* save specific structure relative to OS */
1709 struct net_device
*net_dev
;
1710 unsigned long VirtualIfCnt
;
1711 const struct firmware
*firmware
;
1713 struct rt_rtmp_chip_op chipOps
;
1714 u16 ThisTbttNumToNextWakeUp
;
1717 /*****************************************************************************************/
1718 /* PCI related parameters */
1719 /*****************************************************************************************/
1720 u8
*CSRBaseAddress
; /* PCI MMIO Base Address, all access will use */
1721 unsigned int irq_num
;
1724 u16 RLnkCtrlConfiguration
;
1726 u16 HostLnkCtrlConfiguration
;
1727 u16 HostLnkCtrlOffset
;
1728 u16 PCIePowerSaveLevel
;
1729 unsigned long Rt3xxHostLinkCtrl
; /* USed for 3090F chip */
1730 unsigned long Rt3xxRalinkLinkCtrl
; /* USed for 3090F chip */
1731 u16 DeviceID
; /* Read from PCI config */
1732 unsigned long AccessBBPFailCount
;
1733 BOOLEAN bPCIclkOff
; /* flag that indicate if the PICE power status in Configuration SPace.. */
1734 BOOLEAN bPCIclkOffDisableTx
; /* */
1736 BOOLEAN brt30xxBanMcuCmd
; /*when = 0xff means all commands are ok to set . */
1737 BOOLEAN b3090ESpecialChip
; /*3090E special chip that write EEPROM 0x24=0x9280. */
1738 unsigned long CheckDmaBusyCount
; /* Check Interrupt Status Register Count. */
1741 u32 int_disable_mask
;
1744 struct rt_rtmp_dmabuf TxBufSpace
[NUM_OF_TX_RING
]; /* Shared memory of all 1st pre-allocated TxBuf associated with each TXD */
1745 struct rt_rtmp_dmabuf RxDescRing
; /* Shared memory for RX descriptors */
1746 struct rt_rtmp_dmabuf TxDescRing
[NUM_OF_TX_RING
]; /* Shared memory for Tx descriptors */
1747 struct rt_rtmp_tx_ring TxRing
[NUM_OF_TX_RING
]; /* AC0~4 + HCCA */
1748 #endif /* RTMP_MAC_PCI // */
1750 spinlock_t irq_lock
;
1754 /*****************************************************************************************/
1755 /* USB related parameters */
1756 /*****************************************************************************************/
1757 struct usb_config_descriptor
*config
;
1758 u32 BulkInEpAddr
; /* bulk-in endpoint address */
1759 u32 BulkOutEpAddr
[6]; /* bulk-out endpoint address */
1762 u16 BulkOutMaxPacketSize
;
1763 u16 BulkInMaxPacketSize
;
1765 /*======Control Flags */
1766 long PendingIoCount
;
1767 unsigned long BulkFlags
;
1768 BOOLEAN bUsbTxBulkAggre
; /* Flags for bulk out data priority */
1770 /*======Cmd Thread */
1771 struct rt_cmdq CmdQ
;
1772 spinlock_t CmdQLock
; /* CmdQLock spinlock */
1773 struct rt_rtmp_os_task cmdQTask
;
1775 /*======Semaphores (event) */
1776 struct semaphore UsbVendorReq_semaphore
;
1777 void *UsbVendorReqBuf
;
1778 wait_queue_head_t
*wait
;
1779 #endif /* RTMP_MAC_USB // */
1781 /*****************************************************************************************/
1782 /* RBUS related parameters */
1783 /*****************************************************************************************/
1785 /*****************************************************************************************/
1786 /* Both PCI/USB related parameters */
1787 /*****************************************************************************************/
1788 /*struct rt_rtmp_dev_info chipInfo; */
1789 RTMP_INF_TYPE infType
;
1791 /*****************************************************************************************/
1792 /* Driver Mgmt related parameters */
1793 /*****************************************************************************************/
1794 struct rt_rtmp_os_task mlmeTask
;
1795 #ifdef RTMP_TIMER_TASK_SUPPORT
1796 /* If you want use timer task to handle the timer related jobs, enable this. */
1797 struct rt_rtmp_timer_task_queue TimerQ
;
1798 spinlock_t TimerQLock
;
1799 struct rt_rtmp_os_task timerTask
;
1800 #endif /* RTMP_TIMER_TASK_SUPPORT // */
1802 /*****************************************************************************************/
1803 /* Tx related parameters */
1804 /*****************************************************************************************/
1805 BOOLEAN DeQueueRunning
[NUM_OF_TX_RING
]; /* for ensuring RTUSBDeQueuePacket get call once */
1806 spinlock_t DeQueueLock
[NUM_OF_TX_RING
];
1809 /* Data related context and AC specified, 4 AC supported */
1810 spinlock_t BulkOutLock
[6]; /* BulkOut spinlock for 4 ACs */
1811 spinlock_t MLMEBulkOutLock
; /* MLME BulkOut lock */
1813 struct rt_ht_tx_context TxContext
[NUM_OF_TX_RING
];
1814 spinlock_t TxContextQueueLock
[NUM_OF_TX_RING
]; /* TxContextQueue spinlock */
1816 /* 4 sets of Bulk Out index and pending flag */
1817 u8 NextBulkOutIndex
[4]; /* only used for 4 EDCA bulkout pipe */
1819 BOOLEAN BulkOutPending
[6]; /* used for total 6 bulkout pipe */
1821 BOOLEAN MgmtBulkPending
;
1822 unsigned long bulkResetReq
[6];
1823 #endif /* RTMP_MAC_USB // */
1825 /* resource for software backlog queues */
1826 struct rt_queue_header TxSwQueue
[NUM_OF_TX_RING
]; /* 4 AC + 1 HCCA */
1827 spinlock_t TxSwQueueLock
[NUM_OF_TX_RING
]; /* TxSwQueue spinlock */
1829 struct rt_rtmp_dmabuf MgmtDescRing
; /* Shared memory for MGMT descriptors */
1830 struct rt_rtmp_mgmt_ring MgmtRing
;
1831 spinlock_t MgmtRingLock
; /* Prio Ring spinlock */
1833 /*****************************************************************************************/
1834 /* Rx related parameters */
1835 /*****************************************************************************************/
1838 struct rt_rtmp_rx_ring RxRing
;
1839 spinlock_t RxRingLock
; /* Rx Ring spinlock */
1841 spinlock_t McuCmdLock
; /*MCU Command Queue spinlock */
1842 #endif /* RT3090 // */
1843 #endif /* RTMP_MAC_PCI // */
1845 struct rt_rx_context RxContext
[RX_RING_SIZE
]; /* 1 for redundant multiple IRP bulk in. */
1846 spinlock_t BulkInLock
; /* BulkIn spinlock for 4 ACs */
1847 u8 PendingRx
; /* The Maximum pending Rx value should be RX_RING_SIZE. */
1848 u8 NextRxBulkInIndex
; /* Indicate the current RxContext Index which hold by Host controller. */
1849 u8 NextRxBulkInReadIndex
; /* Indicate the current RxContext Index which driver can read & process it. */
1850 unsigned long NextRxBulkInPosition
; /* Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. */
1851 unsigned long TransferBufferLength
; /* current length of the packet buffer */
1852 unsigned long ReadPosition
; /* current read position in a packet buffer */
1853 #endif /* RTMP_MAC_USB // */
1855 /*****************************************************************************************/
1856 /* ASIC related parameters */
1857 /*****************************************************************************************/
1858 u32 MACVersion
; /* MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. */
1860 /* --------------------------- */
1862 /* --------------------------- */
1863 unsigned long EepromVersion
; /* byte 0: version, byte 1: revision, byte 2~3: unused */
1864 unsigned long FirmwareVersion
; /* byte 0: Minor version, byte 1: Major version, otherwise unused. */
1865 u16 EEPROMDefaultValue
[NUM_EEPROM_BBP_PARMS
];
1866 u8 EEPROMAddressNum
; /* 93c46=6 93c66=8 */
1867 BOOLEAN EepromAccess
;
1870 /* --------------------------- */
1872 /* --------------------------- */
1873 u8 BbpWriteLatch
[140]; /* record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID */
1874 char BbpRssiToDbmDelta
; /* change from u8 to char for high power */
1875 struct rt_bbp_r66_tuning BbpTuning
;
1877 /* ---------------------------- */
1879 /* ---------------------------- */
1880 u8 RfIcType
; /* RFIC_xxx */
1881 unsigned long RfFreqOffset
; /* Frequency offset for channel switching */
1882 struct rt_rtmp_rf_regs LatchRfRegs
; /* latch th latest RF programming value since RF IC doesn't support READ */
1884 EEPROM_ANTENNA_STRUC Antenna
; /* Since ANtenna definition is different for a & g. We need to save it for future reference. */
1885 EEPROM_NIC_CONFIG2_STRUC NicConfig2
;
1887 /* This soft Rx Antenna Diversity mechanism is used only when user set */
1888 /* RX Antenna = DIVERSITY ON */
1889 struct rt_soft_rx_ant_diversity RxAnt
;
1892 struct rt_channel_tx_power TxPower
[MAX_NUM_OF_CHANNELS
]; /* Store Tx power value for all channels. */
1893 struct rt_channel_tx_power ChannelList
[MAX_NUM_OF_CHANNELS
]; /* list all supported channels for site survey */
1894 struct rt_channel_11j_tx_power TxPower11J
[MAX_NUM_OF_11JCHANNELS
]; /* 802.11j channel and bw */
1895 struct rt_channel_11j_tx_power ChannelList11J
[MAX_NUM_OF_11JCHANNELS
]; /* list all supported channels for site survey */
1897 u8 ChannelListNum
; /* number of channel in ChannelList[] */
1900 unsigned long Tx20MPwrCfgABand
[5];
1901 unsigned long Tx20MPwrCfgGBand
[5];
1902 unsigned long Tx40MPwrCfgABand
[5];
1903 unsigned long Tx40MPwrCfgGBand
[5];
1905 BOOLEAN bAutoTxAgcA
; /* Enable driver auto Tx Agc control */
1906 u8 TssiRefA
; /* Store Tssi reference value as 25 temperature. */
1907 u8 TssiPlusBoundaryA
[5]; /* Tssi boundary for increase Tx power to compensate. */
1908 u8 TssiMinusBoundaryA
[5]; /* Tssi boundary for decrease Tx power to compensate. */
1909 u8 TxAgcStepA
; /* Store Tx TSSI delta increment / decrement value */
1910 char TxAgcCompensateA
; /* Store the compensation (TxAgcStep * (idx-1)) */
1912 BOOLEAN bAutoTxAgcG
; /* Enable driver auto Tx Agc control */
1913 u8 TssiRefG
; /* Store Tssi reference value as 25 temperature. */
1914 u8 TssiPlusBoundaryG
[5]; /* Tssi boundary for increase Tx power to compensate. */
1915 u8 TssiMinusBoundaryG
[5]; /* Tssi boundary for decrease Tx power to compensate. */
1916 u8 TxAgcStepG
; /* Store Tx TSSI delta increment / decrement value */
1917 char TxAgcCompensateG
; /* Store the compensation (TxAgcStep * (idx-1)) */
1919 char BGRssiOffset0
; /* Store B/G RSSI#0 Offset value on EEPROM 0x46h */
1920 char BGRssiOffset1
; /* Store B/G RSSI#1 Offset value */
1921 char BGRssiOffset2
; /* Store B/G RSSI#2 Offset value */
1923 char ARssiOffset0
; /* Store A RSSI#0 Offset value on EEPROM 0x4Ah */
1924 char ARssiOffset1
; /* Store A RSSI#1 Offset value */
1925 char ARssiOffset2
; /* Store A RSSI#2 Offset value */
1927 char BLNAGain
; /* Store B/G external LNA#0 value on EEPROM 0x44h */
1928 char ALNAGain0
; /* Store A external LNA#0 value for ch36~64 */
1929 char ALNAGain1
; /* Store A external LNA#1 value for ch100~128 */
1930 char ALNAGain2
; /* Store A external LNA#2 value for ch132~165 */
1936 u8 TxMixerGain24G
; /* Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G */
1938 #endif /* RT30xx // */
1939 /* ---------------------------- */
1941 /* ---------------------------- */
1942 MCU_LEDCS_STRUC LedCntl
;
1943 u16 Led1
; /* read from EEPROM 0x3c */
1944 u16 Led2
; /* EEPROM 0x3e */
1945 u16 Led3
; /* EEPROM 0x40 */
1946 u8 LedIndicatorStrength
;
1947 u8 RssiSingalstrengthOffet
;
1948 BOOLEAN bLedOnScanning
;
1951 /*****************************************************************************************/
1952 /* 802.11 related parameters */
1953 /*****************************************************************************************/
1954 /* outgoing BEACON frame buffer and corresponding TXD */
1955 struct rt_txwi BeaconTxWI
;
1957 u16 BeaconOffset
[HW_BEACON_MAX_COUNT
];
1959 /* pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. */
1960 struct rt_pspoll_frame PsPollFrame
;
1961 struct rt_header_802_11 NullFrame
;
1964 struct rt_tx_context BeaconContext
[BEACON_RING_SIZE
];
1965 struct rt_tx_context NullContext
;
1966 struct rt_tx_context PsPollContext
;
1967 struct rt_tx_context RTSContext
;
1968 #endif /* RTMP_MAC_USB // */
1970 /*=========AP=========== */
1972 /*=======STA=========== */
1973 /* ----------------------------------------------- */
1974 /* STA specific configuration & operation status */
1975 /* used only when pAd->OpMode == OPMODE_STA */
1976 /* ----------------------------------------------- */
1977 struct rt_sta_admin_config StaCfg
; /* user desired settings */
1978 struct rt_sta_active_config StaActive
; /* valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) */
1979 char nickname
[IW_ESSID_MAX_SIZE
+ 1]; /* nickname, only used in the iwconfig i/f */
1982 /*=======Common=========== */
1983 /* OP mode: either AP or STA */
1984 u8 OpMode
; /* OPMODE_STA, OPMODE_AP */
1986 int IndicateMediaState
; /* Base on Indication state, default is NdisMediaStateDisConnected */
1988 /* MAT related parameters */
1990 /* configuration: read from Registry & E2PROM */
1991 BOOLEAN bLocalAdminMAC
; /* Use user changed MAC */
1992 u8 PermanentAddress
[MAC_ADDR_LEN
]; /* Factory default MAC address */
1993 u8 CurrentAddress
[MAC_ADDR_LEN
]; /* User changed MAC address */
1995 /* ------------------------------------------------------ */
1996 /* common configuration to both OPMODE_STA and OPMODE_AP */
1997 /* ------------------------------------------------------ */
1998 struct rt_common_config CommonCfg
;
1999 struct rt_mlme Mlme
;
2001 /* AP needs those vaiables for site survey feature. */
2002 struct rt_mlme_aux MlmeAux
; /* temporary settings used during MLME state machine */
2003 struct rt_bss_table ScanTab
; /* store the latest SCAN result */
2005 /*About MacTab, the sta driver will use #0 and #1 for multicast and AP. */
2006 struct rt_mac_table MacTab
; /* ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. */
2007 spinlock_t MacTabLock
;
2009 struct rt_ba_table BATable
;
2011 spinlock_t BATabLock
;
2012 struct rt_ralink_timer RECBATimer
;
2014 /* encryption/decryption KEY tables */
2015 struct rt_cipher_key SharedKey
[MAX_MBSSID_NUM
][4]; /* STA always use SharedKey[BSS0][0..3] */
2017 /* RX re-assembly buffer for fragmentation */
2018 struct rt_fragment_frame FragFrame
; /* Frame storage for fragment frame */
2020 /* various Counters */
2021 struct rt_counter_802_3 Counters8023
; /* 802.3 counters */
2022 struct rt_counter_802_11 WlanCounters
; /* 802.11 MIB counters */
2023 struct rt_counter_ralink RalinkCounters
; /* Ralink propriety counters */
2024 struct rt_counter_drs DrsCounters
; /* counters for Dynamic TX Rate Switching */
2025 struct rt_private PrivateInfo
; /* Private information & counters */
2027 /* flags, see fRTMP_ADAPTER_xxx flags */
2028 unsigned long Flags
; /* Represent current device status */
2029 unsigned long PSFlags
; /* Power Save operation flag. */
2031 /* current TX sequence # */
2034 /* Control disconnect / connect event generation */
2035 /*+++Didn't used anymore */
2036 unsigned long LinkDownTime
;
2038 unsigned long LastRxRate
;
2039 unsigned long LastTxRate
;
2040 /*+++Used only for Station */
2041 BOOLEAN bConfigChanged
; /* Config Change flag for the same SSID setting */
2044 unsigned long ExtraInfo
; /* Extra information for displaying status */
2045 unsigned long SystemErrorBitmap
; /* b0: E2PROM version error */
2047 /*+++Didn't used anymore */
2048 unsigned long MacIcVersion
; /* MAC/BBP serial interface issue solved after ver.D */
2051 /* --------------------------- */
2052 /* System event log */
2053 /* --------------------------- */
2054 struct rt_802_11_event_table EventTab
;
2058 /*****************************************************************************************/
2059 /* Statistic related parameters */
2060 /*****************************************************************************************/
2062 unsigned long BulkOutDataOneSecCount
;
2063 unsigned long BulkInDataOneSecCount
;
2064 unsigned long BulkLastOneSecCount
; /* BulkOutDataOneSecCount + BulkInDataOneSecCount */
2065 unsigned long watchDogRxCnt
;
2066 unsigned long watchDogRxOverFlowCnt
;
2067 unsigned long watchDogTxPendingCnt
[NUM_OF_TX_RING
];
2068 int TransferedLength
[NUM_OF_TX_RING
];
2069 #endif /* RTMP_MAC_USB // */
2071 BOOLEAN bUpdateBcnCntDone
;
2072 unsigned long watchDogMacDeadlock
; /* prevent MAC/BBP into deadlock condition */
2073 /* ---------------------------- */
2074 /* DEBUG paramerts */
2075 /* ---------------------------- */
2076 /*unsigned long DebugSetting[4]; */
2077 BOOLEAN bBanAllBaSetup
;
2078 BOOLEAN bPromiscuous
;
2080 /* ---------------------------- */
2081 /* rt2860c emulation-use Parameters */
2082 /* ---------------------------- */
2083 /*unsigned long rtsaccu[30]; */
2084 /*unsigned long ctsaccu[30]; */
2085 /*unsigned long cfendaccu[30]; */
2086 /*unsigned long bacontent[16]; */
2087 /*unsigned long rxint[RX_RING_SIZE+1]; */
2090 BOOLEAN bForcePrintTX
;
2091 BOOLEAN bForcePrintRX
;
2092 /*BOOLEAN bDisablescanning; //defined in RT2870 USB */
2093 BOOLEAN bStaFifoTest
;
2094 BOOLEAN bProtectionTest
;
2095 BOOLEAN bBroadComHT
;
2096 /*+++Following add from RT2870 USB. */
2097 unsigned long BulkOutReq
;
2098 unsigned long BulkOutComplete
;
2099 unsigned long BulkOutCompleteOther
;
2100 unsigned long BulkOutCompleteCancel
; /* seems not use now? */
2101 unsigned long BulkInReq
;
2102 unsigned long BulkInComplete
;
2103 unsigned long BulkInCompleteFail
;
2106 struct wificonf WIFItestbed
;
2108 struct reordering_mpdu_pool mpdu_blk_pool
;
2110 unsigned long OneSecondnonBEpackets
; /* record non BE packets per second */
2113 struct iw_statistics iw_stats
;
2115 struct net_device_stats stats
;
2116 #endif /* LINUX // */
2118 unsigned long TbttTickCount
;
2119 #ifdef PCI_MSI_SUPPORT
2121 #endif /* PCI_MSI_SUPPORT // */
2125 #define TIME_BASE (1000000/OS_HZ)
2126 #define TIME_ONE_SECOND (1000000/TIME_BASE)
2128 unsigned long be_adjust_last_time
;
2134 #ifdef RTMP_EFUSE_SUPPORT
2136 u8 EEPROMImage
[1024];
2137 #endif /* RTMP_EFUSE_SUPPORT // */
2138 #endif /* RT30xx // */
2141 #define DELAYINTMASK 0x0003fffb
2142 #define INTMASK 0x0003fffb
2143 #define IndMask 0x0003fffc
2144 #define RxINT 0x00000005 /* Delayed Rx or indivi rx */
2145 #define TxDataInt 0x000000fa /* Delayed Tx or indivi tx */
2146 #define TxMgmtInt 0x00000102 /* Delayed Tx or indivi tx */
2147 #define TxCoherent 0x00020000 /* tx coherent */
2148 #define RxCoherent 0x00010000 /* rx coherent */
2149 #define McuCommand 0x00000200 /* mcu */
2150 #define PreTBTTInt 0x00001000 /* Pre-TBTT interrupt */
2151 #define TBTTInt 0x00000800 /* TBTT interrupt */
2152 #define GPTimeOutInt 0x00008000 /* GPtimeout interrupt */
2153 #define AutoWakeupInt 0x00004000 /* AutoWakeupInt interrupt */
2154 #define FifoStaFullInt 0x00002000 /* fifo statistics full interrupt */
2156 /***************************************************************************
2157 * Rx Path software control block related data structures
2158 **************************************************************************/
2160 RT28XX_RXD_STRUC RxD
;
2161 struct rt_rxwi
*pRxWI
;
2162 struct rt_header_802_11
*pHeader
;
2167 u8 UserPriority
; /* for calculate TKIP MIC using */
2170 #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag)
2171 #define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag)
2172 #define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag))
2174 #define fRX_WDS 0x0001
2175 #define fRX_AMSDU 0x0002
2176 #define fRX_ARALINK 0x0004
2177 #define fRX_HTC 0x0008
2178 #define fRX_PAD 0x0010
2179 #define fRX_AMPDU 0x0020
2180 #define fRX_QOS 0x0040
2181 #define fRX_INFRA 0x0080
2182 #define fRX_EAP 0x0100
2183 #define fRX_MESH 0x0200
2184 #define fRX_APCLI 0x0400
2185 #define fRX_DLS 0x0800
2186 #define fRX_WPI 0x1000
2188 #define LENGTH_AMSDU_SUBFRAMEHEAD 14
2189 #define LENGTH_ARALINK_SUBFRAMEHEAD 14
2190 #define LENGTH_ARALINK_HEADER_FIELD 2
2192 /***************************************************************************
2193 * Tx Path software control block related data structures
2194 **************************************************************************/
2195 #define TX_UNKOWN_FRAME 0x00
2196 #define TX_MCAST_FRAME 0x01
2197 #define TX_LEGACY_FRAME 0x02
2198 #define TX_AMPDU_FRAME 0x04
2199 #define TX_AMSDU_FRAME 0x08
2200 #define TX_RALINK_FRAME 0x10
2201 #define TX_FRAG_FRAME 0x20
2203 /* Currently the sizeof(struct rt_tx_blk) is 148 bytes. */
2206 u8 TxFrameType
; /* Indicate the Transmission type of the all frames in one batch */
2207 u8 TotalFrameNum
; /* Total frame number want to send-out in one batch */
2208 u16 TotalFragNum
; /* Total frame fragments required in one batch */
2209 u16 TotalFrameLen
; /* Total length of all frames want to send-out in one batch */
2211 struct rt_queue_header TxPacketList
;
2212 struct rt_mac_table_entry
*pMacEntry
; /* NULL: packet with 802.11 RA field is multicast/broadcast address */
2213 HTTRANSMIT_SETTING
*pTransmit
;
2215 /* Following structure used for the characteristics of a specific packet. */
2217 u8
*pSrcBufHeader
; /* Reference to the head of sk_buff->data */
2218 u8
*pSrcBufData
; /* Reference to the sk_buff->data, will changed depends on hanlding progresss */
2219 u32 SrcBufLen
; /* Length of packet payload which not including Layer 2 header */
2220 u8
*pExtraLlcSnapEncap
; /* NULL means no extra LLC/SNAP is required */
2221 u8 HeaderBuf
[128]; /* TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP */
2222 /*RT2870 2.1.0.0 uses only 80 bytes */
2223 /*RT3070 2.1.1.0 uses only 96 bytes */
2224 /*RT3090 2.1.0.0 uses only 96 bytes */
2225 u8 MpduHeaderLen
; /* 802.11 header length NOT including the padding */
2226 u8 HdrPadLen
; /* recording Header Padding Length; */
2227 u8 apidx
; /* The interface associated to this packet */
2228 u8 Wcid
; /* The MAC entry associated to this packet */
2229 u8 UserPriority
; /* priority class of packet */
2230 u8 FrameGap
; /* what kind of IFS this packet use */
2231 u8 MpduReqNum
; /* number of fragments of this frame */
2232 u8 TxRate
; /* TODO: Obsoleted? Should change to MCS? */
2233 u8 CipherAlg
; /* cipher alogrithm */
2234 struct rt_cipher_key
*pKey
;
2236 u16 Flags
; /*See following definitions for detail. */
2238 /*YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. */
2239 unsigned long Priv
; /* Hardware specific value saved in here. */
2242 #define fTX_bRtsRequired 0x0001 /* Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. */
2243 #define fTX_bAckRequired 0x0002 /* the packet need ack response */
2244 #define fTX_bPiggyBack 0x0004 /* Legacy device use Piggback or not */
2245 #define fTX_bHTRate 0x0008 /* allow to use HT rate */
2246 #define fTX_bForceNonQoS 0x0010 /* force to transmit frame without WMM-QoS in HT mode */
2247 #define fTX_bAllowFrag 0x0020 /* allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment */
2248 #define fTX_bMoreData 0x0040 /* there are more data packets in PowerSave Queue */
2249 #define fTX_bWMM 0x0080 /* QOS Data */
2250 #define fTX_bClearEAPFrame 0x0100
2252 #define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag)
2253 #define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0)
2254 #define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag))
2256 /***************************************************************************
2257 * Other static inline function definitions
2258 **************************************************************************/
2259 static inline void ConvertMulticastIP2MAC(u8
*pIpAddr
,
2263 if (pIpAddr
== NULL
)
2266 if (ppMacAddr
== NULL
|| *ppMacAddr
== NULL
)
2269 switch (ProtoType
) {
2271 /* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */
2272 *(*ppMacAddr
) = 0x33;
2273 *(*ppMacAddr
+ 1) = 0x33;
2274 *(*ppMacAddr
+ 2) = pIpAddr
[12];
2275 *(*ppMacAddr
+ 3) = pIpAddr
[13];
2276 *(*ppMacAddr
+ 4) = pIpAddr
[14];
2277 *(*ppMacAddr
+ 5) = pIpAddr
[15];
2282 /* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */
2283 *(*ppMacAddr
) = 0x01;
2284 *(*ppMacAddr
+ 1) = 0x00;
2285 *(*ppMacAddr
+ 2) = 0x5e;
2286 *(*ppMacAddr
+ 3) = pIpAddr
[1] & 0x7f;
2287 *(*ppMacAddr
+ 4) = pIpAddr
[2];
2288 *(*ppMacAddr
+ 5) = pIpAddr
[3];
2295 char *GetPhyMode(int Mode
);
2296 char *GetBW(int BW
);
2299 /* Private routines in rtmp_init.c */
2301 int RTMPAllocAdapterBlock(void *handle
,
2302 struct rt_rtmp_adapter
**ppAdapter
);
2304 int RTMPAllocTxRxRingMemory(struct rt_rtmp_adapter
*pAd
);
2306 void RTMPFreeAdapter(struct rt_rtmp_adapter
*pAd
);
2308 int NICReadRegParameters(struct rt_rtmp_adapter
*pAd
,
2309 void *WrapperConfigurationContext
);
2311 #ifdef RTMP_RF_RW_SUPPORT
2312 void NICInitRFRegisters(struct rt_rtmp_adapter
*pAd
);
2314 void RtmpChipOpsRFHook(struct rt_rtmp_adapter
*pAd
);
2316 int RT30xxWriteRFRegister(struct rt_rtmp_adapter
*pAd
,
2317 u8 regID
, u8 value
);
2319 int RT30xxReadRFRegister(struct rt_rtmp_adapter
*pAd
,
2320 u8 regID
, u8
*pValue
);
2321 #endif /* RTMP_RF_RW_SUPPORT // */
2323 void NICReadEEPROMParameters(struct rt_rtmp_adapter
*pAd
, u8
*mac_addr
);
2325 void NICInitAsicFromEEPROM(struct rt_rtmp_adapter
*pAd
);
2327 int NICInitializeAdapter(struct rt_rtmp_adapter
*pAd
, IN BOOLEAN bHardReset
);
2329 int NICInitializeAsic(struct rt_rtmp_adapter
*pAd
, IN BOOLEAN bHardReset
);
2331 void NICIssueReset(struct rt_rtmp_adapter
*pAd
);
2333 void RTMPRingCleanUp(struct rt_rtmp_adapter
*pAd
, u8 RingType
);
2335 void UserCfgInit(struct rt_rtmp_adapter
*pAd
);
2337 void NICResetFromError(struct rt_rtmp_adapter
*pAd
);
2339 int NICLoadFirmware(struct rt_rtmp_adapter
*pAd
);
2341 void NICEraseFirmware(struct rt_rtmp_adapter
*pAd
);
2343 int NICLoadRateSwitchingParams(struct rt_rtmp_adapter
*pAd
);
2345 BOOLEAN
NICCheckForHang(struct rt_rtmp_adapter
*pAd
);
2347 void NICUpdateFifoStaCounters(struct rt_rtmp_adapter
*pAd
);
2349 void NICUpdateRawCounters(struct rt_rtmp_adapter
*pAd
);
2351 void RTMPZeroMemory(void *pSrc
, unsigned long Length
);
2353 unsigned long RTMPCompareMemory(void *pSrc1
, void *pSrc2
, unsigned long Length
);
2355 void RTMPMoveMemory(void *pDest
, void *pSrc
, unsigned long Length
);
2357 void AtoH(char *src
, u8
*dest
, int destlen
);
2359 void RTMPPatchMacBbpBug(struct rt_rtmp_adapter
*pAd
);
2361 void RTMPInitTimer(struct rt_rtmp_adapter
*pAd
,
2362 struct rt_ralink_timer
*pTimer
,
2363 void *pTimerFunc
, void *pData
, IN BOOLEAN Repeat
);
2365 void RTMPSetTimer(struct rt_ralink_timer
*pTimer
, unsigned long Value
);
2367 void RTMPModTimer(struct rt_ralink_timer
*pTimer
, unsigned long Value
);
2369 void RTMPCancelTimer(struct rt_ralink_timer
*pTimer
, OUT BOOLEAN
* pCancelled
);
2371 void RTMPSetLED(struct rt_rtmp_adapter
*pAd
, u8 Status
);
2373 void RTMPSetSignalLED(struct rt_rtmp_adapter
*pAd
, IN NDIS_802_11_RSSI Dbm
);
2375 void RTMPEnableRxTx(struct rt_rtmp_adapter
*pAd
);
2378 /* prototype in action.c */
2380 void ActionStateMachineInit(struct rt_rtmp_adapter
*pAd
,
2381 struct rt_state_machine
*S
,
2382 OUT STATE_MACHINE_FUNC Trans
[]);
2384 void MlmeADDBAAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2386 void MlmeDELBAAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2388 void MlmeDLSAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2390 void MlmeInvalidAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2392 void MlmeQOSAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2394 void PeerAddBAReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2396 void PeerAddBARspAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2398 void PeerDelBAAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2400 void PeerBAAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2402 void SendPSMPAction(struct rt_rtmp_adapter
*pAd
, u8 Wcid
, u8 Psmp
);
2404 void PeerRMAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2406 void PeerPublicAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2408 void PeerHTAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2410 void PeerQOSAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2412 void RECBATimerTimeout(void *SystemSpecific1
,
2413 void *FunctionContext
,
2414 void *SystemSpecific2
, void *SystemSpecific3
);
2416 void ORIBATimerTimeout(struct rt_rtmp_adapter
*pAd
);
2418 void SendRefreshBAR(struct rt_rtmp_adapter
*pAd
, struct rt_mac_table_entry
*pEntry
);
2420 void ActHeaderInit(struct rt_rtmp_adapter
*pAd
,
2421 struct rt_header_802_11
*pHdr80211
,
2422 u8
*Addr1
, u8
*Addr2
, u8
*Addr3
);
2424 void BarHeaderInit(struct rt_rtmp_adapter
*pAd
,
2425 struct rt_frame_bar
*pCntlBar
, u8
*pDA
, u8
*pSA
);
2427 void InsertActField(struct rt_rtmp_adapter
*pAd
,
2429 unsigned long *pFrameLen
, u8 Category
, u8 ActCode
);
2431 BOOLEAN
CntlEnqueueForRecv(struct rt_rtmp_adapter
*pAd
,
2433 unsigned long MsgLen
, struct rt_frame_ba_req
*pMsg
);
2436 /* Private routines in rtmp_data.c */
2438 BOOLEAN
RTMPHandleRxDoneInterrupt(struct rt_rtmp_adapter
*pAd
);
2440 BOOLEAN
RTMPHandleTxRingDmaDoneInterrupt(struct rt_rtmp_adapter
*pAd
,
2441 INT_SOURCE_CSR_STRUC TxRingBitmap
);
2443 void RTMPHandleMgmtRingDmaDoneInterrupt(struct rt_rtmp_adapter
*pAd
);
2445 void RTMPHandleTBTTInterrupt(struct rt_rtmp_adapter
*pAd
);
2447 void RTMPHandlePreTBTTInterrupt(struct rt_rtmp_adapter
*pAd
);
2449 void RTMPHandleTwakeupInterrupt(struct rt_rtmp_adapter
*pAd
);
2451 void RTMPHandleRxCoherentInterrupt(struct rt_rtmp_adapter
*pAd
);
2453 BOOLEAN
TxFrameIsAggregatible(struct rt_rtmp_adapter
*pAd
,
2454 u8
*pPrevAddr1
, u8
*p8023hdr
);
2456 BOOLEAN
PeerIsAggreOn(struct rt_rtmp_adapter
*pAd
,
2457 unsigned long TxRate
, struct rt_mac_table_entry
*pMacEntry
);
2459 int Sniff2BytesFromNdisBuffer(char *pFirstBuffer
,
2461 u8
*pByte0
, u8
*pByte1
);
2463 int STASendPacket(struct rt_rtmp_adapter
*pAd
, void *pPacket
);
2465 void STASendPackets(void *MiniportAdapterContext
,
2466 void **ppPacketArray
, u32 NumberOfPackets
);
2468 void RTMPDeQueuePacket(struct rt_rtmp_adapter
*pAd
,
2469 IN BOOLEAN bIntContext
,
2470 u8 QueIdx
, u8 Max_Tx_Packets
);
2472 int RTMPHardTransmit(struct rt_rtmp_adapter
*pAd
,
2474 u8 QueIdx
, unsigned long *pFreeTXDLeft
);
2476 int STAHardTransmit(struct rt_rtmp_adapter
*pAd
,
2477 struct rt_tx_blk
*pTxBlk
, u8 QueIdx
);
2479 void STARxEAPOLFrameIndicate(struct rt_rtmp_adapter
*pAd
,
2480 struct rt_mac_table_entry
*pEntry
,
2481 struct rt_rx_blk
*pRxBlk
, u8 FromWhichBSSID
);
2483 int RTMPFreeTXDRequest(struct rt_rtmp_adapter
*pAd
,
2485 u8 NumberRequired
, u8
*FreeNumberIs
);
2487 int MlmeHardTransmit(struct rt_rtmp_adapter
*pAd
,
2488 u8 QueIdx
, void *pPacket
);
2490 int MlmeHardTransmitMgmtRing(struct rt_rtmp_adapter
*pAd
,
2491 u8 QueIdx
, void *pPacket
);
2494 int MlmeHardTransmitTxRing(struct rt_rtmp_adapter
*pAd
,
2495 u8 QueIdx
, void *pPacket
);
2497 int MlmeDataHardTransmit(struct rt_rtmp_adapter
*pAd
,
2498 u8 QueIdx
, void *pPacket
);
2500 void RTMPWriteTxDescriptor(struct rt_rtmp_adapter
*pAd
,
2501 struct rt_txd
*pTxD
, IN BOOLEAN bWIV
, u8 QSEL
);
2502 #endif /* RTMP_MAC_PCI // */
2504 u16
RTMPCalcDuration(struct rt_rtmp_adapter
*pAd
, u8 Rate
, unsigned long Size
);
2506 void RTMPWriteTxWI(struct rt_rtmp_adapter
*pAd
, struct rt_txwi
* pTxWI
, IN BOOLEAN FRAG
, IN BOOLEAN CFACK
, IN BOOLEAN InsTimestamp
, IN BOOLEAN AMPDU
, IN BOOLEAN Ack
, IN BOOLEAN NSeq
, /* HW new a sequence. */
2509 unsigned long Length
,
2514 IN BOOLEAN CfAck
, IN HTTRANSMIT_SETTING
* pTransmit
);
2516 void RTMPWriteTxWI_Data(struct rt_rtmp_adapter
*pAd
,
2517 struct rt_txwi
*pTxWI
, struct rt_tx_blk
*pTxBlk
);
2519 void RTMPWriteTxWI_Cache(struct rt_rtmp_adapter
*pAd
,
2520 struct rt_txwi
*pTxWI
, struct rt_tx_blk
*pTxBlk
);
2522 void RTMPSuspendMsduTransmission(struct rt_rtmp_adapter
*pAd
);
2524 void RTMPResumeMsduTransmission(struct rt_rtmp_adapter
*pAd
);
2526 int MiniportMMRequest(struct rt_rtmp_adapter
*pAd
,
2527 u8 QueIdx
, u8
*pData
, u32 Length
);
2529 /*+++mark by shiang, now this function merge to MiniportMMRequest() */
2530 /*---mark by shiang, now this function merge to MiniportMMRequest() */
2532 void RTMPSendNullFrame(struct rt_rtmp_adapter
*pAd
,
2533 u8 TxRate
, IN BOOLEAN bQosNull
);
2535 void RTMPSendDisassociationFrame(struct rt_rtmp_adapter
*pAd
);
2537 void RTMPSendRTSFrame(struct rt_rtmp_adapter
*pAd
,
2539 IN
unsigned int NextMpduSize
,
2543 u8 QueIdx
, u8 FrameGap
);
2545 struct rt_queue_header
*RTMPCheckTxSwQueue(struct rt_rtmp_adapter
*pAd
, u8
* QueIdx
);
2547 void RTMPReportMicError(struct rt_rtmp_adapter
*pAd
, struct rt_cipher_key
*pWpaKey
);
2549 void WpaMicFailureReportFrame(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2551 void WpaDisassocApAndBlockAssoc(void *SystemSpecific1
,
2552 void *FunctionContext
,
2553 void *SystemSpecific2
,
2554 void *SystemSpecific3
);
2556 void WpaStaPairwiseKeySetting(struct rt_rtmp_adapter
*pAd
);
2558 void WpaStaGroupKeySetting(struct rt_rtmp_adapter
*pAd
);
2560 int RTMPCloneNdisPacket(struct rt_rtmp_adapter
*pAd
,
2561 IN BOOLEAN pInsAMSDUHdr
,
2563 void **ppOutPacket
);
2565 int RTMPAllocateNdisPacket(struct rt_rtmp_adapter
*pAd
,
2569 u8
*pData
, u32 DataLen
);
2571 void RTMPFreeNdisPacket(struct rt_rtmp_adapter
*pAd
, void *pPacket
);
2573 BOOLEAN
RTMPFreeTXDUponTxDmaDone(struct rt_rtmp_adapter
*pAd
, u8 QueIdx
);
2575 BOOLEAN
RTMPCheckDHCPFrame(struct rt_rtmp_adapter
*pAd
, void *pPacket
);
2577 BOOLEAN
RTMPCheckEtherType(struct rt_rtmp_adapter
*pAd
, void *pPacket
);
2580 /* Private routines in rtmp_wep.c */
2582 void RTMPInitWepEngine(struct rt_rtmp_adapter
*pAd
,
2584 u8 KeyId
, u8 KeyLen
, u8
*pDest
);
2586 void RTMPEncryptData(struct rt_rtmp_adapter
*pAd
,
2587 u8
*pSrc
, u8
*pDest
, u32 Len
);
2589 BOOLEAN
RTMPSoftDecryptWEP(struct rt_rtmp_adapter
*pAd
,
2591 unsigned long DataByteCnt
, struct rt_cipher_key
*pGroupKey
);
2593 void RTMPSetICV(struct rt_rtmp_adapter
*pAd
, u8
*pDest
);
2595 void ARCFOUR_INIT(struct rt_arcfourcontext
*Ctx
, u8
*pKey
, u32 KeyLen
);
2597 u8
ARCFOUR_BYTE(struct rt_arcfourcontext
*Ctx
);
2599 void ARCFOUR_DECRYPT(struct rt_arcfourcontext
*Ctx
,
2600 u8
*pDest
, u8
*pSrc
, u32 Len
);
2602 void ARCFOUR_ENCRYPT(struct rt_arcfourcontext
*Ctx
,
2603 u8
*pDest
, u8
*pSrc
, u32 Len
);
2605 void WPAARCFOUR_ENCRYPT(struct rt_arcfourcontext
*Ctx
,
2606 u8
*pDest
, u8
*pSrc
, u32 Len
);
2608 u32
RTMP_CALC_FCS32(u32 Fcs
, u8
*Cp
, int Len
);
2614 /* Asic/RF/BBP related functions */
2616 void AsicAdjustTxPower(struct rt_rtmp_adapter
*pAd
);
2618 void AsicUpdateProtect(struct rt_rtmp_adapter
*pAd
,
2621 IN BOOLEAN bDisableBGProtect
, IN BOOLEAN bNonGFExist
);
2623 void AsicSwitchChannel(struct rt_rtmp_adapter
*pAd
,
2624 u8 Channel
, IN BOOLEAN bScan
);
2626 void AsicLockChannel(struct rt_rtmp_adapter
*pAd
, u8 Channel
);
2628 void AsicRfTuningExec(void *SystemSpecific1
,
2629 void *FunctionContext
,
2630 void *SystemSpecific2
, void *SystemSpecific3
);
2632 void AsicResetBBPAgent(struct rt_rtmp_adapter
*pAd
);
2634 void AsicSleepThenAutoWakeup(struct rt_rtmp_adapter
*pAd
,
2635 u16 TbttNumToNextWakeUp
);
2637 void AsicForceSleep(struct rt_rtmp_adapter
*pAd
);
2639 void AsicForceWakeup(struct rt_rtmp_adapter
*pAd
, IN BOOLEAN bFromTx
);
2641 void AsicSetBssid(struct rt_rtmp_adapter
*pAd
, u8
*pBssid
);
2643 void AsicSetMcastWC(struct rt_rtmp_adapter
*pAd
);
2645 void AsicDelWcidTab(struct rt_rtmp_adapter
*pAd
, u8 Wcid
);
2647 void AsicEnableRDG(struct rt_rtmp_adapter
*pAd
);
2649 void AsicDisableRDG(struct rt_rtmp_adapter
*pAd
);
2651 void AsicDisableSync(struct rt_rtmp_adapter
*pAd
);
2653 void AsicEnableBssSync(struct rt_rtmp_adapter
*pAd
);
2655 void AsicEnableIbssSync(struct rt_rtmp_adapter
*pAd
);
2657 void AsicSetEdcaParm(struct rt_rtmp_adapter
*pAd
, struct rt_edca_parm
*pEdcaParm
);
2659 void AsicSetSlotTime(struct rt_rtmp_adapter
*pAd
, IN BOOLEAN bUseShortSlotTime
);
2661 void AsicAddSharedKeyEntry(struct rt_rtmp_adapter
*pAd
,
2665 u8
*pKey
, u8
*pTxMic
, u8
*pRxMic
);
2667 void AsicRemoveSharedKeyEntry(struct rt_rtmp_adapter
*pAd
,
2668 u8 BssIndex
, u8 KeyIdx
);
2670 void AsicUpdateWCIDAttribute(struct rt_rtmp_adapter
*pAd
,
2674 IN BOOLEAN bUsePairewiseKeyTable
);
2676 void AsicUpdateWCIDIVEIV(struct rt_rtmp_adapter
*pAd
,
2677 u16 WCID
, unsigned long uIV
, unsigned long uEIV
);
2679 void AsicUpdateRxWCIDTable(struct rt_rtmp_adapter
*pAd
,
2680 u16 WCID
, u8
*pAddr
);
2682 void AsicAddKeyEntry(struct rt_rtmp_adapter
*pAd
,
2686 struct rt_cipher_key
*pCipherKey
,
2687 IN BOOLEAN bUsePairewiseKeyTable
, IN BOOLEAN bTxKey
);
2689 void AsicAddPairwiseKeyEntry(struct rt_rtmp_adapter
*pAd
,
2691 u8 WCID
, struct rt_cipher_key
*pCipherKey
);
2693 void AsicRemovePairwiseKeyEntry(struct rt_rtmp_adapter
*pAd
,
2694 u8 BssIdx
, u8 Wcid
);
2696 BOOLEAN
AsicSendCommandToMcu(struct rt_rtmp_adapter
*pAd
,
2698 u8 Token
, u8 Arg0
, u8 Arg1
);
2701 BOOLEAN
AsicCheckCommanOk(struct rt_rtmp_adapter
*pAd
, u8 Command
);
2702 #endif /* RTMP_MAC_PCI // */
2704 void MacAddrRandomBssid(struct rt_rtmp_adapter
*pAd
, u8
*pAddr
);
2706 void MgtMacHeaderInit(struct rt_rtmp_adapter
*pAd
,
2707 struct rt_header_802_11
*pHdr80211
,
2709 u8 ToDs
, u8
*pDA
, u8
*pBssid
);
2711 void MlmeRadioOff(struct rt_rtmp_adapter
*pAd
);
2713 void MlmeRadioOn(struct rt_rtmp_adapter
*pAd
);
2715 void BssTableInit(struct rt_bss_table
*Tab
);
2717 void BATableInit(struct rt_rtmp_adapter
*pAd
, struct rt_ba_table
*Tab
);
2719 unsigned long BssTableSearch(struct rt_bss_table
*Tab
, u8
*pBssid
, u8 Channel
);
2721 unsigned long BssSsidTableSearch(struct rt_bss_table
*Tab
,
2723 u8
*pSsid
, u8 SsidLen
, u8 Channel
);
2725 unsigned long BssTableSearchWithSSID(struct rt_bss_table
*Tab
,
2728 u8 SsidLen
, u8 Channel
);
2730 unsigned long BssSsidTableSearchBySSID(struct rt_bss_table
*Tab
,
2731 u8
*pSsid
, u8 SsidLen
);
2733 void BssTableDeleteEntry(struct rt_bss_table
*pTab
,
2734 u8
*pBssid
, u8 Channel
);
2736 void BATableDeleteORIEntry(struct rt_rtmp_adapter
*pAd
,
2737 struct rt_ba_ori_entry
*pBAORIEntry
);
2739 void BssEntrySet(struct rt_rtmp_adapter
*pAd
, struct rt_bss_entry
*pBss
, u8
*pBssid
, char Ssid
[], u8 SsidLen
, u8 BssType
, u16 BeaconPeriod
, struct rt_cf_parm
* CfParm
, u16 AtimWin
, u16 CapabilityInfo
, u8 SupRate
[], u8 SupRateLen
, u8 ExtRate
[], u8 ExtRateLen
, struct rt_ht_capability_ie
* pHtCapability
, struct rt_add_ht_info_ie
* pAddHtInfo
, /* AP might use this additional ht info IE */
2742 u8 NewExtChanOffset
,
2745 IN LARGE_INTEGER TimeStamp
,
2747 struct rt_edca_parm
*pEdcaParm
,
2748 struct rt_qos_capability_parm
*pQosCapability
,
2749 struct rt_qbss_load_parm
*pQbssLoad
,
2750 u16 LengthVIE
, struct rt_ndis_802_11_variable_ies
*pVIE
);
2752 unsigned long BssTableSetEntry(struct rt_rtmp_adapter
*pAd
, struct rt_bss_table
*pTab
, u8
*pBssid
, char Ssid
[], u8 SsidLen
, u8 BssType
, u16 BeaconPeriod
, struct rt_cf_parm
* CfParm
, u16 AtimWin
, u16 CapabilityInfo
, u8 SupRate
[], u8 SupRateLen
, u8 ExtRate
[], u8 ExtRateLen
, struct rt_ht_capability_ie
* pHtCapability
, struct rt_add_ht_info_ie
* pAddHtInfo
, /* AP might use this additional ht info IE */
2755 u8 NewExtChanOffset
,
2758 IN LARGE_INTEGER TimeStamp
,
2760 struct rt_edca_parm
*pEdcaParm
,
2761 struct rt_qos_capability_parm
*pQosCapability
,
2762 struct rt_qbss_load_parm
*pQbssLoad
,
2763 u16 LengthVIE
, struct rt_ndis_802_11_variable_ies
*pVIE
);
2765 void BATableInsertEntry(struct rt_rtmp_adapter
*pAd
,
2771 u8 OriginatorStatus
, IN BOOLEAN IsRecipient
);
2773 void BssTableSsidSort(struct rt_rtmp_adapter
*pAd
,
2774 struct rt_bss_table
*OutTab
, char Ssid
[], u8 SsidLen
);
2776 void BssTableSortByRssi(struct rt_bss_table
*OutTab
);
2778 void BssCipherParse(struct rt_bss_entry
*pBss
);
2780 int MlmeQueueInit(struct rt_mlme_queue
*Queue
);
2782 void MlmeQueueDestroy(struct rt_mlme_queue
*Queue
);
2784 BOOLEAN
MlmeEnqueue(struct rt_rtmp_adapter
*pAd
,
2785 unsigned long Machine
,
2786 unsigned long MsgType
, unsigned long MsgLen
, void *Msg
);
2788 BOOLEAN
MlmeEnqueueForRecv(struct rt_rtmp_adapter
*pAd
,
2790 unsigned long TimeStampHigh
,
2791 unsigned long TimeStampLow
,
2795 unsigned long MsgLen
, void *Msg
, u8 Signal
);
2797 BOOLEAN
MlmeDequeue(struct rt_mlme_queue
*Queue
, struct rt_mlme_queue_elem
**Elem
);
2799 void MlmeRestartStateMachine(struct rt_rtmp_adapter
*pAd
);
2801 BOOLEAN
MlmeQueueEmpty(struct rt_mlme_queue
*Queue
);
2803 BOOLEAN
MlmeQueueFull(struct rt_mlme_queue
*Queue
);
2805 BOOLEAN
MsgTypeSubst(struct rt_rtmp_adapter
*pAd
,
2806 struct rt_frame_802_11
*pFrame
,
2807 int *Machine
, int *MsgType
);
2809 void StateMachineInit(struct rt_state_machine
*Sm
,
2810 IN STATE_MACHINE_FUNC Trans
[],
2812 unsigned long MsgNr
,
2813 IN STATE_MACHINE_FUNC DefFunc
,
2814 unsigned long InitState
, unsigned long Base
);
2816 void StateMachineSetAction(struct rt_state_machine
*S
,
2817 unsigned long St
, unsigned long Msg
, IN STATE_MACHINE_FUNC F
);
2819 void StateMachinePerformAction(struct rt_rtmp_adapter
*pAd
,
2820 struct rt_state_machine
*S
, struct rt_mlme_queue_elem
*Elem
);
2822 void Drop(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2824 void AssocStateMachineInit(struct rt_rtmp_adapter
*pAd
,
2825 struct rt_state_machine
*Sm
,
2826 OUT STATE_MACHINE_FUNC Trans
[]);
2828 void ReassocTimeout(void *SystemSpecific1
,
2829 void *FunctionContext
,
2830 void *SystemSpecific2
, void *SystemSpecific3
);
2832 void AssocTimeout(void *SystemSpecific1
,
2833 void *FunctionContext
,
2834 void *SystemSpecific2
, void *SystemSpecific3
);
2836 void DisassocTimeout(void *SystemSpecific1
,
2837 void *FunctionContext
,
2838 void *SystemSpecific2
, void *SystemSpecific3
);
2840 /*---------------------------------------------- */
2841 void MlmeAssocReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2843 void MlmeReassocReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2845 void MlmeDisassocReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2847 void PeerAssocRspAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2849 void PeerReassocRspAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2851 void PeerDisassocAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2853 void DisassocTimeoutAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2855 void AssocTimeoutAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2857 void ReassocTimeoutAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2859 void Cls3errAction(struct rt_rtmp_adapter
*pAd
, u8
*pAddr
);
2861 void InvalidStateWhenAssoc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2863 void InvalidStateWhenReassoc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2865 void InvalidStateWhenDisassociate(struct rt_rtmp_adapter
*pAd
,
2866 struct rt_mlme_queue_elem
*Elem
);
2869 void MlmeCntlConfirm(struct rt_rtmp_adapter
*pAd
, unsigned long MsgType
, u16 Msg
);
2870 #endif /* RTMP_MAC_USB // */
2872 void ComposePsPoll(struct rt_rtmp_adapter
*pAd
);
2874 void ComposeNullFrame(struct rt_rtmp_adapter
*pAd
);
2876 void AssocPostProc(struct rt_rtmp_adapter
*pAd
,
2884 struct rt_edca_parm
*pEdcaParm
,
2885 struct rt_ht_capability_ie
*pHtCapability
,
2886 u8 HtCapabilityLen
, struct rt_add_ht_info_ie
*pAddHtInfo
);
2888 void AuthStateMachineInit(struct rt_rtmp_adapter
*pAd
,
2889 struct rt_state_machine
*sm
, OUT STATE_MACHINE_FUNC Trans
[]);
2891 void AuthTimeout(void *SystemSpecific1
,
2892 void *FunctionContext
,
2893 void *SystemSpecific2
, void *SystemSpecific3
);
2895 void MlmeAuthReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2897 void PeerAuthRspAtSeq2Action(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2899 void PeerAuthRspAtSeq4Action(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2901 void AuthTimeoutAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2903 void Cls2errAction(struct rt_rtmp_adapter
*pAd
, u8
*pAddr
);
2905 void MlmeDeauthReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2907 void InvalidStateWhenAuth(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2909 /*============================================= */
2911 void AuthRspStateMachineInit(struct rt_rtmp_adapter
*pAd
,
2912 struct rt_state_machine
*Sm
,
2913 IN STATE_MACHINE_FUNC Trans
[]);
2915 void PeerDeauthAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2917 void PeerAuthSimpleRspGenAndSend(struct rt_rtmp_adapter
*pAd
,
2918 struct rt_header_802_11
*pHdr80211
,
2921 u16 Reason
, u16 Status
);
2924 /* Private routines in dls.c */
2927 /*======================================== */
2929 void SyncStateMachineInit(struct rt_rtmp_adapter
*pAd
,
2930 struct rt_state_machine
*Sm
,
2931 OUT STATE_MACHINE_FUNC Trans
[]);
2933 void BeaconTimeout(void *SystemSpecific1
,
2934 void *FunctionContext
,
2935 void *SystemSpecific2
, void *SystemSpecific3
);
2937 void ScanTimeout(void *SystemSpecific1
,
2938 void *FunctionContext
,
2939 void *SystemSpecific2
, void *SystemSpecific3
);
2941 void InvalidStateWhenScan(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2943 void InvalidStateWhenJoin(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2945 void InvalidStateWhenStart(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2947 void EnqueueProbeRequest(struct rt_rtmp_adapter
*pAd
);
2949 BOOLEAN
ScanRunning(struct rt_rtmp_adapter
*pAd
);
2950 /*========================================= */
2952 void MlmeCntlInit(struct rt_rtmp_adapter
*pAd
,
2953 struct rt_state_machine
*S
, OUT STATE_MACHINE_FUNC Trans
[]);
2955 void MlmeCntlMachinePerformAction(struct rt_rtmp_adapter
*pAd
,
2956 struct rt_state_machine
*S
,
2957 struct rt_mlme_queue_elem
*Elem
);
2959 void CntlIdleProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2961 void CntlOidScanProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2963 void CntlOidSsidProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2965 void CntlOidRTBssidProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2967 void CntlMlmeRoamingProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2969 void CntlWaitDisassocProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2971 void CntlWaitJoinProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2973 void CntlWaitReassocProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2975 void CntlWaitStartProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2977 void CntlWaitAuthProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2979 void CntlWaitAuthProc2(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2981 void CntlWaitAssocProc(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
2983 void LinkUp(struct rt_rtmp_adapter
*pAd
, u8 BssType
);
2985 void LinkDown(struct rt_rtmp_adapter
*pAd
, IN BOOLEAN IsReqFromAP
);
2987 void IterateOnBssTab(struct rt_rtmp_adapter
*pAd
);
2989 void IterateOnBssTab2(struct rt_rtmp_adapter
*pAd
);;
2991 void JoinParmFill(struct rt_rtmp_adapter
*pAd
,
2992 struct rt_mlme_join_req
*JoinReq
, unsigned long BssIdx
);
2994 void AssocParmFill(struct rt_rtmp_adapter
*pAd
,
2995 struct rt_mlme_assoc_req
*AssocReq
,
2998 unsigned long Timeout
, u16 ListenIntv
);
3000 void ScanParmFill(struct rt_rtmp_adapter
*pAd
,
3001 struct rt_mlme_scan_req
*ScanReq
,
3003 u8 SsidLen
, u8 BssType
, u8 ScanType
);
3005 void DisassocParmFill(struct rt_rtmp_adapter
*pAd
,
3006 struct rt_mlme_disassoc_req
*DisassocReq
,
3007 u8
*pAddr
, u16 Reason
);
3009 void StartParmFill(struct rt_rtmp_adapter
*pAd
,
3010 struct rt_mlme_start_req
*StartReq
,
3011 char Ssid
[], u8 SsidLen
);
3013 void AuthParmFill(struct rt_rtmp_adapter
*pAd
,
3014 struct rt_mlme_auth_req
*AuthReq
,
3015 u8
*pAddr
, u16 Alg
);
3017 void EnqueuePsPoll(struct rt_rtmp_adapter
*pAd
);
3019 void EnqueueBeaconFrame(struct rt_rtmp_adapter
*pAd
);
3021 void MlmeJoinReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
3023 void MlmeScanReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
3025 void MlmeStartReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
3027 void ScanTimeoutAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
3029 void BeaconTimeoutAtJoinAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
3031 void PeerBeaconAtScanAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
3033 void PeerBeaconAtJoinAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
3035 void PeerBeacon(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
3037 void PeerProbeReqAction(struct rt_rtmp_adapter
*pAd
, struct rt_mlme_queue_elem
*Elem
);
3039 void ScanNextChannel(struct rt_rtmp_adapter
*pAd
);
3041 unsigned long MakeIbssBeacon(struct rt_rtmp_adapter
*pAd
);
3043 BOOLEAN
MlmeScanReqSanity(struct rt_rtmp_adapter
*pAd
,
3045 unsigned long MsgLen
,
3048 u8
*SsidLen
, u8
*ScanType
);
3050 BOOLEAN
PeerBeaconAndProbeRspSanity(struct rt_rtmp_adapter
*pAd
,
3052 unsigned long MsgLen
,
3062 OUT LARGE_INTEGER
* pTimestamp
,
3063 struct rt_cf_parm
*pCfParm
,
3065 u16
*pCapabilityInfo
,
3076 u8
*pAironetCellPowerLimit
,
3077 struct rt_edca_parm
*pEdcaParm
,
3078 struct rt_qbss_load_parm
*pQbssLoad
,
3079 struct rt_qos_capability_parm
*pQosCapability
,
3080 unsigned long *pRalinkIe
,
3081 u8
*pHtCapabilityLen
,
3082 u8
*pPreNHtCapabilityLen
,
3083 struct rt_ht_capability_ie
*pHtCapability
,
3085 struct rt_add_ht_info_ie
*AddHtInfo
,
3088 struct rt_ndis_802_11_variable_ies
*pVIE
);
3090 BOOLEAN
PeerAddBAReqActionSanity(struct rt_rtmp_adapter
*pAd
,
3092 unsigned long MsgLen
, u8
*pAddr2
);
3094 BOOLEAN
PeerAddBARspActionSanity(struct rt_rtmp_adapter
*pAd
,
3095 void *pMsg
, unsigned long MsgLen
);
3097 BOOLEAN
PeerDelBAActionSanity(struct rt_rtmp_adapter
*pAd
,
3098 u8 Wcid
, void *pMsg
, unsigned long MsgLen
);
3100 BOOLEAN
MlmeAssocReqSanity(struct rt_rtmp_adapter
*pAd
,
3102 unsigned long MsgLen
,
3104 u16
*CapabilityInfo
,
3105 unsigned long *Timeout
, u16
*ListenIntv
);
3107 BOOLEAN
MlmeAuthReqSanity(struct rt_rtmp_adapter
*pAd
,
3109 unsigned long MsgLen
,
3111 unsigned long *Timeout
, u16
*Alg
);
3113 BOOLEAN
MlmeStartReqSanity(struct rt_rtmp_adapter
*pAd
,
3115 unsigned long MsgLen
,
3116 char Ssid
[], u8
*Ssidlen
);
3118 BOOLEAN
PeerAuthSanity(struct rt_rtmp_adapter
*pAd
,
3120 unsigned long MsgLen
,
3124 u16
*Status
, char ChlgText
[]);
3126 BOOLEAN
PeerAssocRspSanity(struct rt_rtmp_adapter
*pAd
, void *pMsg
, unsigned long MsgLen
, u8
*pAddr2
, u16
*pCapabilityInfo
, u16
*pStatus
, u16
*pAid
, u8 SupRate
[], u8
*pSupRateLen
, u8 ExtRate
[], u8
*pExtRateLen
, struct rt_ht_capability_ie
*pHtCapability
, struct rt_add_ht_info_ie
*pAddHtInfo
, /* AP might use this additional ht info IE */
3127 u8
*pHtCapabilityLen
,
3129 u8
*pNewExtChannelOffset
,
3130 struct rt_edca_parm
*pEdcaParm
, u8
*pCkipFlag
);
3132 BOOLEAN
PeerDisassocSanity(struct rt_rtmp_adapter
*pAd
,
3134 unsigned long MsgLen
,
3135 u8
*pAddr2
, u16
*Reason
);
3137 BOOLEAN
PeerWpaMessageSanity(struct rt_rtmp_adapter
*pAd
,
3138 struct rt_eapol_packet
*pMsg
,
3139 unsigned long MsgLen
,
3140 u8 MsgType
, struct rt_mac_table_entry
*pEntry
);
3142 BOOLEAN
PeerDeauthSanity(struct rt_rtmp_adapter
*pAd
,
3144 unsigned long MsgLen
,
3145 u8
*pAddr2
, u16
*Reason
);
3147 BOOLEAN
PeerProbeReqSanity(struct rt_rtmp_adapter
*pAd
,
3149 unsigned long MsgLen
,
3151 char Ssid
[], u8
*pSsidLen
);
3153 BOOLEAN
GetTimBit(char *Ptr
,
3158 u8
*DtimPeriod
, u8
*MessageToMe
);
3160 u8
ChannelSanity(struct rt_rtmp_adapter
*pAd
, u8 channel
);
3162 NDIS_802_11_NETWORK_TYPE
NetworkTypeInUseSanity(struct rt_bss_entry
*pBss
);
3164 BOOLEAN
MlmeDelBAReqSanity(struct rt_rtmp_adapter
*pAd
,
3165 void *Msg
, unsigned long MsgLen
);
3167 BOOLEAN
MlmeAddBAReqSanity(struct rt_rtmp_adapter
*pAd
,
3168 void *Msg
, unsigned long MsgLen
, u8
*pAddr2
);
3170 unsigned long MakeOutgoingFrame(u8
*Buffer
, unsigned long *Length
, ...);
3172 void LfsrInit(struct rt_rtmp_adapter
*pAd
, unsigned long Seed
);
3174 u8
RandomByte(struct rt_rtmp_adapter
*pAd
);
3176 void AsicUpdateAutoFallBackTable(struct rt_rtmp_adapter
*pAd
, u8
*pTxRate
);
3178 void MlmePeriodicExec(void *SystemSpecific1
,
3179 void *FunctionContext
,
3180 void *SystemSpecific2
, void *SystemSpecific3
);
3182 void LinkDownExec(void *SystemSpecific1
,
3183 void *FunctionContext
,
3184 void *SystemSpecific2
, void *SystemSpecific3
);
3186 void STAMlmePeriodicExec(struct rt_rtmp_adapter
*pAd
);
3188 void MlmeAutoScan(struct rt_rtmp_adapter
*pAd
);
3190 void MlmeAutoReconnectLastSSID(struct rt_rtmp_adapter
*pAd
);
3192 BOOLEAN
MlmeValidateSSID(u8
*pSsid
, u8 SsidLen
);
3194 void MlmeCheckForRoaming(struct rt_rtmp_adapter
*pAd
, unsigned long Now32
);
3196 BOOLEAN
MlmeCheckForFastRoaming(struct rt_rtmp_adapter
*pAd
);
3198 void MlmeDynamicTxRateSwitching(struct rt_rtmp_adapter
*pAd
);
3200 void MlmeSetTxRate(struct rt_rtmp_adapter
*pAd
,
3201 struct rt_mac_table_entry
*pEntry
, struct rt_rtmp_tx_rate_switch
* pTxRate
);
3203 void MlmeSelectTxRateTable(struct rt_rtmp_adapter
*pAd
,
3204 struct rt_mac_table_entry
*pEntry
,
3206 u8
*pTableSize
, u8
*pInitTxRateIdx
);
3208 void MlmeCalculateChannelQuality(struct rt_rtmp_adapter
*pAd
,
3209 struct rt_mac_table_entry
*pMacEntry
, unsigned long Now
);
3211 void MlmeCheckPsmChange(struct rt_rtmp_adapter
*pAd
, unsigned long Now32
);
3213 void MlmeSetPsmBit(struct rt_rtmp_adapter
*pAd
, u16 psm
);
3215 void MlmeSetTxPreamble(struct rt_rtmp_adapter
*pAd
, u16 TxPreamble
);
3217 void UpdateBasicRateBitmap(struct rt_rtmp_adapter
*pAd
);
3219 void MlmeUpdateTxRates(struct rt_rtmp_adapter
*pAd
,
3220 IN BOOLEAN bLinkUp
, u8 apidx
);
3222 void MlmeUpdateHtTxRates(struct rt_rtmp_adapter
*pAd
, u8 apidx
);
3224 void RTMPCheckRates(struct rt_rtmp_adapter
*pAd
,
3225 IN u8 SupRate
[], IN u8
*SupRateLen
);
3227 BOOLEAN
RTMPCheckChannel(struct rt_rtmp_adapter
*pAd
,
3228 u8 CentralChannel
, u8 Channel
);
3230 BOOLEAN
RTMPCheckHt(struct rt_rtmp_adapter
*pAd
,
3232 struct rt_ht_capability_ie
*pHtCapability
,
3233 struct rt_add_ht_info_ie
*pAddHtInfo
);
3235 void StaQuickResponeForRateUpExec(void *SystemSpecific1
,
3236 void *FunctionContext
,
3237 void *SystemSpecific2
,
3238 void *SystemSpecific3
);
3240 void RTMPUpdateMlmeRate(struct rt_rtmp_adapter
*pAd
);
3242 char RTMPMaxRssi(struct rt_rtmp_adapter
*pAd
,
3243 char Rssi0
, char Rssi1
, char Rssi2
);
3246 void AsicSetRxAnt(struct rt_rtmp_adapter
*pAd
, u8 Ant
);
3248 void RTMPFilterCalibration(struct rt_rtmp_adapter
*pAd
);
3250 #ifdef RTMP_EFUSE_SUPPORT
3251 /*2008/09/11:KH add to support efuse<-- */
3252 int set_eFuseGetFreeBlockCount_Proc(struct rt_rtmp_adapter
*pAd
, char *arg
);
3254 int set_eFusedump_Proc(struct rt_rtmp_adapter
*pAd
, char *arg
);
3256 void eFusePhysicalReadRegisters(struct rt_rtmp_adapter
*pAd
,
3258 u16 Length
, u16
*pData
);
3260 int RtmpEfuseSupportCheck(struct rt_rtmp_adapter
*pAd
);
3262 void eFuseGetFreeBlockCount(struct rt_rtmp_adapter
*pAd
, u32
*EfuseFreeBlock
);
3264 int eFuse_init(struct rt_rtmp_adapter
*pAd
);
3265 /*2008/09/11:KH add to support efuse--> */
3266 #endif /* RTMP_EFUSE_SUPPORT // */
3268 /* add by johnli, RF power sequence setup */
3269 void RT30xxLoadRFNormalModeSetup(struct rt_rtmp_adapter
*pAd
);
3271 void RT30xxLoadRFSleepModeSetup(struct rt_rtmp_adapter
*pAd
);
3273 void RT30xxReverseRFSleepModeSetup(struct rt_rtmp_adapter
*pAd
);
3277 void NICInitRT3070RFRegisters(struct rt_rtmp_adapter
*pAd
);
3278 #endif /* RT3070 // */
3280 void NICInitRT3090RFRegisters(struct rt_rtmp_adapter
*pAd
);
3281 #endif /* RT3090 // */
3283 void RT30xxHaltAction(struct rt_rtmp_adapter
*pAd
);
3285 void RT30xxSetRxAnt(struct rt_rtmp_adapter
*pAd
, u8 Ant
);
3286 #endif /* RT30xx // */
3288 void AsicEvaluateRxAnt(struct rt_rtmp_adapter
*pAd
);
3290 void AsicRxAntEvalTimeout(void *SystemSpecific1
,
3291 void *FunctionContext
,
3292 void *SystemSpecific2
, void *SystemSpecific3
);
3294 void APSDPeriodicExec(void *SystemSpecific1
,
3295 void *FunctionContext
,
3296 void *SystemSpecific2
, void *SystemSpecific3
);
3298 BOOLEAN
RTMPCheckEntryEnableAutoRateSwitch(struct rt_rtmp_adapter
*pAd
,
3299 struct rt_mac_table_entry
*pEntry
);
3301 u8
RTMPStaFixedTxMode(struct rt_rtmp_adapter
*pAd
, struct rt_mac_table_entry
*pEntry
);
3303 void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode
, struct rt_mac_table_entry
*pEntry
);
3305 BOOLEAN
RTMPAutoRateSwitchCheck(struct rt_rtmp_adapter
*pAd
);
3307 int MlmeInit(struct rt_rtmp_adapter
*pAd
);
3309 void MlmeHandler(struct rt_rtmp_adapter
*pAd
);
3311 void MlmeHalt(struct rt_rtmp_adapter
*pAd
);
3313 void MlmeResetRalinkCounters(struct rt_rtmp_adapter
*pAd
);
3315 void BuildChannelList(struct rt_rtmp_adapter
*pAd
);
3317 u8
FirstChannel(struct rt_rtmp_adapter
*pAd
);
3319 u8
NextChannel(struct rt_rtmp_adapter
*pAd
, u8 channel
);
3321 void ChangeToCellPowerLimit(struct rt_rtmp_adapter
*pAd
,
3322 u8 AironetCellPowerLimit
);
3325 /* Prototypes of function definition in rtmp_tkip.c */
3327 void RTMPInitTkipEngine(struct rt_rtmp_adapter
*pAd
,
3332 u8
*pTSC
, unsigned long *pIV16
, unsigned long *pIV32
);
3334 void RTMPInitMICEngine(struct rt_rtmp_adapter
*pAd
,
3337 u8
*pSA
, u8 UserPriority
, u8
*pMICKey
);
3339 BOOLEAN
RTMPTkipCompareMICValue(struct rt_rtmp_adapter
*pAd
,
3344 u8 UserPriority
, u32 Len
);
3346 void RTMPCalculateMICValue(struct rt_rtmp_adapter
*pAd
,
3349 struct rt_cipher_key
*pKey
, u8 apidx
);
3351 void RTMPTkipAppendByte(struct rt_tkip_key_info
*pTkip
, u8 uChar
);
3353 void RTMPTkipAppend(struct rt_tkip_key_info
*pTkip
, u8
*pSrc
, u32 nBytes
);
3355 void RTMPTkipGetMIC(struct rt_tkip_key_info
*pTkip
);
3357 BOOLEAN
RTMPSoftDecryptTKIP(struct rt_rtmp_adapter
*pAd
,
3359 unsigned long DataByteCnt
,
3360 u8 UserPriority
, struct rt_cipher_key
*pWpaKey
);
3362 BOOLEAN
RTMPSoftDecryptAES(struct rt_rtmp_adapter
*pAd
,
3364 unsigned long DataByteCnt
, struct rt_cipher_key
*pWpaKey
);
3367 /* Prototypes of function definition in cmm_info.c */
3369 int RT_CfgSetCountryRegion(struct rt_rtmp_adapter
*pAd
, char *arg
, int band
);
3371 int RT_CfgSetWirelessMode(struct rt_rtmp_adapter
*pAd
, char *arg
);
3373 int RT_CfgSetShortSlot(struct rt_rtmp_adapter
*pAd
, char *arg
);
3375 int RT_CfgSetWepKey(struct rt_rtmp_adapter
*pAd
,
3377 struct rt_cipher_key
*pSharedKey
, int keyIdx
);
3379 int RT_CfgSetWPAPSKKey(struct rt_rtmp_adapter
*pAd
,
3382 int hashStrLen
, u8
*pPMKBuf
);
3385 /* Prototypes of function definition in cmm_info.c */
3387 void RTMPWPARemoveAllKeys(struct rt_rtmp_adapter
*pAd
);
3389 void RTMPSetPhyMode(struct rt_rtmp_adapter
*pAd
, unsigned long phymode
);
3391 void RTMPUpdateHTIE(struct rt_ht_capability
*pRtHt
,
3393 struct rt_ht_capability_ie
*pHtCapability
,
3394 struct rt_add_ht_info_ie
*pAddHtInfo
);
3396 void RTMPAddWcidAttributeEntry(struct rt_rtmp_adapter
*pAd
,
3399 u8 CipherAlg
, struct rt_mac_table_entry
*pEntry
);
3401 char *GetEncryptType(char enc
);
3403 char *GetAuthMode(char auth
);
3405 void RTMPSetHT(struct rt_rtmp_adapter
*pAd
, struct rt_oid_set_ht_phymode
*pHTPhyMode
);
3407 void RTMPSetIndividualHT(struct rt_rtmp_adapter
*pAd
, u8 apidx
);
3409 void RTMPSendWirelessEvent(struct rt_rtmp_adapter
*pAd
,
3411 u8
*pAddr
, u8 BssIdx
, char Rssi
);
3413 char ConvertToRssi(struct rt_rtmp_adapter
*pAd
, char Rssi
, u8 RssiNumber
);
3415 /*===================================
3416 Function prototype in cmm_wpa.c
3417 =================================== */
3418 void RTMPToWirelessSta(struct rt_rtmp_adapter
*pAd
,
3419 struct rt_mac_table_entry
*pEntry
,
3423 u32 DataLen
, IN BOOLEAN bClearFrame
);
3425 void WpaDerivePTK(struct rt_rtmp_adapter
*pAd
,
3430 u8
*SA
, u8
*output
, u32 len
);
3432 void GenRandom(struct rt_rtmp_adapter
*pAd
, u8
*macAddr
, u8
*random
);
3434 BOOLEAN
RTMPCheckWPAframe(struct rt_rtmp_adapter
*pAd
,
3435 struct rt_mac_table_entry
*pEntry
,
3437 unsigned long DataByteCount
, u8 FromWhichBSSID
);
3439 void AES_GTK_KEY_UNWRAP(u8
*key
,
3441 u32 c_len
, u8
*ciphertext
);
3443 BOOLEAN
RTMPParseEapolKeyData(struct rt_rtmp_adapter
*pAd
,
3448 IN BOOLEAN bWPA2
, struct rt_mac_table_entry
*pEntry
);
3450 void ConstructEapolMsg(struct rt_mac_table_entry
*pEntry
,
3451 u8 GroupKeyWepStatus
,
3458 u8 RSNIE_Len
, struct rt_eapol_packet
*pMsg
);
3460 int RTMPSoftDecryptBroadCastData(struct rt_rtmp_adapter
*pAd
,
3461 struct rt_rx_blk
*pRxBlk
,
3462 IN NDIS_802_11_ENCRYPTION_STATUS
3464 struct rt_cipher_key
*pShard_key
);
3466 void RTMPMakeRSNIE(struct rt_rtmp_adapter
*pAd
,
3467 u32 AuthMode
, u32 WepStatus
, u8 apidx
);
3470 /* function prototype in ap_wpa.c */
3472 void RTMPGetTxTscFromAsic(struct rt_rtmp_adapter
*pAd
,
3473 u8 apidx
, u8
*pTxTsc
);
3475 void APInstallPairwiseKey(struct rt_rtmp_adapter
*pAd
, struct rt_mac_table_entry
*pEntry
);
3477 u32
APValidateRSNIE(struct rt_rtmp_adapter
*pAd
,
3478 struct rt_mac_table_entry
*pEntry
,
3479 u8
*pRsnIe
, u8 rsnie_len
);
3481 void HandleCounterMeasure(struct rt_rtmp_adapter
*pAd
, struct rt_mac_table_entry
*pEntry
);
3483 void WPAStart4WayHS(struct rt_rtmp_adapter
*pAd
,
3484 struct rt_mac_table_entry
*pEntry
, unsigned long TimeInterval
);
3486 void WPAStart2WayGroupHS(struct rt_rtmp_adapter
*pAd
, struct rt_mac_table_entry
*pEntry
);
3488 void PeerPairMsg1Action(struct rt_rtmp_adapter
*pAd
,
3489 struct rt_mac_table_entry
*pEntry
, struct rt_mlme_queue_elem
*Elem
);
3491 void PeerPairMsg2Action(struct rt_rtmp_adapter
*pAd
,
3492 struct rt_mac_table_entry
*pEntry
, struct rt_mlme_queue_elem
*Elem
);
3494 void PeerPairMsg3Action(struct rt_rtmp_adapter
*pAd
,
3495 struct rt_mac_table_entry
*pEntry
, struct rt_mlme_queue_elem
*Elem
);
3497 void PeerPairMsg4Action(struct rt_rtmp_adapter
*pAd
,
3498 struct rt_mac_table_entry
*pEntry
, struct rt_mlme_queue_elem
*Elem
);
3500 void PeerGroupMsg1Action(struct rt_rtmp_adapter
*pAd
,
3501 struct rt_mac_table_entry
*pEntry
, struct rt_mlme_queue_elem
*Elem
);
3503 void PeerGroupMsg2Action(struct rt_rtmp_adapter
*pAd
,
3504 struct rt_mac_table_entry
*pEntry
,
3505 void *Msg
, u32 MsgLen
);
3507 void WpaDeriveGTK(u8
*PMK
,
3509 u8
*AA
, u8
*output
, u32 len
);
3511 void AES_GTK_KEY_WRAP(u8
*key
,
3513 u32 p_len
, u8
*ciphertext
);
3515 /*typedef void (*TIMER_FUNCTION)(unsigned long); */
3518 void RTMP_SetPeriodicTimer(struct timer_list
*pTimer
,
3519 IN
unsigned long timeout
);
3521 void RTMP_OS_Init_Timer(struct rt_rtmp_adapter
*pAd
,
3522 struct timer_list
*pTimer
,
3523 IN TIMER_FUNCTION function
, void *data
);
3525 void RTMP_OS_Add_Timer(struct timer_list
*pTimer
,
3526 IN
unsigned long timeout
);
3528 void RTMP_OS_Mod_Timer(struct timer_list
*pTimer
,
3529 IN
unsigned long timeout
);
3531 void RTMP_OS_Del_Timer(struct timer_list
*pTimer
,
3532 OUT BOOLEAN
*pCancelled
);
3534 void RTMP_OS_Release_Packet(struct rt_rtmp_adapter
*pAd
, struct rt_queue_entry
*pEntry
);
3536 void RTMPusecDelay(unsigned long usec
);
3538 int os_alloc_mem(struct rt_rtmp_adapter
*pAd
,
3539 u8
**mem
, unsigned long size
);
3541 int os_free_mem(struct rt_rtmp_adapter
*pAd
, void *mem
);
3543 void RTMP_AllocateSharedMemory(struct rt_rtmp_adapter
*pAd
,
3544 unsigned long Length
,
3546 void **VirtualAddress
,
3547 dma_addr_t
*PhysicalAddress
);
3549 void RTMPFreeTxRxRingMemory(struct rt_rtmp_adapter
*pAd
);
3551 int AdapterBlockAllocateMemory(void *handle
, void **ppAd
);
3553 void RTMP_AllocateTxDescMemory(struct rt_rtmp_adapter
*pAd
,
3555 unsigned long Length
,
3557 void **VirtualAddress
,
3558 dma_addr_t
*PhysicalAddress
);
3560 void RTMP_AllocateFirstTxBuffer(struct rt_rtmp_adapter
*pAd
,
3562 unsigned long Length
,
3564 void **VirtualAddress
,
3565 dma_addr_t
*PhysicalAddress
);
3567 void RTMP_FreeFirstTxBuffer(struct rt_rtmp_adapter
*pAd
,
3568 unsigned long Length
,
3570 void *VirtualAddress
,
3571 dma_addr_t PhysicalAddress
);
3573 void RTMP_AllocateMgmtDescMemory(struct rt_rtmp_adapter
*pAd
,
3574 unsigned long Length
,
3576 void **VirtualAddress
,
3577 dma_addr_t
*PhysicalAddress
);
3579 void RTMP_AllocateRxDescMemory(struct rt_rtmp_adapter
*pAd
,
3580 unsigned long Length
,
3582 void **VirtualAddress
,
3583 dma_addr_t
*PhysicalAddress
);
3585 void RTMP_FreeDescMemory(struct rt_rtmp_adapter
*pAd
,
3586 unsigned long Length
,
3587 void *VirtualAddress
,
3588 dma_addr_t PhysicalAddress
);
3590 void *RtmpOSNetPktAlloc(struct rt_rtmp_adapter
*pAd
, IN
int size
);
3592 void *RTMP_AllocateRxPacketBuffer(struct rt_rtmp_adapter
*pAd
,
3593 unsigned long Length
,
3595 void **VirtualAddress
,
3596 OUT dma_addr_t
*PhysicalAddress
);
3598 void *RTMP_AllocateTxPacketBuffer(struct rt_rtmp_adapter
*pAd
,
3599 unsigned long Length
,
3601 void **VirtualAddress
);
3603 void *RTMP_AllocateFragPacketBuffer(struct rt_rtmp_adapter
*pAd
,
3604 unsigned long Length
);
3606 void RTMP_QueryPacketInfo(void *pPacket
,
3607 struct rt_packet_info
*pPacketInfo
,
3608 u8
**pSrcBufVA
, u32
*pSrcBufLen
);
3610 void RTMP_QueryNextPacketInfo(void **ppPacket
,
3611 struct rt_packet_info
*pPacketInfo
,
3612 u8
**pSrcBufVA
, u32
*pSrcBufLen
);
3614 BOOLEAN
RTMP_FillTxBlkInfo(struct rt_rtmp_adapter
*pAd
, struct rt_tx_blk
*pTxBlk
);
3616 struct rt_rtmp_sg_list
*rt_get_sg_list_from_packet(void *pPacket
,
3617 struct rt_rtmp_sg_list
*sg
);
3619 void announce_802_3_packet(struct rt_rtmp_adapter
*pAd
, void *pPacket
);
3621 u32
BA_Reorder_AMSDU_Annnounce(struct rt_rtmp_adapter
*pAd
, void *pPacket
);
3623 struct net_device
*get_netdev_from_bssid(struct rt_rtmp_adapter
*pAd
, u8 FromWhichBSSID
);
3625 void *duplicate_pkt(struct rt_rtmp_adapter
*pAd
,
3629 unsigned long DataSize
, u8 FromWhichBSSID
);
3631 void *duplicate_pkt_with_TKIP_MIC(struct rt_rtmp_adapter
*pAd
,
3634 void ba_flush_reordering_timeout_mpdus(struct rt_rtmp_adapter
*pAd
,
3635 struct rt_ba_rec_entry
*pBAEntry
,
3636 unsigned long Now32
);
3638 void BAOriSessionSetUp(struct rt_rtmp_adapter
*pAd
,
3639 struct rt_mac_table_entry
*pEntry
,
3642 unsigned long DelayTime
, IN BOOLEAN isForced
);
3644 void BASessionTearDownALL(struct rt_rtmp_adapter
*pAd
, u8 Wcid
);
3646 BOOLEAN
OS_Need_Clone_Packet(void);
3648 void build_tx_packet(struct rt_rtmp_adapter
*pAd
,
3650 u8
*pFrame
, unsigned long FrameLen
);
3652 void BAOriSessionTearDown(struct rt_rtmp_adapter
*pAd
,
3655 IN BOOLEAN bPassive
, IN BOOLEAN bForceSend
);
3657 void BARecSessionTearDown(struct rt_rtmp_adapter
*pAd
,
3658 u8 Wcid
, u8 TID
, IN BOOLEAN bPassive
);
3660 BOOLEAN
ba_reordering_resource_init(struct rt_rtmp_adapter
*pAd
, int num
);
3661 void ba_reordering_resource_release(struct rt_rtmp_adapter
*pAd
);
3663 char *rstrtok(char *s
, IN
const char *ct
);
3665 /*//////// common ioctl functions ////////// */
3666 int SetCommonHT(struct rt_rtmp_adapter
*pAd
);
3668 int WpaCheckEapCode(struct rt_rtmp_adapter
*pAd
,
3669 u8
*pFrame
, u16 FrameLen
, u16 OffSet
);
3671 void WpaSendMicFailureToWpaSupplicant(struct rt_rtmp_adapter
*pAd
,
3672 IN BOOLEAN bUnicast
);
3674 int wext_notify_event_assoc(struct rt_rtmp_adapter
*pAd
);
3676 BOOLEAN
STARxDoneInterruptHandle(struct rt_rtmp_adapter
*pAd
, IN BOOLEAN argc
);
3678 /* AMPDU packet indication */
3679 void Indicate_AMPDU_Packet(struct rt_rtmp_adapter
*pAd
,
3680 struct rt_rx_blk
*pRxBlk
, u8 FromWhichBSSID
);
3682 /* AMSDU packet indication */
3683 void Indicate_AMSDU_Packet(struct rt_rtmp_adapter
*pAd
,
3684 struct rt_rx_blk
*pRxBlk
, u8 FromWhichBSSID
);
3686 /* Normal legacy Rx packet indication */
3687 void Indicate_Legacy_Packet(struct rt_rtmp_adapter
*pAd
,
3688 struct rt_rx_blk
*pRxBlk
, u8 FromWhichBSSID
);
3690 void Indicate_EAPOL_Packet(struct rt_rtmp_adapter
*pAd
,
3691 struct rt_rx_blk
*pRxBlk
, u8 FromWhichBSSID
);
3693 void update_os_packet_info(struct rt_rtmp_adapter
*pAd
,
3694 struct rt_rx_blk
*pRxBlk
, u8 FromWhichBSSID
);
3696 void wlan_802_11_to_802_3_packet(struct rt_rtmp_adapter
*pAd
,
3697 struct rt_rx_blk
*pRxBlk
,
3701 /* remove LLC and get 802_3 Header */
3702 #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \
3704 u8 *_pRemovedLLCSNAP = NULL, *_pDA, *_pSA; \
3706 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) { \
3707 _pDA = _pRxBlk->pHeader->Addr3; \
3708 _pSA = (u8 *)_pRxBlk->pHeader + sizeof(struct rt_header_802_11); \
3711 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_INFRA)) {\
3712 _pDA = _pRxBlk->pHeader->Addr1; \
3713 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_DLS)) \
3714 _pSA = _pRxBlk->pHeader->Addr2; \
3716 _pSA = _pRxBlk->pHeader->Addr3; \
3719 _pDA = _pRxBlk->pHeader->Addr1; \
3720 _pSA = _pRxBlk->pHeader->Addr2; \
3724 CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \
3725 _pRxBlk->DataSize, _pRemovedLLCSNAP); \
3728 void Sta_Announce_or_Forward_802_3_Packet(struct rt_rtmp_adapter
*pAd
,
3732 #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\
3733 Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS);
3734 /*announce_802_3_packet(_pAd, _pPacket); */
3736 void *DuplicatePacket(struct rt_rtmp_adapter
*pAd
,
3737 void *pPacket
, u8 FromWhichBSSID
);
3739 void *ClonePacket(struct rt_rtmp_adapter
*pAd
,
3741 u8
*pData
, unsigned long DataSize
);
3743 /* Normal, AMPDU or AMSDU */
3744 void CmmRxnonRalinkFrameIndicate(struct rt_rtmp_adapter
*pAd
,
3745 struct rt_rx_blk
*pRxBlk
, u8 FromWhichBSSID
);
3747 void CmmRxRalinkFrameIndicate(struct rt_rtmp_adapter
*pAd
,
3748 struct rt_mac_table_entry
*pEntry
,
3749 struct rt_rx_blk
*pRxBlk
, u8 FromWhichBSSID
);
3751 void Update_Rssi_Sample(struct rt_rtmp_adapter
*pAd
,
3752 struct rt_rssi_sample
*pRssi
, struct rt_rxwi
* pRxWI
);
3754 void *GetPacketFromRxRing(struct rt_rtmp_adapter
*pAd
,
3755 OUT PRT28XX_RXD_STRUC pSaveRxD
,
3756 OUT BOOLEAN
*pbReschedule
,
3757 IN u32
*pRxPending
);
3759 void *RTMPDeFragmentDataFrame(struct rt_rtmp_adapter
*pAd
, struct rt_rx_blk
*pRxBlk
);
3762 DIDmsg_lnxind_wlansniffrm
= 0x00000044,
3763 DIDmsg_lnxind_wlansniffrm_hosttime
= 0x00010044,
3764 DIDmsg_lnxind_wlansniffrm_mactime
= 0x00020044,
3765 DIDmsg_lnxind_wlansniffrm_channel
= 0x00030044,
3766 DIDmsg_lnxind_wlansniffrm_rssi
= 0x00040044,
3767 DIDmsg_lnxind_wlansniffrm_sq
= 0x00050044,
3768 DIDmsg_lnxind_wlansniffrm_signal
= 0x00060044,
3769 DIDmsg_lnxind_wlansniffrm_noise
= 0x00070044,
3770 DIDmsg_lnxind_wlansniffrm_rate
= 0x00080044,
3771 DIDmsg_lnxind_wlansniffrm_istx
= 0x00090044,
3772 DIDmsg_lnxind_wlansniffrm_frmlen
= 0x000A0044
3775 P80211ENUM_msgitem_status_no_value
= 0x00
3778 P80211ENUM_truth_false
= 0x00,
3779 P80211ENUM_truth_true
= 0x01
3782 /* Definition from madwifi */
3783 struct rt_p80211item_uint32
{
3790 struct rt_wlan_ng_prism2_header
{
3793 #define WLAN_DEVNAMELEN_MAX 16
3794 u8 devname
[WLAN_DEVNAMELEN_MAX
];
3795 struct rt_p80211item_uint32 hosttime
;
3796 struct rt_p80211item_uint32 mactime
;
3797 struct rt_p80211item_uint32 channel
;
3798 struct rt_p80211item_uint32 rssi
;
3799 struct rt_p80211item_uint32 sq
;
3800 struct rt_p80211item_uint32 signal
;
3801 struct rt_p80211item_uint32 noise
;
3802 struct rt_p80211item_uint32 rate
;
3803 struct rt_p80211item_uint32 istx
;
3804 struct rt_p80211item_uint32 frmlen
;
3807 /* The radio capture header precedes the 802.11 header. */
3808 struct PACKED rt_ieee80211_radiotap_header
{
3809 u8 it_version
; /* Version 0. Only increases
3810 * for drastic changes,
3811 * introduction of compatible
3812 * new fields does not count.
3815 u16 it_len
; /* length of the whole
3816 * header in bytes, including
3817 * it_version, it_pad,
3818 * it_len, and data fields.
3820 u32 it_present
; /* A bitmap telling which
3821 * fields are present. Set bit 31
3822 * (0x80000000) to extend the
3823 * bitmap by another 32 bits.
3824 * Additional extensions are made
3825 * by setting bit 31.
3829 enum ieee80211_radiotap_type
{
3830 IEEE80211_RADIOTAP_TSFT
= 0,
3831 IEEE80211_RADIOTAP_FLAGS
= 1,
3832 IEEE80211_RADIOTAP_RATE
= 2,
3833 IEEE80211_RADIOTAP_CHANNEL
= 3,
3834 IEEE80211_RADIOTAP_FHSS
= 4,
3835 IEEE80211_RADIOTAP_DBM_ANTSIGNAL
= 5,
3836 IEEE80211_RADIOTAP_DBM_ANTNOISE
= 6,
3837 IEEE80211_RADIOTAP_LOCK_QUALITY
= 7,
3838 IEEE80211_RADIOTAP_TX_ATTENUATION
= 8,
3839 IEEE80211_RADIOTAP_DB_TX_ATTENUATION
= 9,
3840 IEEE80211_RADIOTAP_DBM_TX_POWER
= 10,
3841 IEEE80211_RADIOTAP_ANTENNA
= 11,
3842 IEEE80211_RADIOTAP_DB_ANTSIGNAL
= 12,
3843 IEEE80211_RADIOTAP_DB_ANTNOISE
= 13
3846 #define WLAN_RADIOTAP_PRESENT ( \
3847 (1 << IEEE80211_RADIOTAP_TSFT) | \
3848 (1 << IEEE80211_RADIOTAP_FLAGS) | \
3849 (1 << IEEE80211_RADIOTAP_RATE) | \
3852 struct rt_wlan_radiotap_header
{
3853 struct rt_ieee80211_radiotap_header wt_ihdr
;
3858 /* Definition from madwifi */
3860 void send_monitor_packets(struct rt_rtmp_adapter
*pAd
, struct rt_rx_blk
*pRxBlk
);
3862 void RTMPSetDesiredRates(struct rt_rtmp_adapter
*pAdapter
, long Rates
);
3864 int Set_FixedTxMode_Proc(struct rt_rtmp_adapter
*pAd
, char *arg
);
3866 BOOLEAN
RT28XXChipsetCheck(IN
void *_dev_p
);
3868 void RT28XXDMADisable(struct rt_rtmp_adapter
*pAd
);
3870 void RT28XXDMAEnable(struct rt_rtmp_adapter
*pAd
);
3872 void RT28xx_UpdateBeaconToAsic(struct rt_rtmp_adapter
*pAd
,
3874 unsigned long BeaconLen
, unsigned long UpdatePos
);
3876 int rt28xx_init(struct rt_rtmp_adapter
*pAd
,
3877 char *pDefaultMac
, char *pHostName
);
3879 int RtmpNetTaskInit(struct rt_rtmp_adapter
*pAd
);
3881 void RtmpNetTaskExit(struct rt_rtmp_adapter
*pAd
);
3883 int RtmpMgmtTaskInit(struct rt_rtmp_adapter
*pAd
);
3885 void RtmpMgmtTaskExit(struct rt_rtmp_adapter
*pAd
);
3887 void tbtt_tasklet(unsigned long data
);
3889 struct net_device
*RtmpPhyNetDevInit(struct rt_rtmp_adapter
*pAd
,
3890 struct rt_rtmp_os_netdev_op_hook
*pNetHook
);
3892 BOOLEAN
RtmpPhyNetDevExit(struct rt_rtmp_adapter
*pAd
, struct net_device
*net_dev
);
3894 int RtmpRaDevCtrlInit(struct rt_rtmp_adapter
*pAd
, IN RTMP_INF_TYPE infType
);
3896 BOOLEAN
RtmpRaDevCtrlExit(struct rt_rtmp_adapter
*pAd
);
3900 /* Function Prototype in cmm_data_pci.c */
3902 u16
RtmpPCI_WriteTxResource(struct rt_rtmp_adapter
*pAd
,
3903 struct rt_tx_blk
*pTxBlk
,
3904 IN BOOLEAN bIsLast
, u16
*FreeNumber
);
3906 u16
RtmpPCI_WriteSingleTxResource(struct rt_rtmp_adapter
*pAd
,
3907 struct rt_tx_blk
*pTxBlk
,
3911 u16
RtmpPCI_WriteMultiTxResource(struct rt_rtmp_adapter
*pAd
,
3912 struct rt_tx_blk
*pTxBlk
,
3913 u8 frameNum
, u16
*FreeNumber
);
3915 u16
RtmpPCI_WriteFragTxResource(struct rt_rtmp_adapter
*pAd
,
3916 struct rt_tx_blk
*pTxBlk
,
3917 u8 fragNum
, u16
*FreeNumber
);
3919 u16
RtmpPCI_WriteSubTxResource(struct rt_rtmp_adapter
*pAd
,
3920 struct rt_tx_blk
*pTxBlk
,
3921 IN BOOLEAN bIsLast
, u16
*FreeNumber
);
3923 void RtmpPCI_FinalWriteTxResource(struct rt_rtmp_adapter
*pAd
,
3924 struct rt_tx_blk
*pTxBlk
,
3928 void RtmpPCIDataLastTxIdx(struct rt_rtmp_adapter
*pAd
,
3929 u8 QueIdx
, u16 LastTxIdx
);
3931 void RtmpPCIDataKickOut(struct rt_rtmp_adapter
*pAd
,
3932 struct rt_tx_blk
*pTxBlk
, u8 QueIdx
);
3934 int RtmpPCIMgmtKickOut(struct rt_rtmp_adapter
*pAd
,
3937 u8
*pSrcBufVA
, u32 SrcBufLen
);
3939 int RTMPCheckRxError(struct rt_rtmp_adapter
*pAd
,
3940 struct rt_header_802_11
*pHeader
,
3941 struct rt_rxwi
*pRxWI
, IN PRT28XX_RXD_STRUC pRxD
);
3943 BOOLEAN
RT28xxPciAsicRadioOff(struct rt_rtmp_adapter
*pAd
,
3944 u8 Level
, u16 TbttNumToNextWakeUp
);
3946 BOOLEAN
RT28xxPciAsicRadioOn(struct rt_rtmp_adapter
*pAd
, u8 Level
);
3948 void RTMPInitPCIeLinkCtrlValue(struct rt_rtmp_adapter
*pAd
);
3950 void RTMPFindHostPCIDev(struct rt_rtmp_adapter
*pAd
);
3952 void RTMPPCIeLinkCtrlValueRestore(struct rt_rtmp_adapter
*pAd
, u8 Level
);
3954 void RTMPPCIeLinkCtrlSetting(struct rt_rtmp_adapter
*pAd
, u16 Max
);
3956 void RTMPrt3xSetPCIePowerLinkCtrl(struct rt_rtmp_adapter
*pAd
);
3958 void PsPollWakeExec(void *SystemSpecific1
,
3959 void *FunctionContext
,
3960 void *SystemSpecific2
, void *SystemSpecific3
);
3962 void RadioOnExec(void *SystemSpecific1
,
3963 void *FunctionContext
,
3964 void *SystemSpecific2
, void *SystemSpecific3
);
3966 void RT28xxPciStaAsicForceWakeup(struct rt_rtmp_adapter
*pAd
, IN BOOLEAN bFromTx
);
3968 void RT28xxPciStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter
*pAd
,
3969 u16 TbttNumToNextWakeUp
);
3971 void RT28xxPciMlmeRadioOn(struct rt_rtmp_adapter
*pAd
);
3973 void RT28xxPciMlmeRadioOFF(struct rt_rtmp_adapter
*pAd
);
3974 #endif /* RTMP_MAC_PCI // */
3978 /* Function Prototype in rtusb_bulk.c */
3980 void RTUSBInitTxDesc(struct rt_rtmp_adapter
*pAd
,
3981 struct rt_tx_context
*pTxContext
,
3982 u8 BulkOutPipeId
, IN usb_complete_t Func
);
3984 void RTUSBInitHTTxDesc(struct rt_rtmp_adapter
*pAd
,
3985 struct rt_ht_tx_context
*pTxContext
,
3987 unsigned long BulkOutSize
, IN usb_complete_t Func
);
3989 void RTUSBInitRxDesc(struct rt_rtmp_adapter
*pAd
, struct rt_rx_context
*pRxContext
);
3991 void RTUSBCleanUpDataBulkOutQueue(struct rt_rtmp_adapter
*pAd
);
3993 void RTUSBCancelPendingBulkOutIRP(struct rt_rtmp_adapter
*pAd
);
3995 void RTUSBBulkOutDataPacket(struct rt_rtmp_adapter
*pAd
,
3996 u8 BulkOutPipeId
, u8 Index
);
3998 void RTUSBBulkOutNullFrame(struct rt_rtmp_adapter
*pAd
);
4000 void RTUSBBulkOutRTSFrame(struct rt_rtmp_adapter
*pAd
);
4002 void RTUSBCancelPendingBulkInIRP(struct rt_rtmp_adapter
*pAd
);
4004 void RTUSBCancelPendingIRPs(struct rt_rtmp_adapter
*pAd
);
4006 void RTUSBBulkOutMLMEPacket(struct rt_rtmp_adapter
*pAd
, u8 Index
);
4008 void RTUSBBulkOutPsPoll(struct rt_rtmp_adapter
*pAd
);
4010 void RTUSBCleanUpMLMEBulkOutQueue(struct rt_rtmp_adapter
*pAd
);
4012 void RTUSBKickBulkOut(struct rt_rtmp_adapter
*pAd
);
4014 void RTUSBBulkReceive(struct rt_rtmp_adapter
*pAd
);
4016 void DoBulkIn(struct rt_rtmp_adapter
*pAd
);
4018 void RTUSBInitRxDesc(struct rt_rtmp_adapter
*pAd
, struct rt_rx_context
*pRxContext
);
4020 void RTUSBBulkRxHandle(IN
unsigned long data
);
4023 /* Function Prototype in rtusb_io.c */
4025 int RTUSBMultiRead(struct rt_rtmp_adapter
*pAd
,
4026 u16 Offset
, u8
*pData
, u16 length
);
4028 int RTUSBMultiWrite(struct rt_rtmp_adapter
*pAd
,
4029 u16 Offset
, const u8
*pData
, u16 length
);
4031 int RTUSBMultiWrite_OneByte(struct rt_rtmp_adapter
*pAd
,
4032 u16 Offset
, const u8
*pData
);
4034 int RTUSBReadBBPRegister(struct rt_rtmp_adapter
*pAd
,
4037 int RTUSBWriteBBPRegister(struct rt_rtmp_adapter
*pAd
,
4040 int RTUSBWriteRFRegister(struct rt_rtmp_adapter
*pAd
, u32 Value
);
4042 int RTUSB_VendorRequest(struct rt_rtmp_adapter
*pAd
,
4048 void *TransferBuffer
,
4049 u32 TransferBufferLength
);
4051 int RTUSBReadEEPROM(struct rt_rtmp_adapter
*pAd
,
4052 u16 Offset
, u8
*pData
, u16 length
);
4054 int RTUSBWriteEEPROM(struct rt_rtmp_adapter
*pAd
,
4055 u16 Offset
, u8
*pData
, u16 length
);
4057 void RTUSBPutToSleep(struct rt_rtmp_adapter
*pAd
);
4059 int RTUSBWakeUp(struct rt_rtmp_adapter
*pAd
);
4061 void RTUSBInitializeCmdQ(struct rt_cmdq
*cmdq
);
4063 int RTUSBEnqueueCmdFromNdis(struct rt_rtmp_adapter
*pAd
,
4065 IN BOOLEAN SetInformation
,
4066 void *pInformationBuffer
,
4067 u32 InformationBufferLength
);
4069 int RTUSBEnqueueInternalCmd(struct rt_rtmp_adapter
*pAd
,
4071 void *pInformationBuffer
,
4072 u32 InformationBufferLength
);
4074 void RTUSBDequeueCmd(struct rt_cmdq
*cmdq
, struct rt_cmdqelmt
* * pcmdqelmt
);
4076 int RTUSBCmdThread(IN
void *Context
);
4078 void RTUSBBssBeaconExit(struct rt_rtmp_adapter
*pAd
);
4080 void RTUSBBssBeaconStop(struct rt_rtmp_adapter
*pAd
);
4082 void RTUSBBssBeaconStart(struct rt_rtmp_adapter
*pAd
);
4084 void RTUSBBssBeaconInit(struct rt_rtmp_adapter
*pAd
);
4086 void RTUSBWatchDog(struct rt_rtmp_adapter
*pAd
);
4088 int RTUSBWriteMACRegister(struct rt_rtmp_adapter
*pAd
,
4089 u16 Offset
, u32 Value
);
4091 int RTUSBReadMACRegister(struct rt_rtmp_adapter
*pAd
,
4092 u16 Offset
, u32
*pValue
);
4094 int RTUSBSingleWrite(struct rt_rtmp_adapter
*pAd
,
4095 u16 Offset
, u16 Value
);
4097 int RTUSBFirmwareWrite(struct rt_rtmp_adapter
*pAd
,
4098 const u8
*pFwImage
, unsigned long FwLen
);
4100 int RTUSBVenderReset(struct rt_rtmp_adapter
*pAd
);
4102 int RTUSBSetHardWareRegister(struct rt_rtmp_adapter
*pAdapter
, void *pBuf
);
4104 int RTUSBQueryHardWareRegister(struct rt_rtmp_adapter
*pAdapter
,
4107 void CMDHandler(struct rt_rtmp_adapter
*pAd
);
4109 int RTUSBWriteHWMACAddress(struct rt_rtmp_adapter
*pAdapter
);
4111 void MacTableInitialize(struct rt_rtmp_adapter
*pAd
);
4113 void MlmeSetPsm(struct rt_rtmp_adapter
*pAd
, u16 psm
);
4115 int RTMPWPAAddKeyProc(struct rt_rtmp_adapter
*pAd
, void *pBuf
);
4117 void AsicRxAntEvalAction(struct rt_rtmp_adapter
*pAd
);
4119 void append_pkt(struct rt_rtmp_adapter
*pAd
,
4123 unsigned long DataSize
, void **ppPacket
);
4125 u32
deaggregate_AMSDU_announce(struct rt_rtmp_adapter
*pAd
,
4127 u8
*pData
, unsigned long DataSize
);
4129 int RTMPCheckRxError(struct rt_rtmp_adapter
*pAd
,
4130 struct rt_header_802_11
*pHeader
,
4131 struct rt_rxwi
*pRxWI
,
4132 IN PRT28XX_RXD_STRUC pRxINFO
);
4134 void RTUSBMlmeHardTransmit(struct rt_rtmp_adapter
*pAd
, struct rt_mgmt
*pMgmt
);
4136 int MlmeThread(void *Context
);
4139 /* Function Prototype in rtusb_data.c */
4141 int RTUSBFreeDescriptorRequest(struct rt_rtmp_adapter
*pAd
,
4143 u32 NumberRequired
);
4145 BOOLEAN
RTUSBNeedQueueBackForAgg(struct rt_rtmp_adapter
*pAd
, u8 BulkOutPipeId
);
4147 void RTMPWriteTxInfo(struct rt_rtmp_adapter
*pAd
,
4148 struct rt_txinfo
*pTxInfo
,
4151 u8 QueueSel
, u8 NextValid
, u8 TxBurst
);
4154 /* Function Prototype in cmm_data_usb.c */
4156 u16
RtmpUSB_WriteSubTxResource(struct rt_rtmp_adapter
*pAd
,
4157 struct rt_tx_blk
*pTxBlk
,
4158 IN BOOLEAN bIsLast
, u16
*FreeNumber
);
4160 u16
RtmpUSB_WriteSingleTxResource(struct rt_rtmp_adapter
*pAd
,
4161 struct rt_tx_blk
*pTxBlk
,
4165 u16
RtmpUSB_WriteFragTxResource(struct rt_rtmp_adapter
*pAd
,
4166 struct rt_tx_blk
*pTxBlk
,
4167 u8 fragNum
, u16
*FreeNumber
);
4169 u16
RtmpUSB_WriteMultiTxResource(struct rt_rtmp_adapter
*pAd
,
4170 struct rt_tx_blk
*pTxBlk
,
4171 u8 frameNum
, u16
*FreeNumber
);
4173 void RtmpUSB_FinalWriteTxResource(struct rt_rtmp_adapter
*pAd
,
4174 struct rt_tx_blk
*pTxBlk
,
4175 u16 totalMPDUSize
, u16 TxIdx
);
4177 void RtmpUSBDataLastTxIdx(struct rt_rtmp_adapter
*pAd
,
4178 u8 QueIdx
, u16 TxIdx
);
4180 void RtmpUSBDataKickOut(struct rt_rtmp_adapter
*pAd
,
4181 struct rt_tx_blk
*pTxBlk
, u8 QueIdx
);
4183 int RtmpUSBMgmtKickOut(struct rt_rtmp_adapter
*pAd
,
4186 u8
*pSrcBufVA
, u32 SrcBufLen
);
4188 void RtmpUSBNullFrameKickOut(struct rt_rtmp_adapter
*pAd
,
4190 u8
*pNullFrame
, u32 frameLen
);
4192 void RtmpUsbStaAsicForceWakeupTimeout(void *SystemSpecific1
,
4193 void *FunctionContext
,
4194 void *SystemSpecific2
,
4195 void *SystemSpecific3
);
4197 void RT28xxUsbStaAsicForceWakeup(struct rt_rtmp_adapter
*pAd
, IN BOOLEAN bFromTx
);
4199 void RT28xxUsbStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter
*pAd
,
4200 u16 TbttNumToNextWakeUp
);
4202 void RT28xxUsbMlmeRadioOn(struct rt_rtmp_adapter
*pAd
);
4204 void RT28xxUsbMlmeRadioOFF(struct rt_rtmp_adapter
*pAd
);
4205 #endif /* RTMP_MAC_USB // */
4207 void AsicTurnOffRFClk(struct rt_rtmp_adapter
*pAd
, u8 Channel
);
4209 void AsicTurnOnRFClk(struct rt_rtmp_adapter
*pAd
, u8 Channel
);
4211 #ifdef RTMP_TIMER_TASK_SUPPORT
4212 int RtmpTimerQThread(IN
void *Context
);
4214 struct rt_rtmp_timer_task_entry
*RtmpTimerQInsert(struct rt_rtmp_adapter
*pAd
,
4215 struct rt_ralink_timer
*pTimer
);
4217 BOOLEAN
RtmpTimerQRemove(struct rt_rtmp_adapter
*pAd
,
4218 struct rt_ralink_timer
*pTimer
);
4220 void RtmpTimerQExit(struct rt_rtmp_adapter
*pAd
);
4222 void RtmpTimerQInit(struct rt_rtmp_adapter
*pAd
);
4223 #endif /* RTMP_TIMER_TASK_SUPPORT // */
4225 void AsicStaBbpTuning(struct rt_rtmp_adapter
*pAd
);
4227 BOOLEAN
StaAddMacTableEntry(struct rt_rtmp_adapter
*pAd
,
4228 struct rt_mac_table_entry
*pEntry
,
4229 u8 MaxSupportedRateIn500Kbps
,
4230 struct rt_ht_capability_ie
*pHtCapability
,
4232 struct rt_add_ht_info_ie
*pAddHtInfo
,
4233 u8 AddHtInfoLen
, u16 CapabilityInfo
);
4235 BOOLEAN
AUTH_ReqSend(struct rt_rtmp_adapter
*pAd
,
4236 struct rt_mlme_queue_elem
*pElem
,
4237 struct rt_ralink_timer
*pAuthTimer
,
4240 u8
*pNewElement
, unsigned long ElementLen
);
4242 void RTMP_IndicateMediaState(struct rt_rtmp_adapter
*pAd
);
4244 void ReSyncBeaconTime(struct rt_rtmp_adapter
*pAd
);
4246 void RTMPSetAGCInitValue(struct rt_rtmp_adapter
*pAd
, u8 BandWidth
);
4248 int rt28xx_close(struct net_device
*dev
);
4249 int rt28xx_open(struct net_device
*dev
);
4251 #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++)
4252 #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--)
4253 #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt)
4256 __inline
int VIRTUAL_IF_UP(struct rt_rtmp_adapter
*pAd
)
4258 if (VIRTUAL_IF_NUM(pAd
) == 0) {
4259 if (rt28xx_open(pAd
->net_dev
) != 0) {
4260 DBGPRINT(RT_DEBUG_TRACE
,
4261 ("rt28xx_open return fail!\n"));
4266 VIRTUAL_IF_INC(pAd
);
4270 __inline
void VIRTUAL_IF_DOWN(struct rt_rtmp_adapter
*pAd
)
4272 VIRTUAL_IF_DEC(pAd
);
4273 if (VIRTUAL_IF_NUM(pAd
) == 0)
4274 rt28xx_close(pAd
->net_dev
);
4277 #endif /* LINUX // */
4280 OS Related funciton prototype definitions.
4281 TODO: Maybe we need to move these function prototypes to other proper place.
4283 int RtmpOSWrielessEventSend(struct rt_rtmp_adapter
*pAd
,
4287 u8
*pData
, u32 dataLen
);
4289 int RtmpOSNetDevAddrSet(struct net_device
*pNetDev
, u8
*pMacAddr
);
4291 int RtmpOSNetDevAttach(struct net_device
*pNetDev
,
4292 struct rt_rtmp_os_netdev_op_hook
*pDevOpHook
);
4294 void RtmpOSNetDevClose(struct net_device
*pNetDev
);
4296 void RtmpOSNetDevDetach(struct net_device
*pNetDev
);
4298 int RtmpOSNetDevAlloc(struct net_device
**pNewNetDev
, u32 privDataSize
);
4300 void RtmpOSNetDevFree(struct net_device
*pNetDev
);
4302 struct net_device
*RtmpOSNetDevGetByName(struct net_device
*pNetDev
, char *pDevName
);
4304 void RtmpOSNetDeviceRefPut(struct net_device
*pNetDev
);
4306 struct net_device
*RtmpOSNetDevCreate(struct rt_rtmp_adapter
*pAd
,
4309 int privMemSize
, char *pNamePrefix
);
4312 Task operation related function prototypes
4314 void RtmpOSTaskCustomize(struct rt_rtmp_os_task
*pTask
);
4316 int RtmpOSTaskNotifyToExit(struct rt_rtmp_os_task
*pTask
);
4318 int RtmpOSTaskKill(struct rt_rtmp_os_task
*pTask
);
4320 int RtmpOSTaskInit(struct rt_rtmp_os_task
*pTask
,
4321 char *pTaskName
, void * pPriv
);
4323 int RtmpOSTaskAttach(struct rt_rtmp_os_task
*pTask
,
4324 IN
int (*fn
) (void *), IN
void *arg
);
4327 File operation related function prototypes
4329 struct file
*RtmpOSFileOpen(IN
char *pPath
, IN
int flag
, IN
int mode
);
4331 int RtmpOSFileClose(struct file
*osfd
);
4333 void RtmpOSFileSeek(struct file
*osfd
, IN
int offset
);
4335 int RtmpOSFileRead(struct file
*osfd
, IN
char *pDataPtr
, IN
int readLen
);
4337 int RtmpOSFileWrite(struct file
*osfd
, IN
char *pDataPtr
, IN
int writeLen
);
4339 #endif /* __RTMP_H__ */