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.
17 * Purpose: MAC Data structure
28 #include <linux/module.h>
29 #include <linux/types.h>
30 #include <linux/pci.h>
31 #include <linux/etherdevice.h>
32 #include <linux/skbuff.h>
33 #include <linux/interrupt.h>
34 #include <linux/crc32.h>
35 #include <net/mac80211.h>
39 #include "device_cfg.h"
46 /*--------------------- Export Definitions -------------------------*/
62 #define AUTO_FB_NONE 0
72 #define ANT_DIVERSITY 2
75 #define ANT_UNKNOWN 0xFF
77 #define BB_VGA_LEVEL 4
78 #define BB_VGA_CHANGE_THRESHOLD 16
80 #define MAKE_BEACON_RESERVED 10 /* (us) */
84 #define AVAIL_TD(p, q) ((p)->opts.tx_descs[(q)] - ((p)->iTDUsed[(q)]))
86 /* 0:11A 1:11B 2:11G */
91 /* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga (OFDM in BasicRate) */
94 #define PK_TYPE_11GB 2
95 #define PK_TYPE_11GA 3
97 #define OWNED_BY_HOST 0
98 #define OWNED_BY_NIC 1
101 int rx_descs0; /* Number of RX descriptors0 */
102 int rx_descs1; /* Number of RX descriptors1 */
103 int tx_descs[2]; /* Number of TX descriptors 0, 1 */
104 int int_works; /* interrupt limits */
112 struct pci_dev *pcid;
114 struct ieee80211_hw *hw;
115 struct ieee80211_vif *vif;
116 unsigned long key_entry_inuse;
122 /* dma addr, rx/tx pool */
124 dma_addr_t rd0_pool_dma;
125 dma_addr_t rd1_pool_dma;
127 dma_addr_t td0_pool_dma;
128 dma_addr_t td1_pool_dma;
130 dma_addr_t tx_bufs_dma0;
131 dma_addr_t tx_bufs_dma1;
132 dma_addr_t tx_beacon_dma;
134 unsigned char *tx0_bufs;
135 unsigned char *tx1_bufs;
136 unsigned char *tx_beacon_bufs;
138 void __iomem *PortOffset;
142 unsigned char byRxMode;
146 volatile int iTDUsed[TYPE_MAXTD];
148 struct vnt_tx_desc *apCurrTD[TYPE_MAXTD];
149 struct vnt_tx_desc *apTailTD[TYPE_MAXTD];
151 struct vnt_tx_desc *apTD0Rings;
152 struct vnt_tx_desc *apTD1Rings;
154 struct vnt_rx_desc *aRD0Ring;
155 struct vnt_rx_desc *aRD1Ring;
156 struct vnt_rx_desc *pCurrRD[TYPE_MAXRD];
158 struct vnt_options opts;
167 /* Version control */
168 unsigned char byLocalID;
169 unsigned char byRFType;
171 unsigned char byMaxPwrLevel;
172 unsigned char byZoneType;
174 unsigned char byOriginalZonetype;
176 unsigned char abyCurrentNetAddr[ETH_ALEN]; __aligned(2)
177 bool bLinkPass; /* link status: OK or fail */
179 unsigned int uCurrRSSI;
180 unsigned char byCurrSQ;
182 unsigned long dwTxAntennaSel;
183 unsigned long dwRxAntennaSel;
184 unsigned char byAntennaCount;
185 unsigned char byRxAntennaMode;
186 unsigned char byTxAntennaMode;
189 unsigned char *pbyTmpBuff;
190 unsigned int uSIFS; /* Current SIFS */
191 unsigned int uDIFS; /* Current DIFS */
192 unsigned int uEIFS; /* Current EIFS */
193 unsigned int uSlot; /* Current SlotTime */
194 unsigned int uCwMin; /* Current CwMin */
195 unsigned int uCwMax; /* CwMax is fixed on 1023. */
197 unsigned char bySIFS;
198 unsigned char byDIFS;
199 unsigned char byEIFS;
200 unsigned char bySlot;
201 unsigned char byCWMaxMin;
203 u8 byBBType; /* 0:11A, 1:11B, 2:11G */
205 * 0:11a,1:11b,2:11gb (only CCK
206 * in BasicRate), 3:11ga (OFDM in
209 unsigned short wBasicRate;
210 unsigned char byACKRate;
211 unsigned char byTopOFDMBasicRate;
212 unsigned char byTopCCKBasicRate;
214 unsigned char byMinChannel;
215 unsigned char byMaxChannel;
217 unsigned char byPreambleType;
218 unsigned char byShortPreamble;
220 unsigned short wCurrentRate;
221 unsigned char byShortRetryLimit;
222 unsigned char byLongRetryLimit;
223 enum nl80211_iftype op_mode;
225 unsigned short wMaxTransmitMSDULifetime;
227 bool bEncryptionEnable;
232 bool bBarkerPreambleMd;
234 bool bRadioControlOff;
237 unsigned short wListenInterval;
240 /* GPIO Radio Control */
241 unsigned char byRadioCtl;
242 unsigned char byGPIO;
244 bool bPrvActive4RadioOFF;
248 unsigned short wSeqCounter;
249 unsigned short wBCNBufLen;
250 bool bBeaconBufReady;
252 bool bIsBeaconBufReadySet;
253 unsigned int cbBeaconBufReadySetCnt;
259 unsigned char byAutoFBCtrl;
261 /* For Update BaseBand VGA Gain Offset */
263 unsigned int uBBVGADiffCount;
264 unsigned char byBBVGANew;
265 unsigned char byBBVGACurrent;
266 unsigned char abyBBVGA[BB_VGA_LEVEL];
267 long ldBmThreshold[BB_VGA_LEVEL];
269 unsigned char byBBPreEDRSSI;
270 unsigned char byBBPreEDIndex;
272 unsigned long dwDiagRefCount;
275 unsigned char byFOETuning;
277 /* For RF Power table */
278 unsigned char byCCKPwr;
279 unsigned char byOFDMPwrG;
280 unsigned char byCurPwr;
282 unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G + 1];
283 unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL + 1];
284 char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G + 1];
285 char abyOFDMDefaultPwr[CB_MAX_CHANNEL + 1];
286 char abyRegPwr[CB_MAX_CHANNEL + 1];
287 char abyLocalPwr[CB_MAX_CHANNEL + 1];
289 /* BaseBand Loopback Use */
290 unsigned char byBBCR4d;
291 unsigned char byBBCRc9;
292 unsigned char byBBCR88;
293 unsigned char byBBCR09;
295 unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */
297 unsigned short wBeaconInterval;
300 struct work_struct interrupt_work;
302 struct ieee80211_low_level_stats low_stats;