2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
31 Miniport generic portion header file
35 -------- ---------- ----------------------------------------------
36 Paul Lin 08-01-2002 created
37 James Tan 09-06-2002 modified (Revise NTCRegTable)
38 John Chang 12-22-2004 modified for RT2561/2661. merge with STA driver
44 // =============================================================
45 // Function Prototypes
46 // =============================================================
50 BOOLEAN
APBridgeToWirelessSta(
60 IN NDIS_HANDLE MiniportAdapterContext
,
61 IN PPNDIS_PACKET ppPacketArray
,
62 IN UINT NumberOfPackets
);
64 NDIS_STATUS
APSendPacket(
66 IN PNDIS_PACKET pPacket
);
69 NDIS_STATUS
APHardTransmit(
74 VOID
APRxEAPOLFrameIndicate(
76 IN MAC_TABLE_ENTRY
*pEntry
,
78 IN UCHAR FromWhichBSSID
);
80 NDIS_STATUS
APCheckRxError(
82 IN PRT28XX_RXD_STRUC pRxD
,
85 BOOLEAN
APCheckClass2Class3Error(
88 IN PHEADER_802_11 pHeader
);
90 VOID
APHandleRxPsPoll(
96 VOID
RTMPDescriptorEndianChange(
98 IN ULONG DescriptorType
);
100 VOID
RTMPFrameEndianChange(
101 IN PRTMP_ADAPTER pAd
,
104 IN BOOLEAN FromRxDoneInt
);
108 VOID
APAssocStateMachineInit(
109 IN PRTMP_ADAPTER pAd
,
111 OUT STATE_MACHINE_FUNC Trans
[]);
113 VOID
APPeerAssocReqAction(
114 IN PRTMP_ADAPTER pAd
,
115 IN MLME_QUEUE_ELEM
*Elem
);
117 VOID
APPeerReassocReqAction(
118 IN PRTMP_ADAPTER pAd
,
119 IN MLME_QUEUE_ELEM
*Elem
);
121 VOID
APPeerDisassocReqAction(
122 IN PRTMP_ADAPTER pAd
,
123 IN MLME_QUEUE_ELEM
*Elem
);
125 VOID
MbssKickOutStas(
126 IN PRTMP_ADAPTER pAd
,
130 VOID
APMlmeKickOutSta(
131 IN PRTMP_ADAPTER pAd
,
136 VOID
APMlmeDisassocReqAction(
137 IN PRTMP_ADAPTER pAd
,
138 IN MLME_QUEUE_ELEM
*Elem
);
140 VOID
APCls3errAction(
141 IN PRTMP_ADAPTER pAd
,
143 IN PHEADER_802_11 pHeader
);
146 USHORT
APBuildAssociation(
147 IN PRTMP_ADAPTER pAd
,
148 IN MAC_TABLE_ENTRY
*pEntry
,
149 IN USHORT CapabilityInfo
,
150 IN UCHAR MaxSupportedRateIn500Kbps
,
153 IN BOOLEAN bWmmCapable
,
156 IN EXT_CAP_INFO_ELEMENT ExtCapInfo
,
157 #endif // DOT11N_DRAFT3 //
158 IN HT_CAPABILITY_IE
*pHtCapability
,
159 IN UCHAR HtCapabilityLen
,
163 VOID RTMPAddClientSec(
164 IN PRTMP_ADAPTER pAd,
171 IN MAC_TABLE_ENTRY *pEntry);
176 void APAuthStateMachineInit(
177 IN PRTMP_ADAPTER pAd
,
178 IN STATE_MACHINE
*Sm
,
179 OUT STATE_MACHINE_FUNC Trans
[]);
181 VOID
APCls2errAction(
182 IN PRTMP_ADAPTER pAd
,
184 IN PHEADER_802_11 pHeader
);
189 VOID
APMakeBssBeacon(
190 IN PRTMP_ADAPTER pAd
,
193 VOID
APUpdateBeaconFrame(
194 IN PRTMP_ADAPTER pAd
,
197 VOID
APMakeAllBssBeacon(
198 IN PRTMP_ADAPTER pAd
);
200 VOID
APUpdateAllBeaconFrame(
201 IN PRTMP_ADAPTER pAd
);
206 VOID
APSyncStateMachineInit(
207 IN PRTMP_ADAPTER pAd
,
208 IN STATE_MACHINE
*Sm
,
209 OUT STATE_MACHINE_FUNC Trans
[]);
212 IN PVOID SystemSpecific1
,
213 IN PVOID FunctionContext
,
214 IN PVOID SystemSpecific2
,
215 IN PVOID SystemSpecific3
);
217 VOID
APInvalidStateWhenScan(
218 IN PRTMP_ADAPTER pAd
,
219 IN MLME_QUEUE_ELEM
*Elem
);
221 VOID
APScanTimeoutAction(
222 IN PRTMP_ADAPTER pAd
,
223 IN MLME_QUEUE_ELEM
*Elem
);
225 VOID
APPeerProbeReqAction(
226 IN PRTMP_ADAPTER pAd
,
227 IN MLME_QUEUE_ELEM
*Elem
);
229 VOID
APPeerBeaconAction(
230 IN PRTMP_ADAPTER pAd
,
231 IN MLME_QUEUE_ELEM
*Elem
);
233 VOID
APMlmeScanReqAction(
234 IN PRTMP_ADAPTER pAd
,
235 IN MLME_QUEUE_ELEM
*Elem
);
237 VOID
APPeerBeaconAtScanAction(
238 IN PRTMP_ADAPTER pAd
,
239 IN MLME_QUEUE_ELEM
*Elem
);
241 VOID
APScanCnclAction(
242 IN PRTMP_ADAPTER pAd
,
243 IN MLME_QUEUE_ELEM
*Elem
);
246 IN PRTMP_ADAPTER pAd
,
247 IN PNDIS_802_11_SSID pSsid
,
257 OUT PUCHAR pMaxSupportRate
);
260 BOOLEAN
ApScanRunning(
261 IN PRTMP_ADAPTER pAd
);
264 VOID
APOverlappingBSSScan(
265 IN RTMP_ADAPTER
*pAd
);
266 #endif // DOT11N_DRAFT3 //
269 VOID
WpaStateMachineInit(
270 IN PRTMP_ADAPTER pAd
,
271 IN STATE_MACHINE
*Sm
,
272 OUT STATE_MACHINE_FUNC Trans
[]);
275 VOID
APMlmePeriodicExec(
276 IN PRTMP_ADAPTER pAd
);
278 VOID
APMlmeSelectTxRateTable(
279 IN PRTMP_ADAPTER pAd
,
280 IN PMAC_TABLE_ENTRY pEntry
,
282 IN PUCHAR pTableSize
,
283 IN PUCHAR pInitTxRateIdx
);
285 VOID
APMlmeSetTxRate(
286 IN PRTMP_ADAPTER pAd
,
287 IN PMAC_TABLE_ENTRY pEntry
,
288 IN PRTMP_TX_RATE_SWITCH pTxRate
);
290 VOID
APMlmeDynamicTxRateSwitching(
291 IN PRTMP_ADAPTER pAd
);
293 VOID
APQuickResponeForRateUpExec(
294 IN PVOID SystemSpecific1
,
295 IN PVOID FunctionContext
,
296 IN PVOID SystemSpecific2
,
297 IN PVOID SystemSpecific3
);
299 BOOLEAN
APMsgTypeSubst(
300 IN PRTMP_ADAPTER pAd
,
301 IN PFRAME_802_11 pFrame
,
305 VOID
APQuickResponeForRateUpExec(
306 IN PVOID SystemSpecific1
,
307 IN PVOID FunctionContext
,
308 IN PVOID SystemSpecific2
,
309 IN PVOID SystemSpecific3
);
312 VOID
RTMPSetPiggyBack(
313 IN PRTMP_ADAPTER pAd
,
314 IN BOOLEAN bPiggyBack
);
316 VOID
APAsicEvaluateRxAnt(
317 IN PRTMP_ADAPTER pAd
);
319 VOID
APAsicRxAntEvalTimeout(
320 IN PRTMP_ADAPTER pAd
);
324 VOID
APSwitchChannel(
325 IN PRTMP_ADAPTER pAd
,
328 NDIS_STATUS
APInitialize(
329 IN PRTMP_ADAPTER pAd
);
332 IN PRTMP_ADAPTER pAd
);
335 IN PRTMP_ADAPTER pAd
);
338 IN PRTMP_ADAPTER pAd
);
340 VOID
APCleanupPsQueue(
341 IN PRTMP_ADAPTER pAd
,
342 IN PQUEUE_HEADER pQueue
);
345 IN PRTMP_ADAPTER pAd
);
347 MAC_TABLE_ENTRY
*MacTableInsertEntry(
348 IN PRTMP_ADAPTER pAd
,
351 IN BOOLEAN CleanAll
);
353 BOOLEAN
MacTableDeleteEntry(
354 IN PRTMP_ADAPTER pAd
,
358 MAC_TABLE_ENTRY
*MacTableLookup(
359 IN PRTMP_ADAPTER pAd
,
362 VOID
MacTableMaintenance(
363 IN PRTMP_ADAPTER pAd
);
365 UINT32
MacTableAssocStaNumGet(
366 IN PRTMP_ADAPTER pAd
);
368 MAC_TABLE_ENTRY
*APSsPsInquiry(
369 IN PRTMP_ADAPTER pAd
,
376 BOOLEAN
APPsIndicate(
377 IN PRTMP_ADAPTER pAd
,
383 IN PRTMP_ADAPTER pAd
,
387 #ifdef DOT11_N_SUPPORT
388 VOID
APUpdateOperationMode(
389 IN PRTMP_ADAPTER pAd
);
390 #endif // DOT11_N_SUPPORT //
392 VOID
APUpdateCapabilityAndErpIe(
393 IN PRTMP_ADAPTER pAd
);
395 BOOLEAN
ApCheckAccessControlList(
396 IN PRTMP_ADAPTER pAd
,
400 VOID
ApUpdateAccessControlList(
401 IN PRTMP_ADAPTER pAd
,
404 VOID
ApEnqueueNullFrame(
405 IN PRTMP_ADAPTER pAd
,
415 IN PRTMP_ADAPTER pAd
,
421 VOID
ApEnqueueAckFrame(
422 IN PRTMP_ADAPTER pAd
,
430 BOOLEAN
PeerAssocReqCmmSanity(
431 IN PRTMP_ADAPTER pAd
,
436 OUT USHORT
*pCapabilityInfo
,
437 OUT USHORT
*pListenInterval
,
441 OUT UCHAR
*pRatesLen
,
445 OUT BOOLEAN
*pbWmmCapable
,
446 OUT ULONG
*pRalinkIe
,
448 OUT EXT_CAP_INFO_ELEMENT
*pExtCapInfo
,
449 #endif // DOT11N_DRAFT3 //
450 OUT UCHAR
*pHtCapabilityLen
,
451 OUT HT_CAPABILITY_IE
*pHtCapability
);
454 BOOLEAN
PeerDisassocReqSanity(
455 IN PRTMP_ADAPTER pAd
,
461 BOOLEAN
PeerDeauthReqSanity(
462 IN PRTMP_ADAPTER pAd
,
468 BOOLEAN
APPeerAuthSanity(
469 IN PRTMP_ADAPTER pAd
,
480 BOOLEAN
APPeerProbeReqSanity(
481 IN PRTMP_ADAPTER pAd
,
488 BOOLEAN
APPeerBeaconAndProbeRspSanity(
489 IN PRTMP_ADAPTER pAd
,
497 OUT USHORT
*BeaconPeriod
,
499 OUT LARGE_INTEGER
*Timestamp
,
500 OUT USHORT
*CapabilityInfo
,
503 OUT BOOLEAN
*ExtendedRateIeExist
,
505 #if defined(RT30xx) || defined(RT305x)
507 IN PRTMP_ADAPTER pAd
);
509 VOID
DisableAPMIMOPS(
510 IN PRTMP_ADAPTER pAd
);