Merge branch 'slab/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / vt6656 / bssdb.h
CommitLineData
92b96797
FB
1/*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
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.
9 *
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.
14 *
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.
18 *
19 *
20 * File: bssdb.h
21 *
22 * Purpose: Handles the Basic Service Set & Node Database functions
23 *
24 * Author: Lyndon Chen
25 *
26 * Date: July 16, 2002
27 *
28 */
29
30#ifndef __BSSDB_H__
31#define __BSSDB_H__
32
92b96797 33#include <linux/skbuff.h>
92b96797 34#include "80211hdr.h"
92b96797 35#include "80211mgr.h"
92b96797 36#include "card.h"
92b96797 37#include "mib.h"
92b96797
FB
38
39/*--------------------- Export Definitions -------------------------*/
40
41#define MAX_NODE_NUM 64
42#define MAX_BSS_NUM 42
d9d1ccb5 43#define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */
92b96797
FB
44#define MAX_PS_TX_BUF 32 // sta max power saving tx buf
45#define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
46#define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
47
48#define USE_PROTECT_PERIOD 10 // 10 sec, Use protect mode check period
49#define ERP_RECOVER_COUNT 30 // 30 sec, ERP support callback check
50#define BSS_CLEAR_COUNT 1
51
52#define RSSI_STAT_COUNT 10
53#define MAX_CHECK_RSSI_COUNT 8
54
55// STA dwflags
56#define WLAN_STA_AUTH BIT0
57#define WLAN_STA_ASSOC BIT1
58#define WLAN_STA_PS BIT2
59#define WLAN_STA_TIM BIT3
60// permanent; do not remove entry on expiration
61#define WLAN_STA_PERM BIT4
62// If 802.1X is used, this flag is
63// controlling whether STA is authorized to
64// send and receive non-IEEE 802.1X frames
65#define WLAN_STA_AUTHORIZED BIT5
66
92b96797
FB
67#define MAX_WPA_IE_LEN 64
68
69
70/*--------------------- Export Classes ----------------------------*/
71
72/*--------------------- Export Variables --------------------------*/
73
74
75/*--------------------- Export Types ------------------------------*/
76
77//
78// IEEE 802.11 Structures and definitions
79//
80
81typedef struct tagSERPObject {
82 BOOL bERPExist;
83 BYTE byERP;
d9d1ccb5 84} ERPObject, *PERPObject;
92b96797
FB
85
86
87typedef struct tagSRSNCapObject {
88 BOOL bRSNCapExist;
89 WORD wRSNCap;
d9d1ccb5 90} SRSNCapObject, *PSRSNCapObject;
92b96797
FB
91
92// BSS info(AP)
93#pragma pack(1)
94typedef struct tagKnownBSS {
95 // BSS info
96 BOOL bActive;
97 BYTE abyBSSID[WLAN_BSSID_LEN];
cc856e61 98 unsigned int uChannel;
92b96797
FB
99 BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
100 BYTE abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
cc856e61 101 unsigned int uRSSI;
92b96797
FB
102 BYTE bySQ;
103 WORD wBeaconInterval;
104 WORD wCapInfo;
105 BYTE abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
106 BYTE byRxRate;
107
108// WORD wATIMWindow;
109 BYTE byRSSIStatCnt;
213d2e93
AM
110 signed long ldBmMAX;
111 signed long ldBmAverage[RSSI_STAT_COUNT];
112 signed long ldBmAverRange;
92b96797
FB
113 //For any BSSID selection improvment
114 BOOL bSelected;
115
116 //++ WPA informations
117 BOOL bWPAValid;
118 BYTE byGKType;
119 BYTE abyPKType[4];
120 WORD wPKCount;
121 BYTE abyAuthType[4];
122 WORD wAuthCount;
123 BYTE byDefaultK_as_PK;
124 BYTE byReplayIdx;
125 //--
126
127 //++ WPA2 informations
128 BOOL bWPA2Valid;
129 BYTE byCSSGK;
130 WORD wCSSPKCount;
131 BYTE abyCSSPK[4];
132 WORD wAKMSSAuthCount;
133 BYTE abyAKMSSAuthType[4];
134
135 //++ wpactl
136 BYTE byWPAIE[MAX_WPA_IE_LEN];
137 BYTE byRSNIE[MAX_WPA_IE_LEN];
138 WORD wWPALen;
139 WORD wRSNLen;
140
141 // Clear count
cc856e61 142 unsigned int uClearCount;
92b96797 143// BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
cc856e61 144 unsigned int uIELength;
92b96797
FB
145 QWORD qwBSSTimestamp;
146 QWORD qwLocalTSF; // local TSF timer
147
148 CARD_PHY_TYPE eNetworkTypeInUse;
149
150 ERPObject sERP;
151 SRSNCapObject sRSNCapObj;
152 BYTE abyIEs[1024]; // don't move this field !!
153
d9d1ccb5 154} __attribute__ ((__packed__))
193a823c 155KnownBSS , *PKnownBSS;
92b96797
FB
156
157
158
159typedef enum tagNODE_STATE {
160 NODE_FREE,
161 NODE_AGED,
162 NODE_KNOWN,
163 NODE_AUTH,
164 NODE_ASSOC
165} NODE_STATE, *PNODE_STATE;
166
167
168// STA node info
169typedef struct tagKnownNodeDB {
170 // STA info
171 BOOL bActive;
172 BYTE abyMACAddr[WLAN_ADDR_LEN];
173 BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
174 BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
175 WORD wTxDataRate;
176 BOOL bShortPreamble;
177 BOOL bERPExist;
178 BOOL bShortSlotTime;
cc856e61 179 unsigned int uInActiveCount;
92b96797
FB
180 WORD wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
181 WORD wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
182 WORD wSuppRate;
183 BYTE byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
184 BYTE byTopCCKBasicRate; //Records the highest basic rate in CCK mode
185
186 // For AP mode
187 struct sk_buff_head sTxPSQueue;
188 WORD wCapInfo;
189 WORD wListenInterval;
190 WORD wAID;
191 NODE_STATE eNodeState;
192 BOOL bPSEnable;
193 BOOL bRxPSPoll;
194 BYTE byAuthSequence;
cc856e61 195 unsigned long ulLastRxJiffer;
92b96797
FB
196 BYTE bySuppRate;
197 DWORD dwFlags;
198 WORD wEnQueueCnt;
199
200 BOOL bOnFly;
cc856e61 201 unsigned long long KeyRSC;
92b96797
FB
202 BYTE byKeyIndex;
203 DWORD dwKeyIndex;
204 BYTE byCipherSuite;
205 DWORD dwTSC47_16;
206 WORD wTSC15_0;
cc856e61 207 unsigned int uWepKeyLength;
92b96797
FB
208 BYTE abyWepKey[WLAN_WEPMAX_KEYLEN];
209 //
210 // Auto rate fallback vars
211 BOOL bIsInFallback;
cc856e61
AM
212 unsigned int uAverageRSSI;
213 unsigned int uRateRecoveryTimeout;
214 unsigned int uRatePollTimeout;
215 unsigned int uTxFailures;
216 unsigned int uTxAttempts;
217
218 unsigned int uTxRetry;
219 unsigned int uFailureRatio;
220 unsigned int uRetryRatio;
221 unsigned int uTxOk[MAX_RATE+1];
222 unsigned int uTxFail[MAX_RATE+1];
223 unsigned int uTimeCount;
92b96797 224
193a823c 225} KnownNodeDB, *PKnownNodeDB;
92b96797 226
92b96797
FB
227/*--------------------- Export Functions --------------------------*/
228
0cbd8d98
AM
229PKnownBSS BSSpSearchBSSList(void *hDeviceContext,
230 PBYTE pbyDesireBSSID,
231 PBYTE pbyDesireSSID,
232 CARD_PHY_TYPE ePhyType);
233
234PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext,
235 PBYTE abyBSSID,
236 PWLAN_IE_SSID pSSID);
237
238void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID);
239
240BOOL BSSbInsertToBSSList(void *hDeviceContext,
241 PBYTE abyBSSIDAddr,
242 QWORD qwTimestamp,
243 WORD wBeaconInterval,
244 WORD wCapInfo,
245 BYTE byCurrChannel,
246 PWLAN_IE_SSID pSSID,
247 PWLAN_IE_SUPP_RATES pSuppRates,
248 PWLAN_IE_SUPP_RATES pExtSuppRates,
249 PERPObject psERP,
250 PWLAN_IE_RSN pRSN,
251 PWLAN_IE_RSN_EXT pRSNWPA,
252 PWLAN_IE_COUNTRY pIE_Country,
253 PWLAN_IE_QUIET pIE_Quiet,
cc856e61 254 unsigned int uIELength,
0cbd8d98
AM
255 PBYTE pbyIEs,
256 void *pRxPacketContext);
257
258BOOL BSSbUpdateToBSSList(void *hDeviceContext,
259 QWORD qwTimestamp,
260 WORD wBeaconInterval,
261 WORD wCapInfo,
262 BYTE byCurrChannel,
263 BOOL bChannelHit,
264 PWLAN_IE_SSID pSSID,
265 PWLAN_IE_SUPP_RATES pSuppRates,
266 PWLAN_IE_SUPP_RATES pExtSuppRates,
267 PERPObject psERP,
268 PWLAN_IE_RSN pRSN,
269 PWLAN_IE_RSN_EXT pRSNWPA,
270 PWLAN_IE_COUNTRY pIE_Country,
271 PWLAN_IE_QUIET pIE_Quiet,
272 PKnownBSS pBSSList,
cc856e61 273 unsigned int uIELength,
0cbd8d98
AM
274 PBYTE pbyIEs,
275 void *pRxPacketContext);
276
277BOOL BSSbIsSTAInNodeDB(void *hDeviceContext,
278 PBYTE abyDstAddr,
93a94c42 279 unsigned int *puNodeIndex);
0cbd8d98 280
93a94c42 281void BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex);
0cbd8d98
AM
282
283void BSSvUpdateAPNode(void *hDeviceContext,
284 PWORD pwCapInfo,
285 PWLAN_IE_SUPP_RATES pItemRates,
286 PWLAN_IE_SUPP_RATES pExtSuppRates);
287
288void BSSvSecondCallBack(void *hDeviceContext);
289
290void BSSvUpdateNodeTxCounter(void *hDeviceContext,
291 PSStatCounter pStatistic,
292 BYTE byTSR,
293 BYTE byPktNO);
294
295void BSSvRemoveOneNode(void *hDeviceContext,
cc856e61 296 unsigned int uNodeIndex);
0cbd8d98
AM
297
298void BSSvAddMulticastNode(void *hDeviceContext);
299
300void BSSvClearNodeDBTable(void *hDeviceContext,
cc856e61 301 unsigned int uStartIndex);
0cbd8d98
AM
302
303void BSSvClearAnyBSSJoinRecord(void *hDeviceContext);
92b96797 304
e7b07d1d 305#endif /* __BSSDB_H__ */