2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
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.
22 * Purpose: Handles the Basic Service Set & Node Database functions
33 #include <linux/skbuff.h>
40 #define MAX_NODE_NUM 64
41 #define MAX_BSS_NUM 42
42 #define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */
43 #define MAX_PS_TX_BUF 32 // sta max power saving tx buf
44 #define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
45 #define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
47 #define USE_PROTECT_PERIOD 10 // 10 sec, Use protect mode check period
48 #define ERP_RECOVER_COUNT 30 // 30 sec, ERP support callback check
49 #define BSS_CLEAR_COUNT 1
51 #define RSSI_STAT_COUNT 10
52 #define MAX_CHECK_RSSI_COUNT 8
55 #define WLAN_STA_AUTH BIT0
56 #define WLAN_STA_ASSOC BIT1
57 #define WLAN_STA_PS BIT2
58 #define WLAN_STA_TIM BIT3
59 // permanent; do not remove entry on expiration
60 #define WLAN_STA_PERM BIT4
61 // If 802.1X is used, this flag is
62 // controlling whether STA is authorized to
63 // send and receive non-IEEE 802.1X frames
64 #define WLAN_STA_AUTHORIZED BIT5
66 #define MAX_WPA_IE_LEN 64
74 // IEEE 802.11 Structures and definitions
77 typedef struct tagSERPObject {
80 } ERPObject, *PERPObject;
83 typedef struct tagSRSNCapObject {
86 } SRSNCapObject, *PSRSNCapObject;
89 typedef struct tagKnownBSS {
92 u8 abyBSSID[WLAN_BSSID_LEN];
93 unsigned int uChannel;
94 u8 abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
95 u8 abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
100 u8 abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
106 signed long ldBmAverage[RSSI_STAT_COUNT];
107 signed long ldBmAverRange;
108 //For any BSSID selection improvment
111 //++ WPA informations
122 //++ WPA2 informations
128 u8 abyAKMSSAuthType[4];
131 u8 byWPAIE[MAX_WPA_IE_LEN];
132 u8 byRSNIE[MAX_WPA_IE_LEN];
137 unsigned int uClearCount;
138 // u8 abyIEs[WLAN_BEACON_FR_MAXLEN];
139 unsigned int uIELength;
141 u64 qwLocalTSF;/* local TSF timer */
143 CARD_PHY_TYPE eNetworkTypeInUse;
146 SRSNCapObject sRSNCapObj;
147 u8 abyIEs[1024]; // don't move this field !!
149 } __attribute__ ((__packed__))
150 KnownBSS , *PKnownBSS;
154 typedef enum tagNODE_STATE {
160 } NODE_STATE, *PNODE_STATE;
164 typedef struct tagKnownNodeDB {
167 u8 abyMACAddr[WLAN_ADDR_LEN];
168 u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
169 u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
174 unsigned int uInActiveCount;
175 u16 wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
176 u16 wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
178 u8 byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
179 u8 byTopCCKBasicRate; //Records the highest basic rate in CCK mode
182 struct sk_buff_head sTxPSQueue;
186 NODE_STATE eNodeState;
190 unsigned long ulLastRxJiffer;
196 unsigned long long KeyRSC;
202 unsigned int uWepKeyLength;
203 u8 abyWepKey[WLAN_WEPMAX_KEYLEN];
205 // Auto rate fallback vars
207 unsigned int uAverageRSSI;
208 unsigned int uRateRecoveryTimeout;
209 unsigned int uRatePollTimeout;
210 unsigned int uTxFailures;
211 unsigned int uTxAttempts;
213 unsigned int uTxRetry;
214 unsigned int uFailureRatio;
215 unsigned int uRetryRatio;
216 unsigned int uTxOk[MAX_RATE+1];
217 unsigned int uTxFail[MAX_RATE+1];
218 unsigned int uTimeCount;
220 } KnownNodeDB, *PKnownNodeDB;
223 PKnownBSS BSSpSearchBSSList(struct vnt_private *, u8 *pbyDesireBSSID,
224 u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType);
226 PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *, u8 *abyBSSID,
227 PWLAN_IE_SSID pSSID);
229 void BSSvClearBSSList(struct vnt_private *, int bKeepCurrBSSID);
231 int BSSbInsertToBSSList(struct vnt_private *,
238 PWLAN_IE_SUPP_RATES pSuppRates,
239 PWLAN_IE_SUPP_RATES pExtSuppRates,
242 PWLAN_IE_RSN_EXT pRSNWPA,
243 PWLAN_IE_COUNTRY pIE_Country,
244 PWLAN_IE_QUIET pIE_Quiet,
247 void *pRxPacketContext);
249 int BSSbUpdateToBSSList(struct vnt_private *,
256 PWLAN_IE_SUPP_RATES pSuppRates,
257 PWLAN_IE_SUPP_RATES pExtSuppRates,
260 PWLAN_IE_RSN_EXT pRSNWPA,
261 PWLAN_IE_COUNTRY pIE_Country,
262 PWLAN_IE_QUIET pIE_Quiet,
266 void *pRxPacketContext);
268 int BSSbIsSTAInNodeDB(struct vnt_private *, u8 * abyDstAddr,
271 void BSSvCreateOneNode(struct vnt_private *, u32 *puNodeIndex);
273 void BSSvUpdateAPNode(struct vnt_private *, u16 *pwCapInfo,
274 PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pExtSuppRates);
276 void BSSvSecondCallBack(struct vnt_private *);
278 void BSSvUpdateNodeTxCounter(struct vnt_private *, PSStatCounter pStatistic,
279 u8 byTSR, u8 byPktNO);
281 void BSSvRemoveOneNode(struct vnt_private *, u32 uNodeIndex);
283 void BSSvAddMulticastNode(struct vnt_private *);
285 void BSSvClearNodeDBTable(struct vnt_private *, u32 uStartIndex);
287 void BSSvClearAnyBSSJoinRecord(struct vnt_private *);
289 #endif /* __BSSDB_H__ */