Commit | Line | Data |
---|---|---|
91980990 GKH |
1 | /* |
2 | ************************************************************************* | |
3 | * Ralink Tech Inc. | |
4 | * 5F., No.36, Taiyuan St., Jhubei City, | |
5 | * Hsinchu County 302, | |
6 | * Taiwan, R.O.C. | |
7 | * | |
8 | * (c) Copyright 2002-2007, Ralink Technology, Inc. | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify * | |
11 | * it under the terms of the GNU General Public License as published by * | |
12 | * the Free Software Foundation; either version 2 of the License, or * | |
13 | * (at your option) any later version. * | |
14 | * * | |
15 | * This program is distributed in the hope that it will be useful, * | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
18 | * GNU General Public License for more details. * | |
19 | * * | |
20 | * You should have received a copy of the GNU General Public License * | |
21 | * along with this program; if not, write to the * | |
22 | * Free Software Foundation, Inc., * | |
23 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | |
24 | * * | |
25 | ************************************************************************* | |
26 | ||
27 | Module Name: | |
28 | rtmp.h | |
29 | ||
30 | Abstract: | |
31 | Miniport generic portion header file | |
32 | ||
33 | Revision History: | |
6ccb5d7c | 34 | Who When What |
91980990 | 35 | -------- ---------- ---------------------------------------------- |
6ccb5d7c JM |
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 | |
39 | Justin P. Mattock 11/07/2010 Fix some typos | |
91980990 GKH |
40 | */ |
41 | #ifndef __RTMP_H__ | |
42 | #define __RTMP_H__ | |
43 | ||
91980990 | 44 | #include "spectrum_def.h" |
ca97b838 | 45 | #include "rtmp_dot11.h" |
ca97b838 | 46 | #include "rtmp_chip.h" |
91980990 | 47 | |
62eb734b | 48 | struct rt_rtmp_adapter; |
ca97b838 | 49 | |
cc277069 | 50 | /*#define DBG 1 */ |
ca97b838 | 51 | |
cc277069 | 52 | /*#define DBG_DIAGNOSE 1 */ |
ca97b838 | 53 | |
cc277069 | 54 | /*+++Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */ |
ca97b838 BZ |
55 | #define MAX_DATAMM_RETRY 3 |
56 | #define MGMT_USE_QUEUE_FLAG 0x80 | |
cc277069 | 57 | /*---Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */ |
ca97b838 BZ |
58 | |
59 | #define MAXSEQ (0xFFF) | |
91980990 | 60 | |
52b81c89 BZ |
61 | extern unsigned char SNAP_AIRONET[]; |
62 | extern unsigned char CISCO_OUI[]; | |
51126deb | 63 | extern u8 BaSizeArray[4]; |
91980990 | 64 | |
51126deb BZ |
65 | extern u8 BROADCAST_ADDR[MAC_ADDR_LEN]; |
66 | extern u8 ZERO_MAC_ADDR[MAC_ADDR_LEN]; | |
67 | extern unsigned long BIT32[32]; | |
68 | extern u8 BIT8[8]; | |
52b81c89 BZ |
69 | extern char *CipherName[]; |
70 | extern char *MCSToMbps[]; | |
51126deb BZ |
71 | extern u8 RxwiMCSToOfdmRate[12]; |
72 | extern u8 SNAP_802_1H[6]; | |
73 | extern u8 SNAP_BRIDGE_TUNNEL[6]; | |
74 | extern u8 SNAP_AIRONET[8]; | |
75 | extern u8 CKIP_LLC_SNAP[8]; | |
76 | extern u8 EAPOL_LLC_SNAP[8]; | |
77 | extern u8 EAPOL[2]; | |
78 | extern u8 IPX[2]; | |
79 | extern u8 APPLE_TALK[2]; | |
80 | extern u8 RateIdToPlcpSignal[12]; /* see IEEE802.11a-1999 p.14 */ | |
81 | extern u8 OfdmRateToRxwiMCS[]; | |
82 | extern u8 OfdmSignalToRateId[16]; | |
83 | extern u8 default_cwmin[4]; | |
84 | extern u8 default_cwmax[4]; | |
85 | extern u8 default_sta_aifsn[4]; | |
86 | extern u8 MapUserPriorityToAccessCategory[8]; | |
87 | ||
88 | extern u16 RateUpPER[]; | |
89 | extern u16 RateDownPER[]; | |
90 | extern u8 Phy11BNextRateDownward[]; | |
91 | extern u8 Phy11BNextRateUpward[]; | |
92 | extern u8 Phy11BGNextRateDownward[]; | |
93 | extern u8 Phy11BGNextRateUpward[]; | |
94 | extern u8 Phy11ANextRateDownward[]; | |
95 | extern u8 Phy11ANextRateUpward[]; | |
96 | extern char RssiSafeLevelForTxRate[]; | |
97 | extern u8 RateIdToMbps[]; | |
98 | extern u16 RateIdTo500Kbps[]; | |
99 | ||
100 | extern u8 CipherSuiteWpaNoneTkip[]; | |
101 | extern u8 CipherSuiteWpaNoneTkipLen; | |
102 | ||
103 | extern u8 CipherSuiteWpaNoneAes[]; | |
104 | extern u8 CipherSuiteWpaNoneAesLen; | |
105 | ||
106 | extern u8 SsidIe; | |
107 | extern u8 SupRateIe; | |
108 | extern u8 ExtRateIe; | |
109 | ||
110 | extern u8 HtCapIe; | |
111 | extern u8 AddHtInfoIe; | |
112 | extern u8 NewExtChanIe; | |
113 | ||
114 | extern u8 ErpIe; | |
115 | extern u8 DsIe; | |
116 | extern u8 TimIe; | |
117 | extern u8 WpaIe; | |
118 | extern u8 Wpa2Ie; | |
119 | extern u8 IbssIe; | |
120 | extern u8 Ccx2Ie; | |
121 | extern u8 WapiIe; | |
122 | ||
123 | extern u8 WPA_OUI[]; | |
124 | extern u8 RSN_OUI[]; | |
125 | extern u8 WAPI_OUI[]; | |
126 | extern u8 WME_INFO_ELEM[]; | |
127 | extern u8 WME_PARM_ELEM[]; | |
128 | extern u8 Ccx2QosInfo[]; | |
129 | extern u8 Ccx2IeInfo[]; | |
130 | extern u8 RALINK_OUI[]; | |
131 | extern u8 PowerConstraintIE[]; | |
132 | ||
133 | extern u8 RateSwitchTable[]; | |
134 | extern u8 RateSwitchTable11B[]; | |
135 | extern u8 RateSwitchTable11G[]; | |
136 | extern u8 RateSwitchTable11BG[]; | |
137 | ||
138 | extern u8 RateSwitchTable11BGN1S[]; | |
139 | extern u8 RateSwitchTable11BGN2S[]; | |
140 | extern u8 RateSwitchTable11BGN2SForABand[]; | |
141 | extern u8 RateSwitchTable11N1S[]; | |
142 | extern u8 RateSwitchTable11N2S[]; | |
143 | extern u8 RateSwitchTable11N2SForABand[]; | |
144 | ||
145 | extern u8 PRE_N_HT_OUI[]; | |
52b81c89 | 146 | |
62eb734b | 147 | struct rt_rssi_sample { |
51126deb BZ |
148 | char LastRssi0; /* last received RSSI */ |
149 | char LastRssi1; /* last received RSSI */ | |
150 | char LastRssi2; /* last received RSSI */ | |
151 | char AvgRssi0; | |
152 | char AvgRssi1; | |
153 | char AvgRssi2; | |
154 | short AvgRssi0X8; | |
155 | short AvgRssi1X8; | |
156 | short AvgRssi2X8; | |
62eb734b | 157 | }; |
91980990 | 158 | |
cc277069 BZ |
159 | /* */ |
160 | /* Queue structure and macros */ | |
161 | /* */ | |
62eb734b BZ |
162 | struct rt_queue_entry; |
163 | ||
164 | struct rt_queue_entry { | |
165 | struct rt_queue_entry *Next; | |
166 | }; | |
91980990 | 167 | |
cc277069 | 168 | /* Queue structure */ |
62eb734b BZ |
169 | struct rt_queue_header { |
170 | struct rt_queue_entry *Head; | |
171 | struct rt_queue_entry *Tail; | |
51126deb | 172 | unsigned long Number; |
62eb734b | 173 | }; |
91980990 GKH |
174 | |
175 | #define InitializeQueueHeader(QueueHeader) \ | |
176 | { \ | |
177 | (QueueHeader)->Head = (QueueHeader)->Tail = NULL; \ | |
178 | (QueueHeader)->Number = 0; \ | |
179 | } | |
180 | ||
181 | #define RemoveHeadQueue(QueueHeader) \ | |
182 | (QueueHeader)->Head; \ | |
183 | { \ | |
62eb734b | 184 | struct rt_queue_entry *pNext; \ |
fdb2fd14 | 185 | if ((QueueHeader)->Head != NULL) { \ |
91980990 | 186 | pNext = (QueueHeader)->Head->Next; \ |
ca97b838 | 187 | (QueueHeader)->Head->Next = NULL; \ |
91980990 GKH |
188 | (QueueHeader)->Head = pNext; \ |
189 | if (pNext == NULL) \ | |
190 | (QueueHeader)->Tail = NULL; \ | |
191 | (QueueHeader)->Number--; \ | |
192 | } \ | |
193 | } | |
194 | ||
195 | #define InsertHeadQueue(QueueHeader, QueueEntry) \ | |
196 | { \ | |
62eb734b BZ |
197 | ((struct rt_queue_entry *)QueueEntry)->Next = (QueueHeader)->Head; \ |
198 | (QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \ | |
91980990 | 199 | if ((QueueHeader)->Tail == NULL) \ |
62eb734b | 200 | (QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \ |
91980990 GKH |
201 | (QueueHeader)->Number++; \ |
202 | } | |
203 | ||
204 | #define InsertTailQueue(QueueHeader, QueueEntry) \ | |
205 | { \ | |
62eb734b | 206 | ((struct rt_queue_entry *)QueueEntry)->Next = NULL; \ |
91980990 | 207 | if ((QueueHeader)->Tail) \ |
62eb734b | 208 | (QueueHeader)->Tail->Next = (struct rt_queue_entry *)(QueueEntry); \ |
91980990 | 209 | else \ |
62eb734b BZ |
210 | (QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \ |
211 | (QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \ | |
91980990 GKH |
212 | (QueueHeader)->Number++; \ |
213 | } | |
214 | ||
ca97b838 BZ |
215 | #define InsertTailQueueAc(pAd, pEntry, QueueHeader, QueueEntry) \ |
216 | { \ | |
62eb734b | 217 | ((struct rt_queue_entry *)QueueEntry)->Next = NULL; \ |
ca97b838 | 218 | if ((QueueHeader)->Tail) \ |
62eb734b | 219 | (QueueHeader)->Tail->Next = (struct rt_queue_entry *)(QueueEntry); \ |
ca97b838 | 220 | else \ |
62eb734b BZ |
221 | (QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \ |
222 | (QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \ | |
ca97b838 BZ |
223 | (QueueHeader)->Number++; \ |
224 | } | |
225 | ||
cc277069 BZ |
226 | /* */ |
227 | /* Macros for flag and ref count operations */ | |
228 | /* */ | |
91980990 GKH |
229 | #define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F)) |
230 | #define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F)) | |
231 | #define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0) | |
232 | #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0) | |
233 | #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) | |
cc277069 | 234 | /* Macro for power save flag. */ |
ed291e80 AM |
235 | #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F)) |
236 | #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F)) | |
237 | #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0) | |
238 | #define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0) | |
239 | #define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F)) | |
240 | ||
91980990 GKH |
241 | #define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F)) |
242 | #define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F)) | |
243 | #define OPSTATUS_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.OpStatusFlags & (_F)) != 0) | |
244 | ||
fdb2fd14 NM |
245 | #define CLIENT_STATUS_SET_FLAG(_pEntry, _F) ((_pEntry)->ClientStatusFlags |= (_F)) |
246 | #define CLIENT_STATUS_CLEAR_FLAG(_pEntry, _F) ((_pEntry)->ClientStatusFlags &= ~(_F)) | |
247 | #define CLIENT_STATUS_TEST_FLAG(_pEntry, _F) (((_pEntry)->ClientStatusFlags & (_F)) != 0) | |
91980990 GKH |
248 | |
249 | #define RX_FILTER_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter |= (_F)) | |
250 | #define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F)) | |
251 | #define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0) | |
252 | ||
91980990 GKH |
253 | #define STA_NO_SECURITY_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11EncryptionDisabled) |
254 | #define STA_WEP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) | |
255 | #define STA_TKIP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) | |
256 | #define STA_AES_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) | |
257 | ||
258 | #define STA_TGN_WIFI_ON(_p) (_p->StaCfg.bTGnWifiTest == TRUE) | |
91980990 GKH |
259 | |
260 | #define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE)) | |
261 | #define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE)) | |
262 | ||
91980990 GKH |
263 | #define INC_RING_INDEX(_idx, _RingSize) \ |
264 | { \ | |
265 | (_idx) = (_idx+1) % (_RingSize); \ | |
266 | } | |
267 | ||
cc277069 | 268 | /* StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here. */ |
91980990 GKH |
269 | #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \ |
270 | { \ | |
271 | _pAd->StaActive.SupportedHtPhy.ChannelWidth = _pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth; \ | |
272 | _pAd->StaActive.SupportedHtPhy.MimoPs = _pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs; \ | |
273 | _pAd->StaActive.SupportedHtPhy.GF = _pAd->MlmeAux.HtCapability.HtCapInfo.GF; \ | |
274 | _pAd->StaActive.SupportedHtPhy.ShortGIfor20 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20; \ | |
275 | _pAd->StaActive.SupportedHtPhy.ShortGIfor40 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40; \ | |
276 | _pAd->StaActive.SupportedHtPhy.TxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC; \ | |
277 | _pAd->StaActive.SupportedHtPhy.RxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC; \ | |
278 | _pAd->StaActive.SupportedHtPhy.ExtChanOffset = _pAd->MlmeAux.AddHtInfo.AddHtInfo.ExtChanOffset; \ | |
279 | _pAd->StaActive.SupportedHtPhy.RecomWidth = _pAd->MlmeAux.AddHtInfo.AddHtInfo.RecomWidth; \ | |
280 | _pAd->StaActive.SupportedHtPhy.OperaionMode = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode; \ | |
281 | _pAd->StaActive.SupportedHtPhy.NonGfPresent = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent; \ | |
fdb2fd14 | 282 | NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(u8) * 16);\ |
91980990 GKH |
283 | } |
284 | ||
285 | #define COPY_AP_HTSETTINGS_FROM_BEACON(_pAd, _pHtCapability) \ | |
286 | { \ | |
51126deb | 287 | _pAd->MacTab.Content[BSSID_WCID].AMsduSize = (u8)(_pHtCapability->HtCapInfo.AMsduSize); \ |
fdb2fd14 | 288 | _pAd->MacTab.Content[BSSID_WCID].MmpsMode = (u8)(_pHtCapability->HtCapInfo.MimoPs); \ |
51126deb | 289 | _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (u8)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \ |
91980990 | 290 | } |
91980990 | 291 | |
cc277069 BZ |
292 | /* */ |
293 | /* MACRO for 32-bit PCI register read / write */ | |
294 | /* */ | |
295 | /* Usage : RTMP_IO_READ32( */ | |
62eb734b | 296 | /* struct rt_rtmp_adapter *pAd, */ |
51126deb BZ |
297 | /* unsigned long Register_Offset, */ |
298 | /* unsigned long * pValue) */ | |
cc277069 BZ |
299 | /* */ |
300 | /* RTMP_IO_WRITE32( */ | |
62eb734b | 301 | /* struct rt_rtmp_adapter *pAd, */ |
51126deb BZ |
302 | /* unsigned long Register_Offset, */ |
303 | /* unsigned long Value) */ | |
cc277069 BZ |
304 | /* */ |
305 | ||
306 | /* */ | |
307 | /* Common fragment list structure - Identical to the scatter gather frag list structure */ | |
308 | /* */ | |
62eb734b BZ |
309 | /*#define struct rt_rtmp_sg_element SCATTER_GATHER_ELEMENT */ |
310 | /*#define struct rt_rtmp_sg_element *PSCATTER_GATHER_ELEMENT */ | |
91980990 GKH |
311 | #define NIC_MAX_PHYS_BUF_COUNT 8 |
312 | ||
62eb734b | 313 | struct rt_rtmp_sg_element { |
51126deb BZ |
314 | void *Address; |
315 | unsigned long Length; | |
316 | unsigned long *Reserved; | |
62eb734b | 317 | }; |
91980990 | 318 | |
62eb734b | 319 | struct rt_rtmp_sg_list { |
51126deb BZ |
320 | unsigned long NumberOfElements; |
321 | unsigned long *Reserved; | |
62eb734b BZ |
322 | struct rt_rtmp_sg_element Elements[NIC_MAX_PHYS_BUF_COUNT]; |
323 | }; | |
91980990 | 324 | |
cc277069 BZ |
325 | /* */ |
326 | /* Some utility macros */ | |
327 | /* */ | |
91980990 GKH |
328 | #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)))) |
329 | ||
330 | #define INC_COUNTER64(Val) (Val.QuadPart++) | |
331 | ||
332 | #define INFRA_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_INFRA_ON)) | |
333 | #define ADHOC_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_ADHOC_ON)) | |
334 | #define MONITOR_ON(_p) (((_p)->StaCfg.BssType) == BSS_MONITOR) | |
335 | #define IDLE_ON(_p) (!INFRA_ON(_p) && !ADHOC_ON(_p)) | |
336 | ||
cc277069 | 337 | /* Check LEAP & CCKM flags */ |
91980990 GKH |
338 | #define LEAP_ON(_p) (((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) |
339 | #define LEAP_CCKM_ON(_p) ((((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg.LeapAuthInfo.CCKM == TRUE)) | |
340 | ||
6ccb5d7c | 341 | /* if original Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required */ |
91980990 GKH |
342 | #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \ |
343 | { \ | |
fdb2fd14 | 344 | if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) { \ |
91980990 GKH |
345 | _pExtraLlcSnapEncap = SNAP_802_1H; \ |
346 | if (NdisEqualMemory(IPX, _pBufVA + 12, 2) || \ | |
fdb2fd14 | 347 | NdisEqualMemory(APPLE_TALK, _pBufVA + 12, 2)) { \ |
91980990 GKH |
348 | _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \ |
349 | } \ | |
350 | } \ | |
fdb2fd14 | 351 | else { \ |
91980990 GKH |
352 | _pExtraLlcSnapEncap = NULL; \ |
353 | } \ | |
354 | } | |
355 | ||
cc277069 | 356 | /* New Define for new Tx Path. */ |
91980990 GKH |
357 | #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \ |
358 | { \ | |
fdb2fd14 | 359 | if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) { \ |
91980990 GKH |
360 | _pExtraLlcSnapEncap = SNAP_802_1H; \ |
361 | if (NdisEqualMemory(IPX, _pBufVA, 2) || \ | |
fdb2fd14 | 362 | NdisEqualMemory(APPLE_TALK, _pBufVA, 2)) { \ |
91980990 GKH |
363 | _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \ |
364 | } \ | |
365 | } \ | |
fdb2fd14 | 366 | else { \ |
91980990 GKH |
367 | _pExtraLlcSnapEncap = NULL; \ |
368 | } \ | |
369 | } | |
370 | ||
91980990 GKH |
371 | #define MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType) \ |
372 | { \ | |
373 | NdisMoveMemory(_p, _pMac1, MAC_ADDR_LEN); \ | |
374 | NdisMoveMemory((_p + MAC_ADDR_LEN), _pMac2, MAC_ADDR_LEN); \ | |
375 | NdisMoveMemory((_p + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \ | |
376 | } | |
377 | ||
cc277069 BZ |
378 | /* if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way. */ |
379 | /* else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field */ | |
380 | /* else remove the LLC/SNAP field from the result Ethernet frame */ | |
381 | /* Patch for WHQL only, which did not turn on Netbios but use IPX within its payload */ | |
382 | /* Note: */ | |
383 | /* _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO */ | |
384 | /* _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed */ | |
91980990 GKH |
385 | #define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \ |
386 | { \ | |
387 | char LLC_Len[2]; \ | |
fdb2fd14 | 388 | \ |
91980990 GKH |
389 | _pRemovedLLCSNAP = NULL; \ |
390 | if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \ | |
fdb2fd14 NM |
391 | NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) { \ |
392 | u8 *pProto = _pData + 6; \ | |
393 | \ | |
394 | if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \ | |
395 | NdisEqualMemory(SNAP_802_1H, _pData, 6)) { \ | |
396 | LLC_Len[0] = (u8)(_DataSize / 256); \ | |
397 | LLC_Len[1] = (u8)(_DataSize % 256); \ | |
398 | MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \ | |
399 | } \ | |
400 | else { \ | |
401 | MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \ | |
402 | _pRemovedLLCSNAP = _pData; \ | |
403 | _DataSize -= LENGTH_802_1_H; \ | |
404 | _pData += LENGTH_802_1_H; \ | |
405 | } \ | |
91980990 | 406 | } \ |
fdb2fd14 NM |
407 | else { \ |
408 | LLC_Len[0] = (u8)(_DataSize / 256); \ | |
409 | LLC_Len[1] = (u8)(_DataSize % 256); \ | |
410 | MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \ | |
91980990 GKH |
411 | } \ |
412 | } | |
413 | ||
cc277069 BZ |
414 | /* Enqueue this frame to MLME engine */ |
415 | /* We need to enqueue the whole frame because MLME need to pass data type */ | |
416 | /* information from 802.11 header */ | |
ca97b838 | 417 | #ifdef RTMP_MAC_PCI |
91980990 GKH |
418 | #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ |
419 | { \ | |
51126deb | 420 | u32 High32TSF, Low32TSF; \ |
91980990 GKH |
421 | RTMP_IO_READ32(_pAd, TSF_TIMER_DW1, &High32TSF); \ |
422 | RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \ | |
fdb2fd14 | 423 | MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (u8)_Rssi0, (u8)_Rssi1, (u8)_Rssi2, _FrameSize, _pFrame, (u8)_PlcpSignal); \ |
91980990 | 424 | } |
cc277069 | 425 | #endif /* RTMP_MAC_PCI // */ |
ca97b838 | 426 | #ifdef RTMP_MAC_USB |
3a32ed12 BZ |
427 | #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ |
428 | { \ | |
fdb2fd14 NM |
429 | u32 High32TSF = 0, Low32TSF = 0; \ |
430 | MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (u8)_Rssi0, (u8)_Rssi1, (u8)_Rssi2, _FrameSize, _pFrame, (u8)_PlcpSignal); \ | |
3a32ed12 | 431 | } |
cc277069 | 432 | #endif /* RTMP_MAC_USB // */ |
91980990 | 433 | |
fdb2fd14 NM |
434 | #define MAC_ADDR_EQUAL(pAddr1, pAddr2) RTMPEqualMemory((void *)(pAddr1), (void *)(pAddr2), MAC_ADDR_LEN) |
435 | #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1 == len2) && (RTMPEqualMemory(ssid1, ssid2, len1))) | |
91980990 | 436 | |
cc277069 BZ |
437 | /* */ |
438 | /* Check if it is Japan W53(ch52,56,60,64) channel. */ | |
439 | /* */ | |
91980990 GKH |
440 | #define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64)) |
441 | ||
ca97b838 BZ |
442 | #define STA_EXTRA_SETTING(_pAd) |
443 | ||
91980990 GKH |
444 | #define STA_PORT_SECURED(_pAd) \ |
445 | { \ | |
ca97b838 BZ |
446 | BOOLEAN Cancelled; \ |
447 | (_pAd)->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \ | |
448 | NdisAcquireSpinLock(&((_pAd)->MacTabLock)); \ | |
449 | (_pAd)->MacTab.Content[BSSID_WCID].PortSecured = (_pAd)->StaCfg.PortSecured; \ | |
450 | (_pAd)->MacTab.Content[BSSID_WCID].PrivacyFilter = Ndis802_11PrivFilterAcceptAll;\ | |
ed291e80 | 451 | NdisReleaseSpinLock(&(_pAd)->MacTabLock); \ |
ca97b838 BZ |
452 | RTMPCancelTimer(&((_pAd)->Mlme.LinkDownTimer), &Cancelled);\ |
453 | STA_EXTRA_SETTING(_pAd); \ | |
91980990 | 454 | } |
91980990 | 455 | |
cc277069 BZ |
456 | /* */ |
457 | /* Data buffer for DMA operation, the buffer must be contiguous physical memory */ | |
458 | /* Both DMA to / from CPU use the same structure. */ | |
459 | /* */ | |
62eb734b | 460 | struct rt_rtmp_dmabuf { |
51126deb BZ |
461 | unsigned long AllocSize; |
462 | void *AllocVa; /* TxBuf virtual address */ | |
8a10a546 | 463 | dma_addr_t AllocPa; /* TxBuf physical address */ |
62eb734b | 464 | }; |
91980990 | 465 | |
cc277069 BZ |
466 | /* */ |
467 | /* Control block (Descriptor) for all ring descriptor DMA operation, buffer must be */ | |
8a10a546 | 468 | /* contiguous physical memory. char stored the binding Rx packet descriptor */ |
cc277069 | 469 | /* which won't be released, driver has to wait until upper layer return the packet */ |
6ccb5d7c | 470 | /* before giving up this rx ring descriptor to ASIC. NDIS_BUFFER is associated pair */ |
8a10a546 | 471 | /* to describe the packet buffer. For Tx, char stored the tx packet descriptor */ |
cc277069 BZ |
472 | /* which driver should ACK upper layer when the tx is physically done or failed. */ |
473 | /* */ | |
62eb734b | 474 | struct rt_rtmp_dmacb { |
51126deb BZ |
475 | unsigned long AllocSize; /* Control block size */ |
476 | void *AllocVa; /* Control block virtual address */ | |
8a10a546 BZ |
477 | dma_addr_t AllocPa; /* Control block physical address */ |
478 | void *pNdisPacket; | |
479 | void *pNextNdisPacket; | |
91980990 | 480 | |
62eb734b BZ |
481 | struct rt_rtmp_dmabuf DmaBuf; /* Associated DMA buffer structure */ |
482 | }; | |
91980990 | 483 | |
62eb734b BZ |
484 | struct rt_rtmp_tx_ring { |
485 | struct rt_rtmp_dmacb Cell[TX_RING_SIZE]; | |
51126deb BZ |
486 | u32 TxCpuIdx; |
487 | u32 TxDmaIdx; | |
488 | u32 TxSwFreeIdx; /* software next free tx index */ | |
62eb734b | 489 | }; |
91980990 | 490 | |
62eb734b BZ |
491 | struct rt_rtmp_rx_ring { |
492 | struct rt_rtmp_dmacb Cell[RX_RING_SIZE]; | |
51126deb BZ |
493 | u32 RxCpuIdx; |
494 | u32 RxDmaIdx; | |
495 | int RxSwReadIdx; /* software next read index */ | |
62eb734b | 496 | }; |
91980990 | 497 | |
62eb734b BZ |
498 | struct rt_rtmp_mgmt_ring { |
499 | struct rt_rtmp_dmacb Cell[MGMT_RING_SIZE]; | |
51126deb BZ |
500 | u32 TxCpuIdx; |
501 | u32 TxDmaIdx; | |
502 | u32 TxSwFreeIdx; /* software next free tx index */ | |
62eb734b | 503 | }; |
91980990 | 504 | |
cc277069 BZ |
505 | /* */ |
506 | /* Statistic counter structure */ | |
507 | /* */ | |
62eb734b | 508 | struct rt_counter_802_3 { |
cc277069 | 509 | /* General Stats */ |
51126deb BZ |
510 | unsigned long GoodTransmits; |
511 | unsigned long GoodReceives; | |
512 | unsigned long TxErrors; | |
513 | unsigned long RxErrors; | |
514 | unsigned long RxNoBuffer; | |
91980990 | 515 | |
cc277069 | 516 | /* Ethernet Stats */ |
51126deb BZ |
517 | unsigned long RcvAlignmentErrors; |
518 | unsigned long OneCollision; | |
519 | unsigned long MoreCollisions; | |
91980990 | 520 | |
62eb734b | 521 | }; |
91980990 | 522 | |
62eb734b | 523 | struct rt_counter_802_11 { |
51126deb | 524 | unsigned long Length; |
52b81c89 BZ |
525 | LARGE_INTEGER LastTransmittedFragmentCount; |
526 | LARGE_INTEGER TransmittedFragmentCount; | |
527 | LARGE_INTEGER MulticastTransmittedFrameCount; | |
528 | LARGE_INTEGER FailedCount; | |
529 | LARGE_INTEGER RetryCount; | |
530 | LARGE_INTEGER MultipleRetryCount; | |
531 | LARGE_INTEGER RTSSuccessCount; | |
532 | LARGE_INTEGER RTSFailureCount; | |
533 | LARGE_INTEGER ACKFailureCount; | |
534 | LARGE_INTEGER FrameDuplicateCount; | |
535 | LARGE_INTEGER ReceivedFragmentCount; | |
536 | LARGE_INTEGER MulticastReceivedFrameCount; | |
537 | LARGE_INTEGER FCSErrorCount; | |
62eb734b | 538 | }; |
91980990 | 539 | |
62eb734b | 540 | struct rt_counter_ralink { |
51126deb BZ |
541 | unsigned long TransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ |
542 | unsigned long ReceivedByteCount; /* both CRC okay and CRC error, used to calculate RX throughput */ | |
543 | unsigned long BeenDisassociatedCount; | |
544 | unsigned long BadCQIAutoRecoveryCount; | |
545 | unsigned long PoorCQIRoamingCount; | |
546 | unsigned long MgmtRingFullCount; | |
547 | unsigned long RxCountSinceLastNULL; | |
548 | unsigned long RxCount; | |
549 | unsigned long RxRingErrCount; | |
550 | unsigned long KickTxCount; | |
551 | unsigned long TxRingErrCount; | |
52b81c89 | 552 | LARGE_INTEGER RealFcsErrCount; |
51126deb BZ |
553 | unsigned long PendingNdisPacketCount; |
554 | ||
555 | unsigned long OneSecOsTxCount[NUM_OF_TX_RING]; | |
556 | unsigned long OneSecDmaDoneCount[NUM_OF_TX_RING]; | |
557 | u32 OneSecTxDoneCount; | |
558 | unsigned long OneSecRxCount; | |
559 | u32 OneSecTxAggregationCount; | |
560 | u32 OneSecRxAggregationCount; | |
561 | u32 OneSecReceivedByteCount; | |
562 | u32 OneSecFrameDuplicateCount; | |
563 | ||
564 | u32 OneSecTransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ | |
565 | u32 OneSecTxNoRetryOkCount; | |
566 | u32 OneSecTxRetryOkCount; | |
567 | u32 OneSecTxFailCount; | |
568 | u32 OneSecFalseCCACnt; /* CCA error count, for debug purpose, might move to global counter */ | |
569 | u32 OneSecRxOkCnt; /* RX without error */ | |
570 | u32 OneSecRxOkDataCnt; /* unicast-to-me DATA frame count */ | |
571 | u32 OneSecRxFcsErrCnt; /* CRC error */ | |
572 | u32 OneSecBeaconSentCnt; | |
573 | u32 LastOneSecTotalTxCount; /* OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount */ | |
574 | u32 LastOneSecRxOkDataCnt; /* OneSecRxOkDataCnt */ | |
575 | unsigned long DuplicateRcv; | |
576 | unsigned long TxAggCount; | |
577 | unsigned long TxNonAggCount; | |
578 | unsigned long TxAgg1MPDUCount; | |
579 | unsigned long TxAgg2MPDUCount; | |
580 | unsigned long TxAgg3MPDUCount; | |
581 | unsigned long TxAgg4MPDUCount; | |
582 | unsigned long TxAgg5MPDUCount; | |
583 | unsigned long TxAgg6MPDUCount; | |
584 | unsigned long TxAgg7MPDUCount; | |
585 | unsigned long TxAgg8MPDUCount; | |
586 | unsigned long TxAgg9MPDUCount; | |
587 | unsigned long TxAgg10MPDUCount; | |
588 | unsigned long TxAgg11MPDUCount; | |
589 | unsigned long TxAgg12MPDUCount; | |
590 | unsigned long TxAgg13MPDUCount; | |
591 | unsigned long TxAgg14MPDUCount; | |
592 | unsigned long TxAgg15MPDUCount; | |
593 | unsigned long TxAgg16MPDUCount; | |
52b81c89 BZ |
594 | |
595 | LARGE_INTEGER TransmittedOctetsInAMSDU; | |
596 | LARGE_INTEGER TransmittedAMSDUCount; | |
597 | LARGE_INTEGER ReceivedOctesInAMSDUCount; | |
598 | LARGE_INTEGER ReceivedAMSDUCount; | |
599 | LARGE_INTEGER TransmittedAMPDUCount; | |
600 | LARGE_INTEGER TransmittedMPDUsInAMPDUCount; | |
601 | LARGE_INTEGER TransmittedOctetsInAMPDUCount; | |
602 | LARGE_INTEGER MPDUInReceivedAMPDUCount; | |
62eb734b | 603 | }; |
91980990 | 604 | |
62eb734b | 605 | struct rt_counter_drs { |
6ccb5d7c | 606 | /* record each TX rate's quality. 0 is best, the bigger the worse. */ |
51126deb BZ |
607 | u16 TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; |
608 | u8 PER[MAX_STEP_OF_TX_RATE_SWITCH]; | |
609 | u8 TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ | |
610 | unsigned long CurrTxRateStableTime; /* # of second in current TX rate */ | |
52b81c89 BZ |
611 | BOOLEAN fNoisyEnvironment; |
612 | BOOLEAN fLastSecAccordingRSSI; | |
51126deb BZ |
613 | u8 LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ |
614 | u8 LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ | |
615 | unsigned long LastTxOkCount; | |
62eb734b | 616 | }; |
91980990 | 617 | |
ca97b838 BZ |
618 | /*************************************************************************** |
619 | * security key related data structure | |
620 | **************************************************************************/ | |
62eb734b | 621 | struct rt_cipher_key { |
51126deb BZ |
622 | u8 Key[16]; /* right now we implement 4 keys, 128 bits max */ |
623 | u8 RxMic[8]; /* make alignment */ | |
624 | u8 TxMic[8]; | |
625 | u8 TxTsc[6]; /* 48bit TSC value */ | |
626 | u8 RxTsc[6]; /* 48bit TSC value */ | |
627 | u8 CipherAlg; /* 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 */ | |
628 | u8 KeyLen; | |
629 | u8 BssId[6]; | |
cc277069 | 630 | /* Key length for each key, 0: entry is invalid */ |
51126deb | 631 | u8 Type; /* Indicate Pairwise/Group when reporting MIC error */ |
62eb734b | 632 | }; |
91980990 | 633 | |
cc277069 | 634 | /* structure to define WPA Group Key Rekey Interval */ |
62eb734b | 635 | struct PACKED rt_802_11_wpa_rekey { |
51126deb BZ |
636 | unsigned long ReKeyMethod; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ |
637 | unsigned long ReKeyInterval; /* time-based: seconds, packet-based: kilo-packets */ | |
62eb734b | 638 | }; |
ca97b838 BZ |
639 | |
640 | #ifdef RTMP_MAC_USB | |
641 | /*************************************************************************** | |
642 | * RTUSB I/O related data structure | |
643 | **************************************************************************/ | |
62eb734b | 644 | struct rt_set_asic_wcid { |
51126deb BZ |
645 | unsigned long WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ |
646 | unsigned long SetTid; /* time-based: seconds, packet-based: kilo-packets */ | |
647 | unsigned long DeleteTid; /* time-based: seconds, packet-based: kilo-packets */ | |
648 | u8 Addr[MAC_ADDR_LEN]; /* avoid in interrupt when write key */ | |
62eb734b | 649 | }; |
ca97b838 | 650 | |
62eb734b | 651 | struct rt_set_asic_wcid_attri { |
51126deb BZ |
652 | unsigned long WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ |
653 | unsigned long Cipher; /* ASIC Cipher definition */ | |
654 | u8 Addr[ETH_LENGTH_OF_ADDRESS]; | |
62eb734b | 655 | }; |
ca97b838 | 656 | |
cc277069 | 657 | /* for USB interface, avoid in interrupt when write key */ |
62eb734b | 658 | struct rt_add_pairwise_key_entry { |
51126deb BZ |
659 | u8 MacAddr[6]; |
660 | u16 MacTabMatchWCID; /* ASIC */ | |
62eb734b BZ |
661 | struct rt_cipher_key CipherKey; |
662 | }; | |
91980990 | 663 | |
cc277069 | 664 | /* Cipher suite type for mixed mode group cipher, P802.11i-2004 */ |
ca97b838 BZ |
665 | typedef enum _RT_802_11_CIPHER_SUITE_TYPE { |
666 | Cipher_Type_NONE, | |
667 | Cipher_Type_WEP40, | |
668 | Cipher_Type_TKIP, | |
669 | Cipher_Type_RSVD, | |
670 | Cipher_Type_CCMP, | |
671 | Cipher_Type_WEP104 | |
672 | } RT_802_11_CIPHER_SUITE_TYPE, *PRT_802_11_CIPHER_SUITE_TYPE; | |
cc277069 | 673 | #endif /* RTMP_MAC_USB // */ |
91980990 | 674 | |
62eb734b | 675 | struct rt_rogueap_entry { |
51126deb BZ |
676 | u8 Addr[MAC_ADDR_LEN]; |
677 | u8 ErrorCode[2]; /*00 01-Invalid authentication type */ | |
cc277069 BZ |
678 | /*00 02-Authentication timeout */ |
679 | /*00 03-Challenge from AP failed */ | |
680 | /*00 04-Challenge to AP failed */ | |
52b81c89 | 681 | BOOLEAN Reported; |
62eb734b | 682 | }; |
91980990 | 683 | |
62eb734b | 684 | struct rt_rogueap_table { |
51126deb | 685 | u8 RogueApNr; |
62eb734b BZ |
686 | struct rt_rogueap_entry RogueApEntry[MAX_LEN_OF_BSS_TABLE]; |
687 | }; | |
91980990 | 688 | |
cc277069 BZ |
689 | /* */ |
690 | /* Cisco IAPP format */ | |
691 | /* */ | |
62eb734b | 692 | struct rt_cisco_iapp_content { |
51126deb BZ |
693 | u16 Length; /*IAPP Length */ |
694 | u8 MessageType; /*IAPP type */ | |
695 | u8 FunctionCode; /*IAPP function type */ | |
696 | u8 DestinaionMAC[MAC_ADDR_LEN]; | |
697 | u8 SourceMAC[MAC_ADDR_LEN]; | |
698 | u16 Tag; /*Tag(element IE) - Adjacent AP report */ | |
699 | u16 TagLength; /*Length of element not including 4 byte header */ | |
700 | u8 OUI[4]; /*0x00, 0x40, 0x96, 0x00 */ | |
701 | u8 PreviousAP[MAC_ADDR_LEN]; /*MAC Address of access point */ | |
702 | u16 Channel; | |
703 | u16 SsidLen; | |
704 | u8 Ssid[MAX_LEN_OF_SSID]; | |
705 | u16 Seconds; /*Seconds that the client has been disassociated. */ | |
62eb734b | 706 | }; |
91980990 | 707 | |
ca97b838 BZ |
708 | /* |
709 | * Fragment Frame structure | |
710 | */ | |
62eb734b | 711 | struct rt_fragment_frame { |
8a10a546 | 712 | void *pFragPacket; |
51126deb BZ |
713 | unsigned long RxSize; |
714 | u16 Sequence; | |
715 | u16 LastFrag; | |
716 | unsigned long Flags; /* Some extra frame information. bit 0: LLC presented */ | |
62eb734b | 717 | }; |
91980990 | 718 | |
cc277069 BZ |
719 | /* */ |
720 | /* Packet information for NdisQueryPacket */ | |
721 | /* */ | |
62eb734b | 722 | struct rt_packet_info { |
6ccb5d7c | 723 | u32 PhysicalBufferCount; /* Physical breaks of buffer descriptor chained */ |
51126deb BZ |
724 | u32 BufferCount; /* Number of Buffer descriptor chained */ |
725 | u32 TotalPacketLength; /* Self explained */ | |
8a10a546 | 726 | char *pFirstBuffer; /* Pointer to first buffer descriptor */ |
62eb734b | 727 | }; |
91980990 | 728 | |
cc277069 BZ |
729 | /* */ |
730 | /* Arcfour Structure Added by PaulWu */ | |
731 | /* */ | |
62eb734b | 732 | struct rt_arcfourcontext { |
51126deb BZ |
733 | u32 X; |
734 | u32 Y; | |
735 | u8 STATE[256]; | |
62eb734b | 736 | }; |
ca97b838 | 737 | |
cc277069 BZ |
738 | /* */ |
739 | /* Tkip Key structure which RC4 key & MIC calculation */ | |
740 | /* */ | |
62eb734b | 741 | struct rt_tkip_key_info { |
51126deb BZ |
742 | u32 nBytesInM; /* # bytes in M for MICKEY */ |
743 | unsigned long IV16; | |
744 | unsigned long IV32; | |
745 | unsigned long K0; /* for MICKEY Low */ | |
746 | unsigned long K1; /* for MICKEY Hig */ | |
747 | unsigned long L; /* Current state for MICKEY */ | |
748 | unsigned long R; /* Current state for MICKEY */ | |
749 | unsigned long M; /* Message accumulator for MICKEY */ | |
750 | u8 RC4KEY[16]; | |
751 | u8 MIC[8]; | |
62eb734b | 752 | }; |
91980990 | 753 | |
cc277069 BZ |
754 | /* */ |
755 | /* Private / Misc data, counters for driver internal use */ | |
756 | /* */ | |
62eb734b | 757 | struct rt_private { |
51126deb | 758 | u32 SystemResetCnt; /* System reset counter */ |
25985edc | 759 | u32 TxRingFullCnt; /* Tx ring full occurrence number */ |
51126deb | 760 | u32 PhyRxErrCnt; /* PHY Rx error count, for debug purpose, might move to global counter */ |
cc277069 | 761 | /* Variables for WEP encryption / decryption in rtmp_wep.c */ |
51126deb | 762 | u32 FCSCRC32; |
62eb734b | 763 | struct rt_arcfourcontext WEPCONTEXT; |
cc277069 | 764 | /* Tkip stuff */ |
62eb734b BZ |
765 | struct rt_tkip_key_info Tx; |
766 | struct rt_tkip_key_info Rx; | |
767 | }; | |
91980990 | 768 | |
ca97b838 BZ |
769 | /*************************************************************************** |
770 | * Channel and BBP related data structures | |
771 | **************************************************************************/ | |
cc277069 | 772 | /* structure to tune BBP R66 (BBP TUNING) */ |
62eb734b | 773 | struct rt_bbp_r66_tuning { |
52b81c89 | 774 | BOOLEAN bEnable; |
51126deb BZ |
775 | u16 FalseCcaLowerThreshold; /* default 100 */ |
776 | u16 FalseCcaUpperThreshold; /* default 512 */ | |
777 | u8 R66Delta; | |
778 | u8 R66CurrentValue; | |
cc277069 | 779 | BOOLEAN R66LowerUpperSelect; /*Before LinkUp, Used LowerBound or UpperBound as R66 value. */ |
62eb734b | 780 | }; |
91980990 | 781 | |
cc277069 | 782 | /* structure to store channel TX power */ |
62eb734b | 783 | struct rt_channel_tx_power { |
51126deb BZ |
784 | u16 RemainingTimeForUse; /*unit: sec */ |
785 | u8 Channel; | |
786 | char Power; | |
787 | char Power2; | |
788 | u8 MaxTxPwr; | |
789 | u8 DfsReq; | |
62eb734b | 790 | }; |
91980990 | 791 | |
cc277069 | 792 | /* structure to store 802.11j channel TX power */ |
62eb734b | 793 | struct rt_channel_11j_tx_power { |
51126deb BZ |
794 | u8 Channel; |
795 | u8 BW; /* BW_10 or BW_20 */ | |
796 | char Power; | |
797 | char Power2; | |
798 | u16 RemainingTimeForUse; /*unit: sec */ | |
62eb734b | 799 | }; |
91980990 | 800 | |
62eb734b | 801 | struct rt_soft_rx_ant_diversity { |
51126deb BZ |
802 | u8 EvaluatePeriod; /* 0:not evalute status, 1: evaluate status, 2: switching status */ |
803 | u8 EvaluateStableCnt; | |
804 | u8 Pair1PrimaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ | |
805 | u8 Pair1SecondaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ | |
806 | u8 Pair2PrimaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */ | |
807 | u8 Pair2SecondaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */ | |
808 | short Pair1AvgRssi[2]; /* AvgRssi[0]:E1, AvgRssi[1]:E2 */ | |
809 | short Pair2AvgRssi[2]; /* AvgRssi[0]:E3, AvgRssi[1]:E4 */ | |
810 | short Pair1LastAvgRssi; /* */ | |
811 | short Pair2LastAvgRssi; /* */ | |
812 | unsigned long RcvPktNumWhenEvaluate; | |
52b81c89 | 813 | BOOLEAN FirstPktArrivedWhenEvaluate; |
62eb734b BZ |
814 | struct rt_ralink_timer RxAntDiversityTimer; |
815 | }; | |
ca97b838 | 816 | |
ca97b838 BZ |
817 | /*************************************************************************** |
818 | * structure for radar detection and channel switch | |
819 | **************************************************************************/ | |
62eb734b | 820 | struct rt_radar_detect { |
cc277069 | 821 | /*BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h */ |
51126deb BZ |
822 | u8 CSCount; /*Channel switch counter */ |
823 | u8 CSPeriod; /*Channel switch period (beacon count) */ | |
824 | u8 RDCount; /*Radar detection counter */ | |
825 | u8 RDMode; /*Radar Detection mode */ | |
826 | u8 RDDurRegion; /*Radar detection duration region */ | |
827 | u8 BBPR16; | |
828 | u8 BBPR17; | |
829 | u8 BBPR18; | |
830 | u8 BBPR21; | |
831 | u8 BBPR22; | |
832 | u8 BBPR64; | |
833 | unsigned long InServiceMonitorCount; /* unit: sec */ | |
834 | u8 DfsSessionTime; | |
52b81c89 | 835 | BOOLEAN bFastDfs; |
51126deb BZ |
836 | u8 ChMovingTime; |
837 | u8 LongPulseRadarTh; | |
62eb734b | 838 | }; |
ca97b838 | 839 | |
91980990 GKH |
840 | typedef enum _ABGBAND_STATE_ { |
841 | UNKNOWN_BAND, | |
842 | BG_BAND, | |
843 | A_BAND, | |
844 | } ABGBAND_STATE; | |
845 | ||
e44fd1cf | 846 | #ifdef RTMP_MAC_PCI |
cc277069 | 847 | /* Power save method control */ |
52b81c89 BZ |
848 | typedef union _PS_CONTROL { |
849 | struct { | |
6ccb5d7c JM |
850 | unsigned long EnablePSinIdle:1; /* Enable radio off when not connected to AP. radio on only when sitesurvey, */ |
851 | unsigned long EnableNewPS:1; /* Enable new Chip power save function . New method can only be applied in chip version after 2872. and PCIe. */ | |
51126deb BZ |
852 | unsigned long rt30xxPowerMode:2; /* Power Level Mode for rt30xx chip */ |
853 | unsigned long rt30xxFollowHostASPM:1; /* Card Follows Host's setting for rt30xx chip. */ | |
854 | unsigned long rt30xxForceASPMTest:1; /* Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. */ | |
855 | unsigned long rsv:26; /* Radio Measurement Enable */ | |
52b81c89 | 856 | } field; |
51126deb | 857 | unsigned long word; |
52b81c89 | 858 | } PS_CONTROL, *PPS_CONTROL; |
cc277069 | 859 | #endif /* RTMP_MAC_PCI // */ |
ca97b838 BZ |
860 | |
861 | /*************************************************************************** | |
862 | * structure for MLME state machine | |
863 | **************************************************************************/ | |
62eb734b | 864 | struct rt_mlme { |
cc277069 | 865 | /* STA state machines */ |
62eb734b BZ |
866 | struct rt_state_machine CntlMachine; |
867 | struct rt_state_machine AssocMachine; | |
868 | struct rt_state_machine AuthMachine; | |
869 | struct rt_state_machine AuthRspMachine; | |
870 | struct rt_state_machine SyncMachine; | |
871 | struct rt_state_machine WpaPskMachine; | |
872 | struct rt_state_machine LeapMachine; | |
52b81c89 BZ |
873 | STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE]; |
874 | STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE]; | |
875 | STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE]; | |
876 | STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE]; | |
877 | STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE]; | |
cc277069 | 878 | /* Action */ |
62eb734b | 879 | struct rt_state_machine ActMachine; |
ca97b838 | 880 | |
cc277069 | 881 | /* common WPA state machine */ |
62eb734b | 882 | struct rt_state_machine WpaMachine; |
52b81c89 | 883 | STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE]; |
ca97b838 | 884 | |
51126deb BZ |
885 | unsigned long ChannelQuality; /* 0..100, Channel Quality Indication for Roaming */ |
886 | unsigned long Now32; /* latch the value of NdisGetSystemUpTime() */ | |
887 | unsigned long LastSendNULLpsmTime; | |
91980990 | 888 | |
52b81c89 | 889 | BOOLEAN bRunning; |
8a10a546 | 890 | spinlock_t TaskLock; |
62eb734b | 891 | struct rt_mlme_queue Queue; |
91980990 | 892 | |
51126deb | 893 | u32 ShiftReg; |
91980990 | 894 | |
62eb734b BZ |
895 | struct rt_ralink_timer PeriodicTimer; |
896 | struct rt_ralink_timer APSDPeriodicTimer; | |
897 | struct rt_ralink_timer LinkDownTimer; | |
898 | struct rt_ralink_timer LinkUpTimer; | |
ca97b838 | 899 | #ifdef RTMP_MAC_PCI |
51126deb | 900 | u8 bPsPollTimerRunning; |
62eb734b BZ |
901 | struct rt_ralink_timer PsPollTimer; |
902 | struct rt_ralink_timer RadioOnOffTimer; | |
cc277069 | 903 | #endif /* RTMP_MAC_PCI // */ |
51126deb BZ |
904 | unsigned long PeriodicRound; |
905 | unsigned long OneSecPeriodicRound; | |
52b81c89 | 906 | |
51126deb | 907 | u8 RealRxPath; |
52b81c89 BZ |
908 | BOOLEAN bLowThroughput; |
909 | BOOLEAN bEnableAutoAntennaCheck; | |
62eb734b | 910 | struct rt_ralink_timer RxAntEvalTimer; |
91980990 | 911 | |
ca97b838 | 912 | #ifdef RT30xx |
51126deb BZ |
913 | u8 CaliBW40RfR24; |
914 | u8 CaliBW20RfR24; | |
cc277069 | 915 | #endif /* RT30xx // */ |
ca97b838 BZ |
916 | |
917 | #ifdef RTMP_MAC_USB | |
62eb734b | 918 | struct rt_ralink_timer AutoWakeupTimer; |
52b81c89 | 919 | BOOLEAN AutoWakeupTimerRunning; |
cc277069 | 920 | #endif /* RTMP_MAC_USB // */ |
62eb734b | 921 | }; |
91980990 | 922 | |
ca97b838 BZ |
923 | /*************************************************************************** |
924 | * 802.11 N related data structures | |
925 | **************************************************************************/ | |
52b81c89 BZ |
926 | struct reordering_mpdu { |
927 | struct reordering_mpdu *next; | |
25985edc | 928 | void *pPacket; /* converted to 802.3 frame */ |
52b81c89 BZ |
929 | int Sequence; /* sequence number of MPDU */ |
930 | BOOLEAN bAMSDU; | |
ca97b838 BZ |
931 | }; |
932 | ||
52b81c89 | 933 | struct reordering_list { |
ca97b838 | 934 | struct reordering_mpdu *next; |
52b81c89 | 935 | int qlen; |
ca97b838 BZ |
936 | }; |
937 | ||
52b81c89 | 938 | struct reordering_mpdu_pool { |
51126deb | 939 | void *mem; |
8a10a546 | 940 | spinlock_t lock; |
52b81c89 | 941 | struct reordering_list freelist; |
ca97b838 BZ |
942 | }; |
943 | ||
52b81c89 BZ |
944 | typedef enum _REC_BLOCKACK_STATUS { |
945 | Recipient_NONE = 0, | |
ca97b838 BZ |
946 | Recipient_USED, |
947 | Recipient_HandleRes, | |
52b81c89 | 948 | Recipient_Accept |
91980990 GKH |
949 | } REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS; |
950 | ||
52b81c89 BZ |
951 | typedef enum _ORI_BLOCKACK_STATUS { |
952 | Originator_NONE = 0, | |
91980990 | 953 | Originator_USED, |
52b81c89 BZ |
954 | Originator_WaitRes, |
955 | Originator_Done | |
91980990 GKH |
956 | } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS; |
957 | ||
62eb734b | 958 | struct rt_ba_ori_entry { |
51126deb BZ |
959 | u8 Wcid; |
960 | u8 TID; | |
961 | u8 BAWinSize; | |
962 | u8 Token; | |
cc277069 | 963 | /* Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header. */ |
51126deb BZ |
964 | u16 Sequence; |
965 | u16 TimeOutValue; | |
52b81c89 | 966 | ORI_BLOCKACK_STATUS ORI_BA_Status; |
62eb734b | 967 | struct rt_ralink_timer ORIBATimer; |
51126deb | 968 | void *pAdapter; |
62eb734b | 969 | }; |
91980990 | 970 | |
62eb734b | 971 | struct rt_ba_rec_entry { |
51126deb BZ |
972 | u8 Wcid; |
973 | u8 TID; | |
974 | u8 BAWinSize; /* 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. */ | |
975 | /*u8 NumOfRxPkt; */ | |
976 | /*u8 Curindidx; // the head in the RX reordering buffer */ | |
977 | u16 LastIndSeq; | |
978 | /* u16 LastIndSeqAtTimer; */ | |
979 | u16 TimeOutValue; | |
62eb734b | 980 | struct rt_ralink_timer RECBATimer; |
51126deb BZ |
981 | unsigned long LastIndSeqAtTimer; |
982 | unsigned long nDropPacket; | |
983 | unsigned long rcvSeq; | |
52b81c89 | 984 | REC_BLOCKACK_STATUS REC_BA_Status; |
51126deb | 985 | /* u8 RxBufIdxUsed; */ |
cc277069 BZ |
986 | /* corresponding virtual address for RX reordering packet storage. */ |
987 | /*RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; */ | |
8a10a546 | 988 | spinlock_t RxReRingLock; /* Rx Ring spinlock */ |
cc277069 | 989 | /* struct _BA_REC_ENTRY *pNext; */ |
51126deb | 990 | void *pAdapter; |
52b81c89 | 991 | struct reordering_list list; |
62eb734b | 992 | }; |
91980990 | 993 | |
62eb734b | 994 | struct rt_ba_table { |
51126deb BZ |
995 | unsigned long numAsRecipient; /* I am recipient of numAsRecipient clients. These client are in the BARecEntry[] */ |
996 | unsigned long numAsOriginator; /* I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] */ | |
997 | unsigned long numDoneOriginator; /* count Done Originator sessions */ | |
62eb734b BZ |
998 | struct rt_ba_ori_entry BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; |
999 | struct rt_ba_rec_entry BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; | |
1000 | }; | |
91980990 | 1001 | |
cc277069 | 1002 | /*For QureyBATableOID use; */ |
62eb734b | 1003 | struct PACKED rt_oid_ba_rec_entry { |
51126deb BZ |
1004 | u8 MACAddr[MAC_ADDR_LEN]; |
1005 | u8 BaBitmap; /* if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize */ | |
1006 | u8 rsv; | |
1007 | u8 BufSize[8]; | |
52b81c89 | 1008 | REC_BLOCKACK_STATUS REC_BA_Status[8]; |
62eb734b | 1009 | }; |
91980990 | 1010 | |
cc277069 | 1011 | /*For QureyBATableOID use; */ |
62eb734b | 1012 | struct PACKED rt_oid_ba_ori_entry { |
51126deb BZ |
1013 | u8 MACAddr[MAC_ADDR_LEN]; |
1014 | 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 */ | |
1015 | u8 rsv; | |
1016 | u8 BufSize[8]; | |
52b81c89 | 1017 | ORI_BLOCKACK_STATUS ORI_BA_Status[8]; |
62eb734b | 1018 | }; |
91980990 | 1019 | |
62eb734b BZ |
1020 | struct rt_queryba_table { |
1021 | struct rt_oid_ba_ori_entry BAOriEntry[32]; | |
1022 | struct rt_oid_ba_rec_entry BARecEntry[32]; | |
51126deb BZ |
1023 | u8 OriNum; /* Number of below BAOriEntry */ |
1024 | u8 RecNum; /* Number of below BARecEntry */ | |
62eb734b | 1025 | }; |
91980990 | 1026 | |
52b81c89 BZ |
1027 | typedef union _BACAP_STRUC { |
1028 | struct { | |
51126deb BZ |
1029 | u32 RxBAWinLimit:8; |
1030 | u32 TxBAWinLimit:8; | |
1031 | u32 AutoBA:1; /* automatically BA */ | |
1032 | u32 Policy:2; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use */ | |
1033 | u32 MpduDensity:3; | |
1034 | u32 AmsduEnable:1; /*Enable AMSDU transmisstion */ | |
1035 | u32 AmsduSize:1; /* 0:3839, 1:7935 bytes. u32 MSDUSizeToBytes[] = { 3839, 7935}; */ | |
1036 | u32 MMPSmode:2; /* MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable */ | |
1037 | u32 bHtAdhoc:1; /* adhoc can use ht rate. */ | |
1038 | 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. */ | |
fdb2fd14 | 1039 | u32: 4; |
52b81c89 | 1040 | } field; |
51126deb | 1041 | u32 word; |
91980990 | 1042 | } BACAP_STRUC, *PBACAP_STRUC; |
91980990 | 1043 | |
62eb734b | 1044 | struct rt_oid_add_ba_entry { |
52b81c89 | 1045 | BOOLEAN IsRecipient; |
51126deb BZ |
1046 | u8 MACAddr[MAC_ADDR_LEN]; |
1047 | u8 TID; | |
1048 | u8 nMSDU; | |
1049 | u16 TimeOut; | |
cc277069 | 1050 | BOOLEAN bAllTid; /* If True, delete all TID for BA sessions with this MACaddr. */ |
62eb734b | 1051 | }; |
ca97b838 | 1052 | |
ca97b838 BZ |
1053 | #define IS_HT_STA(_pMacEntry) \ |
1054 | (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX) | |
1055 | ||
1056 | #define IS_HT_RATE(_pMacEntry) \ | |
1057 | (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) | |
1058 | ||
1059 | #define PEER_IS_HT_RATE(_pMacEntry) \ | |
1060 | (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) | |
1061 | ||
cc277069 | 1062 | /*This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) */ |
62eb734b | 1063 | struct rt_iot { |
51126deb BZ |
1064 | u8 Threshold[2]; |
1065 | u8 ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; /* compare with threshold[0] */ | |
1066 | u8 RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; /* compare with threshold[1] */ | |
1067 | unsigned long OneSecInWindowCount; | |
1068 | unsigned long OneSecFrameDuplicateCount; | |
1069 | unsigned long OneSecOutWindowCount; | |
1070 | u8 DelOriAct; | |
1071 | u8 DelRecAct; | |
1072 | u8 RTSShortProt; | |
1073 | u8 RTSLongProt; | |
52b81c89 BZ |
1074 | BOOLEAN bRTSLongProtOn; |
1075 | BOOLEAN bLastAtheros; | |
1076 | BOOLEAN bCurrentAtheros; | |
1077 | BOOLEAN bNowAtherosBurstOn; | |
1078 | BOOLEAN bNextDisableRxBA; | |
1079 | BOOLEAN bToggle; | |
62eb734b | 1080 | }; |
91980990 | 1081 | |
cc277069 | 1082 | /* This is the registry setting for 802.11n transmit setting. Used in advanced page. */ |
91980990 | 1083 | typedef union _REG_TRANSMIT_SETTING { |
52b81c89 | 1084 | struct { |
51126deb BZ |
1085 | /*u32 PhyMode:4; */ |
1086 | /*u32 MCS:7; // MCS */ | |
1087 | u32 rsv0:10; | |
1088 | u32 TxBF:1; | |
1089 | u32 BW:1; /*channel bandwidth 20MHz or 40 MHz */ | |
1090 | u32 ShortGI:1; | |
1091 | u32 STBC:1; /*SPACE */ | |
1092 | u32 TRANSNO:2; | |
1093 | u32 HTMODE:1; | |
1094 | u32 EXTCHA:2; | |
1095 | u32 rsv:13; | |
52b81c89 | 1096 | } field; |
51126deb | 1097 | u32 word; |
91980990 GKH |
1098 | } REG_TRANSMIT_SETTING, *PREG_TRANSMIT_SETTING; |
1099 | ||
52b81c89 BZ |
1100 | typedef union _DESIRED_TRANSMIT_SETTING { |
1101 | struct { | |
51126deb BZ |
1102 | u16 MCS:7; /* MCS */ |
1103 | u16 PhyMode:4; | |
1104 | u16 FixedTxMode:2; /* If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. */ | |
1105 | u16 rsv:3; | |
52b81c89 | 1106 | } field; |
51126deb | 1107 | u16 word; |
52b81c89 | 1108 | } DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING; |
91980990 | 1109 | |
ca97b838 BZ |
1110 | #ifdef RTMP_MAC_USB |
1111 | /*************************************************************************** | |
1112 | * USB-based chip Beacon related data structures | |
1113 | **************************************************************************/ | |
1114 | #define BEACON_BITMAP_MASK 0xff | |
62eb734b | 1115 | struct rt_beacon_sync { |
51126deb BZ |
1116 | u8 BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET]; |
1117 | u8 BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE]; | |
1118 | unsigned long TimIELocationInBeacon[HW_BEACON_MAX_COUNT]; | |
1119 | unsigned long CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT]; | |
cc277069 | 1120 | BOOLEAN EnableBeacon; /* trigger to enable beacon transmission. */ |
6ccb5d7c JM |
1121 | u8 BeaconBitMap; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter needs to change. */ |
1122 | u8 DtimBitOn; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter needs to change. */ | |
62eb734b | 1123 | }; |
cc277069 | 1124 | #endif /* RTMP_MAC_USB // */ |
91980990 | 1125 | |
ca97b838 BZ |
1126 | /*************************************************************************** |
1127 | * Multiple SSID related data structures | |
1128 | **************************************************************************/ | |
52b81c89 BZ |
1129 | #define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */ |
1130 | #define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */ | |
91980990 GKH |
1131 | |
1132 | /* clear bcmc TIM bit */ | |
1133 | #define WLAN_MR_TIM_BCMC_CLEAR(apidx) \ | |
1134 | pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] &= ~BIT8[0]; | |
1135 | ||
1136 | /* set bcmc TIM bit */ | |
1137 | #define WLAN_MR_TIM_BCMC_SET(apidx) \ | |
1138 | pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] |= BIT8[0]; | |
1139 | ||
1140 | /* clear a station PS TIM bit */ | |
1141 | #define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, wcid) \ | |
51126deb BZ |
1142 | { u8 tim_offset = wcid >> 3; \ |
1143 | u8 bit_offset = wcid & 0x7; \ | |
91980990 GKH |
1144 | ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); } |
1145 | ||
1146 | /* set a station PS TIM bit */ | |
1147 | #define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \ | |
51126deb BZ |
1148 | { u8 tim_offset = wcid >> 3; \ |
1149 | u8 bit_offset = wcid & 0x7; \ | |
91980990 GKH |
1150 | ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; } |
1151 | ||
cc277069 | 1152 | /* configuration common to OPMODE_AP as well as OPMODE_STA */ |
62eb734b | 1153 | struct rt_common_config { |
91980990 | 1154 | |
52b81c89 | 1155 | BOOLEAN bCountryFlag; |
51126deb BZ |
1156 | u8 CountryCode[3]; |
1157 | u8 Geography; | |
1158 | u8 CountryRegion; /* Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel */ | |
1159 | u8 CountryRegionForABand; /* Enum of country region for A band */ | |
1160 | u8 PhyMode; /* PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED */ | |
1161 | u16 Dsifs; /* in units of usec */ | |
1162 | unsigned long PacketFilter; /* Packet filter for receiving */ | |
1163 | u8 RegulatoryClass; | |
1164 | ||
1165 | char Ssid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */ | |
1166 | u8 SsidLen; /* the actual ssid length in used */ | |
1167 | u8 LastSsidLen; /* the actual ssid length in used */ | |
1168 | char LastSsid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */ | |
1169 | u8 LastBssid[MAC_ADDR_LEN]; | |
1170 | ||
1171 | u8 Bssid[MAC_ADDR_LEN]; | |
1172 | u16 BeaconPeriod; | |
1173 | u8 Channel; | |
1174 | u8 CentralChannel; /* Central Channel when using 40MHz is indicating. not real channel. */ | |
1175 | ||
1176 | u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES]; | |
1177 | u8 SupRateLen; | |
1178 | u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; | |
1179 | u8 ExtRateLen; | |
1180 | u8 DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; /* OID_802_11_DESIRED_RATES */ | |
1181 | u8 MaxDesiredRate; | |
1182 | u8 ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES]; | |
1183 | ||
1184 | unsigned long BasicRateBitmap; /* backup basic ratebitmap */ | |
52b81c89 BZ |
1185 | |
1186 | BOOLEAN bAPSDCapable; | |
1187 | BOOLEAN bInServicePeriod; | |
1188 | BOOLEAN bAPSDAC_BE; | |
1189 | BOOLEAN bAPSDAC_BK; | |
1190 | BOOLEAN bAPSDAC_VI; | |
1191 | BOOLEAN bAPSDAC_VO; | |
ca97b838 BZ |
1192 | |
1193 | /* because TSPEC can modify the APSD flag, we need to keep the APSD flag | |
52b81c89 BZ |
1194 | requested in association stage from the station; |
1195 | we need to recover the APSD flag after the TSPEC is deleted. */ | |
1196 | BOOLEAN bACMAPSDBackup[4]; /* for delivery-enabled & trigger-enabled both */ | |
1197 | BOOLEAN bACMAPSDTr[4]; /* no use */ | |
1198 | ||
1199 | BOOLEAN bNeedSendTriggerFrame; | |
cc277069 | 1200 | BOOLEAN bAPSDForcePowerSave; /* Force power save mode, should only use in APSD-STAUT */ |
51126deb BZ |
1201 | unsigned long TriggerTimerCount; |
1202 | u8 MaxSPLength; | |
1203 | u8 BBPCurrentBW; /* BW_10, BW_20, BW_40 */ | |
cc277069 BZ |
1204 | /* move to MULTISSID_STRUCT for MBSS */ |
1205 | /*HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. */ | |
1206 | REG_TRANSMIT_SETTING RegTransmitSetting; /*registry transmit setting. this is for reading registry setting only. not useful. */ | |
51126deb BZ |
1207 | /*u8 FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode */ |
1208 | u8 TxRate; /* Same value to fill in TXD. TxRate is 6-bit */ | |
1209 | u8 MaxTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ | |
1210 | u8 TxRateIndex; /* Tx rate index in RateSwitchTable */ | |
1211 | u8 TxRateTableSize; /* Valid Tx rate table size in RateSwitchTable */ | |
cc277069 | 1212 | /*BOOLEAN bAutoTxRateSwitch; */ |
51126deb BZ |
1213 | u8 MinTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ |
1214 | u8 RtsRate; /* RATE_xxx */ | |
6ccb5d7c | 1215 | HTTRANSMIT_SETTING MlmeTransmit; /* MGMT frame PHY rate setting when operation at Ht rate. */ |
51126deb BZ |
1216 | u8 MlmeRate; /* RATE_xxx, used to send MLME frames */ |
1217 | u8 BasicMlmeRate; /* Default Rate for sending MLME frames */ | |
cc277069 | 1218 | |
51126deb BZ |
1219 | u16 RtsThreshold; /* in unit of BYTE */ |
1220 | u16 FragmentThreshold; /* in unit of BYTE */ | |
cc277069 | 1221 | |
51126deb BZ |
1222 | u8 TxPower; /* in unit of mW */ |
1223 | unsigned long TxPowerPercentage; /* 0~100 % */ | |
1224 | unsigned long TxPowerDefault; /* keep for TxPowerPercentage */ | |
1225 | u8 PwrConstraint; | |
52b81c89 | 1226 | |
cc277069 BZ |
1227 | BACAP_STRUC BACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ |
1228 | BACAP_STRUC REGBACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ | |
52b81c89 | 1229 | |
62eb734b | 1230 | struct rt_iot IOTestParm; /* 802.11n InterOpbility Test Parameter; */ |
51126deb | 1231 | unsigned long TxPreamble; /* Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto */ |
cc277069 | 1232 | BOOLEAN bUseZeroToDisableFragment; /* Microsoft use 0 as disable */ |
51126deb | 1233 | unsigned long UseBGProtection; /* 0: auto, 1: always use, 2: always not use */ |
cc277069 BZ |
1234 | BOOLEAN bUseShortSlotTime; /* 0: disable, 1 - use short slot (9us) */ |
1235 | BOOLEAN bEnableTxBurst; /* 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST */ | |
1236 | BOOLEAN bAggregationCapable; /* 1: enable TX aggregation when the peer supports it */ | |
1237 | BOOLEAN bPiggyBackCapable; /* 1: enable TX piggy-back according MAC's version */ | |
1238 | BOOLEAN bIEEE80211H; /* 1: enable IEEE802.11h spec. */ | |
51126deb | 1239 | unsigned long DisableOLBCDetect; /* 0: enable OLBC detect; 1 disable OLBC detect */ |
52b81c89 BZ |
1240 | |
1241 | BOOLEAN bRdg; | |
1242 | ||
cc277069 | 1243 | BOOLEAN bWmmCapable; /* 0:disable WMM, 1:enable WMM */ |
62eb734b BZ |
1244 | struct rt_qos_capability_parm APQosCapability; /* QOS capability of the current associated AP */ |
1245 | struct rt_edca_parm APEdcaParm; /* EDCA parameters of the current associated AP */ | |
1246 | struct rt_qbss_load_parm APQbssLoad; /* QBSS load of the current associated AP */ | |
51126deb | 1247 | u8 AckPolicy[4]; /* ACK policy of the specified AC. see ACK_xxx */ |
cc277069 BZ |
1248 | BOOLEAN bDLSCapable; /* 0:disable DLS, 1:enable DLS */ |
1249 | /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */ | |
1250 | /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */ | |
1251 | /* OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. */ | |
1252 | /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition */ | |
51126deb | 1253 | unsigned long OpStatusFlags; |
91980990 | 1254 | |
cc277069 BZ |
1255 | BOOLEAN NdisRadioStateOff; /*For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. */ |
1256 | ABGBAND_STATE BandState; /* For setting BBP used on B/G or A mode. */ | |
91980990 | 1257 | |
cc277069 | 1258 | /* IEEE802.11H--DFS. */ |
62eb734b | 1259 | struct rt_radar_detect RadarDetect; |
91980990 | 1260 | |
cc277069 | 1261 | /* HT */ |
51126deb | 1262 | u8 BASize; /* USer desired BAWindowSize. Should not exceed our max capability */ |
62eb734b BZ |
1263 | /*struct rt_ht_capability SupportedHtPhy; */ |
1264 | struct rt_ht_capability DesiredHtPhy; | |
1265 | struct rt_ht_capability_ie HtCapability; | |
1266 | struct rt_add_ht_info_ie AddHTInfo; /* Useful as AP. */ | |
cc277069 | 1267 | /*This IE is used with channel switch announcement element when changing to a new 40MHz. */ |
6ccb5d7c | 1268 | /*This IE is included in channel switch announcement frames 7.4.1.5, beacons, probe Rsp. */ |
62eb734b | 1269 | 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 */ |
91980990 | 1270 | |
52b81c89 BZ |
1271 | BOOLEAN bHTProtect; |
1272 | BOOLEAN bMIMOPSEnable; | |
1273 | BOOLEAN bBADecline; | |
cc277069 | 1274 | /*2008/11/05: KH add to support Antenna power-saving of AP<-- */ |
52b81c89 | 1275 | BOOLEAN bGreenAPEnable; |
cc277069 | 1276 | /*2008/11/05: KH add to support Antenna power-saving of AP--> */ |
52b81c89 BZ |
1277 | BOOLEAN bDisableReordering; |
1278 | BOOLEAN bForty_Mhz_Intolerant; | |
1279 | BOOLEAN bExtChannelSwitchAnnouncement; | |
1280 | BOOLEAN bRcvBSSWidthTriggerEvents; | |
51126deb | 1281 | unsigned long LastRcvBSSWidthTriggerEventsTime; |
91980990 | 1282 | |
51126deb | 1283 | u8 TxBASize; |
91980990 | 1284 | |
cc277069 | 1285 | /* Enable wireless event */ |
52b81c89 | 1286 | BOOLEAN bWirelessEvent; |
cc277069 | 1287 | BOOLEAN bWiFiTest; /* Enable this parameter for WiFi test */ |
91980990 | 1288 | |
cc277069 | 1289 | /* Tx & Rx Stream number selection */ |
51126deb BZ |
1290 | u8 TxStream; |
1291 | u8 RxStream; | |
91980990 | 1292 | |
cc277069 | 1293 | BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */ |
91980990 | 1294 | |
ca97b838 | 1295 | #ifdef RTMP_MAC_USB |
cc277069 | 1296 | BOOLEAN bMultipleIRP; /* Multiple Bulk IN flag */ |
51126deb | 1297 | u8 NumOfBulkInIRP; /* if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 */ |
62eb734b | 1298 | struct rt_ht_capability SupportedHtPhy; |
51126deb BZ |
1299 | unsigned long MaxPktOneTxBulk; |
1300 | u8 TxBulkFactor; | |
1301 | u8 RxBulkFactor; | |
52b81c89 BZ |
1302 | |
1303 | BOOLEAN IsUpdateBeacon; | |
62eb734b BZ |
1304 | struct rt_beacon_sync *pBeaconSync; |
1305 | struct rt_ralink_timer BeaconUpdateTimer; | |
51126deb BZ |
1306 | u32 BeaconAdjust; |
1307 | u32 BeaconFactor; | |
1308 | u32 BeaconRemain; | |
cc277069 | 1309 | #endif /* RTMP_MAC_USB // */ |
91980990 | 1310 | |
8a10a546 | 1311 | spinlock_t MeasureReqTabLock; |
62eb734b | 1312 | struct rt_measure_req_tab *pMeasureReqTab; |
91980990 | 1313 | |
8a10a546 | 1314 | spinlock_t TpcReqTabLock; |
62eb734b | 1315 | struct rt_tpc_req_tab *pTpcReqTab; |
91980990 | 1316 | |
cc277069 | 1317 | BOOLEAN PSPXlink; /* 0: Disable. 1: Enable */ |
ca97b838 | 1318 | |
fdb2fd14 | 1319 | #if defined(RT305x) || defined(RT30xx) |
cc277069 | 1320 | /* request by Gary, for High Power issue */ |
51126deb | 1321 | u8 HighPowerPatchDisabled; |
ca97b838 BZ |
1322 | #endif |
1323 | ||
52b81c89 | 1324 | BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */ |
62eb734b | 1325 | }; |
91980990 | 1326 | |
91980990 | 1327 | /* Modified by Wu Xi-Kun 4/21/2006 */ |
cc277069 | 1328 | /* STA configuration and status */ |
62eb734b | 1329 | struct rt_sta_admin_config { |
cc277069 BZ |
1330 | /* GROUP 1 - */ |
1331 | /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */ | |
1332 | /* the user intended configuration, but not necessary fully equal to the final */ | |
6ccb5d7c | 1333 | /* settings in ACTIVE BSS after negotiation/compromise with the BSS holder (either */ |
cc277069 BZ |
1334 | /* AP or IBSS holder). */ |
1335 | /* Once initialized, user configuration can only be changed via OID_xxx */ | |
51126deb BZ |
1336 | u8 BssType; /* BSS_INFRA or BSS_ADHOC */ |
1337 | u16 AtimWin; /* used when starting a new IBSS */ | |
cc277069 BZ |
1338 | |
1339 | /* GROUP 2 - */ | |
1340 | /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */ | |
1341 | /* the user intended configuration, and should be always applied to the final */ | |
1342 | /* settings in ACTIVE BSS without compromising with the BSS holder. */ | |
1343 | /* Once initialized, user configuration can only be changed via OID_xxx */ | |
51126deb BZ |
1344 | u8 RssiTrigger; |
1345 | u8 RssiTriggerMode; /* RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD */ | |
1346 | u16 DefaultListenCount; /* default listen count; */ | |
1347 | unsigned long WindowsPowerMode; /* Power mode for AC power */ | |
1348 | unsigned long WindowsBatteryPowerMode; /* Power mode for battery if exists */ | |
cc277069 BZ |
1349 | BOOLEAN bWindowsACCAMEnable; /* Enable CAM power mode when AC on */ |
1350 | BOOLEAN bAutoReconnect; /* Set to TRUE when setting OID_802_11_SSID with no matching BSSID */ | |
51126deb | 1351 | unsigned long WindowsPowerProfile; /* Windows power profile, for NDIS5.1 PnP */ |
cc277069 BZ |
1352 | |
1353 | /* MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1) */ | |
51126deb BZ |
1354 | u16 Psm; /* power management mode (PWR_ACTIVE|PWR_SAVE) */ |
1355 | u16 DisassocReason; | |
1356 | u8 DisassocSta[MAC_ADDR_LEN]; | |
1357 | u16 DeauthReason; | |
1358 | u8 DeauthSta[MAC_ADDR_LEN]; | |
1359 | u16 AuthFailReason; | |
1360 | u8 AuthFailSta[MAC_ADDR_LEN]; | |
52b81c89 | 1361 | |
cc277069 BZ |
1362 | NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */ |
1363 | NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */ | |
52b81c89 | 1364 | NDIS_802_11_WEP_STATUS WepStatus; |
cc277069 | 1365 | NDIS_802_11_WEP_STATUS OrigWepStatus; /* Original wep status set from OID */ |
91980990 | 1366 | |
cc277069 BZ |
1367 | /* Add to support different cipher suite for WPA2/WPA mode */ |
1368 | NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Multicast cipher suite */ | |
1369 | NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher suite */ | |
1370 | BOOLEAN bMixCipher; /* Indicate current Pair & Group use different cipher suites */ | |
51126deb | 1371 | u16 RsnCapability; |
91980990 | 1372 | |
52b81c89 | 1373 | NDIS_802_11_WEP_STATUS GroupKeyWepStatus; |
91980990 | 1374 | |
51126deb BZ |
1375 | u8 WpaPassPhrase[64]; /* WPA PSK pass phrase */ |
1376 | u32 WpaPassPhraseLen; /* the length of WPA PSK pass phrase */ | |
1377 | u8 PMK[32]; /* WPA PSK mode PMK */ | |
1378 | u8 PTK[64]; /* WPA PSK mode PTK */ | |
1379 | u8 GTK[32]; /* GTK from authenticator */ | |
62eb734b | 1380 | struct rt_bssid_info SavedPMK[PMKID_NO]; |
51126deb | 1381 | u32 SavedPMKNum; /* Saved PMKID number */ |
91980990 | 1382 | |
51126deb | 1383 | u8 DefaultKeyId; |
91980990 | 1384 | |
cc277069 | 1385 | /* WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED */ |
51126deb | 1386 | u8 PortSecured; |
91980990 | 1387 | |
cc277069 | 1388 | /* For WPA countermeasures */ |
51126deb | 1389 | unsigned long LastMicErrorTime; /* record last MIC error time */ |
6ccb5d7c | 1390 | unsigned long MicErrCnt; /* Should be 0, 1, 2, then reset to zero (after disassociation). */ |
cc277069 BZ |
1391 | BOOLEAN bBlockAssoc; /* Block associate attempt for 60 seconds after counter measure occurred. */ |
1392 | /* For WPA-PSK supplicant state */ | |
1393 | WPA_STATE WpaState; /* Default is SS_NOTUSE and handled by microsoft 802.1x */ | |
51126deb | 1394 | u8 ReplayCounter[8]; |
6ccb5d7c | 1395 | u8 ANonce[32]; /* ANonce for WPA-PSK from auhenticator */ |
51126deb | 1396 | u8 SNonce[32]; /* SNonce for WPA-PSK */ |
91980990 | 1397 | |
51126deb BZ |
1398 | u8 LastSNR0; /* last received BEACON's SNR */ |
1399 | u8 LastSNR1; /* last received BEACON's SNR for 2nd antenna */ | |
62eb734b | 1400 | struct rt_rssi_sample RssiSample; |
51126deb | 1401 | unsigned long NumOfAvgRssiSample; |
91980990 | 1402 | |
51126deb BZ |
1403 | unsigned long LastBeaconRxTime; /* OS's timestamp of the last BEACON RX time */ |
1404 | unsigned long Last11bBeaconRxTime; /* OS's timestamp of the last 11B BEACON RX time */ | |
1405 | unsigned long Last11gBeaconRxTime; /* OS's timestamp of the last 11G BEACON RX time */ | |
1406 | unsigned long Last20NBeaconRxTime; /* OS's timestamp of the last 20MHz N BEACON RX time */ | |
cc277069 | 1407 | |
51126deb BZ |
1408 | unsigned long LastScanTime; /* Record last scan time for issue BSSID_SCAN_LIST */ |
1409 | unsigned long ScanCnt; /* Scan counts since most recent SSID, BSSID, SCAN OID request */ | |
cc277069 BZ |
1410 | BOOLEAN bSwRadio; /* Software controlled Radio On/Off, TRUE: On */ |
1411 | BOOLEAN bHwRadio; /* Hardware controlled Radio On/Off, TRUE: On */ | |
1412 | BOOLEAN bRadio; /* Radio state, And of Sw & Hw radio state */ | |
1413 | BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */ | |
1414 | BOOLEAN bShowHiddenSSID; /* Show all known SSID in SSID list get operation */ | |
1415 | ||
1416 | /* New for WPA, windows want us to keep association information and */ | |
1417 | /* Fixed IEs from last association response */ | |
62eb734b | 1418 | struct rt_ndis_802_11_association_information AssocInfo; |
51126deb BZ |
1419 | u16 ReqVarIELen; /* Length of next VIE include EID & Length */ |
1420 | u8 ReqVarIEs[MAX_VIE_LEN]; /* The content saved here should be little-endian format. */ | |
1421 | u16 ResVarIELen; /* Length of next VIE include EID & Length */ | |
1422 | u8 ResVarIEs[MAX_VIE_LEN]; | |
52b81c89 | 1423 | |
51126deb BZ |
1424 | u8 RSNIE_Len; |
1425 | u8 RSN_IE[MAX_LEN_OF_RSNIE]; /* The content saved here should be little-endian format. */ | |
cc277069 | 1426 | |
6ccb5d7c | 1427 | unsigned long CLBusyBytes; /* Save the total bytes received during channel load scan time */ |
51126deb | 1428 | u16 RPIDensity[8]; /* Array for RPI density collection */ |
cc277069 | 1429 | |
51126deb BZ |
1430 | u8 RMReqCnt; /* Number of measurement request saved. */ |
1431 | u8 CurrentRMReqIdx; /* Number of measurement request saved. */ | |
cc277069 BZ |
1432 | BOOLEAN ParallelReq; /* Parallel measurement, only one request performed, */ |
1433 | /* It must be the same channel with maximum duration */ | |
51126deb BZ |
1434 | u16 ParallelDuration; /* Maximum duration for parallel measurement */ |
1435 | u8 ParallelChannel; /* Only one channel with parallel measurement */ | |
1436 | u16 IAPPToken; /* IAPP dialog token */ | |
cc277069 | 1437 | /* Hack for channel load and noise histogram parameters */ |
51126deb BZ |
1438 | u8 NHFactor; /* Parameter for Noise histogram */ |
1439 | u8 CLFactor; /* Parameter for channel load */ | |
91980990 | 1440 | |
62eb734b | 1441 | struct rt_ralink_timer StaQuickResponeForRateUpTimer; |
52b81c89 | 1442 | BOOLEAN StaQuickResponeForRateUpTimerRunning; |
91980990 | 1443 | |
51126deb BZ |
1444 | u8 DtimCount; /* 0.. DtimPeriod-1 */ |
1445 | u8 DtimPeriod; /* default = 3 */ | |
91980990 | 1446 | |
cc277069 BZ |
1447 | /*////////////////////////////////////////////////////////////////////////////////////// */ |
1448 | /* This is only for WHQL test. */ | |
52b81c89 | 1449 | BOOLEAN WhqlTest; |
cc277069 | 1450 | /*////////////////////////////////////////////////////////////////////////////////////// */ |
91980990 | 1451 | |
62eb734b | 1452 | struct rt_ralink_timer WpaDisassocAndBlockAssocTimer; |
cc277069 BZ |
1453 | /* Fast Roaming */ |
1454 | BOOLEAN bAutoRoaming; /* 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI */ | |
51126deb | 1455 | char dBmToRoam; /* the condition to roam when receiving Rssi less than this value. It's negative value. */ |
91980990 | 1456 | |
52b81c89 BZ |
1457 | BOOLEAN IEEE8021X; |
1458 | BOOLEAN IEEE8021x_required_keys; | |
62eb734b | 1459 | struct rt_cipher_key DesireSharedKey[4]; /* Record user desired WEP keys */ |
51126deb | 1460 | u8 DesireSharedKeyId; |
91980990 | 1461 | |
cc277069 BZ |
1462 | /* 0: driver ignores wpa_supplicant */ |
1463 | /* 1: wpa_supplicant initiates scanning and AP selection */ | |
1464 | /* 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters */ | |
51126deb BZ |
1465 | u8 WpaSupplicantUP; |
1466 | u8 WpaSupplicantScanCount; | |
52b81c89 | 1467 | BOOLEAN bRSN_IE_FromWpaSupplicant; |
91980990 | 1468 | |
51126deb BZ |
1469 | char dev_name[16]; |
1470 | u16 OriDevType; | |
91980990 | 1471 | |
52b81c89 BZ |
1472 | BOOLEAN bTGnWifiTest; |
1473 | BOOLEAN bScanReqIsFromWebUI; | |
91980990 | 1474 | |
cc277069 | 1475 | HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */ |
52b81c89 | 1476 | DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; |
62eb734b | 1477 | struct rt_ht_phy_info DesiredHtPhyInfo; |
52b81c89 | 1478 | BOOLEAN bAutoTxRateSwitch; |
91980990 | 1479 | |
ca97b838 | 1480 | #ifdef RTMP_MAC_PCI |
51126deb | 1481 | u8 BBPR3; |
cc277069 BZ |
1482 | /* PS Control has 2 meanings for advanced power save function. */ |
1483 | /* 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. */ | |
1484 | /* 2. EnableNewPS : will save more current in sleep or radio off mode. */ | |
52b81c89 | 1485 | PS_CONTROL PSControl; |
cc277069 | 1486 | #endif /* RTMP_MAC_PCI // */ |
ca97b838 | 1487 | |
52b81c89 | 1488 | BOOLEAN bAutoConnectByBssid; |
51126deb | 1489 | unsigned long BeaconLostTime; /* seconds */ |
cc277069 | 1490 | BOOLEAN bForceTxBurst; /* 1: force enble TX PACKET BURST, 0: disable */ |
62eb734b | 1491 | }; |
91980990 | 1492 | |
6ccb5d7c | 1493 | /* This data structure keeps the current active BSS/IBSS's configuration that this STA */ |
cc277069 | 1494 | /* had agreed upon joining the network. Which means these parameters are usually decided */ |
6ccb5d7c | 1495 | /* by the BSS/IBSS creator instead of user configuration. Data in this data structure */ |
cc277069 BZ |
1496 | /* is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE. */ |
1497 | /* Normally, after SCAN or failed roaming attempts, we need to recover back to */ | |
1498 | /* the current active settings. */ | |
62eb734b | 1499 | struct rt_sta_active_config { |
51126deb BZ |
1500 | u16 Aid; |
1501 | u16 AtimWin; /* in kusec; IBSS parameter set element */ | |
1502 | u16 CapabilityInfo; | |
1503 | u16 CfpMaxDuration; | |
1504 | u16 CfpPeriod; | |
91980990 | 1505 | |
cc277069 BZ |
1506 | /* Copy supported rate from desired AP's beacon. We are trying to match */ |
1507 | /* AP's supported and extended rate settings. */ | |
51126deb BZ |
1508 | u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES]; |
1509 | u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; | |
1510 | u8 SupRateLen; | |
1511 | u8 ExtRateLen; | |
cc277069 | 1512 | /* Copy supported ht from desired AP's beacon. We are trying to match */ |
62eb734b BZ |
1513 | struct rt_ht_phy_info SupportedPhyInfo; |
1514 | struct rt_ht_capability SupportedHtPhy; | |
1515 | }; | |
91980990 | 1516 | |
62eb734b BZ |
1517 | struct rt_mac_table_entry; |
1518 | ||
1519 | struct rt_mac_table_entry { | |
cc277069 BZ |
1520 | /*Choose 1 from ValidAsWDS and ValidAsCLI to validize. */ |
1521 | BOOLEAN ValidAsCLI; /* Sta mode, set this TRUE after Linkup,too. */ | |
1522 | BOOLEAN ValidAsWDS; /* This is WDS Entry. only for AP mode. */ | |
6ccb5d7c | 1523 | BOOLEAN ValidAsApCli; /* This is a AP-Client entry, only for AP mode which enable AP-Client functions. */ |
52b81c89 | 1524 | BOOLEAN ValidAsMesh; |
cc277069 | 1525 | BOOLEAN ValidAsDls; /* This is DLS Entry. only for STA mode. */ |
52b81c89 | 1526 | BOOLEAN isCached; |
cc277069 | 1527 | BOOLEAN bIAmBadAtheros; /* Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. */ |
52b81c89 | 1528 | |
51126deb | 1529 | u8 EnqueueEapolStartTimerRunning; /* Enqueue EAPoL-Start for triggering EAP SM */ |
cc277069 | 1530 | /*jan for wpa */ |
6ccb5d7c | 1531 | /* record which entry revoke MIC Failure, if it leaves the BSS itself, AP won't update aMICFailTime MIB */ |
51126deb BZ |
1532 | u8 CMTimerRunning; |
1533 | u8 apidx; /* MBSS number */ | |
1534 | u8 RSNIE_Len; | |
1535 | u8 RSN_IE[MAX_LEN_OF_RSNIE]; | |
1536 | u8 ANonce[LEN_KEY_DESC_NONCE]; | |
1537 | u8 SNonce[LEN_KEY_DESC_NONCE]; | |
1538 | u8 R_Counter[LEN_KEY_DESC_REPLAY]; | |
1539 | u8 PTK[64]; | |
1540 | u8 ReTryCounter; | |
62eb734b BZ |
1541 | struct rt_ralink_timer RetryTimer; |
1542 | struct rt_ralink_timer EnqueueStartForPSKTimer; /* A timer which enqueue EAPoL-Start for triggering PSK SM */ | |
cc277069 | 1543 | NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */ |
52b81c89 BZ |
1544 | NDIS_802_11_WEP_STATUS WepStatus; |
1545 | NDIS_802_11_WEP_STATUS GroupKeyWepStatus; | |
1546 | AP_WPA_STATE WpaState; | |
1547 | GTK_STATE GTKState; | |
51126deb | 1548 | u16 PortSecured; |
cc277069 | 1549 | NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */ |
62eb734b | 1550 | struct rt_cipher_key PairwiseKey; |
51126deb BZ |
1551 | void *pAd; |
1552 | int PMKID_CacheIdx; | |
1553 | u8 PMKID[LEN_PMKID]; | |
52b81c89 | 1554 | |
51126deb BZ |
1555 | u8 Addr[MAC_ADDR_LEN]; |
1556 | u8 PsMode; | |
52b81c89 | 1557 | SST Sst; |
cc277069 BZ |
1558 | AUTH_STATE AuthState; /* for SHARED KEY authentication state machine used only */ |
1559 | BOOLEAN IsReassocSta; /* Indicate whether this is a reassociation procedure */ | |
51126deb BZ |
1560 | u16 Aid; |
1561 | u16 CapabilityInfo; | |
1562 | u8 LastRssi; | |
1563 | unsigned long NoDataIdleCount; | |
1564 | u16 StationKeepAliveCount; /* unit: second */ | |
1565 | unsigned long PsQIdleCount; | |
62eb734b | 1566 | struct rt_queue_header PsQueue; |
52b81c89 | 1567 | |
51126deb | 1568 | u32 StaConnectTime; /* the live time of this station since associated with AP */ |
52b81c89 BZ |
1569 | |
1570 | BOOLEAN bSendBAR; | |
51126deb | 1571 | u16 NoBADataCountDown; |
52b81c89 | 1572 | |
51126deb BZ |
1573 | u32 CachedBuf[16]; /* u32 (4 bytes) for alignment */ |
1574 | u32 TxBFCount; /* 3*3 */ | |
1575 | u32 FIFOCount; | |
1576 | u32 DebugFIFOCount; | |
1577 | u32 DebugTxCount; | |
52b81c89 | 1578 | BOOLEAN bDlsInit; |
91980990 | 1579 | |
cc277069 BZ |
1580 | /*==================================================== */ |
1581 | /*WDS entry needs these */ | |
1582 | /* if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab */ | |
51126deb BZ |
1583 | u32 MatchWDSTabIdx; |
1584 | u8 MaxSupportedRate; | |
1585 | u8 CurrTxRate; | |
1586 | u8 CurrTxRateIndex; | |
cc277069 | 1587 | /* to record the each TX rate's quality. 0 is best, the bigger the worse. */ |
51126deb BZ |
1588 | u16 TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; |
1589 | /* u16 OneSecTxOkCount; */ | |
1590 | u32 OneSecTxNoRetryOkCount; | |
1591 | u32 OneSecTxRetryOkCount; | |
1592 | u32 OneSecTxFailCount; | |
1593 | u32 ContinueTxFailCnt; | |
1594 | u32 CurrTxRateStableTime; /* # of second in current TX rate */ | |
1595 | u8 TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ | |
cc277069 | 1596 | /*==================================================== */ |
91980990 | 1597 | |
52b81c89 BZ |
1598 | BOOLEAN fNoisyEnvironment; |
1599 | BOOLEAN fLastSecAccordingRSSI; | |
51126deb BZ |
1600 | u8 LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ |
1601 | char LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ | |
1602 | unsigned long LastTxOkCount; | |
1603 | u8 PER[MAX_STEP_OF_TX_RATE_SWITCH]; | |
91980990 | 1604 | |
cc277069 BZ |
1605 | /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */ |
1606 | /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */ | |
1607 | /* CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. */ | |
1608 | /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED */ | |
51126deb | 1609 | unsigned long ClientStatusFlags; |
91980990 | 1610 | |
cc277069 | 1611 | HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */ |
91980990 | 1612 | |
cc277069 | 1613 | /* HT EWC MIMO-N used parameters */ |
51126deb BZ |
1614 | u16 RXBAbitmap; /* fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format */ |
1615 | u16 TXBAbitmap; /* This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI */ | |
1616 | u16 TXAutoBAbitmap; | |
1617 | u16 BADeclineBitmap; | |
1618 | u16 BARecWcidArray[NUM_OF_TID]; /* The mapping wcid of recipient session. if RXBAbitmap bit is masked */ | |
1619 | u16 BAOriWcidArray[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ | |
1620 | u16 BAOriSequence[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ | |
91980990 | 1621 | |
cc277069 | 1622 | /* 802.11n features. */ |
51126deb BZ |
1623 | u8 MpduDensity; |
1624 | u8 MaxRAmpduFactor; | |
1625 | u8 AMsduSize; | |
1626 | u8 MmpsMode; /* MIMO power save more. */ | |
91980990 | 1627 | |
62eb734b | 1628 | struct rt_ht_capability_ie HTCapability; |
91980990 | 1629 | |
52b81c89 | 1630 | BOOLEAN bAutoTxRateSwitch; |
91980990 | 1631 | |
51126deb | 1632 | u8 RateLen; |
62eb734b | 1633 | struct rt_mac_table_entry *pNext; |
51126deb BZ |
1634 | u16 TxSeq[NUM_OF_TID]; |
1635 | u16 NonQosDataSeq; | |
91980990 | 1636 | |
62eb734b | 1637 | struct rt_rssi_sample RssiSample; |
91980990 | 1638 | |
51126deb BZ |
1639 | u32 TXMCSExpected[16]; |
1640 | u32 TXMCSSuccessful[16]; | |
1641 | u32 TXMCSFailed[16]; | |
1642 | u32 TXMCSAutoFallBack[16][16]; | |
ca97b838 | 1643 | |
51126deb | 1644 | unsigned long LastBeaconRxTime; |
ca97b838 | 1645 | |
51126deb | 1646 | unsigned long AssocDeadLine; |
62eb734b | 1647 | }; |
91980990 | 1648 | |
62eb734b | 1649 | struct rt_mac_table { |
51126deb | 1650 | u16 Size; |
62eb734b BZ |
1651 | struct rt_mac_table_entry *Hash[HASH_TABLE_SIZE]; |
1652 | struct rt_mac_table_entry Content[MAX_LEN_OF_MAC_TABLE]; | |
1653 | struct rt_queue_header McastPsQueue; | |
51126deb | 1654 | unsigned long PsQIdleCount; |
52b81c89 | 1655 | BOOLEAN fAnyStationInPsm; |
cc277069 BZ |
1656 | BOOLEAN fAnyStationBadAtheros; /* Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. */ |
1657 | BOOLEAN fAnyTxOPForceDisable; /* Check if it is necessary to disable BE TxOP */ | |
1658 | BOOLEAN fAllStationAsRalink; /* Check if all stations are ralink-chipset */ | |
1659 | BOOLEAN fAnyStationIsLegacy; /* Check if I use legacy rate to transmit to my BSS Station/ */ | |
1660 | BOOLEAN fAnyStationNonGF; /* Check if any Station can't support GF. */ | |
1661 | BOOLEAN fAnyStation20Only; /* Check if any Station can't support GF. */ | |
1662 | BOOLEAN fAnyStationMIMOPSDynamic; /* Check if any Station is MIMO Dynamic */ | |
1663 | BOOLEAN fAnyBASession; /* Check if there is BA session. Force turn on RTS/CTS */ | |
1664 | /*2008/10/28: KH add to support Antenna power-saving of AP<-- */ | |
1665 | /*2008/10/28: KH add to support Antenna power-saving of AP--> */ | |
62eb734b | 1666 | }; |
91980990 | 1667 | |
52b81c89 BZ |
1668 | struct wificonf { |
1669 | BOOLEAN bShortGI; | |
91980990 GKH |
1670 | BOOLEAN bGreenField; |
1671 | }; | |
1672 | ||
62eb734b | 1673 | struct rt_rtmp_dev_info { |
51126deb | 1674 | u8 chipName[16]; |
52b81c89 | 1675 | RTMP_INF_TYPE infType; |
62eb734b | 1676 | }; |
91980990 | 1677 | |
62eb734b | 1678 | struct rt_rtmp_chip_op { |
ca97b838 | 1679 | /* Calibration access related callback functions */ |
62eb734b BZ |
1680 | int (*eeinit) (struct rt_rtmp_adapter *pAd); /* int (*eeinit)(struct rt_rtmp_adapter *pAd); */ |
1681 | int (*eeread) (struct rt_rtmp_adapter *pAd, u16 offset, u16 *pValue); /* int (*eeread)(struct rt_rtmp_adapter *pAd, int offset, u16 *pValue); */ | |
ca97b838 BZ |
1682 | |
1683 | /* MCU related callback functions */ | |
62eb734b BZ |
1684 | int (*loadFirmware) (struct rt_rtmp_adapter *pAd); /* int (*loadFirmware)(struct rt_rtmp_adapter *pAd); */ |
1685 | int (*eraseFirmware) (struct rt_rtmp_adapter *pAd); /* int (*eraseFirmware)(struct rt_rtmp_adapter *pAd); */ | |
1686 | 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); */ | |
ca97b838 BZ |
1687 | |
1688 | /* RF access related callback functions */ | |
62eb734b BZ |
1689 | struct rt_reg_pair *pRFRegTable; |
1690 | void (*AsicRfInit) (struct rt_rtmp_adapter *pAd); | |
1691 | void (*AsicRfTurnOn) (struct rt_rtmp_adapter *pAd); | |
1692 | void (*AsicRfTurnOff) (struct rt_rtmp_adapter *pAd); | |
1693 | void (*AsicReverseRfFromSleepMode) (struct rt_rtmp_adapter *pAd); | |
1694 | void (*AsicHaltAction) (struct rt_rtmp_adapter *pAd); | |
ca97b838 BZ |
1695 | }; |
1696 | ||
cc277069 BZ |
1697 | /* */ |
1698 | /* The miniport adapter structure */ | |
1699 | /* */ | |
62eb734b | 1700 | struct rt_rtmp_adapter { |
51126deb | 1701 | void *OS_Cookie; /* save specific structure relative to OS */ |
8a10a546 | 1702 | struct net_device *net_dev; |
51126deb | 1703 | unsigned long VirtualIfCnt; |
c22202fa | 1704 | const struct firmware *firmware; |
91980990 | 1705 | |
62eb734b | 1706 | struct rt_rtmp_chip_op chipOps; |
51126deb | 1707 | u16 ThisTbttNumToNextWakeUp; |
ca97b838 BZ |
1708 | |
1709 | #ifdef RTMP_MAC_PCI | |
1710 | /*****************************************************************************************/ | |
1711 | /* PCI related parameters */ | |
1712 | /*****************************************************************************************/ | |
51126deb | 1713 | u8 *CSRBaseAddress; /* PCI MMIO Base Address, all access will use */ |
52b81c89 BZ |
1714 | unsigned int irq_num; |
1715 | ||
51126deb BZ |
1716 | u16 LnkCtrlBitMask; |
1717 | u16 RLnkCtrlConfiguration; | |
1718 | u16 RLnkCtrlOffset; | |
1719 | u16 HostLnkCtrlConfiguration; | |
1720 | u16 HostLnkCtrlOffset; | |
1721 | u16 PCIePowerSaveLevel; | |
1722 | unsigned long Rt3xxHostLinkCtrl; /* USed for 3090F chip */ | |
1723 | unsigned long Rt3xxRalinkLinkCtrl; /* USed for 3090F chip */ | |
1724 | u16 DeviceID; /* Read from PCI config */ | |
1725 | unsigned long AccessBBPFailCount; | |
6ccb5d7c | 1726 | BOOLEAN bPCIclkOff; /* flag that indicates if the PICE power status in Configuration Space.. */ |
cc277069 | 1727 | BOOLEAN bPCIclkOffDisableTx; /* */ |
52b81c89 | 1728 | |
cc277069 BZ |
1729 | BOOLEAN brt30xxBanMcuCmd; /*when = 0xff means all commands are ok to set . */ |
1730 | BOOLEAN b3090ESpecialChip; /*3090E special chip that write EEPROM 0x24=0x9280. */ | |
51126deb | 1731 | unsigned long CheckDmaBusyCount; /* Check Interrupt Status Register Count. */ |
52b81c89 | 1732 | |
51126deb BZ |
1733 | u32 int_enable_reg; |
1734 | u32 int_disable_mask; | |
1735 | u32 int_pending; | |
52b81c89 | 1736 | |
62eb734b BZ |
1737 | struct rt_rtmp_dmabuf TxBufSpace[NUM_OF_TX_RING]; /* Shared memory of all 1st pre-allocated TxBuf associated with each TXD */ |
1738 | struct rt_rtmp_dmabuf RxDescRing; /* Shared memory for RX descriptors */ | |
1739 | struct rt_rtmp_dmabuf TxDescRing[NUM_OF_TX_RING]; /* Shared memory for Tx descriptors */ | |
1740 | struct rt_rtmp_tx_ring TxRing[NUM_OF_TX_RING]; /* AC0~4 + HCCA */ | |
cc277069 | 1741 | #endif /* RTMP_MAC_PCI // */ |
52b81c89 | 1742 | |
8a10a546 | 1743 | spinlock_t irq_lock; |
51126deb | 1744 | u8 irq_disabled; |
91980990 | 1745 | |
ca97b838 | 1746 | #ifdef RTMP_MAC_USB |
3a32ed12 BZ |
1747 | /*****************************************************************************************/ |
1748 | /* USB related parameters */ | |
1749 | /*****************************************************************************************/ | |
52b81c89 | 1750 | struct usb_config_descriptor *config; |
51126deb BZ |
1751 | u32 BulkInEpAddr; /* bulk-in endpoint address */ |
1752 | u32 BulkOutEpAddr[6]; /* bulk-out endpoint address */ | |
3a32ed12 | 1753 | |
51126deb BZ |
1754 | u32 NumberOfPipes; |
1755 | u16 BulkOutMaxPacketSize; | |
1756 | u16 BulkInMaxPacketSize; | |
3a32ed12 | 1757 | |
cc277069 | 1758 | /*======Control Flags */ |
51126deb BZ |
1759 | long PendingIoCount; |
1760 | unsigned long BulkFlags; | |
cc277069 | 1761 | BOOLEAN bUsbTxBulkAggre; /* Flags for bulk out data priority */ |
3a32ed12 | 1762 | |
cc277069 | 1763 | /*======Cmd Thread */ |
62eb734b | 1764 | struct rt_cmdq CmdQ; |
8a10a546 | 1765 | spinlock_t CmdQLock; /* CmdQLock spinlock */ |
62eb734b | 1766 | struct rt_rtmp_os_task cmdQTask; |
3a32ed12 | 1767 | |
cc277069 | 1768 | /*======Semaphores (event) */ |
8a10a546 | 1769 | struct semaphore UsbVendorReq_semaphore; |
51126deb | 1770 | void *UsbVendorReqBuf; |
52b81c89 | 1771 | wait_queue_head_t *wait; |
cc277069 | 1772 | #endif /* RTMP_MAC_USB // */ |
ca97b838 BZ |
1773 | |
1774 | /*****************************************************************************************/ | |
1775 | /* RBUS related parameters */ | |
1776 | /*****************************************************************************************/ | |
91980990 | 1777 | |
91980990 | 1778 | /*****************************************************************************************/ |
ca97b838 | 1779 | /* Both PCI/USB related parameters */ |
91980990 | 1780 | /*****************************************************************************************/ |
62eb734b | 1781 | /*struct rt_rtmp_dev_info chipInfo; */ |
52b81c89 | 1782 | RTMP_INF_TYPE infType; |
ca97b838 BZ |
1783 | |
1784 | /*****************************************************************************************/ | |
1785 | /* Driver Mgmt related parameters */ | |
1786 | /*****************************************************************************************/ | |
62eb734b | 1787 | struct rt_rtmp_os_task mlmeTask; |
ca97b838 | 1788 | #ifdef RTMP_TIMER_TASK_SUPPORT |
cc277069 | 1789 | /* If you want use timer task to handle the timer related jobs, enable this. */ |
62eb734b | 1790 | struct rt_rtmp_timer_task_queue TimerQ; |
8a10a546 | 1791 | spinlock_t TimerQLock; |
62eb734b | 1792 | struct rt_rtmp_os_task timerTask; |
cc277069 | 1793 | #endif /* RTMP_TIMER_TASK_SUPPORT // */ |
91980990 GKH |
1794 | |
1795 | /*****************************************************************************************/ | |
1796 | /* Tx related parameters */ | |
1797 | /*****************************************************************************************/ | |
cc277069 | 1798 | BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; /* for ensuring RTUSBDeQueuePacket get call once */ |
8a10a546 | 1799 | spinlock_t DeQueueLock[NUM_OF_TX_RING]; |
91980990 | 1800 | |
ca97b838 | 1801 | #ifdef RTMP_MAC_USB |
cc277069 | 1802 | /* Data related context and AC specified, 4 AC supported */ |
8a10a546 BZ |
1803 | spinlock_t BulkOutLock[6]; /* BulkOut spinlock for 4 ACs */ |
1804 | spinlock_t MLMEBulkOutLock; /* MLME BulkOut lock */ | |
3a32ed12 | 1805 | |
62eb734b | 1806 | struct rt_ht_tx_context TxContext[NUM_OF_TX_RING]; |
8a10a546 | 1807 | spinlock_t TxContextQueueLock[NUM_OF_TX_RING]; /* TxContextQueue spinlock */ |
3a32ed12 | 1808 | |
cc277069 | 1809 | /* 4 sets of Bulk Out index and pending flag */ |
51126deb | 1810 | u8 NextBulkOutIndex[4]; /* only used for 4 EDCA bulkout pipe */ |
3a32ed12 | 1811 | |
cc277069 | 1812 | BOOLEAN BulkOutPending[6]; /* used for total 6 bulkout pipe */ |
51126deb | 1813 | u8 bulkResetPipeid; |
52b81c89 | 1814 | BOOLEAN MgmtBulkPending; |
51126deb | 1815 | unsigned long bulkResetReq[6]; |
cc277069 | 1816 | #endif /* RTMP_MAC_USB // */ |
91980990 | 1817 | |
cc277069 | 1818 | /* resource for software backlog queues */ |
62eb734b | 1819 | struct rt_queue_header TxSwQueue[NUM_OF_TX_RING]; /* 4 AC + 1 HCCA */ |
8a10a546 | 1820 | spinlock_t TxSwQueueLock[NUM_OF_TX_RING]; /* TxSwQueue spinlock */ |
91980990 | 1821 | |
62eb734b BZ |
1822 | struct rt_rtmp_dmabuf MgmtDescRing; /* Shared memory for MGMT descriptors */ |
1823 | struct rt_rtmp_mgmt_ring MgmtRing; | |
8a10a546 | 1824 | spinlock_t MgmtRingLock; /* Prio Ring spinlock */ |
91980990 GKH |
1825 | |
1826 | /*****************************************************************************************/ | |
1827 | /* Rx related parameters */ | |
1828 | /*****************************************************************************************/ | |
ca97b838 BZ |
1829 | |
1830 | #ifdef RTMP_MAC_PCI | |
62eb734b | 1831 | struct rt_rtmp_rx_ring RxRing; |
8a10a546 | 1832 | spinlock_t RxRingLock; /* Rx Ring spinlock */ |
e44fd1cf | 1833 | #ifdef RT3090 |
8a10a546 | 1834 | spinlock_t McuCmdLock; /*MCU Command Queue spinlock */ |
cc277069 BZ |
1835 | #endif /* RT3090 // */ |
1836 | #endif /* RTMP_MAC_PCI // */ | |
ca97b838 | 1837 | #ifdef RTMP_MAC_USB |
62eb734b | 1838 | struct rt_rx_context RxContext[RX_RING_SIZE]; /* 1 for redundant multiple IRP bulk in. */ |
8a10a546 | 1839 | spinlock_t BulkInLock; /* BulkIn spinlock for 4 ACs */ |
51126deb BZ |
1840 | u8 PendingRx; /* The Maximum pending Rx value should be RX_RING_SIZE. */ |
1841 | u8 NextRxBulkInIndex; /* Indicate the current RxContext Index which hold by Host controller. */ | |
1842 | u8 NextRxBulkInReadIndex; /* Indicate the current RxContext Index which driver can read & process it. */ | |
1843 | unsigned long NextRxBulkInPosition; /* Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. */ | |
1844 | unsigned long TransferBufferLength; /* current length of the packet buffer */ | |
1845 | unsigned long ReadPosition; /* current read position in a packet buffer */ | |
cc277069 | 1846 | #endif /* RTMP_MAC_USB // */ |
91980990 GKH |
1847 | |
1848 | /*****************************************************************************************/ | |
1849 | /* ASIC related parameters */ | |
1850 | /*****************************************************************************************/ | |
51126deb | 1851 | u32 MACVersion; /* MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. */ |
91980990 | 1852 | |
cc277069 BZ |
1853 | /* --------------------------- */ |
1854 | /* E2PROM */ | |
1855 | /* --------------------------- */ | |
51126deb BZ |
1856 | unsigned long EepromVersion; /* byte 0: version, byte 1: revision, byte 2~3: unused */ |
1857 | unsigned long FirmwareVersion; /* byte 0: Minor version, byte 1: Major version, otherwise unused. */ | |
1858 | u16 EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; | |
1859 | u8 EEPROMAddressNum; /* 93c46=6 93c66=8 */ | |
52b81c89 | 1860 | BOOLEAN EepromAccess; |
51126deb | 1861 | u8 EFuseTag; |
91980990 | 1862 | |
cc277069 BZ |
1863 | /* --------------------------- */ |
1864 | /* BBP Control */ | |
1865 | /* --------------------------- */ | |
51126deb BZ |
1866 | u8 BbpWriteLatch[140]; /* record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID */ |
1867 | char BbpRssiToDbmDelta; /* change from u8 to char for high power */ | |
62eb734b | 1868 | struct rt_bbp_r66_tuning BbpTuning; |
91980990 | 1869 | |
cc277069 BZ |
1870 | /* ---------------------------- */ |
1871 | /* RFIC control */ | |
1872 | /* ---------------------------- */ | |
51126deb BZ |
1873 | u8 RfIcType; /* RFIC_xxx */ |
1874 | unsigned long RfFreqOffset; /* Frequency offset for channel switching */ | |
6ccb5d7c | 1875 | struct rt_rtmp_rf_regs LatchRfRegs; /* latch the latest RF programming value since RF IC doesn't support READ */ |
91980990 | 1876 | |
6ccb5d7c | 1877 | EEPROM_ANTENNA_STRUC Antenna; /* Since Antenna definition is different for a & g. We need to save it for future reference. */ |
52b81c89 | 1878 | EEPROM_NIC_CONFIG2_STRUC NicConfig2; |
91980990 | 1879 | |
cc277069 BZ |
1880 | /* This soft Rx Antenna Diversity mechanism is used only when user set */ |
1881 | /* RX Antenna = DIVERSITY ON */ | |
62eb734b | 1882 | struct rt_soft_rx_ant_diversity RxAnt; |
52b81c89 | 1883 | |
51126deb | 1884 | u8 RFProgSeq; |
62eb734b BZ |
1885 | struct rt_channel_tx_power TxPower[MAX_NUM_OF_CHANNELS]; /* Store Tx power value for all channels. */ |
1886 | struct rt_channel_tx_power ChannelList[MAX_NUM_OF_CHANNELS]; /* list all supported channels for site survey */ | |
1887 | struct rt_channel_11j_tx_power TxPower11J[MAX_NUM_OF_11JCHANNELS]; /* 802.11j channel and bw */ | |
1888 | struct rt_channel_11j_tx_power ChannelList11J[MAX_NUM_OF_11JCHANNELS]; /* list all supported channels for site survey */ | |
52b81c89 | 1889 | |
51126deb BZ |
1890 | u8 ChannelListNum; /* number of channel in ChannelList[] */ |
1891 | u8 Bbp94; | |
52b81c89 | 1892 | BOOLEAN BbpForCCK; |
51126deb BZ |
1893 | unsigned long Tx20MPwrCfgABand[5]; |
1894 | unsigned long Tx20MPwrCfgGBand[5]; | |
1895 | unsigned long Tx40MPwrCfgABand[5]; | |
1896 | unsigned long Tx40MPwrCfgGBand[5]; | |
52b81c89 | 1897 | |
cc277069 | 1898 | BOOLEAN bAutoTxAgcA; /* Enable driver auto Tx Agc control */ |
51126deb BZ |
1899 | u8 TssiRefA; /* Store Tssi reference value as 25 temperature. */ |
1900 | u8 TssiPlusBoundaryA[5]; /* Tssi boundary for increase Tx power to compensate. */ | |
1901 | u8 TssiMinusBoundaryA[5]; /* Tssi boundary for decrease Tx power to compensate. */ | |
1902 | u8 TxAgcStepA; /* Store Tx TSSI delta increment / decrement value */ | |
1903 | char TxAgcCompensateA; /* Store the compensation (TxAgcStep * (idx-1)) */ | |
cc277069 BZ |
1904 | |
1905 | BOOLEAN bAutoTxAgcG; /* Enable driver auto Tx Agc control */ | |
51126deb BZ |
1906 | u8 TssiRefG; /* Store Tssi reference value as 25 temperature. */ |
1907 | u8 TssiPlusBoundaryG[5]; /* Tssi boundary for increase Tx power to compensate. */ | |
1908 | u8 TssiMinusBoundaryG[5]; /* Tssi boundary for decrease Tx power to compensate. */ | |
1909 | u8 TxAgcStepG; /* Store Tx TSSI delta increment / decrement value */ | |
1910 | char TxAgcCompensateG; /* Store the compensation (TxAgcStep * (idx-1)) */ | |
1911 | ||
1912 | char BGRssiOffset0; /* Store B/G RSSI#0 Offset value on EEPROM 0x46h */ | |
1913 | char BGRssiOffset1; /* Store B/G RSSI#1 Offset value */ | |
1914 | char BGRssiOffset2; /* Store B/G RSSI#2 Offset value */ | |
1915 | ||
1916 | char ARssiOffset0; /* Store A RSSI#0 Offset value on EEPROM 0x4Ah */ | |
1917 | char ARssiOffset1; /* Store A RSSI#1 Offset value */ | |
1918 | char ARssiOffset2; /* Store A RSSI#2 Offset value */ | |
1919 | ||
1920 | char BLNAGain; /* Store B/G external LNA#0 value on EEPROM 0x44h */ | |
1921 | char ALNAGain0; /* Store A external LNA#0 value for ch36~64 */ | |
1922 | char ALNAGain1; /* Store A external LNA#1 value for ch100~128 */ | |
1923 | char ALNAGain2; /* Store A external LNA#2 value for ch132~165 */ | |
ca97b838 | 1924 | #ifdef RT30xx |
cc277069 | 1925 | /* for 3572 */ |
51126deb BZ |
1926 | u8 Bbp25; |
1927 | u8 Bbp26; | |
ca97b838 | 1928 | |
51126deb BZ |
1929 | u8 TxMixerGain24G; /* Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G */ |
1930 | u8 TxMixerGain5G; | |
cc277069 BZ |
1931 | #endif /* RT30xx // */ |
1932 | /* ---------------------------- */ | |
1933 | /* LED control */ | |
1934 | /* ---------------------------- */ | |
52b81c89 | 1935 | MCU_LEDCS_STRUC LedCntl; |
51126deb BZ |
1936 | u16 Led1; /* read from EEPROM 0x3c */ |
1937 | u16 Led2; /* EEPROM 0x3e */ | |
1938 | u16 Led3; /* EEPROM 0x40 */ | |
1939 | u8 LedIndicatorStrength; | |
1940 | u8 RssiSingalstrengthOffet; | |
52b81c89 | 1941 | BOOLEAN bLedOnScanning; |
51126deb | 1942 | u8 LedStatus; |
91980990 GKH |
1943 | |
1944 | /*****************************************************************************************/ | |
1945 | /* 802.11 related parameters */ | |
1946 | /*****************************************************************************************/ | |
cc277069 | 1947 | /* outgoing BEACON frame buffer and corresponding TXD */ |
62eb734b | 1948 | struct rt_txwi BeaconTxWI; |
51126deb BZ |
1949 | u8 *BeaconBuf; |
1950 | u16 BeaconOffset[HW_BEACON_MAX_COUNT]; | |
91980990 | 1951 | |
cc277069 | 1952 | /* pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. */ |
62eb734b BZ |
1953 | struct rt_pspoll_frame PsPollFrame; |
1954 | struct rt_header_802_11 NullFrame; | |
91980990 | 1955 | |
ca97b838 | 1956 | #ifdef RTMP_MAC_USB |
62eb734b BZ |
1957 | struct rt_tx_context BeaconContext[BEACON_RING_SIZE]; |
1958 | struct rt_tx_context NullContext; | |
1959 | struct rt_tx_context PsPollContext; | |
1960 | struct rt_tx_context RTSContext; | |
cc277069 BZ |
1961 | #endif /* RTMP_MAC_USB // */ |
1962 | ||
1963 | /*=========AP=========== */ | |
1964 | ||
1965 | /*=======STA=========== */ | |
1966 | /* ----------------------------------------------- */ | |
1967 | /* STA specific configuration & operation status */ | |
1968 | /* used only when pAd->OpMode == OPMODE_STA */ | |
1969 | /* ----------------------------------------------- */ | |
62eb734b BZ |
1970 | struct rt_sta_admin_config StaCfg; /* user desired settings */ |
1971 | struct rt_sta_active_config StaActive; /* valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) */ | |
51126deb BZ |
1972 | char nickname[IW_ESSID_MAX_SIZE + 1]; /* nickname, only used in the iwconfig i/f */ |
1973 | int PreMediaState; | |
91980990 | 1974 | |
cc277069 BZ |
1975 | /*=======Common=========== */ |
1976 | /* OP mode: either AP or STA */ | |
51126deb | 1977 | u8 OpMode; /* OPMODE_STA, OPMODE_AP */ |
91980990 | 1978 | |
51126deb | 1979 | int IndicateMediaState; /* Base on Indication state, default is NdisMediaStateDisConnected */ |
91980990 | 1980 | |
ca97b838 BZ |
1981 | /* MAT related parameters */ |
1982 | ||
cc277069 BZ |
1983 | /* configuration: read from Registry & E2PROM */ |
1984 | BOOLEAN bLocalAdminMAC; /* Use user changed MAC */ | |
51126deb BZ |
1985 | u8 PermanentAddress[MAC_ADDR_LEN]; /* Factory default MAC address */ |
1986 | u8 CurrentAddress[MAC_ADDR_LEN]; /* User changed MAC address */ | |
91980990 | 1987 | |
cc277069 BZ |
1988 | /* ------------------------------------------------------ */ |
1989 | /* common configuration to both OPMODE_STA and OPMODE_AP */ | |
1990 | /* ------------------------------------------------------ */ | |
62eb734b BZ |
1991 | struct rt_common_config CommonCfg; |
1992 | struct rt_mlme Mlme; | |
91980990 | 1993 | |
6ccb5d7c | 1994 | /* AP needs those variables for site survey feature. */ |
62eb734b BZ |
1995 | struct rt_mlme_aux MlmeAux; /* temporary settings used during MLME state machine */ |
1996 | struct rt_bss_table ScanTab; /* store the latest SCAN result */ | |
91980990 | 1997 | |
cc277069 | 1998 | /*About MacTab, the sta driver will use #0 and #1 for multicast and AP. */ |
62eb734b | 1999 | struct rt_mac_table MacTab; /* ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. */ |
8a10a546 | 2000 | spinlock_t MacTabLock; |
91980990 | 2001 | |
62eb734b | 2002 | struct rt_ba_table BATable; |
1623267a | 2003 | |
8a10a546 | 2004 | spinlock_t BATabLock; |
62eb734b | 2005 | struct rt_ralink_timer RECBATimer; |
91980990 | 2006 | |
cc277069 | 2007 | /* encryption/decryption KEY tables */ |
62eb734b | 2008 | struct rt_cipher_key SharedKey[MAX_MBSSID_NUM][4]; /* STA always use SharedKey[BSS0][0..3] */ |
91980990 | 2009 | |
cc277069 | 2010 | /* RX re-assembly buffer for fragmentation */ |
62eb734b | 2011 | struct rt_fragment_frame FragFrame; /* Frame storage for fragment frame */ |
91980990 | 2012 | |
cc277069 | 2013 | /* various Counters */ |
62eb734b BZ |
2014 | struct rt_counter_802_3 Counters8023; /* 802.3 counters */ |
2015 | struct rt_counter_802_11 WlanCounters; /* 802.11 MIB counters */ | |
6ccb5d7c | 2016 | struct rt_counter_ralink RalinkCounters; /* Ralink proprietary counters */ |
62eb734b BZ |
2017 | struct rt_counter_drs DrsCounters; /* counters for Dynamic TX Rate Switching */ |
2018 | struct rt_private PrivateInfo; /* Private information & counters */ | |
91980990 | 2019 | |
cc277069 | 2020 | /* flags, see fRTMP_ADAPTER_xxx flags */ |
51126deb BZ |
2021 | unsigned long Flags; /* Represent current device status */ |
2022 | unsigned long PSFlags; /* Power Save operation flag. */ | |
91980990 | 2023 | |
cc277069 | 2024 | /* current TX sequence # */ |
51126deb | 2025 | u16 Sequence; |
91980990 | 2026 | |
cc277069 | 2027 | /* Control disconnect / connect event generation */ |
6ccb5d7c | 2028 | /*+++Not used anymore */ |
51126deb | 2029 | unsigned long LinkDownTime; |
cc277069 | 2030 | /*--- */ |
51126deb BZ |
2031 | unsigned long LastRxRate; |
2032 | unsigned long LastTxRate; | |
cc277069 BZ |
2033 | /*+++Used only for Station */ |
2034 | BOOLEAN bConfigChanged; /* Config Change flag for the same SSID setting */ | |
2035 | /*--- */ | |
91980990 | 2036 | |
51126deb BZ |
2037 | unsigned long ExtraInfo; /* Extra information for displaying status */ |
2038 | unsigned long SystemErrorBitmap; /* b0: E2PROM version error */ | |
91980990 | 2039 | |
6ccb5d7c | 2040 | /*+++Not used anymore */ |
51126deb | 2041 | unsigned long MacIcVersion; /* MAC/BBP serial interface issue solved after ver.D */ |
cc277069 | 2042 | /*--- */ |
91980990 | 2043 | |
cc277069 BZ |
2044 | /* --------------------------- */ |
2045 | /* System event log */ | |
2046 | /* --------------------------- */ | |
62eb734b | 2047 | struct rt_802_11_event_table EventTab; |
91980990 | 2048 | |
52b81c89 | 2049 | BOOLEAN HTCEnable; |
91980990 GKH |
2050 | |
2051 | /*****************************************************************************************/ | |
2052 | /* Statistic related parameters */ | |
2053 | /*****************************************************************************************/ | |
ca97b838 | 2054 | #ifdef RTMP_MAC_USB |
51126deb BZ |
2055 | unsigned long BulkOutDataOneSecCount; |
2056 | unsigned long BulkInDataOneSecCount; | |
2057 | unsigned long BulkLastOneSecCount; /* BulkOutDataOneSecCount + BulkInDataOneSecCount */ | |
2058 | unsigned long watchDogRxCnt; | |
2059 | unsigned long watchDogRxOverFlowCnt; | |
2060 | unsigned long watchDogTxPendingCnt[NUM_OF_TX_RING]; | |
2061 | int TransferedLength[NUM_OF_TX_RING]; | |
cc277069 | 2062 | #endif /* RTMP_MAC_USB // */ |
52b81c89 BZ |
2063 | |
2064 | BOOLEAN bUpdateBcnCntDone; | |
51126deb | 2065 | unsigned long watchDogMacDeadlock; /* prevent MAC/BBP into deadlock condition */ |
cc277069 BZ |
2066 | /* ---------------------------- */ |
2067 | /* DEBUG paramerts */ | |
2068 | /* ---------------------------- */ | |
51126deb | 2069 | /*unsigned long DebugSetting[4]; */ |
52b81c89 BZ |
2070 | BOOLEAN bBanAllBaSetup; |
2071 | BOOLEAN bPromiscuous; | |
91980990 | 2072 | |
cc277069 BZ |
2073 | /* ---------------------------- */ |
2074 | /* rt2860c emulation-use Parameters */ | |
2075 | /* ---------------------------- */ | |
51126deb BZ |
2076 | /*unsigned long rtsaccu[30]; */ |
2077 | /*unsigned long ctsaccu[30]; */ | |
2078 | /*unsigned long cfendaccu[30]; */ | |
2079 | /*unsigned long bacontent[16]; */ | |
2080 | /*unsigned long rxint[RX_RING_SIZE+1]; */ | |
2081 | /*u8 rcvba[60]; */ | |
52b81c89 BZ |
2082 | BOOLEAN bLinkAdapt; |
2083 | BOOLEAN bForcePrintTX; | |
2084 | BOOLEAN bForcePrintRX; | |
cc277069 | 2085 | /*BOOLEAN bDisablescanning; //defined in RT2870 USB */ |
52b81c89 BZ |
2086 | BOOLEAN bStaFifoTest; |
2087 | BOOLEAN bProtectionTest; | |
2088 | BOOLEAN bBroadComHT; | |
cc277069 | 2089 | /*+++Following add from RT2870 USB. */ |
51126deb BZ |
2090 | unsigned long BulkOutReq; |
2091 | unsigned long BulkOutComplete; | |
2092 | unsigned long BulkOutCompleteOther; | |
6ccb5d7c | 2093 | unsigned long BulkOutCompleteCancel; /* seems not used now? */ |
51126deb BZ |
2094 | unsigned long BulkInReq; |
2095 | unsigned long BulkInComplete; | |
2096 | unsigned long BulkInCompleteFail; | |
cc277069 | 2097 | /*--- */ |
91980990 | 2098 | |
52b81c89 | 2099 | struct wificonf WIFItestbed; |
91980990 | 2100 | |
91980990 | 2101 | struct reordering_mpdu_pool mpdu_blk_pool; |
91980990 | 2102 | |
51126deb | 2103 | unsigned long OneSecondnonBEpackets; /* record non BE packets per second */ |
91980990 | 2104 | |
ca97b838 | 2105 | #ifdef LINUX |
52b81c89 | 2106 | struct iw_statistics iw_stats; |
ca97b838 | 2107 | |
52b81c89 | 2108 | struct net_device_stats stats; |
cc277069 | 2109 | #endif /* LINUX // */ |
ca97b838 | 2110 | |
51126deb | 2111 | unsigned long TbttTickCount; |
91980990 | 2112 | #ifdef PCI_MSI_SUPPORT |
52b81c89 | 2113 | BOOLEAN HaveMsi; |
cc277069 | 2114 | #endif /* PCI_MSI_SUPPORT // */ |
91980990 | 2115 | |
51126deb | 2116 | u8 is_on; |
91980990 GKH |
2117 | |
2118 | #define TIME_BASE (1000000/OS_HZ) | |
2119 | #define TIME_ONE_SECOND (1000000/TIME_BASE) | |
51126deb BZ |
2120 | u8 flg_be_adjust; |
2121 | unsigned long be_adjust_last_time; | |
91980990 | 2122 | |
51126deb BZ |
2123 | u8 FlgCtsEnabled; |
2124 | u8 PM_FlgSuspend; | |
3a32ed12 | 2125 | |
ca97b838 BZ |
2126 | #ifdef RT30xx |
2127 | #ifdef RTMP_EFUSE_SUPPORT | |
52b81c89 | 2128 | BOOLEAN bUseEfuse; |
51126deb | 2129 | u8 EEPROMImage[1024]; |
cc277069 BZ |
2130 | #endif /* RTMP_EFUSE_SUPPORT // */ |
2131 | #endif /* RT30xx // */ | |
ca97b838 BZ |
2132 | }; |
2133 | ||
91980990 GKH |
2134 | #define DELAYINTMASK 0x0003fffb |
2135 | #define INTMASK 0x0003fffb | |
2136 | #define IndMask 0x0003fffc | |
cc277069 BZ |
2137 | #define RxINT 0x00000005 /* Delayed Rx or indivi rx */ |
2138 | #define TxDataInt 0x000000fa /* Delayed Tx or indivi tx */ | |
2139 | #define TxMgmtInt 0x00000102 /* Delayed Tx or indivi tx */ | |
2140 | #define TxCoherent 0x00020000 /* tx coherent */ | |
2141 | #define RxCoherent 0x00010000 /* rx coherent */ | |
2142 | #define McuCommand 0x00000200 /* mcu */ | |
2143 | #define PreTBTTInt 0x00001000 /* Pre-TBTT interrupt */ | |
2144 | #define TBTTInt 0x00000800 /* TBTT interrupt */ | |
2145 | #define GPTimeOutInt 0x00008000 /* GPtimeout interrupt */ | |
2146 | #define AutoWakeupInt 0x00004000 /* AutoWakeupInt interrupt */ | |
2147 | #define FifoStaFullInt 0x00002000 /* fifo statistics full interrupt */ | |
91980990 | 2148 | |
ca97b838 BZ |
2149 | /*************************************************************************** |
2150 | * Rx Path software control block related data structures | |
2151 | **************************************************************************/ | |
62eb734b | 2152 | struct rt_rx_blk { |
52b81c89 | 2153 | RT28XX_RXD_STRUC RxD; |
fdb2fd14 NM |
2154 | struct rt_rxwi *pRxWI; |
2155 | struct rt_header_802_11 *pHeader; | |
8a10a546 | 2156 | void *pRxPacket; |
51126deb BZ |
2157 | u8 *pData; |
2158 | u16 DataSize; | |
2159 | u16 Flags; | |
2160 | u8 UserPriority; /* for calculate TKIP MIC using */ | |
62eb734b | 2161 | }; |
91980990 | 2162 | |
91980990 GKH |
2163 | #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag) |
2164 | #define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag) | |
2165 | #define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag)) | |
2166 | ||
91980990 GKH |
2167 | #define fRX_WDS 0x0001 |
2168 | #define fRX_AMSDU 0x0002 | |
2169 | #define fRX_ARALINK 0x0004 | |
2170 | #define fRX_HTC 0x0008 | |
2171 | #define fRX_PAD 0x0010 | |
2172 | #define fRX_AMPDU 0x0020 | |
2173 | #define fRX_QOS 0x0040 | |
2174 | #define fRX_INFRA 0x0080 | |
2175 | #define fRX_EAP 0x0100 | |
2176 | #define fRX_MESH 0x0200 | |
2177 | #define fRX_APCLI 0x0400 | |
2178 | #define fRX_DLS 0x0800 | |
2179 | #define fRX_WPI 0x1000 | |
2180 | ||
2181 | #define LENGTH_AMSDU_SUBFRAMEHEAD 14 | |
2182 | #define LENGTH_ARALINK_SUBFRAMEHEAD 14 | |
2183 | #define LENGTH_ARALINK_HEADER_FIELD 2 | |
2184 | ||
ca97b838 BZ |
2185 | /*************************************************************************** |
2186 | * Tx Path software control block related data structures | |
2187 | **************************************************************************/ | |
91980990 GKH |
2188 | #define TX_UNKOWN_FRAME 0x00 |
2189 | #define TX_MCAST_FRAME 0x01 | |
2190 | #define TX_LEGACY_FRAME 0x02 | |
2191 | #define TX_AMPDU_FRAME 0x04 | |
2192 | #define TX_AMSDU_FRAME 0x08 | |
2193 | #define TX_RALINK_FRAME 0x10 | |
2194 | #define TX_FRAG_FRAME 0x20 | |
2195 | ||
62eb734b BZ |
2196 | /* Currently the sizeof(struct rt_tx_blk) is 148 bytes. */ |
2197 | struct rt_tx_blk { | |
51126deb BZ |
2198 | u8 QueIdx; |
2199 | u8 TxFrameType; /* Indicate the Transmission type of the all frames in one batch */ | |
6ccb5d7c | 2200 | u8 TotalFrameNum; /* Total frame number that wants to send-out in one batch */ |
51126deb | 2201 | u16 TotalFragNum; /* Total frame fragments required in one batch */ |
6ccb5d7c | 2202 | u16 TotalFrameLen; /* Total length of all frames that wants to send-out in one batch */ |
91980990 | 2203 | |
62eb734b BZ |
2204 | struct rt_queue_header TxPacketList; |
2205 | struct rt_mac_table_entry *pMacEntry; /* NULL: packet with 802.11 RA field is multicast/broadcast address */ | |
52b81c89 | 2206 | HTTRANSMIT_SETTING *pTransmit; |
91980990 | 2207 | |
cc277069 | 2208 | /* Following structure used for the characteristics of a specific packet. */ |
8a10a546 | 2209 | void *pPacket; |
51126deb | 2210 | u8 *pSrcBufHeader; /* Reference to the head of sk_buff->data */ |
6ccb5d7c | 2211 | u8 *pSrcBufData; /* Reference to the sk_buff->data, will change depending on the handling progresss */ |
51126deb BZ |
2212 | u32 SrcBufLen; /* Length of packet payload which not including Layer 2 header */ |
2213 | u8 *pExtraLlcSnapEncap; /* NULL means no extra LLC/SNAP is required */ | |
2214 | u8 HeaderBuf[128]; /* TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP */ | |
cc277069 BZ |
2215 | /*RT2870 2.1.0.0 uses only 80 bytes */ |
2216 | /*RT3070 2.1.1.0 uses only 96 bytes */ | |
2217 | /*RT3090 2.1.0.0 uses only 96 bytes */ | |
51126deb BZ |
2218 | u8 MpduHeaderLen; /* 802.11 header length NOT including the padding */ |
2219 | u8 HdrPadLen; /* recording Header Padding Length; */ | |
2220 | u8 apidx; /* The interface associated to this packet */ | |
2221 | u8 Wcid; /* The MAC entry associated to this packet */ | |
2222 | u8 UserPriority; /* priority class of packet */ | |
6ccb5d7c | 2223 | u8 FrameGap; /* what kind of IFS does this packet use */ |
51126deb BZ |
2224 | u8 MpduReqNum; /* number of fragments of this frame */ |
2225 | u8 TxRate; /* TODO: Obsoleted? Should change to MCS? */ | |
2226 | u8 CipherAlg; /* cipher alogrithm */ | |
62eb734b | 2227 | struct rt_cipher_key *pKey; |
52b81c89 | 2228 | |
51126deb | 2229 | u16 Flags; /*See following definitions for detail. */ |
91980990 | 2230 | |
cc277069 | 2231 | /*YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. */ |
51126deb | 2232 | unsigned long Priv; /* Hardware specific value saved in here. */ |
62eb734b | 2233 | }; |
91980990 | 2234 | |
ace91157 JS |
2235 | #define fTX_bRtsRequired 0x0001 /* Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. */ |
2236 | #define fTX_bAckRequired 0x0002 /* the packet need ack response */ | |
2237 | #define fTX_bPiggyBack 0x0004 /* Legacy device use Piggback or not */ | |
2238 | #define fTX_bHTRate 0x0008 /* allow to use HT rate */ | |
2239 | #define fTX_bForceNonQoS 0x0010 /* force to transmit frame without WMM-QoS in HT mode */ | |
2240 | #define fTX_bAllowFrag 0x0020 /* allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment */ | |
2241 | #define fTX_bMoreData 0x0040 /* there are more data packets in PowerSave Queue */ | |
2242 | #define fTX_bWMM 0x0080 /* QOS Data */ | |
2243 | #define fTX_bClearEAPFrame 0x0100 | |
91980990 | 2244 | |
91980990 GKH |
2245 | #define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag) |
2246 | #define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0) | |
2247 | #define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag)) | |
2248 | ||
ca97b838 BZ |
2249 | /*************************************************************************** |
2250 | * Other static inline function definitions | |
2251 | **************************************************************************/ | |
51126deb | 2252 | static inline void ConvertMulticastIP2MAC(u8 *pIpAddr, |
fdb2fd14 | 2253 | u8 **ppMacAddr, |
51126deb | 2254 | u16 ProtoType) |
91980990 GKH |
2255 | { |
2256 | if (pIpAddr == NULL) | |
2257 | return; | |
2258 | ||
2259 | if (ppMacAddr == NULL || *ppMacAddr == NULL) | |
2260 | return; | |
2261 | ||
52b81c89 BZ |
2262 | switch (ProtoType) { |
2263 | case ETH_P_IPV6: | |
cc277069 | 2264 | /* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */ |
52b81c89 BZ |
2265 | *(*ppMacAddr) = 0x33; |
2266 | *(*ppMacAddr + 1) = 0x33; | |
2267 | *(*ppMacAddr + 2) = pIpAddr[12]; | |
2268 | *(*ppMacAddr + 3) = pIpAddr[13]; | |
2269 | *(*ppMacAddr + 4) = pIpAddr[14]; | |
2270 | *(*ppMacAddr + 5) = pIpAddr[15]; | |
2271 | break; | |
2272 | ||
2273 | case ETH_P_IP: | |
2274 | default: | |
cc277069 | 2275 | /* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */ |
52b81c89 BZ |
2276 | *(*ppMacAddr) = 0x01; |
2277 | *(*ppMacAddr + 1) = 0x00; | |
2278 | *(*ppMacAddr + 2) = 0x5e; | |
2279 | *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f; | |
2280 | *(*ppMacAddr + 4) = pIpAddr[2]; | |
2281 | *(*ppMacAddr + 5) = pIpAddr[3]; | |
2282 | break; | |
91980990 GKH |
2283 | } |
2284 | ||
2285 | return; | |
2286 | } | |
ca97b838 | 2287 | |
ca97b838 | 2288 | char *GetPhyMode(int Mode); |
52b81c89 | 2289 | char *GetBW(int BW); |
91980990 | 2290 | |
cc277069 BZ |
2291 | /* */ |
2292 | /* Private routines in rtmp_init.c */ | |
2293 | /* */ | |
51126deb | 2294 | int RTMPAllocAdapterBlock(void *handle, |
fdb2fd14 | 2295 | struct rt_rtmp_adapter **ppAdapter); |
91980990 | 2296 | |
62eb734b | 2297 | int RTMPAllocTxRxRingMemory(struct rt_rtmp_adapter *pAd); |
91980990 | 2298 | |
62eb734b | 2299 | void RTMPFreeAdapter(struct rt_rtmp_adapter *pAd); |
91980990 | 2300 | |
62eb734b | 2301 | int NICReadRegParameters(struct rt_rtmp_adapter *pAd, |
8a10a546 | 2302 | void *WrapperConfigurationContext); |
91980990 | 2303 | |
ca97b838 | 2304 | #ifdef RTMP_RF_RW_SUPPORT |
62eb734b | 2305 | void NICInitRFRegisters(struct rt_rtmp_adapter *pAd); |
ca97b838 | 2306 | |
62eb734b | 2307 | void RtmpChipOpsRFHook(struct rt_rtmp_adapter *pAd); |
ca97b838 | 2308 | |
62eb734b | 2309 | int RT30xxWriteRFRegister(struct rt_rtmp_adapter *pAd, |
51126deb | 2310 | u8 regID, u8 value); |
ca97b838 | 2311 | |
62eb734b | 2312 | int RT30xxReadRFRegister(struct rt_rtmp_adapter *pAd, |
51126deb | 2313 | u8 regID, u8 *pValue); |
cc277069 | 2314 | #endif /* RTMP_RF_RW_SUPPORT // */ |
91980990 | 2315 | |
62eb734b | 2316 | void NICReadEEPROMParameters(struct rt_rtmp_adapter *pAd, u8 *mac_addr); |
91980990 | 2317 | |
62eb734b | 2318 | void NICInitAsicFromEEPROM(struct rt_rtmp_adapter *pAd); |
91980990 | 2319 | |
62eb734b | 2320 | int NICInitializeAdapter(struct rt_rtmp_adapter *pAd, IN BOOLEAN bHardReset); |
91980990 | 2321 | |
62eb734b | 2322 | int NICInitializeAsic(struct rt_rtmp_adapter *pAd, IN BOOLEAN bHardReset); |
91980990 | 2323 | |
62eb734b | 2324 | void NICIssueReset(struct rt_rtmp_adapter *pAd); |
ca97b838 | 2325 | |
62eb734b | 2326 | void RTMPRingCleanUp(struct rt_rtmp_adapter *pAd, u8 RingType); |
91980990 | 2327 | |
62eb734b | 2328 | void UserCfgInit(struct rt_rtmp_adapter *pAd); |
91980990 | 2329 | |
62eb734b | 2330 | void NICResetFromError(struct rt_rtmp_adapter *pAd); |
91980990 | 2331 | |
62eb734b | 2332 | int NICLoadFirmware(struct rt_rtmp_adapter *pAd); |
91980990 | 2333 | |
62eb734b | 2334 | void NICEraseFirmware(struct rt_rtmp_adapter *pAd); |
91980990 | 2335 | |
62eb734b | 2336 | int NICLoadRateSwitchingParams(struct rt_rtmp_adapter *pAd); |
91980990 | 2337 | |
62eb734b | 2338 | BOOLEAN NICCheckForHang(struct rt_rtmp_adapter *pAd); |
91980990 | 2339 | |
62eb734b | 2340 | void NICUpdateFifoStaCounters(struct rt_rtmp_adapter *pAd); |
91980990 | 2341 | |
62eb734b | 2342 | void NICUpdateRawCounters(struct rt_rtmp_adapter *pAd); |
91980990 | 2343 | |
51126deb | 2344 | void RTMPZeroMemory(void *pSrc, unsigned long Length); |
91980990 | 2345 | |
51126deb | 2346 | unsigned long RTMPCompareMemory(void *pSrc1, void *pSrc2, unsigned long Length); |
91980990 | 2347 | |
51126deb | 2348 | void RTMPMoveMemory(void *pDest, void *pSrc, unsigned long Length); |
91980990 | 2349 | |
51126deb | 2350 | void AtoH(char *src, u8 *dest, int destlen); |
91980990 | 2351 | |
62eb734b | 2352 | void RTMPPatchMacBbpBug(struct rt_rtmp_adapter *pAd); |
91980990 | 2353 | |
62eb734b BZ |
2354 | void RTMPInitTimer(struct rt_rtmp_adapter *pAd, |
2355 | struct rt_ralink_timer *pTimer, | |
51126deb | 2356 | void *pTimerFunc, void *pData, IN BOOLEAN Repeat); |
91980990 | 2357 | |
62eb734b | 2358 | void RTMPSetTimer(struct rt_ralink_timer *pTimer, unsigned long Value); |
91980990 | 2359 | |
62eb734b | 2360 | void RTMPModTimer(struct rt_ralink_timer *pTimer, unsigned long Value); |
91980990 | 2361 | |
62eb734b | 2362 | void RTMPCancelTimer(struct rt_ralink_timer *pTimer, OUT BOOLEAN * pCancelled); |
91980990 | 2363 | |
62eb734b | 2364 | void RTMPSetLED(struct rt_rtmp_adapter *pAd, u8 Status); |
91980990 | 2365 | |
62eb734b | 2366 | void RTMPSetSignalLED(struct rt_rtmp_adapter *pAd, IN NDIS_802_11_RSSI Dbm); |
91980990 | 2367 | |
62eb734b | 2368 | void RTMPEnableRxTx(struct rt_rtmp_adapter *pAd); |
91980990 | 2369 | |
cc277069 BZ |
2370 | /* */ |
2371 | /* prototype in action.c */ | |
2372 | /* */ | |
62eb734b BZ |
2373 | void ActionStateMachineInit(struct rt_rtmp_adapter *pAd, |
2374 | struct rt_state_machine *S, | |
52b81c89 BZ |
2375 | OUT STATE_MACHINE_FUNC Trans[]); |
2376 | ||
62eb734b | 2377 | void MlmeADDBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2378 | |
62eb734b | 2379 | void MlmeDELBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2380 | |
62eb734b | 2381 | void MlmeDLSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2382 | |
62eb734b | 2383 | void MlmeInvalidAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2384 | |
62eb734b | 2385 | void MlmeQOSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2386 | |
62eb734b | 2387 | void PeerAddBAReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2388 | |
62eb734b | 2389 | void PeerAddBARspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2390 | |
62eb734b | 2391 | void PeerDelBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2392 | |
62eb734b | 2393 | void PeerBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2394 | |
62eb734b | 2395 | void SendPSMPAction(struct rt_rtmp_adapter *pAd, u8 Wcid, u8 Psmp); |
52b81c89 | 2396 | |
62eb734b | 2397 | void PeerRMAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2398 | |
62eb734b | 2399 | void PeerPublicAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2400 | |
62eb734b | 2401 | void PeerHTAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2402 | |
62eb734b | 2403 | void PeerQOSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2404 | |
51126deb BZ |
2405 | void RECBATimerTimeout(void *SystemSpecific1, |
2406 | void *FunctionContext, | |
2407 | void *SystemSpecific2, void *SystemSpecific3); | |
52b81c89 | 2408 | |
62eb734b | 2409 | void ORIBATimerTimeout(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2410 | |
62eb734b | 2411 | void SendRefreshBAR(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); |
52b81c89 | 2412 | |
62eb734b | 2413 | void ActHeaderInit(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 2414 | struct rt_header_802_11 *pHdr80211, |
51126deb | 2415 | u8 *Addr1, u8 *Addr2, u8 *Addr3); |
52b81c89 | 2416 | |
62eb734b | 2417 | void BarHeaderInit(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 2418 | struct rt_frame_bar *pCntlBar, u8 *pDA, u8 *pSA); |
52b81c89 | 2419 | |
62eb734b | 2420 | void InsertActField(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2421 | u8 *pFrameBuf, |
2422 | unsigned long *pFrameLen, u8 Category, u8 ActCode); | |
52b81c89 | 2423 | |
62eb734b | 2424 | BOOLEAN CntlEnqueueForRecv(struct rt_rtmp_adapter *pAd, |
51126deb | 2425 | unsigned long Wcid, |
fdb2fd14 | 2426 | unsigned long MsgLen, struct rt_frame_ba_req *pMsg); |
91980990 | 2427 | |
cc277069 BZ |
2428 | /* */ |
2429 | /* Private routines in rtmp_data.c */ | |
2430 | /* */ | |
62eb734b | 2431 | BOOLEAN RTMPHandleRxDoneInterrupt(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2432 | |
62eb734b | 2433 | BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(struct rt_rtmp_adapter *pAd, |
51126deb | 2434 | INT_SOURCE_CSR_STRUC TxRingBitmap); |
52b81c89 | 2435 | |
62eb734b | 2436 | void RTMPHandleMgmtRingDmaDoneInterrupt(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2437 | |
62eb734b | 2438 | void RTMPHandleTBTTInterrupt(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2439 | |
62eb734b | 2440 | void RTMPHandlePreTBTTInterrupt(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2441 | |
62eb734b | 2442 | void RTMPHandleTwakeupInterrupt(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2443 | |
62eb734b | 2444 | void RTMPHandleRxCoherentInterrupt(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2445 | |
62eb734b | 2446 | BOOLEAN TxFrameIsAggregatible(struct rt_rtmp_adapter *pAd, |
51126deb | 2447 | u8 *pPrevAddr1, u8 *p8023hdr); |
52b81c89 | 2448 | |
62eb734b BZ |
2449 | BOOLEAN PeerIsAggreOn(struct rt_rtmp_adapter *pAd, |
2450 | unsigned long TxRate, struct rt_mac_table_entry *pMacEntry); | |
52b81c89 | 2451 | |
8a10a546 | 2452 | int Sniff2BytesFromNdisBuffer(char *pFirstBuffer, |
51126deb BZ |
2453 | u8 DesiredOffset, |
2454 | u8 *pByte0, u8 *pByte1); | |
52b81c89 | 2455 | |
62eb734b | 2456 | int STASendPacket(struct rt_rtmp_adapter *pAd, void *pPacket); |
52b81c89 | 2457 | |
8a10a546 BZ |
2458 | void STASendPackets(void *MiniportAdapterContext, |
2459 | void **ppPacketArray, u32 NumberOfPackets); | |
52b81c89 | 2460 | |
62eb734b | 2461 | void RTMPDeQueuePacket(struct rt_rtmp_adapter *pAd, |
52b81c89 | 2462 | IN BOOLEAN bIntContext, |
51126deb | 2463 | u8 QueIdx, u8 Max_Tx_Packets); |
52b81c89 | 2464 | |
62eb734b | 2465 | int RTMPHardTransmit(struct rt_rtmp_adapter *pAd, |
8a10a546 | 2466 | void *pPacket, |
51126deb | 2467 | u8 QueIdx, unsigned long *pFreeTXDLeft); |
52b81c89 | 2468 | |
62eb734b BZ |
2469 | int STAHardTransmit(struct rt_rtmp_adapter *pAd, |
2470 | struct rt_tx_blk *pTxBlk, u8 QueIdx); | |
52b81c89 | 2471 | |
62eb734b BZ |
2472 | void STARxEAPOLFrameIndicate(struct rt_rtmp_adapter *pAd, |
2473 | struct rt_mac_table_entry *pEntry, | |
2474 | struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); | |
52b81c89 | 2475 | |
62eb734b | 2476 | int RTMPFreeTXDRequest(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2477 | u8 RingType, |
2478 | u8 NumberRequired, u8 *FreeNumberIs); | |
52b81c89 | 2479 | |
62eb734b | 2480 | int MlmeHardTransmit(struct rt_rtmp_adapter *pAd, |
8a10a546 | 2481 | u8 QueIdx, void *pPacket); |
52b81c89 | 2482 | |
62eb734b | 2483 | int MlmeHardTransmitMgmtRing(struct rt_rtmp_adapter *pAd, |
8a10a546 | 2484 | u8 QueIdx, void *pPacket); |
91980990 | 2485 | |
ca97b838 | 2486 | #ifdef RTMP_MAC_PCI |
62eb734b | 2487 | int MlmeHardTransmitTxRing(struct rt_rtmp_adapter *pAd, |
8a10a546 | 2488 | u8 QueIdx, void *pPacket); |
52b81c89 | 2489 | |
62eb734b | 2490 | int MlmeDataHardTransmit(struct rt_rtmp_adapter *pAd, |
8a10a546 | 2491 | u8 QueIdx, void *pPacket); |
52b81c89 | 2492 | |
62eb734b | 2493 | void RTMPWriteTxDescriptor(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 2494 | struct rt_txd *pTxD, IN BOOLEAN bWIV, u8 QSEL); |
cc277069 | 2495 | #endif /* RTMP_MAC_PCI // */ |
ca97b838 | 2496 | |
62eb734b | 2497 | u16 RTMPCalcDuration(struct rt_rtmp_adapter *pAd, u8 Rate, unsigned long Size); |
3d49ad33 | 2498 | |
62eb734b | 2499 | 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. */ |
51126deb BZ |
2500 | u8 BASize, |
2501 | u8 WCID, | |
2502 | unsigned long Length, | |
2503 | u8 PID, | |
2504 | u8 TID, | |
2505 | u8 TxRate, | |
2506 | u8 Txopmode, | |
f751ffab | 2507 | IN BOOLEAN CfAck, IN HTTRANSMIT_SETTING *pTransmit); |
ca97b838 | 2508 | |
62eb734b | 2509 | void RTMPWriteTxWI_Data(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 2510 | struct rt_txwi *pTxWI, struct rt_tx_blk *pTxBlk); |
91980990 | 2511 | |
62eb734b | 2512 | void RTMPWriteTxWI_Cache(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 2513 | struct rt_txwi *pTxWI, struct rt_tx_blk *pTxBlk); |
91980990 | 2514 | |
62eb734b | 2515 | void RTMPSuspendMsduTransmission(struct rt_rtmp_adapter *pAd); |
91980990 | 2516 | |
62eb734b | 2517 | void RTMPResumeMsduTransmission(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2518 | |
62eb734b | 2519 | int MiniportMMRequest(struct rt_rtmp_adapter *pAd, |
51126deb | 2520 | u8 QueIdx, u8 *pData, u32 Length); |
52b81c89 | 2521 | |
cc277069 BZ |
2522 | /*+++mark by shiang, now this function merge to MiniportMMRequest() */ |
2523 | /*---mark by shiang, now this function merge to MiniportMMRequest() */ | |
91980990 | 2524 | |
62eb734b | 2525 | void RTMPSendNullFrame(struct rt_rtmp_adapter *pAd, |
51126deb | 2526 | u8 TxRate, IN BOOLEAN bQosNull); |
91980990 | 2527 | |
62eb734b | 2528 | void RTMPSendDisassociationFrame(struct rt_rtmp_adapter *pAd); |
91980990 | 2529 | |
62eb734b | 2530 | void RTMPSendRTSFrame(struct rt_rtmp_adapter *pAd, |
51126deb | 2531 | u8 *pDA, |
52b81c89 | 2532 | IN unsigned int NextMpduSize, |
51126deb BZ |
2533 | u8 TxRate, |
2534 | u8 RTSRate, | |
2535 | u16 AckDuration, | |
2536 | u8 QueIdx, u8 FrameGap); | |
91980990 | 2537 | |
62eb734b | 2538 | struct rt_queue_header *RTMPCheckTxSwQueue(struct rt_rtmp_adapter *pAd, u8 * QueIdx); |
ca97b838 | 2539 | |
62eb734b | 2540 | void RTMPReportMicError(struct rt_rtmp_adapter *pAd, struct rt_cipher_key *pWpaKey); |
ca97b838 | 2541 | |
62eb734b | 2542 | void WpaMicFailureReportFrame(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2543 | |
51126deb BZ |
2544 | void WpaDisassocApAndBlockAssoc(void *SystemSpecific1, |
2545 | void *FunctionContext, | |
2546 | void *SystemSpecific2, | |
2547 | void *SystemSpecific3); | |
91980990 | 2548 | |
62eb734b | 2549 | void WpaStaPairwiseKeySetting(struct rt_rtmp_adapter *pAd); |
91980990 | 2550 | |
62eb734b | 2551 | void WpaStaGroupKeySetting(struct rt_rtmp_adapter *pAd); |
91980990 | 2552 | |
62eb734b | 2553 | int RTMPCloneNdisPacket(struct rt_rtmp_adapter *pAd, |
52b81c89 | 2554 | IN BOOLEAN pInsAMSDUHdr, |
8a10a546 | 2555 | void *pInPacket, |
fdb2fd14 | 2556 | void **ppOutPacket); |
91980990 | 2557 | |
62eb734b | 2558 | int RTMPAllocateNdisPacket(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 2559 | void **pPacket, |
51126deb BZ |
2560 | u8 *pHeader, |
2561 | u32 HeaderLen, | |
2562 | u8 *pData, u32 DataLen); | |
91980990 | 2563 | |
62eb734b | 2564 | void RTMPFreeNdisPacket(struct rt_rtmp_adapter *pAd, void *pPacket); |
91980990 | 2565 | |
62eb734b | 2566 | BOOLEAN RTMPFreeTXDUponTxDmaDone(struct rt_rtmp_adapter *pAd, u8 QueIdx); |
52b81c89 | 2567 | |
62eb734b | 2568 | BOOLEAN RTMPCheckDHCPFrame(struct rt_rtmp_adapter *pAd, void *pPacket); |
52b81c89 | 2569 | |
62eb734b | 2570 | BOOLEAN RTMPCheckEtherType(struct rt_rtmp_adapter *pAd, void *pPacket); |
91980990 | 2571 | |
cc277069 BZ |
2572 | /* */ |
2573 | /* Private routines in rtmp_wep.c */ | |
2574 | /* */ | |
62eb734b | 2575 | void RTMPInitWepEngine(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2576 | u8 *pKey, |
2577 | u8 KeyId, u8 KeyLen, u8 *pDest); | |
52b81c89 | 2578 | |
62eb734b | 2579 | void RTMPEncryptData(struct rt_rtmp_adapter *pAd, |
51126deb | 2580 | u8 *pSrc, u8 *pDest, u32 Len); |
52b81c89 | 2581 | |
62eb734b | 2582 | BOOLEAN RTMPSoftDecryptWEP(struct rt_rtmp_adapter *pAd, |
51126deb | 2583 | u8 *pData, |
62eb734b | 2584 | unsigned long DataByteCnt, struct rt_cipher_key *pGroupKey); |
52b81c89 | 2585 | |
62eb734b | 2586 | void RTMPSetICV(struct rt_rtmp_adapter *pAd, u8 *pDest); |
52b81c89 | 2587 | |
62eb734b | 2588 | void ARCFOUR_INIT(struct rt_arcfourcontext *Ctx, u8 *pKey, u32 KeyLen); |
52b81c89 | 2589 | |
62eb734b | 2590 | u8 ARCFOUR_BYTE(struct rt_arcfourcontext *Ctx); |
52b81c89 | 2591 | |
62eb734b | 2592 | void ARCFOUR_DECRYPT(struct rt_arcfourcontext *Ctx, |
51126deb | 2593 | u8 *pDest, u8 *pSrc, u32 Len); |
52b81c89 | 2594 | |
62eb734b | 2595 | void ARCFOUR_ENCRYPT(struct rt_arcfourcontext *Ctx, |
51126deb | 2596 | u8 *pDest, u8 *pSrc, u32 Len); |
52b81c89 | 2597 | |
62eb734b | 2598 | void WPAARCFOUR_ENCRYPT(struct rt_arcfourcontext *Ctx, |
51126deb | 2599 | u8 *pDest, u8 *pSrc, u32 Len); |
52b81c89 | 2600 | |
51126deb | 2601 | u32 RTMP_CALC_FCS32(u32 Fcs, u8 *Cp, int Len); |
91980990 | 2602 | |
cc277069 BZ |
2603 | /* */ |
2604 | /* MLME routines */ | |
2605 | /* */ | |
91980990 | 2606 | |
cc277069 | 2607 | /* Asic/RF/BBP related functions */ |
91980990 | 2608 | |
62eb734b | 2609 | void AsicAdjustTxPower(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2610 | |
62eb734b | 2611 | void AsicUpdateProtect(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2612 | u16 OperaionMode, |
2613 | u8 SetMask, | |
52b81c89 BZ |
2614 | IN BOOLEAN bDisableBGProtect, IN BOOLEAN bNonGFExist); |
2615 | ||
62eb734b | 2616 | void AsicSwitchChannel(struct rt_rtmp_adapter *pAd, |
51126deb | 2617 | u8 Channel, IN BOOLEAN bScan); |
52b81c89 | 2618 | |
62eb734b | 2619 | void AsicLockChannel(struct rt_rtmp_adapter *pAd, u8 Channel); |
52b81c89 | 2620 | |
51126deb BZ |
2621 | void AsicRfTuningExec(void *SystemSpecific1, |
2622 | void *FunctionContext, | |
2623 | void *SystemSpecific2, void *SystemSpecific3); | |
52b81c89 | 2624 | |
62eb734b | 2625 | void AsicResetBBPAgent(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2626 | |
62eb734b | 2627 | void AsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd, |
51126deb | 2628 | u16 TbttNumToNextWakeUp); |
52b81c89 | 2629 | |
62eb734b | 2630 | void AsicForceSleep(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2631 | |
62eb734b | 2632 | void AsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx); |
52b81c89 | 2633 | |
62eb734b | 2634 | void AsicSetBssid(struct rt_rtmp_adapter *pAd, u8 *pBssid); |
52b81c89 | 2635 | |
62eb734b | 2636 | void AsicSetMcastWC(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2637 | |
62eb734b | 2638 | void AsicDelWcidTab(struct rt_rtmp_adapter *pAd, u8 Wcid); |
ca97b838 | 2639 | |
62eb734b | 2640 | void AsicEnableRDG(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2641 | |
62eb734b | 2642 | void AsicDisableRDG(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2643 | |
62eb734b | 2644 | void AsicDisableSync(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2645 | |
62eb734b | 2646 | void AsicEnableBssSync(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2647 | |
62eb734b | 2648 | void AsicEnableIbssSync(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2649 | |
62eb734b | 2650 | void AsicSetEdcaParm(struct rt_rtmp_adapter *pAd, struct rt_edca_parm *pEdcaParm); |
52b81c89 | 2651 | |
62eb734b | 2652 | void AsicSetSlotTime(struct rt_rtmp_adapter *pAd, IN BOOLEAN bUseShortSlotTime); |
52b81c89 | 2653 | |
62eb734b | 2654 | void AsicAddSharedKeyEntry(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2655 | u8 BssIndex, |
2656 | u8 KeyIdx, | |
2657 | u8 CipherAlg, | |
2658 | u8 *pKey, u8 *pTxMic, u8 *pRxMic); | |
52b81c89 | 2659 | |
62eb734b | 2660 | void AsicRemoveSharedKeyEntry(struct rt_rtmp_adapter *pAd, |
51126deb | 2661 | u8 BssIndex, u8 KeyIdx); |
52b81c89 | 2662 | |
62eb734b | 2663 | void AsicUpdateWCIDAttribute(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2664 | u16 WCID, |
2665 | u8 BssIndex, | |
2666 | u8 CipherAlg, | |
52b81c89 BZ |
2667 | IN BOOLEAN bUsePairewiseKeyTable); |
2668 | ||
62eb734b | 2669 | void AsicUpdateWCIDIVEIV(struct rt_rtmp_adapter *pAd, |
51126deb | 2670 | u16 WCID, unsigned long uIV, unsigned long uEIV); |
52b81c89 | 2671 | |
62eb734b | 2672 | void AsicUpdateRxWCIDTable(struct rt_rtmp_adapter *pAd, |
51126deb | 2673 | u16 WCID, u8 *pAddr); |
52b81c89 | 2674 | |
62eb734b | 2675 | void AsicAddKeyEntry(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2676 | u16 WCID, |
2677 | u8 BssIndex, | |
2678 | u8 KeyIdx, | |
62eb734b | 2679 | struct rt_cipher_key *pCipherKey, |
52b81c89 BZ |
2680 | IN BOOLEAN bUsePairewiseKeyTable, IN BOOLEAN bTxKey); |
2681 | ||
62eb734b | 2682 | void AsicAddPairwiseKeyEntry(struct rt_rtmp_adapter *pAd, |
51126deb | 2683 | u8 *pAddr, |
62eb734b | 2684 | u8 WCID, struct rt_cipher_key *pCipherKey); |
52b81c89 | 2685 | |
62eb734b | 2686 | void AsicRemovePairwiseKeyEntry(struct rt_rtmp_adapter *pAd, |
51126deb | 2687 | u8 BssIdx, u8 Wcid); |
52b81c89 | 2688 | |
62eb734b | 2689 | BOOLEAN AsicSendCommandToMcu(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2690 | u8 Command, |
2691 | u8 Token, u8 Arg0, u8 Arg1); | |
ca97b838 BZ |
2692 | |
2693 | #ifdef RTMP_MAC_PCI | |
62eb734b | 2694 | BOOLEAN AsicCheckCommanOk(struct rt_rtmp_adapter *pAd, u8 Command); |
cc277069 | 2695 | #endif /* RTMP_MAC_PCI // */ |
ca97b838 | 2696 | |
62eb734b | 2697 | void MacAddrRandomBssid(struct rt_rtmp_adapter *pAd, u8 *pAddr); |
52b81c89 | 2698 | |
62eb734b | 2699 | void MgtMacHeaderInit(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 2700 | struct rt_header_802_11 *pHdr80211, |
51126deb BZ |
2701 | u8 SubType, |
2702 | u8 ToDs, u8 *pDA, u8 *pBssid); | |
52b81c89 | 2703 | |
62eb734b | 2704 | void MlmeRadioOff(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2705 | |
62eb734b | 2706 | void MlmeRadioOn(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2707 | |
62eb734b | 2708 | void BssTableInit(struct rt_bss_table *Tab); |
52b81c89 | 2709 | |
62eb734b | 2710 | void BATableInit(struct rt_rtmp_adapter *pAd, struct rt_ba_table *Tab); |
52b81c89 | 2711 | |
62eb734b | 2712 | unsigned long BssTableSearch(struct rt_bss_table *Tab, u8 *pBssid, u8 Channel); |
52b81c89 | 2713 | |
62eb734b | 2714 | unsigned long BssSsidTableSearch(struct rt_bss_table *Tab, |
51126deb BZ |
2715 | u8 *pBssid, |
2716 | u8 *pSsid, u8 SsidLen, u8 Channel); | |
52b81c89 | 2717 | |
62eb734b | 2718 | unsigned long BssTableSearchWithSSID(struct rt_bss_table *Tab, |
51126deb BZ |
2719 | u8 *Bssid, |
2720 | u8 *pSsid, | |
2721 | u8 SsidLen, u8 Channel); | |
52b81c89 | 2722 | |
62eb734b | 2723 | unsigned long BssSsidTableSearchBySSID(struct rt_bss_table *Tab, |
51126deb | 2724 | u8 *pSsid, u8 SsidLen); |
52b81c89 | 2725 | |
62eb734b | 2726 | void BssTableDeleteEntry(struct rt_bss_table *pTab, |
51126deb | 2727 | u8 *pBssid, u8 Channel); |
52b81c89 | 2728 | |
62eb734b BZ |
2729 | void BATableDeleteORIEntry(struct rt_rtmp_adapter *pAd, |
2730 | struct rt_ba_ori_entry *pBAORIEntry); | |
52b81c89 | 2731 | |
62eb734b | 2732 | 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 */ |
51126deb BZ |
2733 | u8 HtCapabilityLen, |
2734 | u8 AddHtInfoLen, | |
2735 | u8 NewExtChanOffset, | |
2736 | u8 Channel, | |
2737 | char Rssi, | |
52b81c89 | 2738 | IN LARGE_INTEGER TimeStamp, |
51126deb | 2739 | u8 CkipFlag, |
62eb734b BZ |
2740 | struct rt_edca_parm *pEdcaParm, |
2741 | struct rt_qos_capability_parm *pQosCapability, | |
2742 | struct rt_qbss_load_parm *pQbssLoad, | |
2743 | u16 LengthVIE, struct rt_ndis_802_11_variable_ies *pVIE); | |
51126deb | 2744 | |
62eb734b | 2745 | 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 */ |
51126deb BZ |
2746 | u8 HtCapabilityLen, |
2747 | u8 AddHtInfoLen, | |
2748 | u8 NewExtChanOffset, | |
2749 | u8 Channel, | |
2750 | char Rssi, | |
52b81c89 | 2751 | IN LARGE_INTEGER TimeStamp, |
51126deb | 2752 | u8 CkipFlag, |
62eb734b BZ |
2753 | struct rt_edca_parm *pEdcaParm, |
2754 | struct rt_qos_capability_parm *pQosCapability, | |
2755 | struct rt_qbss_load_parm *pQbssLoad, | |
2756 | u16 LengthVIE, struct rt_ndis_802_11_variable_ies *pVIE); | |
52b81c89 | 2757 | |
62eb734b | 2758 | void BATableInsertEntry(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2759 | u16 Aid, |
2760 | u16 TimeOutValue, | |
2761 | u16 StartingSeq, | |
2762 | u8 TID, | |
2763 | u8 BAWinSize, | |
2764 | u8 OriginatorStatus, IN BOOLEAN IsRecipient); | |
52b81c89 | 2765 | |
62eb734b BZ |
2766 | void BssTableSsidSort(struct rt_rtmp_adapter *pAd, |
2767 | struct rt_bss_table *OutTab, char Ssid[], u8 SsidLen); | |
52b81c89 | 2768 | |
62eb734b | 2769 | void BssTableSortByRssi(struct rt_bss_table *OutTab); |
52b81c89 | 2770 | |
62eb734b | 2771 | void BssCipherParse(struct rt_bss_entry *pBss); |
52b81c89 | 2772 | |
62eb734b | 2773 | int MlmeQueueInit(struct rt_mlme_queue *Queue); |
52b81c89 | 2774 | |
62eb734b | 2775 | void MlmeQueueDestroy(struct rt_mlme_queue *Queue); |
52b81c89 | 2776 | |
62eb734b | 2777 | BOOLEAN MlmeEnqueue(struct rt_rtmp_adapter *pAd, |
51126deb | 2778 | unsigned long Machine, |
fdb2fd14 | 2779 | unsigned long MsgType, unsigned long MsgLen, void *Msg); |
52b81c89 | 2780 | |
62eb734b | 2781 | BOOLEAN MlmeEnqueueForRecv(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2782 | unsigned long Wcid, |
2783 | unsigned long TimeStampHigh, | |
2784 | unsigned long TimeStampLow, | |
2785 | u8 Rssi0, | |
2786 | u8 Rssi1, | |
2787 | u8 Rssi2, | |
2788 | unsigned long MsgLen, void *Msg, u8 Signal); | |
52b81c89 | 2789 | |
fdb2fd14 | 2790 | BOOLEAN MlmeDequeue(struct rt_mlme_queue *Queue, struct rt_mlme_queue_elem **Elem); |
52b81c89 | 2791 | |
62eb734b | 2792 | void MlmeRestartStateMachine(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2793 | |
62eb734b | 2794 | BOOLEAN MlmeQueueEmpty(struct rt_mlme_queue *Queue); |
52b81c89 | 2795 | |
62eb734b | 2796 | BOOLEAN MlmeQueueFull(struct rt_mlme_queue *Queue); |
52b81c89 | 2797 | |
62eb734b | 2798 | BOOLEAN MsgTypeSubst(struct rt_rtmp_adapter *pAd, |
fdb2fd14 NM |
2799 | struct rt_frame_802_11 *pFrame, |
2800 | int *Machine, int *MsgType); | |
52b81c89 | 2801 | |
62eb734b | 2802 | void StateMachineInit(struct rt_state_machine *Sm, |
52b81c89 | 2803 | IN STATE_MACHINE_FUNC Trans[], |
51126deb BZ |
2804 | unsigned long StNr, |
2805 | unsigned long MsgNr, | |
52b81c89 | 2806 | IN STATE_MACHINE_FUNC DefFunc, |
51126deb | 2807 | unsigned long InitState, unsigned long Base); |
52b81c89 | 2808 | |
62eb734b | 2809 | void StateMachineSetAction(struct rt_state_machine *S, |
51126deb | 2810 | unsigned long St, unsigned long Msg, IN STATE_MACHINE_FUNC F); |
52b81c89 | 2811 | |
62eb734b BZ |
2812 | void StateMachinePerformAction(struct rt_rtmp_adapter *pAd, |
2813 | struct rt_state_machine *S, struct rt_mlme_queue_elem *Elem); | |
52b81c89 | 2814 | |
62eb734b | 2815 | void Drop(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2816 | |
62eb734b BZ |
2817 | void AssocStateMachineInit(struct rt_rtmp_adapter *pAd, |
2818 | struct rt_state_machine *Sm, | |
52b81c89 BZ |
2819 | OUT STATE_MACHINE_FUNC Trans[]); |
2820 | ||
51126deb BZ |
2821 | void ReassocTimeout(void *SystemSpecific1, |
2822 | void *FunctionContext, | |
2823 | void *SystemSpecific2, void *SystemSpecific3); | |
52b81c89 | 2824 | |
51126deb BZ |
2825 | void AssocTimeout(void *SystemSpecific1, |
2826 | void *FunctionContext, | |
2827 | void *SystemSpecific2, void *SystemSpecific3); | |
52b81c89 | 2828 | |
51126deb BZ |
2829 | void DisassocTimeout(void *SystemSpecific1, |
2830 | void *FunctionContext, | |
2831 | void *SystemSpecific2, void *SystemSpecific3); | |
91980990 | 2832 | |
cc277069 | 2833 | /*---------------------------------------------- */ |
62eb734b | 2834 | void MlmeAssocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2835 | |
62eb734b | 2836 | void MlmeReassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2837 | |
62eb734b | 2838 | void MlmeDisassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2839 | |
62eb734b | 2840 | void PeerAssocRspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2841 | |
62eb734b | 2842 | void PeerReassocRspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2843 | |
62eb734b | 2844 | void PeerDisassocAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2845 | |
62eb734b | 2846 | void DisassocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2847 | |
62eb734b | 2848 | void AssocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2849 | |
62eb734b | 2850 | void ReassocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2851 | |
62eb734b | 2852 | void Cls3errAction(struct rt_rtmp_adapter *pAd, u8 *pAddr); |
91980990 | 2853 | |
62eb734b | 2854 | void InvalidStateWhenAssoc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2855 | |
62eb734b | 2856 | void InvalidStateWhenReassoc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2857 | |
62eb734b BZ |
2858 | void InvalidStateWhenDisassociate(struct rt_rtmp_adapter *pAd, |
2859 | struct rt_mlme_queue_elem *Elem); | |
91980990 | 2860 | |
ca97b838 | 2861 | #ifdef RTMP_MAC_USB |
62eb734b | 2862 | void MlmeCntlConfirm(struct rt_rtmp_adapter *pAd, unsigned long MsgType, u16 Msg); |
cc277069 | 2863 | #endif /* RTMP_MAC_USB // */ |
91980990 | 2864 | |
62eb734b | 2865 | void ComposePsPoll(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2866 | |
62eb734b | 2867 | void ComposeNullFrame(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2868 | |
62eb734b | 2869 | void AssocPostProc(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
2870 | u8 *pAddr2, |
2871 | u16 CapabilityInfo, | |
2872 | u16 Aid, | |
2873 | u8 SupRate[], | |
2874 | u8 SupRateLen, | |
2875 | u8 ExtRate[], | |
2876 | u8 ExtRateLen, | |
62eb734b | 2877 | struct rt_edca_parm *pEdcaParm, |
fdb2fd14 NM |
2878 | struct rt_ht_capability_ie *pHtCapability, |
2879 | u8 HtCapabilityLen, struct rt_add_ht_info_ie *pAddHtInfo); | |
52b81c89 | 2880 | |
62eb734b BZ |
2881 | void AuthStateMachineInit(struct rt_rtmp_adapter *pAd, |
2882 | struct rt_state_machine *sm, OUT STATE_MACHINE_FUNC Trans[]); | |
52b81c89 | 2883 | |
51126deb BZ |
2884 | void AuthTimeout(void *SystemSpecific1, |
2885 | void *FunctionContext, | |
2886 | void *SystemSpecific2, void *SystemSpecific3); | |
52b81c89 | 2887 | |
62eb734b | 2888 | void MlmeAuthReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2889 | |
62eb734b | 2890 | void PeerAuthRspAtSeq2Action(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2891 | |
62eb734b | 2892 | void PeerAuthRspAtSeq4Action(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2893 | |
62eb734b | 2894 | void AuthTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2895 | |
62eb734b | 2896 | void Cls2errAction(struct rt_rtmp_adapter *pAd, u8 *pAddr); |
52b81c89 | 2897 | |
62eb734b | 2898 | void MlmeDeauthReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2899 | |
62eb734b | 2900 | void InvalidStateWhenAuth(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2901 | |
cc277069 | 2902 | /*============================================= */ |
91980990 | 2903 | |
62eb734b BZ |
2904 | void AuthRspStateMachineInit(struct rt_rtmp_adapter *pAd, |
2905 | struct rt_state_machine *Sm, | |
52b81c89 | 2906 | IN STATE_MACHINE_FUNC Trans[]); |
91980990 | 2907 | |
62eb734b | 2908 | void PeerDeauthAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2909 | |
62eb734b | 2910 | void PeerAuthSimpleRspGenAndSend(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 2911 | struct rt_header_802_11 *pHdr80211, |
51126deb BZ |
2912 | u16 Alg, |
2913 | u16 Seq, | |
2914 | u16 Reason, u16 Status); | |
91980990 | 2915 | |
cc277069 BZ |
2916 | /* */ |
2917 | /* Private routines in dls.c */ | |
2918 | /* */ | |
91980990 | 2919 | |
cc277069 | 2920 | /*======================================== */ |
91980990 | 2921 | |
62eb734b BZ |
2922 | void SyncStateMachineInit(struct rt_rtmp_adapter *pAd, |
2923 | struct rt_state_machine *Sm, | |
52b81c89 | 2924 | OUT STATE_MACHINE_FUNC Trans[]); |
91980990 | 2925 | |
51126deb BZ |
2926 | void BeaconTimeout(void *SystemSpecific1, |
2927 | void *FunctionContext, | |
2928 | void *SystemSpecific2, void *SystemSpecific3); | |
91980990 | 2929 | |
51126deb BZ |
2930 | void ScanTimeout(void *SystemSpecific1, |
2931 | void *FunctionContext, | |
2932 | void *SystemSpecific2, void *SystemSpecific3); | |
91980990 | 2933 | |
62eb734b | 2934 | void InvalidStateWhenScan(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2935 | |
62eb734b | 2936 | void InvalidStateWhenJoin(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2937 | |
62eb734b | 2938 | void InvalidStateWhenStart(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
91980990 | 2939 | |
62eb734b | 2940 | void EnqueueProbeRequest(struct rt_rtmp_adapter *pAd); |
91980990 | 2941 | |
62eb734b | 2942 | BOOLEAN ScanRunning(struct rt_rtmp_adapter *pAd); |
cc277069 | 2943 | /*========================================= */ |
91980990 | 2944 | |
62eb734b BZ |
2945 | void MlmeCntlInit(struct rt_rtmp_adapter *pAd, |
2946 | struct rt_state_machine *S, OUT STATE_MACHINE_FUNC Trans[]); | |
52b81c89 | 2947 | |
62eb734b BZ |
2948 | void MlmeCntlMachinePerformAction(struct rt_rtmp_adapter *pAd, |
2949 | struct rt_state_machine *S, | |
2950 | struct rt_mlme_queue_elem *Elem); | |
52b81c89 | 2951 | |
62eb734b | 2952 | void CntlIdleProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2953 | |
62eb734b | 2954 | void CntlOidScanProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2955 | |
62eb734b | 2956 | void CntlOidSsidProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2957 | |
62eb734b | 2958 | void CntlOidRTBssidProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2959 | |
62eb734b | 2960 | void CntlMlmeRoamingProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2961 | |
62eb734b | 2962 | void CntlWaitDisassocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2963 | |
62eb734b | 2964 | void CntlWaitJoinProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2965 | |
62eb734b | 2966 | void CntlWaitReassocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2967 | |
62eb734b | 2968 | void CntlWaitStartProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2969 | |
62eb734b | 2970 | void CntlWaitAuthProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2971 | |
62eb734b | 2972 | void CntlWaitAuthProc2(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2973 | |
62eb734b | 2974 | void CntlWaitAssocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 2975 | |
62eb734b | 2976 | void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType); |
52b81c89 | 2977 | |
62eb734b | 2978 | void LinkDown(struct rt_rtmp_adapter *pAd, IN BOOLEAN IsReqFromAP); |
52b81c89 | 2979 | |
62eb734b | 2980 | void IterateOnBssTab(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2981 | |
859171ca | 2982 | void IterateOnBssTab2(struct rt_rtmp_adapter *pAd); |
52b81c89 | 2983 | |
62eb734b BZ |
2984 | void JoinParmFill(struct rt_rtmp_adapter *pAd, |
2985 | struct rt_mlme_join_req *JoinReq, unsigned long BssIdx); | |
52b81c89 | 2986 | |
62eb734b BZ |
2987 | void AssocParmFill(struct rt_rtmp_adapter *pAd, |
2988 | struct rt_mlme_assoc_req *AssocReq, | |
51126deb BZ |
2989 | u8 *pAddr, |
2990 | u16 CapabilityInfo, | |
2991 | unsigned long Timeout, u16 ListenIntv); | |
52b81c89 | 2992 | |
62eb734b BZ |
2993 | void ScanParmFill(struct rt_rtmp_adapter *pAd, |
2994 | struct rt_mlme_scan_req *ScanReq, | |
51126deb BZ |
2995 | char Ssid[], |
2996 | u8 SsidLen, u8 BssType, u8 ScanType); | |
52b81c89 | 2997 | |
62eb734b BZ |
2998 | void DisassocParmFill(struct rt_rtmp_adapter *pAd, |
2999 | struct rt_mlme_disassoc_req *DisassocReq, | |
51126deb | 3000 | u8 *pAddr, u16 Reason); |
52b81c89 | 3001 | |
62eb734b BZ |
3002 | void StartParmFill(struct rt_rtmp_adapter *pAd, |
3003 | struct rt_mlme_start_req *StartReq, | |
51126deb | 3004 | char Ssid[], u8 SsidLen); |
52b81c89 | 3005 | |
62eb734b BZ |
3006 | void AuthParmFill(struct rt_rtmp_adapter *pAd, |
3007 | struct rt_mlme_auth_req *AuthReq, | |
51126deb | 3008 | u8 *pAddr, u16 Alg); |
52b81c89 | 3009 | |
62eb734b | 3010 | void EnqueuePsPoll(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3011 | |
62eb734b | 3012 | void EnqueueBeaconFrame(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3013 | |
62eb734b | 3014 | void MlmeJoinReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 3015 | |
62eb734b | 3016 | void MlmeScanReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 3017 | |
62eb734b | 3018 | void MlmeStartReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 3019 | |
62eb734b | 3020 | void ScanTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 3021 | |
62eb734b | 3022 | void BeaconTimeoutAtJoinAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 3023 | |
62eb734b | 3024 | void PeerBeaconAtScanAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 3025 | |
62eb734b | 3026 | void PeerBeaconAtJoinAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 3027 | |
62eb734b | 3028 | void PeerBeacon(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 3029 | |
62eb734b | 3030 | void PeerProbeReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); |
52b81c89 | 3031 | |
62eb734b | 3032 | void ScanNextChannel(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3033 | |
62eb734b | 3034 | unsigned long MakeIbssBeacon(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3035 | |
62eb734b | 3036 | BOOLEAN MlmeScanReqSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3037 | void *Msg, |
51126deb | 3038 | unsigned long MsgLen, |
fdb2fd14 | 3039 | u8 *BssType, |
51126deb | 3040 | char ssid[], |
fdb2fd14 | 3041 | u8 *SsidLen, u8 *ScanType); |
52b81c89 | 3042 | |
62eb734b | 3043 | BOOLEAN PeerBeaconAndProbeRspSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3044 | void *Msg, |
51126deb BZ |
3045 | unsigned long MsgLen, |
3046 | u8 MsgChannel, | |
3047 | u8 *pAddr2, | |
3048 | u8 *pBssid, | |
3049 | char Ssid[], | |
fdb2fd14 NM |
3050 | u8 *pSsidLen, |
3051 | u8 *pBssType, | |
3052 | u16 *pBeaconPeriod, | |
3053 | u8 *pChannel, | |
3054 | u8 *pNewChannel, | |
f751ffab | 3055 | OUT LARGE_INTEGER *pTimestamp, |
fdb2fd14 NM |
3056 | struct rt_cf_parm *pCfParm, |
3057 | u16 *pAtimWin, | |
3058 | u16 *pCapabilityInfo, | |
3059 | u8 *pErp, | |
3060 | u8 *pDtimCount, | |
3061 | u8 *pDtimPeriod, | |
3062 | u8 *pBcastFlag, | |
3063 | u8 *pMessageToMe, | |
51126deb | 3064 | u8 SupRate[], |
fdb2fd14 | 3065 | u8 *pSupRateLen, |
51126deb | 3066 | u8 ExtRate[], |
fdb2fd14 NM |
3067 | u8 *pExtRateLen, |
3068 | u8 *pCkipFlag, | |
3069 | u8 *pAironetCellPowerLimit, | |
62eb734b BZ |
3070 | struct rt_edca_parm *pEdcaParm, |
3071 | struct rt_qbss_load_parm *pQbssLoad, | |
3072 | struct rt_qos_capability_parm *pQosCapability, | |
fdb2fd14 NM |
3073 | unsigned long *pRalinkIe, |
3074 | u8 *pHtCapabilityLen, | |
3075 | u8 *pPreNHtCapabilityLen, | |
3076 | struct rt_ht_capability_ie *pHtCapability, | |
3077 | u8 *AddHtInfoLen, | |
3078 | struct rt_add_ht_info_ie *AddHtInfo, | |
3079 | u8 *NewExtChannel, | |
3080 | u16 *LengthVIE, | |
62eb734b | 3081 | struct rt_ndis_802_11_variable_ies *pVIE); |
52b81c89 | 3082 | |
62eb734b | 3083 | BOOLEAN PeerAddBAReqActionSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3084 | void *pMsg, |
51126deb | 3085 | unsigned long MsgLen, u8 *pAddr2); |
52b81c89 | 3086 | |
62eb734b | 3087 | BOOLEAN PeerAddBARspActionSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3088 | void *pMsg, unsigned long MsgLen); |
52b81c89 | 3089 | |
62eb734b | 3090 | BOOLEAN PeerDelBAActionSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3091 | u8 Wcid, void *pMsg, unsigned long MsgLen); |
52b81c89 | 3092 | |
62eb734b | 3093 | BOOLEAN MlmeAssocReqSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3094 | void *Msg, |
51126deb BZ |
3095 | unsigned long MsgLen, |
3096 | u8 *pApAddr, | |
fdb2fd14 NM |
3097 | u16 *CapabilityInfo, |
3098 | unsigned long *Timeout, u16 *ListenIntv); | |
52b81c89 | 3099 | |
62eb734b | 3100 | BOOLEAN MlmeAuthReqSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3101 | void *Msg, |
51126deb BZ |
3102 | unsigned long MsgLen, |
3103 | u8 *pAddr, | |
fdb2fd14 | 3104 | unsigned long *Timeout, u16 *Alg); |
52b81c89 | 3105 | |
62eb734b | 3106 | BOOLEAN MlmeStartReqSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3107 | void *Msg, |
51126deb | 3108 | unsigned long MsgLen, |
fdb2fd14 | 3109 | char Ssid[], u8 *Ssidlen); |
52b81c89 | 3110 | |
62eb734b | 3111 | BOOLEAN PeerAuthSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3112 | void *Msg, |
51126deb BZ |
3113 | unsigned long MsgLen, |
3114 | u8 *pAddr, | |
fdb2fd14 NM |
3115 | u16 *Alg, |
3116 | u16 *Seq, | |
3117 | u16 *Status, char ChlgText[]); | |
51126deb | 3118 | |
fdb2fd14 NM |
3119 | 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 */ |
3120 | u8 *pHtCapabilityLen, | |
3121 | u8 *pAddHtInfoLen, | |
3122 | u8 *pNewExtChannelOffset, | |
3123 | struct rt_edca_parm *pEdcaParm, u8 *pCkipFlag); | |
52b81c89 | 3124 | |
62eb734b | 3125 | BOOLEAN PeerDisassocSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3126 | void *Msg, |
51126deb | 3127 | unsigned long MsgLen, |
fdb2fd14 | 3128 | u8 *pAddr2, u16 *Reason); |
52b81c89 | 3129 | |
62eb734b | 3130 | BOOLEAN PeerWpaMessageSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3131 | struct rt_eapol_packet *pMsg, |
51126deb | 3132 | unsigned long MsgLen, |
62eb734b | 3133 | u8 MsgType, struct rt_mac_table_entry *pEntry); |
52b81c89 | 3134 | |
62eb734b | 3135 | BOOLEAN PeerDeauthSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3136 | void *Msg, |
51126deb | 3137 | unsigned long MsgLen, |
fdb2fd14 | 3138 | u8 *pAddr2, u16 *Reason); |
52b81c89 | 3139 | |
62eb734b | 3140 | BOOLEAN PeerProbeReqSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3141 | void *Msg, |
51126deb BZ |
3142 | unsigned long MsgLen, |
3143 | u8 *pAddr2, | |
fdb2fd14 | 3144 | char Ssid[], u8 *pSsidLen); |
52b81c89 | 3145 | |
fdb2fd14 | 3146 | BOOLEAN GetTimBit(char *Ptr, |
51126deb | 3147 | u16 Aid, |
fdb2fd14 NM |
3148 | u8 *TimLen, |
3149 | u8 *BcastFlag, | |
3150 | u8 *DtimCount, | |
3151 | u8 *DtimPeriod, u8 *MessageToMe); | |
52b81c89 | 3152 | |
62eb734b | 3153 | u8 ChannelSanity(struct rt_rtmp_adapter *pAd, u8 channel); |
52b81c89 | 3154 | |
62eb734b | 3155 | NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(struct rt_bss_entry *pBss); |
52b81c89 | 3156 | |
62eb734b | 3157 | BOOLEAN MlmeDelBAReqSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3158 | void *Msg, unsigned long MsgLen); |
52b81c89 | 3159 | |
62eb734b | 3160 | BOOLEAN MlmeAddBAReqSanity(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3161 | void *Msg, unsigned long MsgLen, u8 *pAddr2); |
52b81c89 | 3162 | |
fdb2fd14 | 3163 | unsigned long MakeOutgoingFrame(u8 *Buffer, unsigned long *Length, ...); |
52b81c89 | 3164 | |
62eb734b | 3165 | void LfsrInit(struct rt_rtmp_adapter *pAd, unsigned long Seed); |
52b81c89 | 3166 | |
62eb734b | 3167 | u8 RandomByte(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3168 | |
62eb734b | 3169 | void AsicUpdateAutoFallBackTable(struct rt_rtmp_adapter *pAd, u8 *pTxRate); |
52b81c89 | 3170 | |
51126deb BZ |
3171 | void MlmePeriodicExec(void *SystemSpecific1, |
3172 | void *FunctionContext, | |
3173 | void *SystemSpecific2, void *SystemSpecific3); | |
52b81c89 | 3174 | |
51126deb BZ |
3175 | void LinkDownExec(void *SystemSpecific1, |
3176 | void *FunctionContext, | |
3177 | void *SystemSpecific2, void *SystemSpecific3); | |
52b81c89 | 3178 | |
62eb734b | 3179 | void STAMlmePeriodicExec(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3180 | |
62eb734b | 3181 | void MlmeAutoScan(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3182 | |
62eb734b | 3183 | void MlmeAutoReconnectLastSSID(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3184 | |
51126deb | 3185 | BOOLEAN MlmeValidateSSID(u8 *pSsid, u8 SsidLen); |
52b81c89 | 3186 | |
62eb734b | 3187 | void MlmeCheckForRoaming(struct rt_rtmp_adapter *pAd, unsigned long Now32); |
52b81c89 | 3188 | |
62eb734b | 3189 | BOOLEAN MlmeCheckForFastRoaming(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3190 | |
62eb734b | 3191 | void MlmeDynamicTxRateSwitching(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3192 | |
62eb734b BZ |
3193 | void MlmeSetTxRate(struct rt_rtmp_adapter *pAd, |
3194 | struct rt_mac_table_entry *pEntry, struct rt_rtmp_tx_rate_switch * pTxRate); | |
52b81c89 | 3195 | |
62eb734b BZ |
3196 | void MlmeSelectTxRateTable(struct rt_rtmp_adapter *pAd, |
3197 | struct rt_mac_table_entry *pEntry, | |
fdb2fd14 | 3198 | u8 **ppTable, |
51126deb | 3199 | u8 *pTableSize, u8 *pInitTxRateIdx); |
52b81c89 | 3200 | |
62eb734b BZ |
3201 | void MlmeCalculateChannelQuality(struct rt_rtmp_adapter *pAd, |
3202 | struct rt_mac_table_entry *pMacEntry, unsigned long Now); | |
52b81c89 | 3203 | |
62eb734b | 3204 | void MlmeCheckPsmChange(struct rt_rtmp_adapter *pAd, unsigned long Now32); |
52b81c89 | 3205 | |
62eb734b | 3206 | void MlmeSetPsmBit(struct rt_rtmp_adapter *pAd, u16 psm); |
52b81c89 | 3207 | |
62eb734b | 3208 | void MlmeSetTxPreamble(struct rt_rtmp_adapter *pAd, u16 TxPreamble); |
52b81c89 | 3209 | |
62eb734b | 3210 | void UpdateBasicRateBitmap(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3211 | |
62eb734b | 3212 | void MlmeUpdateTxRates(struct rt_rtmp_adapter *pAd, |
51126deb | 3213 | IN BOOLEAN bLinkUp, u8 apidx); |
52b81c89 | 3214 | |
62eb734b | 3215 | void MlmeUpdateHtTxRates(struct rt_rtmp_adapter *pAd, u8 apidx); |
52b81c89 | 3216 | |
62eb734b | 3217 | void RTMPCheckRates(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3218 | IN u8 SupRate[], IN u8 *SupRateLen); |
52b81c89 | 3219 | |
62eb734b | 3220 | BOOLEAN RTMPCheckChannel(struct rt_rtmp_adapter *pAd, |
51126deb | 3221 | u8 CentralChannel, u8 Channel); |
52b81c89 | 3222 | |
62eb734b | 3223 | BOOLEAN RTMPCheckHt(struct rt_rtmp_adapter *pAd, |
51126deb | 3224 | u8 Wcid, |
fdb2fd14 NM |
3225 | struct rt_ht_capability_ie *pHtCapability, |
3226 | struct rt_add_ht_info_ie *pAddHtInfo); | |
52b81c89 | 3227 | |
51126deb BZ |
3228 | void StaQuickResponeForRateUpExec(void *SystemSpecific1, |
3229 | void *FunctionContext, | |
3230 | void *SystemSpecific2, | |
3231 | void *SystemSpecific3); | |
52b81c89 | 3232 | |
62eb734b | 3233 | void RTMPUpdateMlmeRate(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3234 | |
62eb734b | 3235 | char RTMPMaxRssi(struct rt_rtmp_adapter *pAd, |
51126deb | 3236 | char Rssi0, char Rssi1, char Rssi2); |
91980990 | 3237 | |
ca97b838 | 3238 | #ifdef RT30xx |
62eb734b | 3239 | void AsicSetRxAnt(struct rt_rtmp_adapter *pAd, u8 Ant); |
3a32ed12 | 3240 | |
62eb734b | 3241 | void RTMPFilterCalibration(struct rt_rtmp_adapter *pAd); |
ca97b838 BZ |
3242 | |
3243 | #ifdef RTMP_EFUSE_SUPPORT | |
cc277069 | 3244 | /*2008/09/11:KH add to support efuse<-- */ |
62eb734b | 3245 | int set_eFuseGetFreeBlockCount_Proc(struct rt_rtmp_adapter *pAd, char *arg); |
ca97b838 | 3246 | |
62eb734b | 3247 | int set_eFusedump_Proc(struct rt_rtmp_adapter *pAd, char *arg); |
ca97b838 | 3248 | |
62eb734b | 3249 | void eFusePhysicalReadRegisters(struct rt_rtmp_adapter *pAd, |
51126deb | 3250 | u16 Offset, |
fdb2fd14 | 3251 | u16 Length, u16 *pData); |
ca97b838 | 3252 | |
62eb734b | 3253 | int RtmpEfuseSupportCheck(struct rt_rtmp_adapter *pAd); |
ca97b838 | 3254 | |
62eb734b | 3255 | void eFuseGetFreeBlockCount(struct rt_rtmp_adapter *pAd, u32 *EfuseFreeBlock); |
ca97b838 | 3256 | |
62eb734b | 3257 | int eFuse_init(struct rt_rtmp_adapter *pAd); |
cc277069 BZ |
3258 | /*2008/09/11:KH add to support efuse--> */ |
3259 | #endif /* RTMP_EFUSE_SUPPORT // */ | |
ca97b838 | 3260 | |
cc277069 | 3261 | /* add by johnli, RF power sequence setup */ |
62eb734b | 3262 | void RT30xxLoadRFNormalModeSetup(struct rt_rtmp_adapter *pAd); |
ca97b838 | 3263 | |
62eb734b | 3264 | void RT30xxLoadRFSleepModeSetup(struct rt_rtmp_adapter *pAd); |
ca97b838 | 3265 | |
62eb734b | 3266 | void RT30xxReverseRFSleepModeSetup(struct rt_rtmp_adapter *pAd); |
cc277069 | 3267 | /* end johnli */ |
ca97b838 BZ |
3268 | |
3269 | #ifdef RT3070 | |
62eb734b | 3270 | void NICInitRT3070RFRegisters(struct rt_rtmp_adapter *pAd); |
cc277069 | 3271 | #endif /* RT3070 // */ |
e44fd1cf | 3272 | #ifdef RT3090 |
62eb734b | 3273 | void NICInitRT3090RFRegisters(struct rt_rtmp_adapter *pAd); |
cc277069 | 3274 | #endif /* RT3090 // */ |
ca97b838 | 3275 | |
62eb734b | 3276 | void RT30xxHaltAction(struct rt_rtmp_adapter *pAd); |
ca97b838 | 3277 | |
62eb734b | 3278 | void RT30xxSetRxAnt(struct rt_rtmp_adapter *pAd, u8 Ant); |
cc277069 | 3279 | #endif /* RT30xx // */ |
ca97b838 | 3280 | |
62eb734b | 3281 | void AsicEvaluateRxAnt(struct rt_rtmp_adapter *pAd); |
91980990 | 3282 | |
51126deb BZ |
3283 | void AsicRxAntEvalTimeout(void *SystemSpecific1, |
3284 | void *FunctionContext, | |
3285 | void *SystemSpecific2, void *SystemSpecific3); | |
91980990 | 3286 | |
51126deb BZ |
3287 | void APSDPeriodicExec(void *SystemSpecific1, |
3288 | void *FunctionContext, | |
3289 | void *SystemSpecific2, void *SystemSpecific3); | |
91980990 | 3290 | |
62eb734b BZ |
3291 | BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(struct rt_rtmp_adapter *pAd, |
3292 | struct rt_mac_table_entry *pEntry); | |
91980990 | 3293 | |
62eb734b | 3294 | u8 RTMPStaFixedTxMode(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); |
91980990 | 3295 | |
62eb734b | 3296 | void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode, struct rt_mac_table_entry *pEntry); |
91980990 | 3297 | |
62eb734b | 3298 | BOOLEAN RTMPAutoRateSwitchCheck(struct rt_rtmp_adapter *pAd); |
91980990 | 3299 | |
62eb734b | 3300 | int MlmeInit(struct rt_rtmp_adapter *pAd); |
91980990 | 3301 | |
62eb734b | 3302 | void MlmeHandler(struct rt_rtmp_adapter *pAd); |
91980990 | 3303 | |
62eb734b | 3304 | void MlmeHalt(struct rt_rtmp_adapter *pAd); |
91980990 | 3305 | |
62eb734b | 3306 | void MlmeResetRalinkCounters(struct rt_rtmp_adapter *pAd); |
91980990 | 3307 | |
62eb734b | 3308 | void BuildChannelList(struct rt_rtmp_adapter *pAd); |
91980990 | 3309 | |
62eb734b | 3310 | u8 FirstChannel(struct rt_rtmp_adapter *pAd); |
91980990 | 3311 | |
62eb734b | 3312 | u8 NextChannel(struct rt_rtmp_adapter *pAd, u8 channel); |
91980990 | 3313 | |
62eb734b | 3314 | void ChangeToCellPowerLimit(struct rt_rtmp_adapter *pAd, |
51126deb | 3315 | u8 AironetCellPowerLimit); |
91980990 | 3316 | |
cc277069 BZ |
3317 | /* */ |
3318 | /* Prototypes of function definition in rtmp_tkip.c */ | |
3319 | /* */ | |
62eb734b | 3320 | void RTMPInitTkipEngine(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3321 | u8 *pTKey, |
3322 | u8 KeyId, | |
3323 | u8 *pTA, | |
3324 | u8 *pMICKey, | |
3325 | u8 *pTSC, unsigned long *pIV16, unsigned long *pIV32); | |
3326 | ||
62eb734b | 3327 | void RTMPInitMICEngine(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3328 | u8 *pKey, |
3329 | u8 *pDA, | |
3330 | u8 *pSA, u8 UserPriority, u8 *pMICKey); | |
52b81c89 | 3331 | |
62eb734b | 3332 | BOOLEAN RTMPTkipCompareMICValue(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3333 | u8 *pSrc, |
3334 | u8 *pDA, | |
3335 | u8 *pSA, | |
3336 | u8 *pMICKey, | |
3337 | u8 UserPriority, u32 Len); | |
52b81c89 | 3338 | |
62eb734b | 3339 | void RTMPCalculateMICValue(struct rt_rtmp_adapter *pAd, |
8a10a546 | 3340 | void *pPacket, |
51126deb | 3341 | u8 *pEncap, |
62eb734b | 3342 | struct rt_cipher_key *pKey, u8 apidx); |
52b81c89 | 3343 | |
62eb734b | 3344 | void RTMPTkipAppendByte(struct rt_tkip_key_info *pTkip, u8 uChar); |
52b81c89 | 3345 | |
62eb734b | 3346 | void RTMPTkipAppend(struct rt_tkip_key_info *pTkip, u8 *pSrc, u32 nBytes); |
52b81c89 | 3347 | |
62eb734b | 3348 | void RTMPTkipGetMIC(struct rt_tkip_key_info *pTkip); |
91980990 | 3349 | |
62eb734b | 3350 | BOOLEAN RTMPSoftDecryptTKIP(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3351 | u8 *pData, |
3352 | unsigned long DataByteCnt, | |
62eb734b | 3353 | u8 UserPriority, struct rt_cipher_key *pWpaKey); |
ca97b838 | 3354 | |
62eb734b | 3355 | BOOLEAN RTMPSoftDecryptAES(struct rt_rtmp_adapter *pAd, |
51126deb | 3356 | u8 *pData, |
62eb734b | 3357 | unsigned long DataByteCnt, struct rt_cipher_key *pWpaKey); |
ca97b838 | 3358 | |
cc277069 BZ |
3359 | /* */ |
3360 | /* Prototypes of function definition in cmm_info.c */ | |
3361 | /* */ | |
62eb734b | 3362 | int RT_CfgSetCountryRegion(struct rt_rtmp_adapter *pAd, char *arg, int band); |
ca97b838 | 3363 | |
62eb734b | 3364 | int RT_CfgSetWirelessMode(struct rt_rtmp_adapter *pAd, char *arg); |
ca97b838 | 3365 | |
62eb734b | 3366 | int RT_CfgSetShortSlot(struct rt_rtmp_adapter *pAd, char *arg); |
ca97b838 | 3367 | |
62eb734b | 3368 | int RT_CfgSetWepKey(struct rt_rtmp_adapter *pAd, |
51126deb | 3369 | char *keyString, |
62eb734b | 3370 | struct rt_cipher_key *pSharedKey, int keyIdx); |
ca97b838 | 3371 | |
62eb734b | 3372 | int RT_CfgSetWPAPSKKey(struct rt_rtmp_adapter *pAd, |
51126deb | 3373 | char *keyString, |
fdb2fd14 | 3374 | u8 *pHashStr, |
51126deb | 3375 | int hashStrLen, u8 *pPMKBuf); |
ca97b838 | 3376 | |
cc277069 BZ |
3377 | /* */ |
3378 | /* Prototypes of function definition in cmm_info.c */ | |
3379 | /* */ | |
62eb734b | 3380 | void RTMPWPARemoveAllKeys(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3381 | |
62eb734b | 3382 | void RTMPSetPhyMode(struct rt_rtmp_adapter *pAd, unsigned long phymode); |
52b81c89 | 3383 | |
62eb734b | 3384 | void RTMPUpdateHTIE(struct rt_ht_capability *pRtHt, |
fdb2fd14 NM |
3385 | u8 *pMcsSet, |
3386 | struct rt_ht_capability_ie *pHtCapability, | |
3387 | struct rt_add_ht_info_ie *pAddHtInfo); | |
52b81c89 | 3388 | |
62eb734b | 3389 | void RTMPAddWcidAttributeEntry(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3390 | u8 BssIdx, |
3391 | u8 KeyIdx, | |
62eb734b | 3392 | u8 CipherAlg, struct rt_mac_table_entry *pEntry); |
52b81c89 | 3393 | |
51126deb | 3394 | char *GetEncryptType(char enc); |
52b81c89 | 3395 | |
51126deb | 3396 | char *GetAuthMode(char auth); |
52b81c89 | 3397 | |
62eb734b | 3398 | void RTMPSetHT(struct rt_rtmp_adapter *pAd, struct rt_oid_set_ht_phymode *pHTPhyMode); |
52b81c89 | 3399 | |
62eb734b | 3400 | void RTMPSetIndividualHT(struct rt_rtmp_adapter *pAd, u8 apidx); |
52b81c89 | 3401 | |
62eb734b | 3402 | void RTMPSendWirelessEvent(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3403 | u16 Event_flag, |
3404 | u8 *pAddr, u8 BssIdx, char Rssi); | |
52b81c89 | 3405 | |
62eb734b | 3406 | char ConvertToRssi(struct rt_rtmp_adapter *pAd, char Rssi, u8 RssiNumber); |
91980990 | 3407 | |
ca97b838 BZ |
3408 | /*=================================== |
3409 | Function prototype in cmm_wpa.c | |
3410 | =================================== */ | |
62eb734b BZ |
3411 | void RTMPToWirelessSta(struct rt_rtmp_adapter *pAd, |
3412 | struct rt_mac_table_entry *pEntry, | |
51126deb BZ |
3413 | u8 *pHeader802_3, |
3414 | u32 HdrLen, | |
3415 | u8 *pData, | |
3416 | u32 DataLen, IN BOOLEAN bClearFrame); | |
52b81c89 | 3417 | |
62eb734b | 3418 | void WpaDerivePTK(struct rt_rtmp_adapter *pAd, |
fdb2fd14 NM |
3419 | u8 *PMK, |
3420 | u8 *ANonce, | |
3421 | u8 *AA, | |
3422 | u8 *SNonce, | |
3423 | u8 *SA, u8 *output, u32 len); | |
52b81c89 | 3424 | |
fdb2fd14 | 3425 | void GenRandom(struct rt_rtmp_adapter *pAd, u8 *macAddr, u8 *random); |
52b81c89 | 3426 | |
62eb734b BZ |
3427 | BOOLEAN RTMPCheckWPAframe(struct rt_rtmp_adapter *pAd, |
3428 | struct rt_mac_table_entry *pEntry, | |
51126deb BZ |
3429 | u8 *pData, |
3430 | unsigned long DataByteCount, u8 FromWhichBSSID); | |
52b81c89 | 3431 | |
fdb2fd14 NM |
3432 | void AES_GTK_KEY_UNWRAP(u8 *key, |
3433 | u8 *plaintext, | |
3434 | u32 c_len, u8 *ciphertext); | |
52b81c89 | 3435 | |
62eb734b | 3436 | BOOLEAN RTMPParseEapolKeyData(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3437 | u8 *pKeyData, |
3438 | u8 KeyDataLen, | |
3439 | u8 GroupKeyIndex, | |
3440 | u8 MsgType, | |
62eb734b | 3441 | IN BOOLEAN bWPA2, struct rt_mac_table_entry *pEntry); |
52b81c89 | 3442 | |
62eb734b | 3443 | void ConstructEapolMsg(struct rt_mac_table_entry *pEntry, |
51126deb BZ |
3444 | u8 GroupKeyWepStatus, |
3445 | u8 MsgType, | |
3446 | u8 DefaultKeyIdx, | |
fdb2fd14 NM |
3447 | u8 *KeyNonce, |
3448 | u8 *TxRSC, | |
3449 | u8 *GTK, | |
3450 | u8 *RSNIE, | |
3451 | u8 RSNIE_Len, struct rt_eapol_packet *pMsg); | |
51126deb | 3452 | |
62eb734b BZ |
3453 | int RTMPSoftDecryptBroadCastData(struct rt_rtmp_adapter *pAd, |
3454 | struct rt_rx_blk *pRxBlk, | |
52b81c89 BZ |
3455 | IN NDIS_802_11_ENCRYPTION_STATUS |
3456 | GroupCipher, | |
62eb734b | 3457 | struct rt_cipher_key *pShard_key); |
52b81c89 | 3458 | |
62eb734b | 3459 | void RTMPMakeRSNIE(struct rt_rtmp_adapter *pAd, |
51126deb | 3460 | u32 AuthMode, u32 WepStatus, u8 apidx); |
91980990 | 3461 | |
cc277069 BZ |
3462 | /* */ |
3463 | /* function prototype in ap_wpa.c */ | |
3464 | /* */ | |
62eb734b | 3465 | void RTMPGetTxTscFromAsic(struct rt_rtmp_adapter *pAd, |
51126deb | 3466 | u8 apidx, u8 *pTxTsc); |
91980990 | 3467 | |
62eb734b | 3468 | void APInstallPairwiseKey(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); |
52b81c89 | 3469 | |
62eb734b BZ |
3470 | u32 APValidateRSNIE(struct rt_rtmp_adapter *pAd, |
3471 | struct rt_mac_table_entry *pEntry, | |
51126deb | 3472 | u8 *pRsnIe, u8 rsnie_len); |
52b81c89 | 3473 | |
62eb734b | 3474 | void HandleCounterMeasure(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); |
52b81c89 | 3475 | |
62eb734b BZ |
3476 | void WPAStart4WayHS(struct rt_rtmp_adapter *pAd, |
3477 | struct rt_mac_table_entry *pEntry, unsigned long TimeInterval); | |
91980990 | 3478 | |
62eb734b | 3479 | void WPAStart2WayGroupHS(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); |
52b81c89 | 3480 | |
62eb734b BZ |
3481 | void PeerPairMsg1Action(struct rt_rtmp_adapter *pAd, |
3482 | struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); | |
52b81c89 | 3483 | |
62eb734b BZ |
3484 | void PeerPairMsg2Action(struct rt_rtmp_adapter *pAd, |
3485 | struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); | |
52b81c89 | 3486 | |
62eb734b BZ |
3487 | void PeerPairMsg3Action(struct rt_rtmp_adapter *pAd, |
3488 | struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); | |
52b81c89 | 3489 | |
62eb734b BZ |
3490 | void PeerPairMsg4Action(struct rt_rtmp_adapter *pAd, |
3491 | struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); | |
52b81c89 | 3492 | |
62eb734b BZ |
3493 | void PeerGroupMsg1Action(struct rt_rtmp_adapter *pAd, |
3494 | struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); | |
52b81c89 | 3495 | |
62eb734b BZ |
3496 | void PeerGroupMsg2Action(struct rt_rtmp_adapter *pAd, |
3497 | struct rt_mac_table_entry *pEntry, | |
fdb2fd14 | 3498 | void *Msg, u32 MsgLen); |
52b81c89 | 3499 | |
fdb2fd14 NM |
3500 | void WpaDeriveGTK(u8 *PMK, |
3501 | u8 *GNonce, | |
3502 | u8 *AA, u8 *output, u32 len); | |
52b81c89 | 3503 | |
fdb2fd14 NM |
3504 | void AES_GTK_KEY_WRAP(u8 *key, |
3505 | u8 *plaintext, | |
3506 | u32 p_len, u8 *ciphertext); | |
52b81c89 | 3507 | |
cc277069 | 3508 | /*typedef void (*TIMER_FUNCTION)(unsigned long); */ |
91980990 | 3509 | |
91980990 | 3510 | /* timeout -- ms */ |
fdb2fd14 | 3511 | void RTMP_SetPeriodicTimer(struct timer_list *pTimer, |
52b81c89 | 3512 | IN unsigned long timeout); |
91980990 | 3513 | |
62eb734b | 3514 | void RTMP_OS_Init_Timer(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3515 | struct timer_list *pTimer, |
51126deb | 3516 | IN TIMER_FUNCTION function, void *data); |
91980990 | 3517 | |
fdb2fd14 | 3518 | void RTMP_OS_Add_Timer(struct timer_list *pTimer, |
52b81c89 | 3519 | IN unsigned long timeout); |
91980990 | 3520 | |
fdb2fd14 | 3521 | void RTMP_OS_Mod_Timer(struct timer_list *pTimer, |
52b81c89 | 3522 | IN unsigned long timeout); |
91980990 | 3523 | |
fdb2fd14 NM |
3524 | void RTMP_OS_Del_Timer(struct timer_list *pTimer, |
3525 | OUT BOOLEAN *pCancelled); | |
91980990 | 3526 | |
62eb734b | 3527 | void RTMP_OS_Release_Packet(struct rt_rtmp_adapter *pAd, struct rt_queue_entry *pEntry); |
91980990 | 3528 | |
51126deb | 3529 | void RTMPusecDelay(unsigned long usec); |
91980990 | 3530 | |
62eb734b | 3531 | int os_alloc_mem(struct rt_rtmp_adapter *pAd, |
fdb2fd14 | 3532 | u8 **mem, unsigned long size); |
91980990 | 3533 | |
62eb734b | 3534 | int os_free_mem(struct rt_rtmp_adapter *pAd, void *mem); |
91980990 | 3535 | |
62eb734b | 3536 | void RTMP_AllocateSharedMemory(struct rt_rtmp_adapter *pAd, |
51126deb | 3537 | unsigned long Length, |
52b81c89 | 3538 | IN BOOLEAN Cached, |
fdb2fd14 | 3539 | void **VirtualAddress, |
8a10a546 | 3540 | dma_addr_t *PhysicalAddress); |
91980990 | 3541 | |
62eb734b | 3542 | void RTMPFreeTxRxRingMemory(struct rt_rtmp_adapter *pAd); |
91980990 | 3543 | |
fdb2fd14 | 3544 | int AdapterBlockAllocateMemory(void *handle, void **ppAd); |
91980990 | 3545 | |
62eb734b | 3546 | void RTMP_AllocateTxDescMemory(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3547 | u32 Index, |
3548 | unsigned long Length, | |
52b81c89 | 3549 | IN BOOLEAN Cached, |
fdb2fd14 | 3550 | void **VirtualAddress, |
8a10a546 | 3551 | dma_addr_t *PhysicalAddress); |
91980990 | 3552 | |
62eb734b | 3553 | void RTMP_AllocateFirstTxBuffer(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3554 | u32 Index, |
3555 | unsigned long Length, | |
52b81c89 | 3556 | IN BOOLEAN Cached, |
fdb2fd14 | 3557 | void **VirtualAddress, |
8a10a546 | 3558 | dma_addr_t *PhysicalAddress); |
91980990 | 3559 | |
62eb734b | 3560 | void RTMP_FreeFirstTxBuffer(struct rt_rtmp_adapter *pAd, |
51126deb | 3561 | unsigned long Length, |
52b81c89 | 3562 | IN BOOLEAN Cached, |
51126deb | 3563 | void *VirtualAddress, |
8a10a546 | 3564 | dma_addr_t PhysicalAddress); |
91980990 | 3565 | |
62eb734b | 3566 | void RTMP_AllocateMgmtDescMemory(struct rt_rtmp_adapter *pAd, |
51126deb | 3567 | unsigned long Length, |
52b81c89 | 3568 | IN BOOLEAN Cached, |
fdb2fd14 | 3569 | void **VirtualAddress, |
8a10a546 | 3570 | dma_addr_t *PhysicalAddress); |
91980990 | 3571 | |
62eb734b | 3572 | void RTMP_AllocateRxDescMemory(struct rt_rtmp_adapter *pAd, |
51126deb | 3573 | unsigned long Length, |
52b81c89 | 3574 | IN BOOLEAN Cached, |
fdb2fd14 | 3575 | void **VirtualAddress, |
8a10a546 | 3576 | dma_addr_t *PhysicalAddress); |
52b81c89 | 3577 | |
62eb734b | 3578 | void RTMP_FreeDescMemory(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3579 | unsigned long Length, |
3580 | void *VirtualAddress, | |
8a10a546 | 3581 | dma_addr_t PhysicalAddress); |
52b81c89 | 3582 | |
62eb734b | 3583 | void *RtmpOSNetPktAlloc(struct rt_rtmp_adapter *pAd, IN int size); |
52b81c89 | 3584 | |
62eb734b | 3585 | void *RTMP_AllocateRxPacketBuffer(struct rt_rtmp_adapter *pAd, |
51126deb | 3586 | unsigned long Length, |
52b81c89 | 3587 | IN BOOLEAN Cached, |
fdb2fd14 NM |
3588 | void **VirtualAddress, |
3589 | OUT dma_addr_t *PhysicalAddress); | |
91980990 | 3590 | |
62eb734b | 3591 | void *RTMP_AllocateTxPacketBuffer(struct rt_rtmp_adapter *pAd, |
51126deb | 3592 | unsigned long Length, |
52b81c89 | 3593 | IN BOOLEAN Cached, |
fdb2fd14 | 3594 | void **VirtualAddress); |
91980990 | 3595 | |
62eb734b | 3596 | void *RTMP_AllocateFragPacketBuffer(struct rt_rtmp_adapter *pAd, |
51126deb | 3597 | unsigned long Length); |
52b81c89 | 3598 | |
8a10a546 | 3599 | void RTMP_QueryPacketInfo(void *pPacket, |
62eb734b | 3600 | struct rt_packet_info *pPacketInfo, |
fdb2fd14 | 3601 | u8 **pSrcBufVA, u32 *pSrcBufLen); |
52b81c89 | 3602 | |
fdb2fd14 | 3603 | void RTMP_QueryNextPacketInfo(void **ppPacket, |
62eb734b | 3604 | struct rt_packet_info *pPacketInfo, |
fdb2fd14 | 3605 | u8 **pSrcBufVA, u32 *pSrcBufLen); |
52b81c89 | 3606 | |
62eb734b | 3607 | BOOLEAN RTMP_FillTxBlkInfo(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk); |
52b81c89 | 3608 | |
fdb2fd14 NM |
3609 | struct rt_rtmp_sg_list *rt_get_sg_list_from_packet(void *pPacket, |
3610 | struct rt_rtmp_sg_list *sg); | |
52b81c89 | 3611 | |
62eb734b | 3612 | void announce_802_3_packet(struct rt_rtmp_adapter *pAd, void *pPacket); |
52b81c89 | 3613 | |
1f2b472c | 3614 | u32 BA_Reorder_AMSDU_Announce(struct rt_rtmp_adapter *pAd, void *pPacket); |
52b81c89 | 3615 | |
62eb734b | 3616 | struct net_device *get_netdev_from_bssid(struct rt_rtmp_adapter *pAd, u8 FromWhichBSSID); |
52b81c89 | 3617 | |
62eb734b | 3618 | void *duplicate_pkt(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3619 | u8 *pHeader802_3, |
3620 | u32 HdrLen, | |
3621 | u8 *pData, | |
3622 | unsigned long DataSize, u8 FromWhichBSSID); | |
52b81c89 | 3623 | |
62eb734b | 3624 | void *duplicate_pkt_with_TKIP_MIC(struct rt_rtmp_adapter *pAd, |
8a10a546 | 3625 | void *pOldPkt); |
52b81c89 | 3626 | |
62eb734b BZ |
3627 | void ba_flush_reordering_timeout_mpdus(struct rt_rtmp_adapter *pAd, |
3628 | struct rt_ba_rec_entry *pBAEntry, | |
51126deb | 3629 | unsigned long Now32); |
52b81c89 | 3630 | |
62eb734b BZ |
3631 | void BAOriSessionSetUp(struct rt_rtmp_adapter *pAd, |
3632 | struct rt_mac_table_entry *pEntry, | |
51126deb BZ |
3633 | u8 TID, |
3634 | u16 TimeOut, | |
3635 | unsigned long DelayTime, IN BOOLEAN isForced); | |
52b81c89 | 3636 | |
62eb734b | 3637 | void BASessionTearDownALL(struct rt_rtmp_adapter *pAd, u8 Wcid); |
52b81c89 BZ |
3638 | |
3639 | BOOLEAN OS_Need_Clone_Packet(void); | |
91980990 | 3640 | |
62eb734b | 3641 | void build_tx_packet(struct rt_rtmp_adapter *pAd, |
8a10a546 | 3642 | void *pPacket, |
51126deb | 3643 | u8 *pFrame, unsigned long FrameLen); |
91980990 | 3644 | |
62eb734b | 3645 | void BAOriSessionTearDown(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3646 | u8 Wcid, |
3647 | u8 TID, | |
52b81c89 | 3648 | IN BOOLEAN bPassive, IN BOOLEAN bForceSend); |
91980990 | 3649 | |
62eb734b | 3650 | void BARecSessionTearDown(struct rt_rtmp_adapter *pAd, |
51126deb | 3651 | u8 Wcid, u8 TID, IN BOOLEAN bPassive); |
91980990 | 3652 | |
62eb734b BZ |
3653 | BOOLEAN ba_reordering_resource_init(struct rt_rtmp_adapter *pAd, int num); |
3654 | void ba_reordering_resource_release(struct rt_rtmp_adapter *pAd); | |
91980990 | 3655 | |
51126deb | 3656 | char *rstrtok(char *s, IN const char *ct); |
91980990 | 3657 | |
cc277069 | 3658 | /*//////// common ioctl functions ////////// */ |
62eb734b | 3659 | int SetCommonHT(struct rt_rtmp_adapter *pAd); |
91980990 | 3660 | |
62eb734b | 3661 | int WpaCheckEapCode(struct rt_rtmp_adapter *pAd, |
51126deb | 3662 | u8 *pFrame, u16 FrameLen, u16 OffSet); |
91980990 | 3663 | |
62eb734b | 3664 | void WpaSendMicFailureToWpaSupplicant(struct rt_rtmp_adapter *pAd, |
52b81c89 | 3665 | IN BOOLEAN bUnicast); |
91980990 | 3666 | |
62eb734b | 3667 | int wext_notify_event_assoc(struct rt_rtmp_adapter *pAd); |
91980990 | 3668 | |
62eb734b | 3669 | BOOLEAN STARxDoneInterruptHandle(struct rt_rtmp_adapter *pAd, IN BOOLEAN argc); |
91980990 | 3670 | |
cc277069 | 3671 | /* AMPDU packet indication */ |
62eb734b BZ |
3672 | void Indicate_AMPDU_Packet(struct rt_rtmp_adapter *pAd, |
3673 | struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); | |
91980990 | 3674 | |
cc277069 | 3675 | /* AMSDU packet indication */ |
62eb734b BZ |
3676 | void Indicate_AMSDU_Packet(struct rt_rtmp_adapter *pAd, |
3677 | struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); | |
91980990 | 3678 | |
cc277069 | 3679 | /* Normal legacy Rx packet indication */ |
62eb734b BZ |
3680 | void Indicate_Legacy_Packet(struct rt_rtmp_adapter *pAd, |
3681 | struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); | |
52b81c89 | 3682 | |
62eb734b BZ |
3683 | void Indicate_EAPOL_Packet(struct rt_rtmp_adapter *pAd, |
3684 | struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); | |
52b81c89 | 3685 | |
62eb734b BZ |
3686 | void update_os_packet_info(struct rt_rtmp_adapter *pAd, |
3687 | struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); | |
52b81c89 | 3688 | |
62eb734b BZ |
3689 | void wlan_802_11_to_802_3_packet(struct rt_rtmp_adapter *pAd, |
3690 | struct rt_rx_blk *pRxBlk, | |
51126deb BZ |
3691 | u8 *pHeader802_3, |
3692 | u8 FromWhichBSSID); | |
91980990 | 3693 | |
cc277069 | 3694 | /* remove LLC and get 802_3 Header */ |
91980990 GKH |
3695 | #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \ |
3696 | { \ | |
51126deb | 3697 | u8 *_pRemovedLLCSNAP = NULL, *_pDA, *_pSA; \ |
91980990 | 3698 | \ |
fdb2fd14 | 3699 | if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) { \ |
91980990 | 3700 | _pDA = _pRxBlk->pHeader->Addr3; \ |
62eb734b | 3701 | _pSA = (u8 *)_pRxBlk->pHeader + sizeof(struct rt_header_802_11); \ |
91980990 | 3702 | } \ |
fdb2fd14 NM |
3703 | else {\ |
3704 | if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_INFRA)) {\ | |
91980990 GKH |
3705 | _pDA = _pRxBlk->pHeader->Addr1; \ |
3706 | if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_DLS)) \ | |
3707 | _pSA = _pRxBlk->pHeader->Addr2; \ | |
3708 | else \ | |
3709 | _pSA = _pRxBlk->pHeader->Addr3; \ | |
3710 | } \ | |
fdb2fd14 | 3711 | else { \ |
91980990 GKH |
3712 | _pDA = _pRxBlk->pHeader->Addr1; \ |
3713 | _pSA = _pRxBlk->pHeader->Addr2; \ | |
3714 | } \ | |
3715 | } \ | |
3716 | \ | |
3717 | CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \ | |
3718 | _pRxBlk->DataSize, _pRemovedLLCSNAP); \ | |
3719 | } | |
91980990 | 3720 | |
62eb734b | 3721 | void Sta_Announce_or_Forward_802_3_Packet(struct rt_rtmp_adapter *pAd, |
8a10a546 | 3722 | void *pPacket, |
51126deb | 3723 | u8 FromWhichBSSID); |
91980990 | 3724 | |
91980990 GKH |
3725 | #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\ |
3726 | Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS); | |
cc277069 | 3727 | /*announce_802_3_packet(_pAd, _pPacket); */ |
91980990 | 3728 | |
62eb734b | 3729 | void *DuplicatePacket(struct rt_rtmp_adapter *pAd, |
8a10a546 | 3730 | void *pPacket, u8 FromWhichBSSID); |
52b81c89 | 3731 | |
62eb734b | 3732 | void *ClonePacket(struct rt_rtmp_adapter *pAd, |
8a10a546 | 3733 | void *pPacket, |
51126deb | 3734 | u8 *pData, unsigned long DataSize); |
91980990 | 3735 | |
cc277069 | 3736 | /* Normal, AMPDU or AMSDU */ |
62eb734b BZ |
3737 | void CmmRxnonRalinkFrameIndicate(struct rt_rtmp_adapter *pAd, |
3738 | struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); | |
91980990 | 3739 | |
62eb734b BZ |
3740 | void CmmRxRalinkFrameIndicate(struct rt_rtmp_adapter *pAd, |
3741 | struct rt_mac_table_entry *pEntry, | |
3742 | struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); | |
91980990 | 3743 | |
62eb734b BZ |
3744 | void Update_Rssi_Sample(struct rt_rtmp_adapter *pAd, |
3745 | struct rt_rssi_sample *pRssi, struct rt_rxwi * pRxWI); | |
91980990 | 3746 | |
62eb734b | 3747 | void *GetPacketFromRxRing(struct rt_rtmp_adapter *pAd, |
52b81c89 | 3748 | OUT PRT28XX_RXD_STRUC pSaveRxD, |
fdb2fd14 NM |
3749 | OUT BOOLEAN *pbReschedule, |
3750 | IN u32 *pRxPending); | |
52b81c89 | 3751 | |
62eb734b | 3752 | void *RTMPDeFragmentDataFrame(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk); |
91980990 | 3753 | |
91980990 | 3754 | enum { |
52b81c89 BZ |
3755 | DIDmsg_lnxind_wlansniffrm = 0x00000044, |
3756 | DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044, | |
3757 | DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044, | |
3758 | DIDmsg_lnxind_wlansniffrm_channel = 0x00030044, | |
3759 | DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044, | |
3760 | DIDmsg_lnxind_wlansniffrm_sq = 0x00050044, | |
3761 | DIDmsg_lnxind_wlansniffrm_signal = 0x00060044, | |
3762 | DIDmsg_lnxind_wlansniffrm_noise = 0x00070044, | |
3763 | DIDmsg_lnxind_wlansniffrm_rate = 0x00080044, | |
3764 | DIDmsg_lnxind_wlansniffrm_istx = 0x00090044, | |
3765 | DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044 | |
91980990 GKH |
3766 | }; |
3767 | enum { | |
52b81c89 | 3768 | P80211ENUM_msgitem_status_no_value = 0x00 |
91980990 GKH |
3769 | }; |
3770 | enum { | |
52b81c89 BZ |
3771 | P80211ENUM_truth_false = 0x00, |
3772 | P80211ENUM_truth_true = 0x01 | |
91980990 GKH |
3773 | }; |
3774 | ||
3775 | /* Definition from madwifi */ | |
62eb734b | 3776 | struct rt_p80211item_uint32 { |
51126deb BZ |
3777 | u32 did; |
3778 | u16 status; | |
3779 | u16 len; | |
3780 | u32 data; | |
62eb734b | 3781 | }; |
91980990 | 3782 | |
62eb734b | 3783 | struct rt_wlan_ng_prism2_header { |
51126deb BZ |
3784 | u32 msgcode; |
3785 | u32 msglen; | |
91980990 | 3786 | #define WLAN_DEVNAMELEN_MAX 16 |
51126deb | 3787 | u8 devname[WLAN_DEVNAMELEN_MAX]; |
62eb734b BZ |
3788 | struct rt_p80211item_uint32 hosttime; |
3789 | struct rt_p80211item_uint32 mactime; | |
3790 | struct rt_p80211item_uint32 channel; | |
3791 | struct rt_p80211item_uint32 rssi; | |
3792 | struct rt_p80211item_uint32 sq; | |
3793 | struct rt_p80211item_uint32 signal; | |
3794 | struct rt_p80211item_uint32 noise; | |
3795 | struct rt_p80211item_uint32 rate; | |
3796 | struct rt_p80211item_uint32 istx; | |
3797 | struct rt_p80211item_uint32 frmlen; | |
3798 | }; | |
91980990 GKH |
3799 | |
3800 | /* The radio capture header precedes the 802.11 header. */ | |
62eb734b | 3801 | struct PACKED rt_ieee80211_radiotap_header { |
51126deb | 3802 | u8 it_version; /* Version 0. Only increases |
91980990 GKH |
3803 | * for drastic changes, |
3804 | * introduction of compatible | |
3805 | * new fields does not count. | |
3806 | */ | |
51126deb BZ |
3807 | u8 it_pad; |
3808 | u16 it_len; /* length of the whole | |
91980990 GKH |
3809 | * header in bytes, including |
3810 | * it_version, it_pad, | |
3811 | * it_len, and data fields. | |
3812 | */ | |
51126deb | 3813 | u32 it_present; /* A bitmap telling which |
52b81c89 BZ |
3814 | * fields are present. Set bit 31 |
3815 | * (0x80000000) to extend the | |
3816 | * bitmap by another 32 bits. | |
3817 | * Additional extensions are made | |
3818 | * by setting bit 31. | |
3819 | */ | |
62eb734b | 3820 | }; |
91980990 GKH |
3821 | |
3822 | enum ieee80211_radiotap_type { | |
52b81c89 BZ |
3823 | IEEE80211_RADIOTAP_TSFT = 0, |
3824 | IEEE80211_RADIOTAP_FLAGS = 1, | |
3825 | IEEE80211_RADIOTAP_RATE = 2, | |
3826 | IEEE80211_RADIOTAP_CHANNEL = 3, | |
3827 | IEEE80211_RADIOTAP_FHSS = 4, | |
3828 | IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, | |
3829 | IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, | |
3830 | IEEE80211_RADIOTAP_LOCK_QUALITY = 7, | |
3831 | IEEE80211_RADIOTAP_TX_ATTENUATION = 8, | |
3832 | IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, | |
3833 | IEEE80211_RADIOTAP_DBM_TX_POWER = 10, | |
3834 | IEEE80211_RADIOTAP_ANTENNA = 11, | |
3835 | IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, | |
3836 | IEEE80211_RADIOTAP_DB_ANTNOISE = 13 | |
91980990 GKH |
3837 | }; |
3838 | ||
3839 | #define WLAN_RADIOTAP_PRESENT ( \ | |
3840 | (1 << IEEE80211_RADIOTAP_TSFT) | \ | |
3841 | (1 << IEEE80211_RADIOTAP_FLAGS) | \ | |
3842 | (1 << IEEE80211_RADIOTAP_RATE) | \ | |
3843 | 0) | |
3844 | ||
62eb734b BZ |
3845 | struct rt_wlan_radiotap_header { |
3846 | struct rt_ieee80211_radiotap_header wt_ihdr; | |
51126deb BZ |
3847 | long long wt_tsft; |
3848 | u8 wt_flags; | |
3849 | u8 wt_rate; | |
62eb734b | 3850 | }; |
91980990 GKH |
3851 | /* Definition from madwifi */ |
3852 | ||
62eb734b | 3853 | void send_monitor_packets(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk); |
91980990 | 3854 | |
62eb734b | 3855 | void RTMPSetDesiredRates(struct rt_rtmp_adapter *pAdapter, long Rates); |
91980990 | 3856 | |
62eb734b | 3857 | int Set_FixedTxMode_Proc(struct rt_rtmp_adapter *pAd, char *arg); |
91980990 | 3858 | |
52b81c89 | 3859 | BOOLEAN RT28XXChipsetCheck(IN void *_dev_p); |
91980990 | 3860 | |
62eb734b | 3861 | void RT28XXDMADisable(struct rt_rtmp_adapter *pAd); |
91980990 | 3862 | |
62eb734b | 3863 | void RT28XXDMAEnable(struct rt_rtmp_adapter *pAd); |
91980990 | 3864 | |
62eb734b | 3865 | void RT28xx_UpdateBeaconToAsic(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
3866 | int apidx, |
3867 | unsigned long BeaconLen, unsigned long UpdatePos); | |
91980990 | 3868 | |
62eb734b | 3869 | int rt28xx_init(struct rt_rtmp_adapter *pAd, |
51126deb | 3870 | char *pDefaultMac, char *pHostName); |
91980990 | 3871 | |
62eb734b | 3872 | int RtmpNetTaskInit(struct rt_rtmp_adapter *pAd); |
91980990 | 3873 | |
62eb734b | 3874 | void RtmpNetTaskExit(struct rt_rtmp_adapter *pAd); |
ca97b838 | 3875 | |
62eb734b | 3876 | int RtmpMgmtTaskInit(struct rt_rtmp_adapter *pAd); |
ca97b838 | 3877 | |
62eb734b | 3878 | void RtmpMgmtTaskExit(struct rt_rtmp_adapter *pAd); |
91980990 GKH |
3879 | |
3880 | void tbtt_tasklet(unsigned long data); | |
3881 | ||
62eb734b BZ |
3882 | struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd, |
3883 | struct rt_rtmp_os_netdev_op_hook *pNetHook); | |
ca97b838 | 3884 | |
62eb734b | 3885 | BOOLEAN RtmpPhyNetDevExit(struct rt_rtmp_adapter *pAd, struct net_device *net_dev); |
ca97b838 | 3886 | |
62eb734b | 3887 | int RtmpRaDevCtrlInit(struct rt_rtmp_adapter *pAd, IN RTMP_INF_TYPE infType); |
ca97b838 | 3888 | |
62eb734b | 3889 | BOOLEAN RtmpRaDevCtrlExit(struct rt_rtmp_adapter *pAd); |
ca97b838 BZ |
3890 | |
3891 | #ifdef RTMP_MAC_PCI | |
cc277069 BZ |
3892 | /* */ |
3893 | /* Function Prototype in cmm_data_pci.c */ | |
3894 | /* */ | |
62eb734b BZ |
3895 | u16 RtmpPCI_WriteTxResource(struct rt_rtmp_adapter *pAd, |
3896 | struct rt_tx_blk *pTxBlk, | |
fdb2fd14 | 3897 | IN BOOLEAN bIsLast, u16 *FreeNumber); |
52b81c89 | 3898 | |
62eb734b BZ |
3899 | u16 RtmpPCI_WriteSingleTxResource(struct rt_rtmp_adapter *pAd, |
3900 | struct rt_tx_blk *pTxBlk, | |
52b81c89 | 3901 | IN BOOLEAN bIsLast, |
fdb2fd14 | 3902 | u16 *FreeNumber); |
52b81c89 | 3903 | |
62eb734b BZ |
3904 | u16 RtmpPCI_WriteMultiTxResource(struct rt_rtmp_adapter *pAd, |
3905 | struct rt_tx_blk *pTxBlk, | |
fdb2fd14 | 3906 | u8 frameNum, u16 *FreeNumber); |
52b81c89 | 3907 | |
62eb734b BZ |
3908 | u16 RtmpPCI_WriteFragTxResource(struct rt_rtmp_adapter *pAd, |
3909 | struct rt_tx_blk *pTxBlk, | |
fdb2fd14 | 3910 | u8 fragNum, u16 *FreeNumber); |
52b81c89 | 3911 | |
62eb734b BZ |
3912 | u16 RtmpPCI_WriteSubTxResource(struct rt_rtmp_adapter *pAd, |
3913 | struct rt_tx_blk *pTxBlk, | |
fdb2fd14 | 3914 | IN BOOLEAN bIsLast, u16 *FreeNumber); |
52b81c89 | 3915 | |
62eb734b BZ |
3916 | void RtmpPCI_FinalWriteTxResource(struct rt_rtmp_adapter *pAd, |
3917 | struct rt_tx_blk *pTxBlk, | |
51126deb BZ |
3918 | u16 totalMPDUSize, |
3919 | u16 FirstTxIdx); | |
52b81c89 | 3920 | |
62eb734b | 3921 | void RtmpPCIDataLastTxIdx(struct rt_rtmp_adapter *pAd, |
51126deb | 3922 | u8 QueIdx, u16 LastTxIdx); |
52b81c89 | 3923 | |
62eb734b BZ |
3924 | void RtmpPCIDataKickOut(struct rt_rtmp_adapter *pAd, |
3925 | struct rt_tx_blk *pTxBlk, u8 QueIdx); | |
52b81c89 | 3926 | |
62eb734b | 3927 | int RtmpPCIMgmtKickOut(struct rt_rtmp_adapter *pAd, |
51126deb | 3928 | u8 QueIdx, |
8a10a546 | 3929 | void *pPacket, |
51126deb | 3930 | u8 *pSrcBufVA, u32 SrcBufLen); |
52b81c89 | 3931 | |
62eb734b | 3932 | int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, |
fdb2fd14 NM |
3933 | struct rt_header_802_11 *pHeader, |
3934 | struct rt_rxwi *pRxWI, IN PRT28XX_RXD_STRUC pRxD); | |
52b81c89 | 3935 | |
62eb734b | 3936 | BOOLEAN RT28xxPciAsicRadioOff(struct rt_rtmp_adapter *pAd, |
51126deb | 3937 | u8 Level, u16 TbttNumToNextWakeUp); |
52b81c89 | 3938 | |
62eb734b | 3939 | BOOLEAN RT28xxPciAsicRadioOn(struct rt_rtmp_adapter *pAd, u8 Level); |
52b81c89 | 3940 | |
62eb734b | 3941 | void RTMPInitPCIeLinkCtrlValue(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3942 | |
62eb734b | 3943 | void RTMPFindHostPCIDev(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3944 | |
62eb734b | 3945 | void RTMPPCIeLinkCtrlValueRestore(struct rt_rtmp_adapter *pAd, u8 Level); |
52b81c89 | 3946 | |
62eb734b | 3947 | void RTMPPCIeLinkCtrlSetting(struct rt_rtmp_adapter *pAd, u16 Max); |
52b81c89 | 3948 | |
62eb734b | 3949 | void RTMPrt3xSetPCIePowerLinkCtrl(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3950 | |
51126deb BZ |
3951 | void PsPollWakeExec(void *SystemSpecific1, |
3952 | void *FunctionContext, | |
3953 | void *SystemSpecific2, void *SystemSpecific3); | |
52b81c89 | 3954 | |
51126deb BZ |
3955 | void RadioOnExec(void *SystemSpecific1, |
3956 | void *FunctionContext, | |
3957 | void *SystemSpecific2, void *SystemSpecific3); | |
52b81c89 | 3958 | |
62eb734b | 3959 | void RT28xxPciStaAsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx); |
52b81c89 | 3960 | |
62eb734b | 3961 | void RT28xxPciStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd, |
51126deb | 3962 | u16 TbttNumToNextWakeUp); |
52b81c89 | 3963 | |
62eb734b | 3964 | void RT28xxPciMlmeRadioOn(struct rt_rtmp_adapter *pAd); |
52b81c89 | 3965 | |
62eb734b | 3966 | void RT28xxPciMlmeRadioOFF(struct rt_rtmp_adapter *pAd); |
cc277069 | 3967 | #endif /* RTMP_MAC_PCI // */ |
3a32ed12 | 3968 | |
ca97b838 | 3969 | #ifdef RTMP_MAC_USB |
cc277069 BZ |
3970 | /* */ |
3971 | /* Function Prototype in rtusb_bulk.c */ | |
3972 | /* */ | |
62eb734b BZ |
3973 | void RTUSBInitTxDesc(struct rt_rtmp_adapter *pAd, |
3974 | struct rt_tx_context *pTxContext, | |
51126deb | 3975 | u8 BulkOutPipeId, IN usb_complete_t Func); |
3a32ed12 | 3976 | |
62eb734b BZ |
3977 | void RTUSBInitHTTxDesc(struct rt_rtmp_adapter *pAd, |
3978 | struct rt_ht_tx_context *pTxContext, | |
51126deb BZ |
3979 | u8 BulkOutPipeId, |
3980 | unsigned long BulkOutSize, IN usb_complete_t Func); | |
3a32ed12 | 3981 | |
62eb734b | 3982 | void RTUSBInitRxDesc(struct rt_rtmp_adapter *pAd, struct rt_rx_context *pRxContext); |
ca97b838 | 3983 | |
62eb734b | 3984 | void RTUSBCleanUpDataBulkOutQueue(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 3985 | |
62eb734b | 3986 | void RTUSBCancelPendingBulkOutIRP(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 3987 | |
62eb734b | 3988 | void RTUSBBulkOutDataPacket(struct rt_rtmp_adapter *pAd, |
51126deb | 3989 | u8 BulkOutPipeId, u8 Index); |
3a32ed12 | 3990 | |
62eb734b | 3991 | void RTUSBBulkOutNullFrame(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 3992 | |
62eb734b | 3993 | void RTUSBBulkOutRTSFrame(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 3994 | |
62eb734b | 3995 | void RTUSBCancelPendingBulkInIRP(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 3996 | |
62eb734b | 3997 | void RTUSBCancelPendingIRPs(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 3998 | |
62eb734b | 3999 | void RTUSBBulkOutMLMEPacket(struct rt_rtmp_adapter *pAd, u8 Index); |
3a32ed12 | 4000 | |
62eb734b | 4001 | void RTUSBBulkOutPsPoll(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 4002 | |
62eb734b | 4003 | void RTUSBCleanUpMLMEBulkOutQueue(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 4004 | |
62eb734b | 4005 | void RTUSBKickBulkOut(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 4006 | |
62eb734b | 4007 | void RTUSBBulkReceive(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 4008 | |
62eb734b | 4009 | void DoBulkIn(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 4010 | |
62eb734b | 4011 | void RTUSBInitRxDesc(struct rt_rtmp_adapter *pAd, struct rt_rx_context *pRxContext); |
3a32ed12 | 4012 | |
51126deb | 4013 | void RTUSBBulkRxHandle(IN unsigned long data); |
ca97b838 | 4014 | |
cc277069 BZ |
4015 | /* */ |
4016 | /* Function Prototype in rtusb_io.c */ | |
4017 | /* */ | |
62eb734b | 4018 | int RTUSBMultiRead(struct rt_rtmp_adapter *pAd, |
51126deb | 4019 | u16 Offset, u8 *pData, u16 length); |
52b81c89 | 4020 | |
62eb734b | 4021 | int RTUSBMultiWrite(struct rt_rtmp_adapter *pAd, |
8838d256 | 4022 | u16 Offset, const u8 *pData, u16 length); |
52b81c89 | 4023 | |
62eb734b | 4024 | int RTUSBMultiWrite_OneByte(struct rt_rtmp_adapter *pAd, |
8838d256 | 4025 | u16 Offset, const u8 *pData); |
52b81c89 | 4026 | |
62eb734b | 4027 | int RTUSBReadBBPRegister(struct rt_rtmp_adapter *pAd, |
51126deb | 4028 | u8 Id, u8 *pValue); |
52b81c89 | 4029 | |
62eb734b | 4030 | int RTUSBWriteBBPRegister(struct rt_rtmp_adapter *pAd, |
51126deb | 4031 | u8 Id, u8 Value); |
52b81c89 | 4032 | |
62eb734b | 4033 | int RTUSBWriteRFRegister(struct rt_rtmp_adapter *pAd, u32 Value); |
52b81c89 | 4034 | |
62eb734b | 4035 | int RTUSB_VendorRequest(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
4036 | u32 TransferFlags, |
4037 | u8 ReservedBits, | |
4038 | u8 Request, | |
4039 | u16 Value, | |
4040 | u16 Index, | |
4041 | void *TransferBuffer, | |
4042 | u32 TransferBufferLength); | |
52b81c89 | 4043 | |
62eb734b | 4044 | int RTUSBReadEEPROM(struct rt_rtmp_adapter *pAd, |
51126deb | 4045 | u16 Offset, u8 *pData, u16 length); |
52b81c89 | 4046 | |
62eb734b | 4047 | int RTUSBWriteEEPROM(struct rt_rtmp_adapter *pAd, |
51126deb | 4048 | u16 Offset, u8 *pData, u16 length); |
52b81c89 | 4049 | |
62eb734b | 4050 | void RTUSBPutToSleep(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4051 | |
62eb734b | 4052 | int RTUSBWakeUp(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4053 | |
62eb734b | 4054 | void RTUSBInitializeCmdQ(struct rt_cmdq *cmdq); |
52b81c89 | 4055 | |
62eb734b | 4056 | int RTUSBEnqueueCmdFromNdis(struct rt_rtmp_adapter *pAd, |
52b81c89 BZ |
4057 | IN NDIS_OID Oid, |
4058 | IN BOOLEAN SetInformation, | |
51126deb BZ |
4059 | void *pInformationBuffer, |
4060 | u32 InformationBufferLength); | |
52b81c89 | 4061 | |
62eb734b | 4062 | int RTUSBEnqueueInternalCmd(struct rt_rtmp_adapter *pAd, |
52b81c89 | 4063 | IN NDIS_OID Oid, |
51126deb BZ |
4064 | void *pInformationBuffer, |
4065 | u32 InformationBufferLength); | |
52b81c89 | 4066 | |
62eb734b | 4067 | void RTUSBDequeueCmd(struct rt_cmdq *cmdq, struct rt_cmdqelmt * * pcmdqelmt); |
52b81c89 | 4068 | |
51126deb | 4069 | int RTUSBCmdThread(IN void *Context); |
52b81c89 | 4070 | |
62eb734b | 4071 | void RTUSBBssBeaconExit(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4072 | |
62eb734b | 4073 | void RTUSBBssBeaconStop(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4074 | |
62eb734b | 4075 | void RTUSBBssBeaconStart(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4076 | |
62eb734b | 4077 | void RTUSBBssBeaconInit(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4078 | |
62eb734b | 4079 | void RTUSBWatchDog(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4080 | |
62eb734b | 4081 | int RTUSBWriteMACRegister(struct rt_rtmp_adapter *pAd, |
51126deb | 4082 | u16 Offset, u32 Value); |
52b81c89 | 4083 | |
62eb734b | 4084 | int RTUSBReadMACRegister(struct rt_rtmp_adapter *pAd, |
51126deb | 4085 | u16 Offset, u32 *pValue); |
52b81c89 | 4086 | |
62eb734b | 4087 | int RTUSBSingleWrite(struct rt_rtmp_adapter *pAd, |
51126deb | 4088 | u16 Offset, u16 Value); |
52b81c89 | 4089 | |
62eb734b | 4090 | int RTUSBFirmwareWrite(struct rt_rtmp_adapter *pAd, |
8838d256 | 4091 | const u8 *pFwImage, unsigned long FwLen); |
52b81c89 | 4092 | |
62eb734b | 4093 | int RTUSBVenderReset(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4094 | |
62eb734b | 4095 | int RTUSBSetHardWareRegister(struct rt_rtmp_adapter *pAdapter, void *pBuf); |
3a32ed12 | 4096 | |
62eb734b | 4097 | int RTUSBQueryHardWareRegister(struct rt_rtmp_adapter *pAdapter, |
51126deb | 4098 | void *pBuf); |
3a32ed12 | 4099 | |
62eb734b | 4100 | void CMDHandler(struct rt_rtmp_adapter *pAd); |
ca97b838 | 4101 | |
62eb734b | 4102 | int RTUSBWriteHWMACAddress(struct rt_rtmp_adapter *pAdapter); |
ca97b838 | 4103 | |
62eb734b | 4104 | void MacTableInitialize(struct rt_rtmp_adapter *pAd); |
3a32ed12 | 4105 | |
62eb734b | 4106 | void MlmeSetPsm(struct rt_rtmp_adapter *pAd, u16 psm); |
ca97b838 | 4107 | |
62eb734b | 4108 | int RTMPWPAAddKeyProc(struct rt_rtmp_adapter *pAd, void *pBuf); |
52b81c89 | 4109 | |
62eb734b | 4110 | void AsicRxAntEvalAction(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4111 | |
62eb734b | 4112 | void append_pkt(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
4113 | u8 *pHeader802_3, |
4114 | u32 HdrLen, | |
4115 | u8 *pData, | |
fdb2fd14 | 4116 | unsigned long DataSize, void **ppPacket); |
52b81c89 | 4117 | |
62eb734b | 4118 | u32 deaggregate_AMSDU_announce(struct rt_rtmp_adapter *pAd, |
8a10a546 | 4119 | void *pPacket, |
51126deb | 4120 | u8 *pData, unsigned long DataSize); |
52b81c89 | 4121 | |
62eb734b | 4122 | int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, |
fdb2fd14 NM |
4123 | struct rt_header_802_11 *pHeader, |
4124 | struct rt_rxwi *pRxWI, | |
52b81c89 BZ |
4125 | IN PRT28XX_RXD_STRUC pRxINFO); |
4126 | ||
62eb734b | 4127 | void RTUSBMlmeHardTransmit(struct rt_rtmp_adapter *pAd, struct rt_mgmt *pMgmt); |
52b81c89 | 4128 | |
51126deb | 4129 | int MlmeThread(void *Context); |
3a32ed12 | 4130 | |
cc277069 BZ |
4131 | /* */ |
4132 | /* Function Prototype in rtusb_data.c */ | |
4133 | /* */ | |
62eb734b | 4134 | int RTUSBFreeDescriptorRequest(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
4135 | u8 BulkOutPipeId, |
4136 | u32 NumberRequired); | |
3a32ed12 | 4137 | |
62eb734b | 4138 | BOOLEAN RTUSBNeedQueueBackForAgg(struct rt_rtmp_adapter *pAd, u8 BulkOutPipeId); |
3a32ed12 | 4139 | |
62eb734b BZ |
4140 | void RTMPWriteTxInfo(struct rt_rtmp_adapter *pAd, |
4141 | struct rt_txinfo *pTxInfo, | |
51126deb | 4142 | u16 USBDMApktLen, |
52b81c89 | 4143 | IN BOOLEAN bWiv, |
51126deb | 4144 | u8 QueueSel, u8 NextValid, u8 TxBurst); |
3a32ed12 | 4145 | |
cc277069 BZ |
4146 | /* */ |
4147 | /* Function Prototype in cmm_data_usb.c */ | |
4148 | /* */ | |
62eb734b BZ |
4149 | u16 RtmpUSB_WriteSubTxResource(struct rt_rtmp_adapter *pAd, |
4150 | struct rt_tx_blk *pTxBlk, | |
fdb2fd14 | 4151 | IN BOOLEAN bIsLast, u16 *FreeNumber); |
52b81c89 | 4152 | |
62eb734b BZ |
4153 | u16 RtmpUSB_WriteSingleTxResource(struct rt_rtmp_adapter *pAd, |
4154 | struct rt_tx_blk *pTxBlk, | |
52b81c89 | 4155 | IN BOOLEAN bIsLast, |
fdb2fd14 | 4156 | u16 *FreeNumber); |
52b81c89 | 4157 | |
62eb734b BZ |
4158 | u16 RtmpUSB_WriteFragTxResource(struct rt_rtmp_adapter *pAd, |
4159 | struct rt_tx_blk *pTxBlk, | |
fdb2fd14 | 4160 | u8 fragNum, u16 *FreeNumber); |
52b81c89 | 4161 | |
62eb734b BZ |
4162 | u16 RtmpUSB_WriteMultiTxResource(struct rt_rtmp_adapter *pAd, |
4163 | struct rt_tx_blk *pTxBlk, | |
fdb2fd14 | 4164 | u8 frameNum, u16 *FreeNumber); |
52b81c89 | 4165 | |
62eb734b BZ |
4166 | void RtmpUSB_FinalWriteTxResource(struct rt_rtmp_adapter *pAd, |
4167 | struct rt_tx_blk *pTxBlk, | |
51126deb | 4168 | u16 totalMPDUSize, u16 TxIdx); |
52b81c89 | 4169 | |
62eb734b | 4170 | void RtmpUSBDataLastTxIdx(struct rt_rtmp_adapter *pAd, |
51126deb | 4171 | u8 QueIdx, u16 TxIdx); |
52b81c89 | 4172 | |
62eb734b BZ |
4173 | void RtmpUSBDataKickOut(struct rt_rtmp_adapter *pAd, |
4174 | struct rt_tx_blk *pTxBlk, u8 QueIdx); | |
ca97b838 | 4175 | |
62eb734b | 4176 | int RtmpUSBMgmtKickOut(struct rt_rtmp_adapter *pAd, |
51126deb | 4177 | u8 QueIdx, |
8a10a546 | 4178 | void *pPacket, |
51126deb | 4179 | u8 *pSrcBufVA, u32 SrcBufLen); |
ca97b838 | 4180 | |
62eb734b | 4181 | void RtmpUSBNullFrameKickOut(struct rt_rtmp_adapter *pAd, |
51126deb | 4182 | u8 QueIdx, |
fdb2fd14 | 4183 | u8 *pNullFrame, u32 frameLen); |
ca97b838 | 4184 | |
51126deb BZ |
4185 | void RtmpUsbStaAsicForceWakeupTimeout(void *SystemSpecific1, |
4186 | void *FunctionContext, | |
4187 | void *SystemSpecific2, | |
4188 | void *SystemSpecific3); | |
ca97b838 | 4189 | |
62eb734b | 4190 | void RT28xxUsbStaAsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx); |
52b81c89 | 4191 | |
62eb734b | 4192 | void RT28xxUsbStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd, |
51126deb | 4193 | u16 TbttNumToNextWakeUp); |
52b81c89 | 4194 | |
62eb734b | 4195 | void RT28xxUsbMlmeRadioOn(struct rt_rtmp_adapter *pAd); |
52b81c89 | 4196 | |
62eb734b | 4197 | void RT28xxUsbMlmeRadioOFF(struct rt_rtmp_adapter *pAd); |
cc277069 | 4198 | #endif /* RTMP_MAC_USB // */ |
52b81c89 | 4199 | |
62eb734b | 4200 | void AsicTurnOffRFClk(struct rt_rtmp_adapter *pAd, u8 Channel); |
52b81c89 | 4201 | |
62eb734b | 4202 | void AsicTurnOnRFClk(struct rt_rtmp_adapter *pAd, u8 Channel); |
ca97b838 BZ |
4203 | |
4204 | #ifdef RTMP_TIMER_TASK_SUPPORT | |
51126deb | 4205 | int RtmpTimerQThread(IN void *Context); |
ca97b838 | 4206 | |
62eb734b BZ |
4207 | struct rt_rtmp_timer_task_entry *RtmpTimerQInsert(struct rt_rtmp_adapter *pAd, |
4208 | struct rt_ralink_timer *pTimer); | |
ca97b838 | 4209 | |
62eb734b BZ |
4210 | BOOLEAN RtmpTimerQRemove(struct rt_rtmp_adapter *pAd, |
4211 | struct rt_ralink_timer *pTimer); | |
ca97b838 | 4212 | |
62eb734b | 4213 | void RtmpTimerQExit(struct rt_rtmp_adapter *pAd); |
ca97b838 | 4214 | |
62eb734b | 4215 | void RtmpTimerQInit(struct rt_rtmp_adapter *pAd); |
cc277069 | 4216 | #endif /* RTMP_TIMER_TASK_SUPPORT // */ |
91980990 | 4217 | |
62eb734b | 4218 | void AsicStaBbpTuning(struct rt_rtmp_adapter *pAd); |
ed291e80 | 4219 | |
62eb734b BZ |
4220 | BOOLEAN StaAddMacTableEntry(struct rt_rtmp_adapter *pAd, |
4221 | struct rt_mac_table_entry *pEntry, | |
51126deb | 4222 | u8 MaxSupportedRateIn500Kbps, |
fdb2fd14 | 4223 | struct rt_ht_capability_ie *pHtCapability, |
51126deb | 4224 | u8 HtCapabilityLen, |
fdb2fd14 | 4225 | struct rt_add_ht_info_ie *pAddHtInfo, |
51126deb | 4226 | u8 AddHtInfoLen, u16 CapabilityInfo); |
ca97b838 | 4227 | |
62eb734b BZ |
4228 | BOOLEAN AUTH_ReqSend(struct rt_rtmp_adapter *pAd, |
4229 | struct rt_mlme_queue_elem *pElem, | |
4230 | struct rt_ralink_timer *pAuthTimer, | |
51126deb BZ |
4231 | char *pSMName, |
4232 | u16 SeqNo, | |
4233 | u8 *pNewElement, unsigned long ElementLen); | |
ca97b838 | 4234 | |
62eb734b | 4235 | void RTMP_IndicateMediaState(struct rt_rtmp_adapter *pAd); |
91980990 | 4236 | |
62eb734b | 4237 | void ReSyncBeaconTime(struct rt_rtmp_adapter *pAd); |
91980990 | 4238 | |
62eb734b | 4239 | void RTMPSetAGCInitValue(struct rt_rtmp_adapter *pAd, u8 BandWidth); |
91980990 | 4240 | |
8a10a546 BZ |
4241 | int rt28xx_close(struct net_device *dev); |
4242 | int rt28xx_open(struct net_device *dev); | |
91980990 | 4243 | |
ca97b838 BZ |
4244 | #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++) |
4245 | #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--) | |
4246 | #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt) | |
4247 | ||
ca97b838 | 4248 | #ifdef LINUX |
62eb734b | 4249 | __inline int VIRTUAL_IF_UP(struct rt_rtmp_adapter *pAd) |
91980990 | 4250 | { |
52b81c89 BZ |
4251 | if (VIRTUAL_IF_NUM(pAd) == 0) { |
4252 | if (rt28xx_open(pAd->net_dev) != 0) { | |
4253 | DBGPRINT(RT_DEBUG_TRACE, | |
4254 | ("rt28xx_open return fail!\n")); | |
91980990 | 4255 | return -1; |
52b81c89 BZ |
4256 | } |
4257 | } else { | |
91980990 GKH |
4258 | } |
4259 | VIRTUAL_IF_INC(pAd); | |
4260 | return 0; | |
4261 | } | |
4262 | ||
62eb734b | 4263 | __inline void VIRTUAL_IF_DOWN(struct rt_rtmp_adapter *pAd) |
91980990 GKH |
4264 | { |
4265 | VIRTUAL_IF_DEC(pAd); | |
4266 | if (VIRTUAL_IF_NUM(pAd) == 0) | |
4267 | rt28xx_close(pAd->net_dev); | |
4268 | return; | |
4269 | } | |
cc277069 | 4270 | #endif /* LINUX // */ |
ca97b838 | 4271 | |
ca97b838 BZ |
4272 | /* |
4273 | OS Related funciton prototype definitions. | |
4274 | TODO: Maybe we need to move these function prototypes to other proper place. | |
4275 | */ | |
62eb734b | 4276 | int RtmpOSWrielessEventSend(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
4277 | u32 eventType, |
4278 | int flags, | |
4279 | u8 *pSrcMac, | |
4280 | u8 *pData, u32 dataLen); | |
ca97b838 | 4281 | |
8a10a546 | 4282 | int RtmpOSNetDevAddrSet(struct net_device *pNetDev, u8 *pMacAddr); |
ca97b838 | 4283 | |
8a10a546 | 4284 | int RtmpOSNetDevAttach(struct net_device *pNetDev, |
62eb734b | 4285 | struct rt_rtmp_os_netdev_op_hook *pDevOpHook); |
ca97b838 | 4286 | |
8a10a546 | 4287 | void RtmpOSNetDevClose(struct net_device *pNetDev); |
ca97b838 | 4288 | |
8a10a546 | 4289 | void RtmpOSNetDevDetach(struct net_device *pNetDev); |
ca97b838 | 4290 | |
fdb2fd14 | 4291 | int RtmpOSNetDevAlloc(struct net_device **pNewNetDev, u32 privDataSize); |
ca97b838 | 4292 | |
8a10a546 | 4293 | void RtmpOSNetDevFree(struct net_device *pNetDev); |
ca97b838 | 4294 | |
8a10a546 | 4295 | struct net_device *RtmpOSNetDevGetByName(struct net_device *pNetDev, char *pDevName); |
ca97b838 | 4296 | |
8a10a546 | 4297 | void RtmpOSNetDeviceRefPut(struct net_device *pNetDev); |
ca97b838 | 4298 | |
62eb734b | 4299 | struct net_device *RtmpOSNetDevCreate(struct rt_rtmp_adapter *pAd, |
51126deb BZ |
4300 | int devType, |
4301 | int devNum, | |
4302 | int privMemSize, char *pNamePrefix); | |
ca97b838 BZ |
4303 | |
4304 | /* | |
4305 | Task operation related function prototypes | |
4306 | */ | |
62eb734b | 4307 | void RtmpOSTaskCustomize(struct rt_rtmp_os_task *pTask); |
ca97b838 | 4308 | |
62eb734b | 4309 | int RtmpOSTaskNotifyToExit(struct rt_rtmp_os_task *pTask); |
ca97b838 | 4310 | |
62eb734b | 4311 | int RtmpOSTaskKill(struct rt_rtmp_os_task *pTask); |
ca97b838 | 4312 | |
62eb734b | 4313 | int RtmpOSTaskInit(struct rt_rtmp_os_task *pTask, |
51126deb | 4314 | char *pTaskName, void * pPriv); |
ca97b838 | 4315 | |
62eb734b | 4316 | int RtmpOSTaskAttach(struct rt_rtmp_os_task *pTask, |
52b81c89 | 4317 | IN int (*fn) (void *), IN void *arg); |
ca97b838 BZ |
4318 | |
4319 | /* | |
4320 | File operation related function prototypes | |
4321 | */ | |
8a10a546 | 4322 | struct file *RtmpOSFileOpen(IN char *pPath, IN int flag, IN int mode); |
ca97b838 | 4323 | |
8a10a546 | 4324 | int RtmpOSFileClose(struct file *osfd); |
ca97b838 | 4325 | |
8a10a546 | 4326 | void RtmpOSFileSeek(struct file *osfd, IN int offset); |
ca97b838 | 4327 | |
8a10a546 | 4328 | int RtmpOSFileRead(struct file *osfd, IN char *pDataPtr, IN int readLen); |
ca97b838 | 4329 | |
8a10a546 | 4330 | int RtmpOSFileWrite(struct file *osfd, IN char *pDataPtr, IN int writeLen); |
91980990 | 4331 | |
cc277069 | 4332 | #endif /* __RTMP_H__ */ |