Merge branches 'msm/fixes-non-critical' and 'msm/cleanup' into next/dt
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / vt6656 / bssdb.h
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
33 #include <linux/skbuff.h>
34 #include "80211hdr.h"
35 #include "80211mgr.h"
36 #include "card.h"
37 #include "mib.h"
38
39 /*--------------------- Export Definitions -------------------------*/
40
41 #define MAX_NODE_NUM 64
42 #define MAX_BSS_NUM 42
43 #define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */
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
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
81 typedef struct tagSERPObject {
82 BOOL bERPExist;
83 BYTE byERP;
84 } ERPObject, *PERPObject;
85
86
87 typedef struct tagSRSNCapObject {
88 BOOL bRSNCapExist;
89 WORD wRSNCap;
90 } SRSNCapObject, *PSRSNCapObject;
91
92 // BSS info(AP)
93 #pragma pack(1)
94 typedef struct tagKnownBSS {
95 // BSS info
96 BOOL bActive;
97 BYTE abyBSSID[WLAN_BSSID_LEN];
98 unsigned int uChannel;
99 BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
100 BYTE abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
101 unsigned int uRSSI;
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;
110 signed long ldBmMAX;
111 signed long ldBmAverage[RSSI_STAT_COUNT];
112 signed long ldBmAverRange;
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
142 unsigned int uClearCount;
143 // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
144 unsigned int uIELength;
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
154 } __attribute__ ((__packed__))
155 KnownBSS , *PKnownBSS;
156
157
158
159 typedef 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
169 typedef 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;
179 unsigned int uInActiveCount;
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;
195 unsigned long ulLastRxJiffer;
196 BYTE bySuppRate;
197 DWORD dwFlags;
198 WORD wEnQueueCnt;
199
200 BOOL bOnFly;
201 unsigned long long KeyRSC;
202 BYTE byKeyIndex;
203 DWORD dwKeyIndex;
204 BYTE byCipherSuite;
205 DWORD dwTSC47_16;
206 WORD wTSC15_0;
207 unsigned int uWepKeyLength;
208 BYTE abyWepKey[WLAN_WEPMAX_KEYLEN];
209 //
210 // Auto rate fallback vars
211 BOOL bIsInFallback;
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;
224
225 } KnownNodeDB, *PKnownNodeDB;
226
227 /*--------------------- Export Functions --------------------------*/
228
229 PKnownBSS BSSpSearchBSSList(void *hDeviceContext,
230 PBYTE pbyDesireBSSID,
231 PBYTE pbyDesireSSID,
232 CARD_PHY_TYPE ePhyType);
233
234 PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext,
235 PBYTE abyBSSID,
236 PWLAN_IE_SSID pSSID);
237
238 void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID);
239
240 BOOL 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,
254 unsigned int uIELength,
255 PBYTE pbyIEs,
256 void *pRxPacketContext);
257
258 BOOL 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,
273 unsigned int uIELength,
274 PBYTE pbyIEs,
275 void *pRxPacketContext);
276
277 BOOL BSSbIsSTAInNodeDB(void *hDeviceContext,
278 PBYTE abyDstAddr,
279 unsigned int *puNodeIndex);
280
281 void BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex);
282
283 void BSSvUpdateAPNode(void *hDeviceContext,
284 PWORD pwCapInfo,
285 PWLAN_IE_SUPP_RATES pItemRates,
286 PWLAN_IE_SUPP_RATES pExtSuppRates);
287
288 void BSSvSecondCallBack(void *hDeviceContext);
289
290 void BSSvUpdateNodeTxCounter(void *hDeviceContext,
291 PSStatCounter pStatistic,
292 BYTE byTSR,
293 BYTE byPktNO);
294
295 void BSSvRemoveOneNode(void *hDeviceContext,
296 unsigned int uNodeIndex);
297
298 void BSSvAddMulticastNode(void *hDeviceContext);
299
300 void BSSvClearNodeDBTable(void *hDeviceContext,
301 unsigned int uStartIndex);
302
303 void BSSvClearAnyBSSJoinRecord(void *hDeviceContext);
304
305 #endif /* __BSSDB_H__ */