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