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>
39 #define MAX_NODE_NUM 64
40 #define MAX_BSS_NUM 42
41 #define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */
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
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
50 #define RSSI_STAT_COUNT 10
51 #define MAX_CHECK_RSSI_COUNT 8
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
65 #define MAX_WPA_IE_LEN 64
68 // IEEE 802.11 Structures and definitions
71 typedef struct tagSERPObject {
74 } ERPObject, *PERPObject;
76 typedef struct tagSRSNCapObject {
79 } SRSNCapObject, *PSRSNCapObject;
82 typedef struct tagKnownBSS {
85 u8 abyBSSID[WLAN_BSSID_LEN];
86 unsigned int uChannel;
87 u8 abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
88 u8 abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
93 u8 abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
99 signed long ldBmAverage[RSSI_STAT_COUNT];
100 signed long ldBmAverRange;
101 //For any BSSID selection improvment
104 //++ WPA informations
115 //++ WPA2 informations
121 u8 abyAKMSSAuthType[4];
124 u8 byWPAIE[MAX_WPA_IE_LEN];
125 u8 byRSNIE[MAX_WPA_IE_LEN];
130 unsigned int uClearCount;
131 // u8 abyIEs[WLAN_BEACON_FR_MAXLEN];
132 unsigned int uIELength;
134 u64 qwLocalTSF;/* local TSF timer */
136 CARD_PHY_TYPE eNetworkTypeInUse;
139 SRSNCapObject sRSNCapObj;
140 u8 abyIEs[1024]; // don't move this field !!
142 } __attribute__ ((__packed__))
143 KnownBSS , *PKnownBSS;
145 typedef enum tagNODE_STATE {
151 } NODE_STATE, *PNODE_STATE;
154 typedef struct tagKnownNodeDB {
157 u8 abyMACAddr[WLAN_ADDR_LEN];
158 u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
159 u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
164 unsigned int uInActiveCount;
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.
168 u8 byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
169 u8 byTopCCKBasicRate; //Records the highest basic rate in CCK mode
172 struct sk_buff_head sTxPSQueue;
176 NODE_STATE eNodeState;
180 unsigned long ulLastRxJiffer;
186 unsigned long long KeyRSC;
192 unsigned int uWepKeyLength;
193 u8 abyWepKey[WLAN_WEPMAX_KEYLEN];
195 // Auto rate fallback vars
197 unsigned int uAverageRSSI;
198 unsigned int uRateRecoveryTimeout;
199 unsigned int uRatePollTimeout;
200 unsigned int uTxFailures;
201 unsigned int uTxAttempts;
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;
210 } KnownNodeDB, *PKnownNodeDB;
212 PKnownBSS BSSpSearchBSSList(struct vnt_private *, u8 *pbyDesireBSSID,
213 u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType);
215 PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *, u8 *abyBSSID,
216 PWLAN_IE_SSID pSSID);
218 void BSSvClearBSSList(struct vnt_private *, int bKeepCurrBSSID);
220 int BSSbInsertToBSSList(struct vnt_private *,
227 PWLAN_IE_SUPP_RATES pSuppRates,
228 PWLAN_IE_SUPP_RATES pExtSuppRates,
231 PWLAN_IE_RSN_EXT pRSNWPA,
232 PWLAN_IE_COUNTRY pIE_Country,
233 PWLAN_IE_QUIET pIE_Quiet,
236 void *pRxPacketContext);
238 int BSSbUpdateToBSSList(struct vnt_private *,
245 PWLAN_IE_SUPP_RATES pSuppRates,
246 PWLAN_IE_SUPP_RATES pExtSuppRates,
249 PWLAN_IE_RSN_EXT pRSNWPA,
250 PWLAN_IE_COUNTRY pIE_Country,
251 PWLAN_IE_QUIET pIE_Quiet,
255 void *pRxPacketContext);
257 int BSSbIsSTAInNodeDB(struct vnt_private *, u8 * abyDstAddr,
260 void BSSvCreateOneNode(struct vnt_private *, u32 *puNodeIndex);
262 void BSSvUpdateAPNode(struct vnt_private *, u16 *pwCapInfo,
263 PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pExtSuppRates);
265 void BSSvSecondCallBack(struct vnt_private *);
267 void BSSvUpdateNodeTxCounter(struct vnt_private *, PSStatCounter pStatistic,
268 u8 byTSR, u8 byPktNO);
270 void BSSvRemoveOneNode(struct vnt_private *, u32 uNodeIndex);
272 void BSSvAddMulticastNode(struct vnt_private *);
274 void BSSvClearNodeDBTable(struct vnt_private *, u32 uStartIndex);
276 void BSSvClearAnyBSSJoinRecord(struct vnt_private *);
278 #endif /* __BSSDB_H__ */