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.
21 * Purpose: MAC Data structure
32 #include <linux/module.h>
33 #include <linux/types.h>
34 #include <linux/pci.h>
35 #include <linux/etherdevice.h>
36 #include <linux/skbuff.h>
37 #include <linux/interrupt.h>
38 #include <linux/crc32.h>
39 #include <net/mac80211.h>
43 #include "device_cfg.h"
50 /*--------------------- Export Definitions -------------------------*/
66 #define AUTO_FB_NONE 0
76 #define ANT_DIVERSITY 2
79 #define ANT_UNKNOWN 0xFF
81 #define BB_VGA_LEVEL 4
82 #define BB_VGA_CHANGE_THRESHOLD 16
84 #define MAKE_BEACON_RESERVED 10 /* (us) */
88 #define AVAIL_TD(p, q) ((p)->opts.tx_descs[(q)] - ((p)->iTDUsed[(q)]))
90 /* 0:11A 1:11B 2:11G */
95 /* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga (OFDM in BasicRate) */
98 #define PK_TYPE_11GB 2
99 #define PK_TYPE_11GA 3
101 #define OWNED_BY_HOST 0
102 #define OWNED_BY_NIC 1
105 int rx_descs0
; /* Number of RX descriptors0 */
106 int rx_descs1
; /* Number of RX descriptors1 */
107 int tx_descs
[2]; /* Number of TX descriptors 0, 1 */
108 int int_works
; /* interrupt limits */
116 struct pci_dev
*pcid
;
118 struct ieee80211_hw
*hw
;
119 struct ieee80211_vif
*vif
;
120 unsigned long key_entry_inuse
;
126 /* dma addr, rx/tx pool */
128 dma_addr_t rd0_pool_dma
;
129 dma_addr_t rd1_pool_dma
;
131 dma_addr_t td0_pool_dma
;
132 dma_addr_t td1_pool_dma
;
134 dma_addr_t tx_bufs_dma0
;
135 dma_addr_t tx_bufs_dma1
;
136 dma_addr_t tx_beacon_dma
;
138 unsigned char *tx0_bufs
;
139 unsigned char *tx1_bufs
;
140 unsigned char *tx_beacon_bufs
;
142 void __iomem
*PortOffset
;
146 unsigned char byRxMode
;
150 volatile int iTDUsed
[TYPE_MAXTD
];
152 struct vnt_tx_desc
*apCurrTD
[TYPE_MAXTD
];
153 struct vnt_tx_desc
*apTailTD
[TYPE_MAXTD
];
155 struct vnt_tx_desc
*apTD0Rings
;
156 struct vnt_tx_desc
*apTD1Rings
;
158 struct vnt_rx_desc
*aRD0Ring
;
159 struct vnt_rx_desc
*aRD1Ring
;
160 struct vnt_rx_desc
*pCurrRD
[TYPE_MAXRD
];
162 struct vnt_options opts
;
171 /* Version control */
172 unsigned char byLocalID
;
173 unsigned char byRFType
;
175 unsigned char byMaxPwrLevel
;
176 unsigned char byZoneType
;
178 unsigned char byOriginalZonetype
;
180 unsigned char abyCurrentNetAddr
[ETH_ALEN
]; __aligned(2)
181 bool bLinkPass
; /* link status: OK or fail */
183 unsigned int uCurrRSSI
;
184 unsigned char byCurrSQ
;
186 unsigned long dwTxAntennaSel
;
187 unsigned long dwRxAntennaSel
;
188 unsigned char byAntennaCount
;
189 unsigned char byRxAntennaMode
;
190 unsigned char byTxAntennaMode
;
193 unsigned char *pbyTmpBuff
;
194 unsigned int uSIFS
; /* Current SIFS */
195 unsigned int uDIFS
; /* Current DIFS */
196 unsigned int uEIFS
; /* Current EIFS */
197 unsigned int uSlot
; /* Current SlotTime */
198 unsigned int uCwMin
; /* Current CwMin */
199 unsigned int uCwMax
; /* CwMax is fixed on 1023. */
201 unsigned char bySIFS
;
202 unsigned char byDIFS
;
203 unsigned char byEIFS
;
204 unsigned char bySlot
;
205 unsigned char byCWMaxMin
;
207 u8 byBBType
; /* 0:11A, 1:11B, 2:11G */
209 * 0:11a,1:11b,2:11gb (only CCK
210 * in BasicRate), 3:11ga (OFDM in
213 unsigned short wBasicRate
;
214 unsigned char byACKRate
;
215 unsigned char byTopOFDMBasicRate
;
216 unsigned char byTopCCKBasicRate
;
218 unsigned char byMinChannel
;
219 unsigned char byMaxChannel
;
221 unsigned char byPreambleType
;
222 unsigned char byShortPreamble
;
224 unsigned short wCurrentRate
;
225 unsigned char byShortRetryLimit
;
226 unsigned char byLongRetryLimit
;
227 enum nl80211_iftype op_mode
;
229 unsigned short wMaxTransmitMSDULifetime
;
231 bool bEncryptionEnable
;
236 bool bBarkerPreambleMd
;
238 bool bRadioControlOff
;
241 unsigned short wListenInterval
;
244 /* GPIO Radio Control */
245 unsigned char byRadioCtl
;
246 unsigned char byGPIO
;
248 bool bPrvActive4RadioOFF
;
252 unsigned short wSeqCounter
;
253 unsigned short wBCNBufLen
;
254 bool bBeaconBufReady
;
256 bool bIsBeaconBufReadySet
;
257 unsigned int cbBeaconBufReadySetCnt
;
263 unsigned char byAutoFBCtrl
;
265 /* For Update BaseBand VGA Gain Offset */
267 unsigned int uBBVGADiffCount
;
268 unsigned char byBBVGANew
;
269 unsigned char byBBVGACurrent
;
270 unsigned char abyBBVGA
[BB_VGA_LEVEL
];
271 long ldBmThreshold
[BB_VGA_LEVEL
];
273 unsigned char byBBPreEDRSSI
;
274 unsigned char byBBPreEDIndex
;
276 unsigned long dwDiagRefCount
;
279 unsigned char byFOETuning
;
281 /* For RF Power table */
282 unsigned char byCCKPwr
;
283 unsigned char byOFDMPwrG
;
284 unsigned char byCurPwr
;
286 unsigned char abyCCKPwrTbl
[CB_MAX_CHANNEL_24G
+1];
287 unsigned char abyOFDMPwrTbl
[CB_MAX_CHANNEL
+1];
288 char abyCCKDefaultPwr
[CB_MAX_CHANNEL_24G
+1];
289 char abyOFDMDefaultPwr
[CB_MAX_CHANNEL
+1];
290 char abyRegPwr
[CB_MAX_CHANNEL
+1];
291 char abyLocalPwr
[CB_MAX_CHANNEL
+1];
293 /* BaseBand Loopback Use */
294 unsigned char byBBCR4d
;
295 unsigned char byBBCRc9
;
296 unsigned char byBBCR88
;
297 unsigned char byBBCR09
;
299 unsigned char abyEEPROM
[EEP_MAX_CONTEXT_SIZE
]; /* unsigned long alignment */
301 unsigned short wBeaconInterval
;
304 struct work_struct interrupt_work
;
306 struct ieee80211_low_level_stats low_stats
;