1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
6 * Purpose: MAC Data structure
17 #include <linux/module.h>
18 #include <linux/types.h>
19 #include <linux/pci.h>
20 #include <linux/etherdevice.h>
21 #include <linux/skbuff.h>
22 #include <linux/interrupt.h>
23 #include <linux/crc32.h>
24 #include <net/mac80211.h>
28 #include "device_cfg.h"
35 /*--------------------- Export Definitions -------------------------*/
51 #define AUTO_FB_NONE 0
61 #define ANT_DIVERSITY 2
64 #define ANT_UNKNOWN 0xFF
66 #define BB_VGA_LEVEL 4
67 #define BB_VGA_CHANGE_THRESHOLD 16
69 #define MAKE_BEACON_RESERVED 10 /* (us) */
73 #define AVAIL_TD(p, q) ((p)->opts.tx_descs[(q)] - ((p)->iTDUsed[(q)]))
75 /* 0:11A 1:11B 2:11G */
80 /* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga (OFDM in BasicRate) */
83 #define PK_TYPE_11GB 2
84 #define PK_TYPE_11GA 3
86 #define OWNED_BY_HOST 0
87 #define OWNED_BY_NIC 1
90 int rx_descs0; /* Number of RX descriptors0 */
91 int rx_descs1; /* Number of RX descriptors1 */
92 int tx_descs[2]; /* Number of TX descriptors 0, 1 */
93 int int_works; /* interrupt limits */
101 struct pci_dev *pcid;
103 struct ieee80211_hw *hw;
104 struct ieee80211_vif *vif;
105 unsigned long key_entry_inuse;
111 /* dma addr, rx/tx pool */
113 dma_addr_t rd0_pool_dma;
114 dma_addr_t rd1_pool_dma;
116 dma_addr_t td0_pool_dma;
117 dma_addr_t td1_pool_dma;
119 dma_addr_t tx_bufs_dma0;
120 dma_addr_t tx_bufs_dma1;
121 dma_addr_t tx_beacon_dma;
123 unsigned char *tx0_bufs;
124 unsigned char *tx1_bufs;
125 unsigned char *tx_beacon_bufs;
127 void __iomem *port_offset;
133 volatile int iTDUsed[TYPE_MAXTD];
135 struct vnt_tx_desc *apCurrTD[TYPE_MAXTD];
136 struct vnt_tx_desc *tail_td[TYPE_MAXTD];
138 struct vnt_tx_desc *apTD0Rings;
139 struct vnt_tx_desc *apTD1Rings;
141 struct vnt_rx_desc *aRD0Ring;
142 struct vnt_rx_desc *aRD1Ring;
143 struct vnt_rx_desc *pCurrRD[TYPE_MAXRD];
145 struct vnt_options opts;
154 /* Version control */
155 unsigned char local_id;
156 unsigned char rf_type;
158 unsigned char max_pwr_level;
159 unsigned char byZoneType;
161 unsigned char byOriginalZonetype;
163 unsigned char abyCurrentNetAddr[ETH_ALEN]; __aligned(2)
164 bool bLinkPass; /* link status: OK or fail */
166 unsigned int current_rssi;
167 unsigned char byCurrSQ;
169 unsigned long dwTxAntennaSel;
170 unsigned long dwRxAntennaSel;
171 unsigned char byAntennaCount;
172 unsigned char byRxAntennaMode;
173 unsigned char byTxAntennaMode;
176 unsigned char *pbyTmpBuff;
177 unsigned int uSIFS; /* Current SIFS */
178 unsigned int uDIFS; /* Current DIFS */
179 unsigned int uEIFS; /* Current EIFS */
180 unsigned int uSlot; /* Current SlotTime */
181 unsigned int uCwMin; /* Current CwMin */
182 unsigned int uCwMax; /* CwMax is fixed on 1023. */
188 unsigned char cw_max_min;
190 u8 byBBType; /* 0:11A, 1:11B, 2:11G */
192 * 0:11a,1:11b,2:11gb (only CCK
193 * in BasicRate), 3:11ga (OFDM in
196 unsigned short wBasicRate;
197 unsigned char byACKRate;
198 unsigned char byTopOFDMBasicRate;
199 unsigned char byTopCCKBasicRate;
201 unsigned char byMinChannel;
202 unsigned char byMaxChannel;
204 unsigned char preamble_type;
205 unsigned char byShortPreamble;
207 unsigned short wCurrentRate;
208 unsigned char byShortRetryLimit;
209 unsigned char byLongRetryLimit;
210 enum nl80211_iftype op_mode;
212 unsigned short wMaxTransmitMSDULifetime;
214 bool bEncryptionEnable;
216 bool short_slot_time;
219 bool bBarkerPreambleMd;
221 bool bRadioControlOff;
224 unsigned short wListenInterval;
227 /* GPIO Radio Control */
228 unsigned char byRadioCtl;
229 unsigned char byGPIO;
231 bool bPrvActive4RadioOFF;
235 unsigned short wSeqCounter;
236 unsigned short wBCNBufLen;
237 bool bBeaconBufReady;
239 bool bIsBeaconBufReadySet;
240 unsigned int cbBeaconBufReadySetCnt;
246 unsigned char byAutoFBCtrl;
248 /* For Update BaseBand VGA Gain Offset */
250 unsigned int uBBVGADiffCount;
251 unsigned char bbvga_new;
252 unsigned char bbvga_current;
253 unsigned char bbvga[BB_VGA_LEVEL];
254 long dbm_threshold[BB_VGA_LEVEL];
256 unsigned char bb_pre_edrssi;
257 unsigned char byBBPreEDIndex;
259 unsigned long dwDiagRefCount;
262 unsigned char byFOETuning;
264 /* For RF Power table */
265 unsigned char byCCKPwr;
266 unsigned char byOFDMPwrG;
267 unsigned char cur_pwr;
269 unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G + 1];
270 unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL + 1];
271 char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G + 1];
272 char abyOFDMDefaultPwr[CB_MAX_CHANNEL + 1];
273 char abyRegPwr[CB_MAX_CHANNEL + 1];
274 char abyLocalPwr[CB_MAX_CHANNEL + 1];
276 /* BaseBand Loopback Use */
277 unsigned char byBBCR4d;
278 unsigned char byBBCRc9;
279 unsigned char byBBCR88;
280 unsigned char byBBCR09;
282 unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */
284 unsigned short beacon_interval;
287 struct work_struct interrupt_work;
289 struct ieee80211_low_level_stats low_stats;