jbd: Fix a race between checkpointing code and journal_get_write_access()
[linux/fpc-iii.git] / drivers / staging / vt6655 / wmgr.h
blob5b526ab2d912c0adb099c611bc54a32bc8815a37
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * File: wmgr.h
22 * Purpose:
24 * Author: lyndon chen
26 * Date: Jan 2, 2003
28 * Functions:
30 * Revision History:
35 #ifndef __WMGR_H__
36 #define __WMGR_H__
38 #if !defined(__TTYPE_H__)
39 #include "ttype.h"
40 #endif
41 #if !defined(__80211MGR_H__)
42 #include "80211mgr.h"
43 #endif
44 #if !defined(__80211HDR_H__)
45 #include "80211hdr.h"
46 #endif
47 #if !defined(__WCMD_H__)
48 #include "wcmd.h"
49 #endif
50 #if !defined(__BSSDB_H__)
51 #include "bssdb.h"
52 #endif
53 #if !defined(__CARD_H__)
54 #include "card.h"
55 #endif
56 #if !defined(__WPA2_H__)
57 #include "wpa2.h"
58 #endif
59 #if !defined(__VNTWIFI_H__)
60 #include "vntwifi.h"
61 #endif
65 /*--------------------- Export Definitions -------------------------*/
69 // Scan time
70 #define PROBE_DELAY 100 // (us)
71 #define SWITCH_CHANNEL_DELAY 200 // (us)
72 #define WLAN_SCAN_MINITIME 25 // (ms)
73 #define WLAN_SCAN_MAXTIME 100 // (ms)
74 #define TRIVIAL_SYNC_DIFFERENCE 0 // (us)
75 #define DEFAULT_IBSS_BI 100 // (ms)
77 #define WCMD_ACTIVE_SCAN_TIME 50 //(ms)
78 #define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
81 #define DEFAULT_MSDU_LIFETIME 512 // ms
82 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
84 #define DEFAULT_MGN_LIFETIME 8 // ms
85 #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
87 #define MAKE_BEACON_RESERVED 10 //(us)
90 #define TIM_MULTICAST_MASK 0x01
91 #define TIM_BITMAPOFFSET_MASK 0xFE
92 #define DEFAULT_DTIM_PERIOD 1
94 #define AP_LONG_RETRY_LIMIT 4
96 #define DEFAULT_IBSS_CHANNEL 6 //2.4G
99 /*--------------------- Export Classes ----------------------------*/
101 /*--------------------- Export Variables --------------------------*/
103 /*--------------------- Export Types ------------------------------*/
104 #define timer_expire(timer,next_tick) mod_timer(&timer, RUN_AT(next_tick))
105 typedef void (*TimerFunction)(ULONG);
108 //+++ NDIS related
110 typedef UCHAR NDIS_802_11_MAC_ADDRESS[6];
111 typedef struct _NDIS_802_11_AI_REQFI
113 USHORT Capabilities;
114 USHORT ListenInterval;
115 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
116 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
118 typedef struct _NDIS_802_11_AI_RESFI
120 USHORT Capabilities;
121 USHORT StatusCode;
122 USHORT AssociationId;
123 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
125 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
127 ULONG Length;
128 USHORT AvailableRequestFixedIEs;
129 NDIS_802_11_AI_REQFI RequestFixedIEs;
130 ULONG RequestIELength;
131 ULONG OffsetRequestIEs;
132 USHORT AvailableResponseFixedIEs;
133 NDIS_802_11_AI_RESFI ResponseFixedIEs;
134 ULONG ResponseIELength;
135 ULONG OffsetResponseIEs;
136 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
140 typedef struct tagSAssocInfo {
141 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
142 BYTE abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
143 // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
144 ULONG RequestIELength;
145 BYTE abyReqIEs[WLAN_BEACON_FR_MAXLEN];
146 } SAssocInfo, DEF* PSAssocInfo;
147 //---
151 typedef enum tagWMAC_AUTHENTICATION_MODE {
154 WMAC_AUTH_OPEN,
155 WMAC_AUTH_SHAREKEY,
156 WMAC_AUTH_AUTO,
157 WMAC_AUTH_WPA,
158 WMAC_AUTH_WPAPSK,
159 WMAC_AUTH_WPANONE,
160 WMAC_AUTH_WPA2,
161 WMAC_AUTH_WPA2PSK,
162 WMAC_AUTH_MAX // Not a real mode, defined as upper bound
165 } WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
169 // Pre-configured Mode (from XP)
171 typedef enum tagWMAC_CONFIG_MODE {
172 WMAC_CONFIG_ESS_STA,
173 WMAC_CONFIG_IBSS_STA,
174 WMAC_CONFIG_AUTO,
175 WMAC_CONFIG_AP
177 } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
180 typedef enum tagWMAC_SCAN_TYPE {
182 WMAC_SCAN_ACTIVE,
183 WMAC_SCAN_PASSIVE,
184 WMAC_SCAN_HYBRID
186 } WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE;
189 typedef enum tagWMAC_SCAN_STATE {
191 WMAC_NO_SCANNING,
192 WMAC_IS_SCANNING,
193 WMAC_IS_PROBEPENDING
195 } WMAC_SCAN_STATE, *PWMAC_SCAN_STATE;
199 // Notes:
200 // Basic Service Set state explained as following:
201 // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
202 // WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
203 // WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
204 // WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
205 // WMAC_STATE_AUTH : Authenticated (Infra)
206 // WMAC_STATE_ASSOCPENDING : Association pending (Infra)
207 // WMAC_STATE_ASSOC : Associated (Infra)
209 typedef enum tagWMAC_BSS_STATE {
211 WMAC_STATE_IDLE,
212 WMAC_STATE_STARTED,
213 WMAC_STATE_JOINTED,
214 WMAC_STATE_AUTHPENDING,
215 WMAC_STATE_AUTH,
216 WMAC_STATE_ASSOCPENDING,
217 WMAC_STATE_ASSOC
219 } WMAC_BSS_STATE, *PWMAC_BSS_STATE;
221 // WMAC selected running mode
222 typedef enum tagWMAC_CURRENT_MODE {
224 WMAC_MODE_STANDBY,
225 WMAC_MODE_ESS_STA,
226 WMAC_MODE_IBSS_STA,
227 WMAC_MODE_ESS_AP
229 } WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE;
232 typedef enum tagWMAC_POWER_MODE {
234 WMAC_POWER_CAM,
235 WMAC_POWER_FAST,
236 WMAC_POWER_MAX
238 } WMAC_POWER_MODE, *PWMAC_POWER_MODE;
242 // Tx Managment Packet descriptor
243 typedef struct tagSTxMgmtPacket {
245 PUWLAN_80211HDR p80211Header;
246 UINT cbMPDULen;
247 UINT cbPayloadLen;
249 } STxMgmtPacket, DEF* PSTxMgmtPacket;
252 // Rx Managment Packet descriptor
253 typedef struct tagSRxMgmtPacket {
255 PUWLAN_80211HDR p80211Header;
256 QWORD qwLocalTSF;
257 UINT cbMPDULen;
258 UINT cbPayloadLen;
259 UINT uRSSI;
260 BYTE bySQ;
261 BYTE byRxRate;
262 BYTE byRxChannel;
264 } SRxMgmtPacket, DEF* PSRxMgmtPacket;
268 typedef struct tagSMgmtObject
271 PVOID pAdapter;
272 // MAC address
273 BYTE abyMACAddr[WLAN_ADDR_LEN];
275 // Configuration Mode
276 WMAC_CONFIG_MODE eConfigMode; // MAC pre-configed mode
277 CARD_PHY_TYPE eCurrentPHYMode;
278 CARD_PHY_TYPE eConfigPHYMode;
281 // Operation state variables
282 WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode
283 WMAC_BSS_STATE eCurrState; // MAC current BSS state
285 PKnownBSS pCurrBSS;
286 BYTE byCSSGK;
287 BYTE byCSSPK;
289 // BYTE abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
290 // BYTE abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
292 // Current state vars
293 UINT uCurrChannel;
294 BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
295 BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
296 BYTE abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
297 BYTE abyCurrBSSID[WLAN_BSSID_LEN];
298 WORD wCurrCapInfo;
299 WORD wCurrAID;
300 WORD wCurrATIMWindow;
301 WORD wCurrBeaconPeriod;
302 BOOL bIsDS;
303 BYTE byERPContext;
305 CMD_STATE eCommandState;
306 UINT uScanChannel;
308 // Desire joinning BSS vars
309 BYTE abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
310 BYTE abyDesireBSSID[WLAN_BSSID_LEN];
312 // Adhoc or AP configuration vars
313 //BYTE abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
314 WORD wIBSSBeaconPeriod;
315 WORD wIBSSATIMWindow;
316 UINT uIBSSChannel;
317 BYTE abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
318 BYTE byAPBBType;
319 BYTE abyWPAIE[MAX_WPA_IE_LEN];
320 WORD wWPAIELen;
322 UINT uAssocCount;
323 BOOL bMoreData;
325 // Scan state vars
326 WMAC_SCAN_STATE eScanState;
327 WMAC_SCAN_TYPE eScanType;
328 UINT uScanStartCh;
329 UINT uScanEndCh;
330 WORD wScanSteps;
331 UINT uScanBSSType;
332 // Desire scannig vars
333 BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
334 BYTE abyScanBSSID[WLAN_BSSID_LEN];
336 // Privacy
337 WMAC_AUTHENTICATION_MODE eAuthenMode;
338 WMAC_ENCRYPTION_MODE eEncryptionMode;
339 BOOL bShareKeyAlgorithm;
340 BYTE abyChallenge[WLAN_CHALLENGE_LEN];
341 BOOL bPrivacyInvoked;
343 // Received beacon state vars
344 BOOL bInTIM;
345 BOOL bMulticastTIM;
346 BYTE byDTIMCount;
347 BYTE byDTIMPeriod;
349 // Power saving state vars
350 WMAC_POWER_MODE ePSMode;
351 WORD wListenInterval;
352 WORD wCountToWakeUp;
353 BOOL bInTIMWake;
354 PBYTE pbyPSPacketPool;
355 BYTE byPSPacketPool[sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN];
356 BOOL bRxBeaconInTBTTWake;
357 BYTE abyPSTxMap[MAX_NODE_NUM + 1];
359 // managment command related
360 UINT uCmdBusy;
361 UINT uCmdHostAPBusy;
363 // managment packet pool
364 PBYTE pbyMgmtPacketPool;
365 BYTE byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
368 // One second callback timer
369 struct timer_list sTimerSecondCallback;
371 // Temporarily Rx Mgmt Packet Descriptor
372 SRxMgmtPacket sRxPacket;
374 // link list of known bss's (scan results)
375 KnownBSS sBSSList[MAX_BSS_NUM];
379 // table list of known node
380 // sNodeDBList[0] is reserved for AP under Infra mode
381 // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
382 KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
386 // WPA2 PMKID Cache
387 SPMKIDCache gsPMKIDCache;
388 BOOL bRoaming;
390 // rate fall back vars
394 // associate info
395 SAssocInfo sAssocInfo;
398 // for 802.11h
399 BOOL b11hEnable;
400 BOOL bSwitchChannel;
401 BYTE byNewChannel;
402 PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep;
403 UINT uLengthOfRepEIDs;
404 BYTE abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
405 BYTE abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
406 BYTE abyIECountry[WLAN_A3FR_MAXLEN];
407 BYTE abyIBSSDFSOwner[6];
408 BYTE byIBSSDFSRecovery;
410 struct sk_buff skb;
412 } SMgmtObject, DEF *PSMgmtObject;
415 /*--------------------- Export Macros ------------------------------*/
418 /*--------------------- Export Functions --------------------------*/
421 void
422 vMgrObjectInit(
423 IN HANDLE hDeviceContext
426 void
427 vMgrTimerInit(
428 IN HANDLE hDeviceContext
431 VOID
432 vMgrObjectReset(
433 IN HANDLE hDeviceContext
436 void
437 vMgrAssocBeginSta(
438 IN HANDLE hDeviceContext,
439 IN PSMgmtObject pMgmt,
440 OUT PCMD_STATUS pStatus
443 VOID
444 vMgrReAssocBeginSta(
445 IN HANDLE hDeviceContext,
446 IN PSMgmtObject pMgmt,
447 OUT PCMD_STATUS pStatus
450 VOID
451 vMgrDisassocBeginSta(
452 IN HANDLE hDeviceContext,
453 IN PSMgmtObject pMgmt,
454 IN PBYTE abyDestAddress,
455 IN WORD wReason,
456 OUT PCMD_STATUS pStatus
459 VOID
460 vMgrAuthenBeginSta(
461 IN HANDLE hDeviceContext,
462 IN PSMgmtObject pMgmt,
463 OUT PCMD_STATUS pStatus
466 VOID
467 vMgrCreateOwnIBSS(
468 IN HANDLE hDeviceContext,
469 OUT PCMD_STATUS pStatus
472 VOID
473 vMgrJoinBSSBegin(
474 IN HANDLE hDeviceContext,
475 OUT PCMD_STATUS pStatus
478 VOID
479 vMgrRxManagePacket(
480 IN HANDLE hDeviceContext,
481 IN PSMgmtObject pMgmt,
482 IN PSRxMgmtPacket pRxPacket
486 VOID
487 vMgrScanBegin(
488 IN HANDLE hDeviceContext,
489 OUT PCMD_STATUS pStatus
493 VOID
494 vMgrDeAuthenBeginSta(
495 IN HANDLE hDeviceContext,
496 IN PSMgmtObject pMgmt,
497 IN PBYTE abyDestAddress,
498 IN WORD wReason,
499 OUT PCMD_STATUS pStatus
502 BOOL
503 bMgrPrepareBeaconToSend(
504 IN HANDLE hDeviceContext,
505 IN PSMgmtObject pMgmt
509 BOOL
510 bAdd_PMKID_Candidate (
511 IN HANDLE hDeviceContext,
512 IN PBYTE pbyBSSID,
513 IN PSRSNCapObject psRSNCapObj
516 VOID
517 vFlush_PMKID_Candidate (
518 IN HANDLE hDeviceContext
521 #endif // __WMGR_H__