x86/xen: resume timer irqs early
[linux/fpc-iii.git] / drivers / staging / vt6655 / wmgr.h
blobb91f1f89ed05f1e970a0c0c7cb9fd2324d9cacca
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 -------------------------*/
48 // Scan time
49 #define PROBE_DELAY 100 // (us)
50 #define SWITCH_CHANNEL_DELAY 200 // (us)
51 #define WLAN_SCAN_MINITIME 25 // (ms)
52 #define WLAN_SCAN_MAXTIME 100 // (ms)
53 #define TRIVIAL_SYNC_DIFFERENCE 0 // (us)
54 #define DEFAULT_IBSS_BI 100 // (ms)
56 #define WCMD_ACTIVE_SCAN_TIME 50 //(ms)
57 #define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
59 #define DEFAULT_MSDU_LIFETIME 512 // ms
60 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
62 #define DEFAULT_MGN_LIFETIME 8 // ms
63 #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
65 #define MAKE_BEACON_RESERVED 10 //(us)
67 #define TIM_MULTICAST_MASK 0x01
68 #define TIM_BITMAPOFFSET_MASK 0xFE
69 #define DEFAULT_DTIM_PERIOD 1
71 #define AP_LONG_RETRY_LIMIT 4
73 #define DEFAULT_IBSS_CHANNEL 6 //2.4G
75 /*--------------------- Export Classes ----------------------------*/
77 /*--------------------- Export Variables --------------------------*/
79 /*--------------------- Export Types ------------------------------*/
80 #define timer_expire(timer, next_tick) mod_timer(&timer, RUN_AT(next_tick))
81 typedef void (*TimerFunction)(unsigned long);
83 //+++ NDIS related
85 typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
86 typedef struct _NDIS_802_11_AI_REQFI
88 unsigned short Capabilities;
89 unsigned short ListenInterval;
90 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
91 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
93 typedef struct _NDIS_802_11_AI_RESFI
95 unsigned short Capabilities;
96 unsigned short StatusCode;
97 unsigned short AssociationId;
98 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
100 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
102 unsigned long Length;
103 unsigned short AvailableRequestFixedIEs;
104 NDIS_802_11_AI_REQFI RequestFixedIEs;
105 unsigned long RequestIELength;
106 unsigned long OffsetRequestIEs;
107 unsigned short AvailableResponseFixedIEs;
108 NDIS_802_11_AI_RESFI ResponseFixedIEs;
109 unsigned long ResponseIELength;
110 unsigned long OffsetResponseIEs;
111 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
113 typedef struct tagSAssocInfo {
114 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
115 unsigned char abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
116 // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
117 unsigned long RequestIELength;
118 unsigned char abyReqIEs[WLAN_BEACON_FR_MAXLEN];
119 } SAssocInfo, *PSAssocInfo;
120 //---
123 typedef enum tagWMAC_AUTHENTICATION_MODE {
124 WMAC_AUTH_OPEN,
125 WMAC_AUTH_SHAREKEY,
126 WMAC_AUTH_AUTO,
127 WMAC_AUTH_WPA,
128 WMAC_AUTH_WPAPSK,
129 WMAC_AUTH_WPANONE,
130 WMAC_AUTH_WPA2,
131 WMAC_AUTH_WPA2PSK,
132 WMAC_AUTH_MAX // Not a real mode, defined as upper bound
134 } WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
137 // Pre-configured Mode (from XP)
139 typedef enum tagWMAC_CONFIG_MODE {
140 WMAC_CONFIG_ESS_STA,
141 WMAC_CONFIG_IBSS_STA,
142 WMAC_CONFIG_AUTO,
143 WMAC_CONFIG_AP
145 } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
148 typedef enum tagWMAC_SCAN_TYPE {
149 WMAC_SCAN_ACTIVE,
150 WMAC_SCAN_PASSIVE,
151 WMAC_SCAN_HYBRID
152 } WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE;
154 typedef enum tagWMAC_SCAN_STATE {
155 WMAC_NO_SCANNING,
156 WMAC_IS_SCANNING,
157 WMAC_IS_PROBEPENDING
158 } WMAC_SCAN_STATE, *PWMAC_SCAN_STATE;
160 // Notes:
161 // Basic Service Set state explained as following:
162 // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
163 // WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
164 // WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
165 // WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
166 // WMAC_STATE_AUTH : Authenticated (Infra)
167 // WMAC_STATE_ASSOCPENDING : Association pending (Infra)
168 // WMAC_STATE_ASSOC : Associated (Infra)
170 typedef enum tagWMAC_BSS_STATE {
171 WMAC_STATE_IDLE,
172 WMAC_STATE_STARTED,
173 WMAC_STATE_JOINTED,
174 WMAC_STATE_AUTHPENDING,
175 WMAC_STATE_AUTH,
176 WMAC_STATE_ASSOCPENDING,
177 WMAC_STATE_ASSOC
178 } WMAC_BSS_STATE, *PWMAC_BSS_STATE;
180 // WMAC selected running mode
181 typedef enum tagWMAC_CURRENT_MODE {
182 WMAC_MODE_STANDBY,
183 WMAC_MODE_ESS_STA,
184 WMAC_MODE_IBSS_STA,
185 WMAC_MODE_ESS_AP
186 } WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE;
189 typedef enum tagWMAC_POWER_MODE {
190 WMAC_POWER_CAM,
191 WMAC_POWER_FAST,
192 WMAC_POWER_MAX
194 } WMAC_POWER_MODE, *PWMAC_POWER_MODE;
197 // Tx Management Packet descriptor
198 typedef struct tagSTxMgmtPacket {
199 PUWLAN_80211HDR p80211Header;
200 unsigned int cbMPDULen;
201 unsigned int cbPayloadLen;
202 } STxMgmtPacket, *PSTxMgmtPacket;
204 // Rx Management Packet descriptor
205 typedef struct tagSRxMgmtPacket {
206 PUWLAN_80211HDR p80211Header;
207 QWORD qwLocalTSF;
208 unsigned int cbMPDULen;
209 unsigned int cbPayloadLen;
210 unsigned int uRSSI;
211 unsigned char bySQ;
212 unsigned char byRxRate;
213 unsigned char byRxChannel;
214 } SRxMgmtPacket, *PSRxMgmtPacket;
216 typedef struct tagSMgmtObject
218 void *pAdapter;
219 // MAC address
220 unsigned char abyMACAddr[WLAN_ADDR_LEN];
222 // Configuration Mode
223 WMAC_CONFIG_MODE eConfigMode; // MAC pre-configed mode
224 CARD_PHY_TYPE eCurrentPHYMode;
225 CARD_PHY_TYPE eConfigPHYMode;
227 // Operation state variables
228 WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode
229 WMAC_BSS_STATE eCurrState; // MAC current BSS state
231 PKnownBSS pCurrBSS;
232 unsigned char byCSSGK;
233 unsigned char byCSSPK;
235 // unsigned char abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
236 // unsigned char abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
238 // Current state vars
239 unsigned int uCurrChannel;
240 unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
241 unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
242 unsigned char abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
243 unsigned char abyCurrBSSID[WLAN_BSSID_LEN];
244 unsigned short wCurrCapInfo;
245 unsigned short wCurrAID;
246 unsigned short wCurrATIMWindow;
247 unsigned short wCurrBeaconPeriod;
248 bool bIsDS;
249 unsigned char byERPContext;
251 CMD_STATE eCommandState;
252 unsigned int uScanChannel;
254 // Desire joining BSS vars
255 unsigned char abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
256 unsigned char abyDesireBSSID[WLAN_BSSID_LEN];
258 // Adhoc or AP configuration vars
259 //unsigned char abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
260 unsigned short wIBSSBeaconPeriod;
261 unsigned short wIBSSATIMWindow;
262 unsigned int uIBSSChannel;
263 unsigned char abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
264 unsigned char byAPBBType;
265 unsigned char abyWPAIE[MAX_WPA_IE_LEN];
266 unsigned short wWPAIELen;
268 unsigned int uAssocCount;
269 bool bMoreData;
271 // Scan state vars
272 WMAC_SCAN_STATE eScanState;
273 WMAC_SCAN_TYPE eScanType;
274 unsigned int uScanStartCh;
275 unsigned int uScanEndCh;
276 unsigned short wScanSteps;
277 unsigned int uScanBSSType;
278 // Desire scanning vars
279 unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
280 unsigned char abyScanBSSID[WLAN_BSSID_LEN];
282 // Privacy
283 WMAC_AUTHENTICATION_MODE eAuthenMode;
284 WMAC_ENCRYPTION_MODE eEncryptionMode;
285 bool bShareKeyAlgorithm;
286 unsigned char abyChallenge[WLAN_CHALLENGE_LEN];
287 bool bPrivacyInvoked;
289 // Received beacon state vars
290 bool bInTIM;
291 bool bMulticastTIM;
292 unsigned char byDTIMCount;
293 unsigned char byDTIMPeriod;
295 // Power saving state vars
296 WMAC_POWER_MODE ePSMode;
297 unsigned short wListenInterval;
298 unsigned short wCountToWakeUp;
299 bool bInTIMWake;
300 unsigned char *pbyPSPacketPool;
301 unsigned char byPSPacketPool[sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN];
302 bool bRxBeaconInTBTTWake;
303 unsigned char abyPSTxMap[MAX_NODE_NUM + 1];
305 // management command related
306 unsigned int uCmdBusy;
307 unsigned int uCmdHostAPBusy;
309 // management packet pool
310 unsigned char *pbyMgmtPacketPool;
311 unsigned char byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
313 // One second callback timer
314 struct timer_list sTimerSecondCallback;
316 // Temporarily Rx Mgmt Packet Descriptor
317 SRxMgmtPacket sRxPacket;
319 // link list of known bss's (scan results)
320 KnownBSS sBSSList[MAX_BSS_NUM];
322 // table list of known node
323 // sNodeDBList[0] is reserved for AP under Infra mode
324 // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
325 KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
327 // WPA2 PMKID Cache
328 SPMKIDCache gsPMKIDCache;
329 bool bRoaming;
331 // rate fall back vars
333 // associate info
334 SAssocInfo sAssocInfo;
336 // for 802.11h
337 bool b11hEnable;
338 bool bSwitchChannel;
339 unsigned char byNewChannel;
340 PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep;
341 unsigned int uLengthOfRepEIDs;
342 unsigned char abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
343 unsigned char abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
344 unsigned char abyIECountry[WLAN_A3FR_MAXLEN];
345 unsigned char abyIBSSDFSOwner[6];
346 unsigned char byIBSSDFSRecovery;
348 struct sk_buff skb;
349 } SMgmtObject, *PSMgmtObject;
351 /*--------------------- Export Macros ------------------------------*/
353 /*--------------------- Export Functions --------------------------*/
355 void
356 vMgrObjectInit(
357 void *hDeviceContext
360 void
361 vMgrTimerInit(
362 void *hDeviceContext
365 void
366 vMgrObjectReset(
367 void *hDeviceContext
370 void
371 vMgrAssocBeginSta(
372 void *hDeviceContext,
373 PSMgmtObject pMgmt,
374 PCMD_STATUS pStatus
377 void
378 vMgrReAssocBeginSta(
379 void *hDeviceContext,
380 PSMgmtObject pMgmt,
381 PCMD_STATUS pStatus
384 void
385 vMgrDisassocBeginSta(
386 void *hDeviceContext,
387 PSMgmtObject pMgmt,
388 unsigned char *abyDestAddress,
389 unsigned short wReason,
390 PCMD_STATUS pStatus
393 void
394 vMgrAuthenBeginSta(
395 void *hDeviceContext,
396 PSMgmtObject pMgmt,
397 PCMD_STATUS pStatus
400 void
401 vMgrCreateOwnIBSS(
402 void *hDeviceContext,
403 PCMD_STATUS pStatus
406 void
407 vMgrJoinBSSBegin(
408 void *hDeviceContext,
409 PCMD_STATUS pStatus
412 void
413 vMgrRxManagePacket(
414 void *hDeviceContext,
415 PSMgmtObject pMgmt,
416 PSRxMgmtPacket pRxPacket
420 void
421 vMgrScanBegin(
422 void *hDeviceContext,
423 PCMD_STATUS pStatus
427 void
428 vMgrDeAuthenBeginSta(
429 void *hDeviceContext,
430 PSMgmtObject pMgmt,
431 unsigned char *abyDestAddress,
432 unsigned short wReason,
433 PCMD_STATUS pStatus
436 bool
437 bMgrPrepareBeaconToSend(
438 void *hDeviceContext,
439 PSMgmtObject pMgmt
442 bool
443 bAdd_PMKID_Candidate(
444 void *hDeviceContext,
445 unsigned char *pbyBSSID,
446 PSRSNCapObject psRSNCapObj
449 void
450 vFlush_PMKID_Candidate(
451 void *hDeviceContext
454 #endif // __WMGR_H__