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>
38 #define MAX_NODE_NUM 64
39 #define MAX_BSS_NUM 42
40 #define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */
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
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
49 #define RSSI_STAT_COUNT 10
50 #define MAX_CHECK_RSSI_COUNT 8
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
64 #define MAX_WPA_IE_LEN 64
67 // IEEE 802.11 Structures and definitions
70 typedef struct tagSERPObject
{
73 } ERPObject
, *PERPObject
;
75 typedef struct tagSRSNCapObject
{
78 } SRSNCapObject
, *PSRSNCapObject
;
81 typedef struct tagKnownBSS
{
84 u8 abyBSSID
[WLAN_BSSID_LEN
];
85 unsigned int uChannel
;
86 u8 abySuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
87 u8 abyExtSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
92 u8 abySSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
98 signed long ldBmAverage
[RSSI_STAT_COUNT
];
99 signed long ldBmAverRange
;
100 //For any BSSID selection improvment
103 //++ WPA informations
114 //++ WPA2 informations
120 u8 abyAKMSSAuthType
[4];
123 u8 byWPAIE
[MAX_WPA_IE_LEN
];
124 u8 byRSNIE
[MAX_WPA_IE_LEN
];
129 unsigned int uClearCount
;
130 // u8 abyIEs[WLAN_BEACON_FR_MAXLEN];
131 unsigned int uIELength
;
133 u64 qwLocalTSF
;/* local TSF timer */
135 CARD_PHY_TYPE eNetworkTypeInUse
;
138 SRSNCapObject sRSNCapObj
;
139 u8 abyIEs
[1024]; // don't move this field !!
141 } __attribute__ ((__packed__
))
142 KnownBSS
, *PKnownBSS
;
144 typedef enum tagNODE_STATE
{
150 } NODE_STATE
, *PNODE_STATE
;
153 typedef struct tagKnownNodeDB
{
156 u8 abyMACAddr
[WLAN_ADDR_LEN
];
157 u8 abyCurrSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
];
158 u8 abyCurrExtSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
];
163 unsigned int uInActiveCount
;
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.
167 u8 byTopOFDMBasicRate
;//Records the highest basic rate in OFDM mode
168 u8 byTopCCKBasicRate
; //Records the highest basic rate in CCK mode
171 struct sk_buff_head sTxPSQueue
;
175 NODE_STATE eNodeState
;
179 unsigned long ulLastRxJiffer
;
185 unsigned long long KeyRSC
;
191 unsigned int uWepKeyLength
;
192 u8 abyWepKey
[WLAN_WEPMAX_KEYLEN
];
194 // Auto rate fallback vars
196 unsigned int uAverageRSSI
;
197 unsigned int uRateRecoveryTimeout
;
198 unsigned int uRatePollTimeout
;
199 unsigned int uTxFailures
;
200 unsigned int uTxAttempts
;
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
;
209 } KnownNodeDB
, *PKnownNodeDB
;
211 PKnownBSS
BSSpSearchBSSList(struct vnt_private
*, u8
*pbyDesireBSSID
,
212 u8
*pbyDesireSSID
, CARD_PHY_TYPE ePhyType
);
214 PKnownBSS
BSSpAddrIsInBSSList(struct vnt_private
*, u8
*abyBSSID
,
215 PWLAN_IE_SSID pSSID
);
217 void BSSvClearBSSList(struct vnt_private
*, int bKeepCurrBSSID
);
219 int BSSbInsertToBSSList(struct vnt_private
*,
226 PWLAN_IE_SUPP_RATES pSuppRates
,
227 PWLAN_IE_SUPP_RATES pExtSuppRates
,
230 PWLAN_IE_RSN_EXT pRSNWPA
,
231 PWLAN_IE_COUNTRY pIE_Country
,
232 PWLAN_IE_QUIET pIE_Quiet
,
235 void *pRxPacketContext
);
237 int BSSbUpdateToBSSList(struct vnt_private
*,
244 PWLAN_IE_SUPP_RATES pSuppRates
,
245 PWLAN_IE_SUPP_RATES pExtSuppRates
,
248 PWLAN_IE_RSN_EXT pRSNWPA
,
249 PWLAN_IE_COUNTRY pIE_Country
,
250 PWLAN_IE_QUIET pIE_Quiet
,
254 void *pRxPacketContext
);
256 int BSSbIsSTAInNodeDB(struct vnt_private
*, u8
* abyDstAddr
,
259 void BSSvCreateOneNode(struct vnt_private
*, u32
*puNodeIndex
);
261 void BSSvUpdateAPNode(struct vnt_private
*, u16
*pwCapInfo
,
262 PWLAN_IE_SUPP_RATES pItemRates
, PWLAN_IE_SUPP_RATES pExtSuppRates
);
264 void BSSvSecondCallBack(struct work_struct
*work
);
266 void BSSvUpdateNodeTxCounter(struct vnt_private
*, u8 byTSR
, u8 byPktNO
);
268 void BSSvRemoveOneNode(struct vnt_private
*, u32 uNodeIndex
);
270 void BSSvAddMulticastNode(struct vnt_private
*);
272 void BSSvClearNodeDBTable(struct vnt_private
*, u32 uStartIndex
);
274 void BSSvClearAnyBSSJoinRecord(struct vnt_private
*);
276 #endif /* __BSSDB_H__ */