Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[deliverable/linux.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
92b96797
FB
38#define MAX_NODE_NUM 64
39#define MAX_BSS_NUM 42
d9d1ccb5 40#define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */
92b96797
FB
41#define MAX_PS_TX_BUF 32 // sta max power saving tx buf
42#define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
43#define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
44
45#define USE_PROTECT_PERIOD 10 // 10 sec, Use protect mode check period
46#define ERP_RECOVER_COUNT 30 // 30 sec, ERP support callback check
47#define BSS_CLEAR_COUNT 1
48
49#define RSSI_STAT_COUNT 10
50#define MAX_CHECK_RSSI_COUNT 8
51
52// STA dwflags
53#define WLAN_STA_AUTH BIT0
54#define WLAN_STA_ASSOC BIT1
55#define WLAN_STA_PS BIT2
56#define WLAN_STA_TIM BIT3
57// permanent; do not remove entry on expiration
58#define WLAN_STA_PERM BIT4
59// If 802.1X is used, this flag is
60// controlling whether STA is authorized to
61// send and receive non-IEEE 802.1X frames
62#define WLAN_STA_AUTHORIZED BIT5
63
92b96797
FB
64#define MAX_WPA_IE_LEN 64
65
92b96797
FB
66//
67// IEEE 802.11 Structures and definitions
68//
69
70typedef struct tagSERPObject {
dfdcc425 71 bool bERPExist;
b902fbfe 72 u8 byERP;
d9d1ccb5 73} ERPObject, *PERPObject;
92b96797 74
92b96797 75typedef struct tagSRSNCapObject {
dfdcc425 76 bool bRSNCapExist;
3eaca0d2 77 u16 wRSNCap;
d9d1ccb5 78} SRSNCapObject, *PSRSNCapObject;
92b96797
FB
79
80// BSS info(AP)
92b96797
FB
81typedef struct tagKnownBSS {
82 // BSS info
dfdcc425 83 bool bActive;
b902fbfe 84 u8 abyBSSID[WLAN_BSSID_LEN];
cc856e61 85 unsigned int uChannel;
b902fbfe
AM
86 u8 abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
87 u8 abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
cc856e61 88 unsigned int uRSSI;
b902fbfe 89 u8 bySQ;
3eaca0d2
AM
90 u16 wBeaconInterval;
91 u16 wCapInfo;
b902fbfe
AM
92 u8 abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
93 u8 byRxRate;
92b96797 94
3eaca0d2 95// u16 wATIMWindow;
b902fbfe 96 u8 byRSSIStatCnt;
213d2e93
AM
97 signed long ldBmMAX;
98 signed long ldBmAverage[RSSI_STAT_COUNT];
99 signed long ldBmAverRange;
92b96797 100 //For any BSSID selection improvment
dfdcc425 101 bool bSelected;
92b96797
FB
102
103 //++ WPA informations
dfdcc425 104 bool bWPAValid;
b902fbfe
AM
105 u8 byGKType;
106 u8 abyPKType[4];
3eaca0d2 107 u16 wPKCount;
b902fbfe 108 u8 abyAuthType[4];
3eaca0d2 109 u16 wAuthCount;
b902fbfe
AM
110 u8 byDefaultK_as_PK;
111 u8 byReplayIdx;
92b96797
FB
112 //--
113
114 //++ WPA2 informations
dfdcc425 115 bool bWPA2Valid;
b902fbfe 116 u8 byCSSGK;
3eaca0d2 117 u16 wCSSPKCount;
b902fbfe 118 u8 abyCSSPK[4];
3eaca0d2 119 u16 wAKMSSAuthCount;
b902fbfe 120 u8 abyAKMSSAuthType[4];
92b96797
FB
121
122 //++ wpactl
b902fbfe
AM
123 u8 byWPAIE[MAX_WPA_IE_LEN];
124 u8 byRSNIE[MAX_WPA_IE_LEN];
3eaca0d2
AM
125 u16 wWPALen;
126 u16 wRSNLen;
92b96797
FB
127
128 // Clear count
cc856e61 129 unsigned int uClearCount;
b902fbfe 130// u8 abyIEs[WLAN_BEACON_FR_MAXLEN];
cc856e61 131 unsigned int uIELength;
7c65fa2a
MP
132 u64 qwBSSTimestamp;
133 u64 qwLocalTSF;/* local TSF timer */
92b96797
FB
134
135 CARD_PHY_TYPE eNetworkTypeInUse;
136
137 ERPObject sERP;
138 SRSNCapObject sRSNCapObj;
b902fbfe 139 u8 abyIEs[1024]; // don't move this field !!
92b96797 140
d9d1ccb5 141} __attribute__ ((__packed__))
193a823c 142KnownBSS , *PKnownBSS;
92b96797 143
92b96797
FB
144typedef enum tagNODE_STATE {
145 NODE_FREE,
146 NODE_AGED,
147 NODE_KNOWN,
148 NODE_AUTH,
149 NODE_ASSOC
150} NODE_STATE, *PNODE_STATE;
151
92b96797
FB
152// STA node info
153typedef struct tagKnownNodeDB {
154 // STA info
dfdcc425 155 bool bActive;
b902fbfe
AM
156 u8 abyMACAddr[WLAN_ADDR_LEN];
157 u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
158 u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
3eaca0d2 159 u16 wTxDataRate;
dfdcc425
AM
160 bool bShortPreamble;
161 bool bERPExist;
162 bool bShortSlotTime;
cc856e61 163 unsigned int uInActiveCount;
3eaca0d2
AM
164 u16 wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
165 u16 wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
166 u16 wSuppRate;
b902fbfe
AM
167 u8 byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
168 u8 byTopCCKBasicRate; //Records the highest basic rate in CCK mode
92b96797
FB
169
170 // For AP mode
171 struct sk_buff_head sTxPSQueue;
3eaca0d2
AM
172 u16 wCapInfo;
173 u16 wListenInterval;
174 u16 wAID;
92b96797 175 NODE_STATE eNodeState;
dfdcc425
AM
176 bool bPSEnable;
177 bool bRxPSPoll;
b902fbfe 178 u8 byAuthSequence;
cc856e61 179 unsigned long ulLastRxJiffer;
b902fbfe 180 u8 bySuppRate;
52a7e64b 181 u32 dwFlags;
3eaca0d2 182 u16 wEnQueueCnt;
92b96797 183
dfdcc425 184 bool bOnFly;
cc856e61 185 unsigned long long KeyRSC;
b902fbfe 186 u8 byKeyIndex;
52a7e64b 187 u32 dwKeyIndex;
b902fbfe 188 u8 byCipherSuite;
52a7e64b 189 u32 dwTSC47_16;
3eaca0d2 190 u16 wTSC15_0;
cc856e61 191 unsigned int uWepKeyLength;
b902fbfe 192 u8 abyWepKey[WLAN_WEPMAX_KEYLEN];
92b96797
FB
193 //
194 // Auto rate fallback vars
dfdcc425 195 bool bIsInFallback;
cc856e61
AM
196 unsigned int uAverageRSSI;
197 unsigned int uRateRecoveryTimeout;
198 unsigned int uRatePollTimeout;
199 unsigned int uTxFailures;
200 unsigned int uTxAttempts;
201
202 unsigned int uTxRetry;
203 unsigned int uFailureRatio;
204 unsigned int uRetryRatio;
205 unsigned int uTxOk[MAX_RATE+1];
206 unsigned int uTxFail[MAX_RATE+1];
207 unsigned int uTimeCount;
92b96797 208
193a823c 209} KnownNodeDB, *PKnownNodeDB;
92b96797 210
d56131de
MP
211PKnownBSS BSSpSearchBSSList(struct vnt_private *, u8 *pbyDesireBSSID,
212 u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType);
0cbd8d98 213
d56131de
MP
214PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *, u8 *abyBSSID,
215 PWLAN_IE_SSID pSSID);
0cbd8d98 216
d56131de 217void BSSvClearBSSList(struct vnt_private *, int bKeepCurrBSSID);
0cbd8d98 218
d56131de
MP
219int BSSbInsertToBSSList(struct vnt_private *,
220 u8 *abyBSSIDAddr,
7c65fa2a 221 u64 qwTimestamp,
d56131de
MP
222 u16 wBeaconInterval,
223 u16 wCapInfo,
224 u8 byCurrChannel,
225 PWLAN_IE_SSID pSSID,
226 PWLAN_IE_SUPP_RATES pSuppRates,
227 PWLAN_IE_SUPP_RATES pExtSuppRates,
228 PERPObject psERP,
229 PWLAN_IE_RSN pRSN,
230 PWLAN_IE_RSN_EXT pRSNWPA,
231 PWLAN_IE_COUNTRY pIE_Country,
232 PWLAN_IE_QUIET pIE_Quiet,
233 u32 uIELength,
234 u8 *pbyIEs,
235 void *pRxPacketContext);
236
237int BSSbUpdateToBSSList(struct vnt_private *,
7c65fa2a 238 u64 qwTimestamp,
d56131de
MP
239 u16 wBeaconInterval,
240 u16 wCapInfo,
241 u8 byCurrChannel,
242 int bChannelHit,
243 PWLAN_IE_SSID pSSID,
244 PWLAN_IE_SUPP_RATES pSuppRates,
245 PWLAN_IE_SUPP_RATES pExtSuppRates,
246 PERPObject psERP,
247 PWLAN_IE_RSN pRSN,
248 PWLAN_IE_RSN_EXT pRSNWPA,
249 PWLAN_IE_COUNTRY pIE_Country,
250 PWLAN_IE_QUIET pIE_Quiet,
251 PKnownBSS pBSSList,
252 u32 uIELength,
253 u8 *pbyIEs,
254 void *pRxPacketContext);
255
b902fbfe 256int BSSbIsSTAInNodeDB(struct vnt_private *, u8 * abyDstAddr,
d56131de
MP
257 u32 *puNodeIndex);
258
259void BSSvCreateOneNode(struct vnt_private *, u32 *puNodeIndex);
260
261void BSSvUpdateAPNode(struct vnt_private *, u16 *pwCapInfo,
262 PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pExtSuppRates);
263
bd9a6dba 264void BSSvSecondCallBack(struct work_struct *work);
d56131de 265
51934e7f 266void BSSvUpdateNodeTxCounter(struct vnt_private *, u8 byTSR, u8 byPktNO);
d56131de
MP
267
268void BSSvRemoveOneNode(struct vnt_private *, u32 uNodeIndex);
269
270void BSSvAddMulticastNode(struct vnt_private *);
271
272void BSSvClearNodeDBTable(struct vnt_private *, u32 uStartIndex);
273
274void BSSvClearAnyBSSJoinRecord(struct vnt_private *);
92b96797 275
e7b07d1d 276#endif /* __BSSDB_H__ */
This page took 0.413904 seconds and 5 git commands to generate.