x86/xen: resume timer irqs early
[linux/fpc-iii.git] / drivers / staging / vt6656 / wmgr.h
blob5424c7f820ade84f57ac0a1af70fcc195b246cea
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 "80211mgr.h"
38 #include "80211hdr.h"
39 #include "wcmd.h"
40 #include "bssdb.h"
41 #include "wpa2.h"
42 #include "card.h"
44 // Scan time
45 #define PROBE_DELAY 100 // (us)
46 #define SWITCH_CHANNEL_DELAY 200 // (us)
47 #define WLAN_SCAN_MINITIME 25 // (ms)
48 #define WLAN_SCAN_MAXTIME 100 // (ms)
49 #define TRIVIAL_SYNC_DIFFERENCE 0 // (us)
50 #define DEFAULT_IBSS_BI 100 // (ms)
52 #define WCMD_ACTIVE_SCAN_TIME 20 //(ms)
53 #define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
55 #define DEFAULT_MSDU_LIFETIME 512 // ms
56 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
58 #define DEFAULT_MGN_LIFETIME 8 // ms
59 #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
61 #define MAKE_BEACON_RESERVED 10 //(us)
63 #define TIM_MULTICAST_MASK 0x01
64 #define TIM_BITMAPOFFSET_MASK 0xFE
65 #define DEFAULT_DTIM_PERIOD 1
67 #define AP_LONG_RETRY_LIMIT 4
69 #define DEFAULT_IBSS_CHANNEL 6 //2.4G
71 //mike define: make timer to expire after desired times
72 #define timer_expire(timer, next_tick) mod_timer(&timer, RUN_AT(next_tick))
74 typedef void (*TimerFunction)(unsigned long);
76 //+++ NDIS related
78 typedef u8 NDIS_802_11_MAC_ADDRESS[ETH_ALEN];
79 typedef struct _NDIS_802_11_AI_REQFI
81 u16 Capabilities;
82 u16 ListenInterval;
83 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
84 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
86 typedef struct _NDIS_802_11_AI_RESFI
88 u16 Capabilities;
89 u16 StatusCode;
90 u16 AssociationId;
91 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
93 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
95 u32 Length;
96 u16 AvailableRequestFixedIEs;
97 NDIS_802_11_AI_REQFI RequestFixedIEs;
98 u32 RequestIELength;
99 u32 OffsetRequestIEs;
100 u16 AvailableResponseFixedIEs;
101 NDIS_802_11_AI_RESFI ResponseFixedIEs;
102 u32 ResponseIELength;
103 u32 OffsetResponseIEs;
104 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
106 typedef struct tagSAssocInfo {
107 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
108 u8 abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
109 /* store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION */
110 u32 RequestIELength;
111 u8 abyReqIEs[WLAN_BEACON_FR_MAXLEN];
112 } SAssocInfo, *PSAssocInfo;
114 typedef enum tagWMAC_AUTHENTICATION_MODE {
116 WMAC_AUTH_OPEN,
117 WMAC_AUTH_SHAREKEY,
118 WMAC_AUTH_AUTO,
119 WMAC_AUTH_WPA,
120 WMAC_AUTH_WPAPSK,
121 WMAC_AUTH_WPANONE,
122 WMAC_AUTH_WPA2,
123 WMAC_AUTH_WPA2PSK,
124 WMAC_AUTH_MAX // Not a real mode, defined as upper bound
125 } WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
127 // Pre-configured Mode (from XP)
129 typedef enum tagWMAC_CONFIG_MODE {
130 WMAC_CONFIG_ESS_STA,
131 WMAC_CONFIG_IBSS_STA,
132 WMAC_CONFIG_AUTO,
133 WMAC_CONFIG_AP
135 } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
137 typedef enum tagWMAC_SCAN_TYPE {
139 WMAC_SCAN_ACTIVE,
140 WMAC_SCAN_PASSIVE,
141 WMAC_SCAN_HYBRID
143 } WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE;
145 typedef enum tagWMAC_SCAN_STATE {
147 WMAC_NO_SCANNING,
148 WMAC_IS_SCANNING,
149 WMAC_IS_PROBEPENDING
151 } WMAC_SCAN_STATE, *PWMAC_SCAN_STATE;
153 // Notes:
154 // Basic Service Set state explained as following:
155 // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
156 // WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
157 // WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
158 // WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
159 // WMAC_STATE_AUTH : Authenticated (Infra)
160 // WMAC_STATE_ASSOCPENDING : Association pending (Infra)
161 // WMAC_STATE_ASSOC : Associated (Infra)
163 typedef enum tagWMAC_BSS_STATE {
165 WMAC_STATE_IDLE,
166 WMAC_STATE_STARTED,
167 WMAC_STATE_JOINTED,
168 WMAC_STATE_AUTHPENDING,
169 WMAC_STATE_AUTH,
170 WMAC_STATE_ASSOCPENDING,
171 WMAC_STATE_ASSOC
173 } WMAC_BSS_STATE, *PWMAC_BSS_STATE;
175 // WMAC selected running mode
176 typedef enum tagWMAC_CURRENT_MODE {
178 WMAC_MODE_STANDBY,
179 WMAC_MODE_ESS_STA,
180 WMAC_MODE_IBSS_STA,
181 WMAC_MODE_ESS_AP
183 } WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE;
185 typedef enum tagWMAC_POWER_MODE {
187 WMAC_POWER_CAM,
188 WMAC_POWER_FAST,
189 WMAC_POWER_MAX
191 } WMAC_POWER_MODE, *PWMAC_POWER_MODE;
193 /* Tx Management Packet descriptor */
194 struct vnt_tx_mgmt {
195 PUWLAN_80211HDR p80211Header;
196 u32 cbMPDULen;
197 u32 cbPayloadLen;
200 /* Rx Management Packet descriptor */
201 struct vnt_rx_mgmt {
202 PUWLAN_80211HDR p80211Header;
203 u64 qwLocalTSF;
204 u32 cbMPDULen;
205 u32 cbPayloadLen;
206 u32 uRSSI;
207 u8 bySQ;
208 u8 byRxRate;
209 u8 byRxChannel;
212 struct vnt_manager {
213 void *pAdapter;
215 /* MAC address */
216 u8 abyMACAddr[WLAN_ADDR_LEN];
218 /* Configuration Mode */
219 WMAC_CONFIG_MODE eConfigMode; /* MAC pre-configed mode */
221 CARD_PHY_TYPE eCurrentPHYMode;
223 /* Operation state variables */
224 WMAC_CURRENT_MODE eCurrMode; /* MAC current connection mode */
225 WMAC_BSS_STATE eCurrState; /* MAC current BSS state */
226 WMAC_BSS_STATE eLastState; /* MAC last BSS state */
228 PKnownBSS pCurrBSS;
229 u8 byCSSGK;
230 u8 byCSSPK;
232 int bCurrBSSIDFilterOn;
234 /* Current state vars */
235 u32 uCurrChannel;
236 u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
237 u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
238 u8 abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
239 u8 abyCurrBSSID[WLAN_BSSID_LEN];
240 u16 wCurrCapInfo;
241 u16 wCurrAID;
242 u32 uRSSITrigger;
243 u16 wCurrATIMWindow;
244 u16 wCurrBeaconPeriod;
245 int bIsDS;
246 u8 byERPContext;
248 CMD_STATE eCommandState;
249 u32 uScanChannel;
251 /* Desire joinning BSS vars */
252 u8 abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
253 u8 abyDesireBSSID[WLAN_BSSID_LEN];
255 /*restore BSS info for Ad-Hoc mode */
256 u8 abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
258 /* Adhoc or AP configuration vars */
259 u16 wIBSSBeaconPeriod;
260 u16 wIBSSATIMWindow;
261 u32 uIBSSChannel;
262 u8 abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
263 u8 byAPBBType;
264 u8 abyWPAIE[MAX_WPA_IE_LEN];
265 u16 wWPAIELen;
267 u32 uAssocCount;
268 int bMoreData;
270 /* Scan state vars */
271 WMAC_SCAN_STATE eScanState;
272 WMAC_SCAN_TYPE eScanType;
273 u32 uScanStartCh;
274 u32 uScanEndCh;
275 u16 wScanSteps;
276 u32 uScanBSSType;
277 /* Desire scannig vars */
278 u8 abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
279 u8 abyScanBSSID[WLAN_BSSID_LEN];
281 /* Privacy */
282 WMAC_AUTHENTICATION_MODE eAuthenMode;
283 int bShareKeyAlgorithm;
284 u8 abyChallenge[WLAN_CHALLENGE_LEN];
285 int bPrivacyInvoked;
287 /* Received beacon state vars */
288 int bInTIM;
289 int bMulticastTIM;
290 u8 byDTIMCount;
291 u8 byDTIMPeriod;
293 /* Power saving state vars */
294 WMAC_POWER_MODE ePSMode;
295 u16 wListenInterval;
296 u16 wCountToWakeUp;
297 int bInTIMWake;
298 u8 *pbyPSPacketPool;
299 u8 byPSPacketPool[sizeof(struct vnt_tx_mgmt)
300 + WLAN_NULLDATA_FR_MAXLEN];
301 int bRxBeaconInTBTTWake;
302 u8 abyPSTxMap[MAX_NODE_NUM + 1];
304 /* management command related */
305 u32 uCmdBusy;
306 u32 uCmdHostAPBusy;
308 /* management packet pool */
309 u8 *pbyMgmtPacketPool;
310 u8 byMgmtPacketPool[sizeof(struct vnt_tx_mgmt)
311 + WLAN_A3FR_MAXLEN];
313 /* One second callback timer */
314 struct timer_list sTimerSecondCallback;
316 /* Temporarily Rx Mgmt Packet Descriptor */
317 struct vnt_rx_mgmt sRxPacket;
319 /* link list of known bss's (scan results) */
320 KnownBSS sBSSList[MAX_BSS_NUM];
321 /* link list of same bss's */
322 KnownBSS pSameBSS[6];
323 int Cisco_cckm;
324 u8 Roam_dbm;
326 /* table list of known node */
327 /* sNodeDBList[0] is reserved for AP under Infra mode */
328 /* sNodeDBList[0] is reserved for Multicast under adhoc/AP mode */
329 KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
331 /* WPA2 PMKID Cache */
332 SPMKIDCache gsPMKIDCache;
333 int bRoaming;
335 /* associate info */
336 SAssocInfo sAssocInfo;
338 /* for 802.11h */
339 int b11hEnable;
340 int bSwitchChannel;
341 u8 byNewChannel;
342 PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep;
343 u32 uLengthOfRepEIDs;
344 u8 abyCurrentMSRReq[sizeof(struct vnt_tx_mgmt)
345 + WLAN_A3FR_MAXLEN];
346 u8 abyCurrentMSRRep[sizeof(struct vnt_tx_mgmt)
347 + WLAN_A3FR_MAXLEN];
348 u8 abyIECountry[WLAN_A3FR_MAXLEN];
349 u8 abyIBSSDFSOwner[6];
350 u8 byIBSSDFSRecovery;
352 struct sk_buff skb;
356 void vMgrObjectInit(struct vnt_private *pDevice);
358 void vMgrAssocBeginSta(struct vnt_private *pDevice,
359 struct vnt_manager *, PCMD_STATUS pStatus);
361 void vMgrReAssocBeginSta(struct vnt_private *pDevice,
362 struct vnt_manager *, PCMD_STATUS pStatus);
364 void vMgrDisassocBeginSta(struct vnt_private *pDevice,
365 struct vnt_manager *, u8 *abyDestAddress, u16 wReason,
366 PCMD_STATUS pStatus);
368 void vMgrAuthenBeginSta(struct vnt_private *pDevice,
369 struct vnt_manager *, PCMD_STATUS pStatus);
371 void vMgrCreateOwnIBSS(struct vnt_private *pDevice,
372 PCMD_STATUS pStatus);
374 void vMgrJoinBSSBegin(struct vnt_private *pDevice,
375 PCMD_STATUS pStatus);
377 void vMgrRxManagePacket(struct vnt_private *pDevice,
378 struct vnt_manager *, struct vnt_rx_mgmt *);
381 void
382 vMgrScanBegin(
383 void *hDeviceContext,
384 PCMD_STATUS pStatus
388 void vMgrDeAuthenBeginSta(struct vnt_private *pDevice,
389 struct vnt_manager *, u8 *abyDestAddress, u16 wReason,
390 PCMD_STATUS pStatus);
392 int bMgrPrepareBeaconToSend(struct vnt_private *pDevice,
393 struct vnt_manager *);
395 int bAdd_PMKID_Candidate(struct vnt_private *pDevice,
396 u8 *pbyBSSID, PSRSNCapObject psRSNCapObj);
398 void vFlush_PMKID_Candidate(struct vnt_private *pDevice);
400 #endif /* __WMGR_H__ */