[ARM] pxa: Gumstix Verdex PCMCIA support
[linux-2.6/verdex.git] / drivers / staging / vt6655 / wmgr.h
blob1c1f2ea5782c62ccdf558f84fd09db65ad86ade3
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:
34 #ifndef __WMGR_H__
35 #define __WMGR_H__
37 #include "ttype.h"
38 #include "80211mgr.h"
39 #include "80211hdr.h"
40 #include "wcmd.h"
41 #include "bssdb.h"
42 #include "wpa2.h"
43 #include "vntwifi.h"
44 #include "card.h"
46 /*--------------------- Export Definitions -------------------------*/
50 // Scan time
51 #define PROBE_DELAY 100 // (us)
52 #define SWITCH_CHANNEL_DELAY 200 // (us)
53 #define WLAN_SCAN_MINITIME 25 // (ms)
54 #define WLAN_SCAN_MAXTIME 100 // (ms)
55 #define TRIVIAL_SYNC_DIFFERENCE 0 // (us)
56 #define DEFAULT_IBSS_BI 100 // (ms)
58 #define WCMD_ACTIVE_SCAN_TIME 50 //(ms)
59 #define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
62 #define DEFAULT_MSDU_LIFETIME 512 // ms
63 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
65 #define DEFAULT_MGN_LIFETIME 8 // ms
66 #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
68 #define MAKE_BEACON_RESERVED 10 //(us)
71 #define TIM_MULTICAST_MASK 0x01
72 #define TIM_BITMAPOFFSET_MASK 0xFE
73 #define DEFAULT_DTIM_PERIOD 1
75 #define AP_LONG_RETRY_LIMIT 4
77 #define DEFAULT_IBSS_CHANNEL 6 //2.4G
80 /*--------------------- Export Classes ----------------------------*/
82 /*--------------------- Export Variables --------------------------*/
84 /*--------------------- Export Types ------------------------------*/
85 #define timer_expire(timer,next_tick) mod_timer(&timer, RUN_AT(next_tick))
86 typedef void (*TimerFunction)(ULONG);
89 //+++ NDIS related
91 typedef UCHAR NDIS_802_11_MAC_ADDRESS[6];
92 typedef struct _NDIS_802_11_AI_REQFI
94 USHORT Capabilities;
95 USHORT ListenInterval;
96 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
97 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
99 typedef struct _NDIS_802_11_AI_RESFI
101 USHORT Capabilities;
102 USHORT StatusCode;
103 USHORT AssociationId;
104 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
106 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
108 ULONG Length;
109 USHORT AvailableRequestFixedIEs;
110 NDIS_802_11_AI_REQFI RequestFixedIEs;
111 ULONG RequestIELength;
112 ULONG OffsetRequestIEs;
113 USHORT AvailableResponseFixedIEs;
114 NDIS_802_11_AI_RESFI ResponseFixedIEs;
115 ULONG ResponseIELength;
116 ULONG OffsetResponseIEs;
117 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
121 typedef struct tagSAssocInfo {
122 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
123 BYTE abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
124 // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
125 ULONG RequestIELength;
126 BYTE abyReqIEs[WLAN_BEACON_FR_MAXLEN];
127 } SAssocInfo, *PSAssocInfo;
128 //---
132 typedef enum tagWMAC_AUTHENTICATION_MODE {
135 WMAC_AUTH_OPEN,
136 WMAC_AUTH_SHAREKEY,
137 WMAC_AUTH_AUTO,
138 WMAC_AUTH_WPA,
139 WMAC_AUTH_WPAPSK,
140 WMAC_AUTH_WPANONE,
141 WMAC_AUTH_WPA2,
142 WMAC_AUTH_WPA2PSK,
143 WMAC_AUTH_MAX // Not a real mode, defined as upper bound
146 } WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
150 // Pre-configured Mode (from XP)
152 typedef enum tagWMAC_CONFIG_MODE {
153 WMAC_CONFIG_ESS_STA,
154 WMAC_CONFIG_IBSS_STA,
155 WMAC_CONFIG_AUTO,
156 WMAC_CONFIG_AP
158 } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
161 typedef enum tagWMAC_SCAN_TYPE {
163 WMAC_SCAN_ACTIVE,
164 WMAC_SCAN_PASSIVE,
165 WMAC_SCAN_HYBRID
167 } WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE;
170 typedef enum tagWMAC_SCAN_STATE {
172 WMAC_NO_SCANNING,
173 WMAC_IS_SCANNING,
174 WMAC_IS_PROBEPENDING
176 } WMAC_SCAN_STATE, *PWMAC_SCAN_STATE;
180 // Notes:
181 // Basic Service Set state explained as following:
182 // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
183 // WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
184 // WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
185 // WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
186 // WMAC_STATE_AUTH : Authenticated (Infra)
187 // WMAC_STATE_ASSOCPENDING : Association pending (Infra)
188 // WMAC_STATE_ASSOC : Associated (Infra)
190 typedef enum tagWMAC_BSS_STATE {
192 WMAC_STATE_IDLE,
193 WMAC_STATE_STARTED,
194 WMAC_STATE_JOINTED,
195 WMAC_STATE_AUTHPENDING,
196 WMAC_STATE_AUTH,
197 WMAC_STATE_ASSOCPENDING,
198 WMAC_STATE_ASSOC
200 } WMAC_BSS_STATE, *PWMAC_BSS_STATE;
202 // WMAC selected running mode
203 typedef enum tagWMAC_CURRENT_MODE {
205 WMAC_MODE_STANDBY,
206 WMAC_MODE_ESS_STA,
207 WMAC_MODE_IBSS_STA,
208 WMAC_MODE_ESS_AP
210 } WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE;
213 typedef enum tagWMAC_POWER_MODE {
215 WMAC_POWER_CAM,
216 WMAC_POWER_FAST,
217 WMAC_POWER_MAX
219 } WMAC_POWER_MODE, *PWMAC_POWER_MODE;
223 // Tx Managment Packet descriptor
224 typedef struct tagSTxMgmtPacket {
226 PUWLAN_80211HDR p80211Header;
227 UINT cbMPDULen;
228 UINT cbPayloadLen;
230 } STxMgmtPacket, *PSTxMgmtPacket;
233 // Rx Managment Packet descriptor
234 typedef struct tagSRxMgmtPacket {
236 PUWLAN_80211HDR p80211Header;
237 QWORD qwLocalTSF;
238 UINT cbMPDULen;
239 UINT cbPayloadLen;
240 UINT uRSSI;
241 BYTE bySQ;
242 BYTE byRxRate;
243 BYTE byRxChannel;
245 } SRxMgmtPacket, *PSRxMgmtPacket;
249 typedef struct tagSMgmtObject
252 PVOID pAdapter;
253 // MAC address
254 BYTE abyMACAddr[WLAN_ADDR_LEN];
256 // Configuration Mode
257 WMAC_CONFIG_MODE eConfigMode; // MAC pre-configed mode
258 CARD_PHY_TYPE eCurrentPHYMode;
259 CARD_PHY_TYPE eConfigPHYMode;
262 // Operation state variables
263 WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode
264 WMAC_BSS_STATE eCurrState; // MAC current BSS state
266 PKnownBSS pCurrBSS;
267 BYTE byCSSGK;
268 BYTE byCSSPK;
270 // BYTE abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
271 // BYTE abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
273 // Current state vars
274 UINT uCurrChannel;
275 BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
276 BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
277 BYTE abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
278 BYTE abyCurrBSSID[WLAN_BSSID_LEN];
279 WORD wCurrCapInfo;
280 WORD wCurrAID;
281 WORD wCurrATIMWindow;
282 WORD wCurrBeaconPeriod;
283 BOOL bIsDS;
284 BYTE byERPContext;
286 CMD_STATE eCommandState;
287 UINT uScanChannel;
289 // Desire joinning BSS vars
290 BYTE abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
291 BYTE abyDesireBSSID[WLAN_BSSID_LEN];
293 // Adhoc or AP configuration vars
294 //BYTE abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
295 WORD wIBSSBeaconPeriod;
296 WORD wIBSSATIMWindow;
297 UINT uIBSSChannel;
298 BYTE abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
299 BYTE byAPBBType;
300 BYTE abyWPAIE[MAX_WPA_IE_LEN];
301 WORD wWPAIELen;
303 UINT uAssocCount;
304 BOOL bMoreData;
306 // Scan state vars
307 WMAC_SCAN_STATE eScanState;
308 WMAC_SCAN_TYPE eScanType;
309 UINT uScanStartCh;
310 UINT uScanEndCh;
311 WORD wScanSteps;
312 UINT uScanBSSType;
313 // Desire scannig vars
314 BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
315 BYTE abyScanBSSID[WLAN_BSSID_LEN];
317 // Privacy
318 WMAC_AUTHENTICATION_MODE eAuthenMode;
319 WMAC_ENCRYPTION_MODE eEncryptionMode;
320 BOOL bShareKeyAlgorithm;
321 BYTE abyChallenge[WLAN_CHALLENGE_LEN];
322 BOOL bPrivacyInvoked;
324 // Received beacon state vars
325 BOOL bInTIM;
326 BOOL bMulticastTIM;
327 BYTE byDTIMCount;
328 BYTE byDTIMPeriod;
330 // Power saving state vars
331 WMAC_POWER_MODE ePSMode;
332 WORD wListenInterval;
333 WORD wCountToWakeUp;
334 BOOL bInTIMWake;
335 PBYTE pbyPSPacketPool;
336 BYTE byPSPacketPool[sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN];
337 BOOL bRxBeaconInTBTTWake;
338 BYTE abyPSTxMap[MAX_NODE_NUM + 1];
340 // management command related
341 UINT uCmdBusy;
342 UINT uCmdHostAPBusy;
344 // management packet pool
345 PBYTE pbyMgmtPacketPool;
346 BYTE byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
349 // One second callback timer
350 struct timer_list sTimerSecondCallback;
352 // Temporarily Rx Mgmt Packet Descriptor
353 SRxMgmtPacket sRxPacket;
355 // link list of known bss's (scan results)
356 KnownBSS sBSSList[MAX_BSS_NUM];
360 // table list of known node
361 // sNodeDBList[0] is reserved for AP under Infra mode
362 // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
363 KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
367 // WPA2 PMKID Cache
368 SPMKIDCache gsPMKIDCache;
369 BOOL bRoaming;
371 // rate fall back vars
375 // associate info
376 SAssocInfo sAssocInfo;
379 // for 802.11h
380 BOOL b11hEnable;
381 BOOL bSwitchChannel;
382 BYTE byNewChannel;
383 PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep;
384 UINT uLengthOfRepEIDs;
385 BYTE abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
386 BYTE abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
387 BYTE abyIECountry[WLAN_A3FR_MAXLEN];
388 BYTE abyIBSSDFSOwner[6];
389 BYTE byIBSSDFSRecovery;
391 struct sk_buff skb;
393 } SMgmtObject, *PSMgmtObject;
396 /*--------------------- Export Macros ------------------------------*/
399 /*--------------------- Export Functions --------------------------*/
402 void
403 vMgrObjectInit(
404 IN HANDLE hDeviceContext
407 void
408 vMgrTimerInit(
409 IN HANDLE hDeviceContext
412 VOID
413 vMgrObjectReset(
414 IN HANDLE hDeviceContext
417 void
418 vMgrAssocBeginSta(
419 IN HANDLE hDeviceContext,
420 IN PSMgmtObject pMgmt,
421 OUT PCMD_STATUS pStatus
424 VOID
425 vMgrReAssocBeginSta(
426 IN HANDLE hDeviceContext,
427 IN PSMgmtObject pMgmt,
428 OUT PCMD_STATUS pStatus
431 VOID
432 vMgrDisassocBeginSta(
433 IN HANDLE hDeviceContext,
434 IN PSMgmtObject pMgmt,
435 IN PBYTE abyDestAddress,
436 IN WORD wReason,
437 OUT PCMD_STATUS pStatus
440 VOID
441 vMgrAuthenBeginSta(
442 IN HANDLE hDeviceContext,
443 IN PSMgmtObject pMgmt,
444 OUT PCMD_STATUS pStatus
447 VOID
448 vMgrCreateOwnIBSS(
449 IN HANDLE hDeviceContext,
450 OUT PCMD_STATUS pStatus
453 VOID
454 vMgrJoinBSSBegin(
455 IN HANDLE hDeviceContext,
456 OUT PCMD_STATUS pStatus
459 VOID
460 vMgrRxManagePacket(
461 IN HANDLE hDeviceContext,
462 IN PSMgmtObject pMgmt,
463 IN PSRxMgmtPacket pRxPacket
467 VOID
468 vMgrScanBegin(
469 IN HANDLE hDeviceContext,
470 OUT PCMD_STATUS pStatus
474 VOID
475 vMgrDeAuthenBeginSta(
476 IN HANDLE hDeviceContext,
477 IN PSMgmtObject pMgmt,
478 IN PBYTE abyDestAddress,
479 IN WORD wReason,
480 OUT PCMD_STATUS pStatus
483 BOOL
484 bMgrPrepareBeaconToSend(
485 IN HANDLE hDeviceContext,
486 IN PSMgmtObject pMgmt
490 BOOL
491 bAdd_PMKID_Candidate (
492 IN HANDLE hDeviceContext,
493 IN PBYTE pbyBSSID,
494 IN PSRSNCapObject psRSNCapObj
497 VOID
498 vFlush_PMKID_Candidate (
499 IN HANDLE hDeviceContext
502 #endif // __WMGR_H__