1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
8 * Purpose: MAC Data structure
19 #include <linux/module.h>
20 #include <linux/types.h>
21 #include <linux/pci.h>
22 #include <linux/etherdevice.h>
23 #include <linux/skbuff.h>
24 #include <linux/interrupt.h>
25 #include <linux/crc32.h>
26 #include <net/mac80211.h>
30 #include "device_cfg.h"
37 /*--------------------- Export Definitions -------------------------*/
53 #define AUTO_FB_NONE 0
63 #define ANT_DIVERSITY 2
66 #define ANT_UNKNOWN 0xFF
68 #define BB_VGA_LEVEL 4
69 #define BB_VGA_CHANGE_THRESHOLD 16
71 #define MAKE_BEACON_RESERVED 10 /* (us) */
75 #define AVAIL_TD(p, q) ((p)->opts.tx_descs[(q)] - ((p)->iTDUsed[(q)]))
77 /* 0:11A 1:11B 2:11G */
82 /* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga (OFDM in BasicRate) */
85 #define PK_TYPE_11GB 2
86 #define PK_TYPE_11GA 3
88 #define OWNED_BY_HOST 0
89 #define OWNED_BY_NIC 1
92 int rx_descs0
; /* Number of RX descriptors0 */
93 int rx_descs1
; /* Number of RX descriptors1 */
94 int tx_descs
[2]; /* Number of TX descriptors 0, 1 */
95 int int_works
; /* interrupt limits */
103 struct pci_dev
*pcid
;
105 struct ieee80211_hw
*hw
;
106 struct ieee80211_vif
*vif
;
107 unsigned long key_entry_inuse
;
113 /* dma addr, rx/tx pool */
115 dma_addr_t rd0_pool_dma
;
116 dma_addr_t rd1_pool_dma
;
118 dma_addr_t td0_pool_dma
;
119 dma_addr_t td1_pool_dma
;
121 dma_addr_t tx_bufs_dma0
;
122 dma_addr_t tx_bufs_dma1
;
123 dma_addr_t tx_beacon_dma
;
125 unsigned char *tx0_bufs
;
126 unsigned char *tx1_bufs
;
127 unsigned char *tx_beacon_bufs
;
129 void __iomem
*PortOffset
;
133 unsigned char byRxMode
;
137 volatile int iTDUsed
[TYPE_MAXTD
];
139 struct vnt_tx_desc
*apCurrTD
[TYPE_MAXTD
];
140 struct vnt_tx_desc
*apTailTD
[TYPE_MAXTD
];
142 struct vnt_tx_desc
*apTD0Rings
;
143 struct vnt_tx_desc
*apTD1Rings
;
145 struct vnt_rx_desc
*aRD0Ring
;
146 struct vnt_rx_desc
*aRD1Ring
;
147 struct vnt_rx_desc
*pCurrRD
[TYPE_MAXRD
];
149 struct vnt_options opts
;
158 /* Version control */
159 unsigned char byLocalID
;
160 unsigned char byRFType
;
162 unsigned char byMaxPwrLevel
;
163 unsigned char byZoneType
;
165 unsigned char byOriginalZonetype
;
167 unsigned char abyCurrentNetAddr
[ETH_ALEN
]; __aligned(2)
168 bool bLinkPass
; /* link status: OK or fail */
170 unsigned int uCurrRSSI
;
171 unsigned char byCurrSQ
;
173 unsigned long dwTxAntennaSel
;
174 unsigned long dwRxAntennaSel
;
175 unsigned char byAntennaCount
;
176 unsigned char byRxAntennaMode
;
177 unsigned char byTxAntennaMode
;
180 unsigned char *pbyTmpBuff
;
181 unsigned int uSIFS
; /* Current SIFS */
182 unsigned int uDIFS
; /* Current DIFS */
183 unsigned int uEIFS
; /* Current EIFS */
184 unsigned int uSlot
; /* Current SlotTime */
185 unsigned int uCwMin
; /* Current CwMin */
186 unsigned int uCwMax
; /* CwMax is fixed on 1023. */
188 unsigned char bySIFS
;
189 unsigned char byDIFS
;
190 unsigned char byEIFS
;
191 unsigned char bySlot
;
192 unsigned char byCWMaxMin
;
194 u8 byBBType
; /* 0:11A, 1:11B, 2:11G */
196 * 0:11a,1:11b,2:11gb (only CCK
197 * in BasicRate), 3:11ga (OFDM in
200 unsigned short wBasicRate
;
201 unsigned char byACKRate
;
202 unsigned char byTopOFDMBasicRate
;
203 unsigned char byTopCCKBasicRate
;
205 unsigned char byMinChannel
;
206 unsigned char byMaxChannel
;
208 unsigned char byPreambleType
;
209 unsigned char byShortPreamble
;
211 unsigned short wCurrentRate
;
212 unsigned char byShortRetryLimit
;
213 unsigned char byLongRetryLimit
;
214 enum nl80211_iftype op_mode
;
216 unsigned short wMaxTransmitMSDULifetime
;
218 bool bEncryptionEnable
;
223 bool bBarkerPreambleMd
;
225 bool bRadioControlOff
;
228 unsigned short wListenInterval
;
231 /* GPIO Radio Control */
232 unsigned char byRadioCtl
;
233 unsigned char byGPIO
;
235 bool bPrvActive4RadioOFF
;
239 unsigned short wSeqCounter
;
240 unsigned short wBCNBufLen
;
241 bool bBeaconBufReady
;
243 bool bIsBeaconBufReadySet
;
244 unsigned int cbBeaconBufReadySetCnt
;
250 unsigned char byAutoFBCtrl
;
252 /* For Update BaseBand VGA Gain Offset */
254 unsigned int uBBVGADiffCount
;
255 unsigned char byBBVGANew
;
256 unsigned char byBBVGACurrent
;
257 unsigned char abyBBVGA
[BB_VGA_LEVEL
];
258 long ldBmThreshold
[BB_VGA_LEVEL
];
260 unsigned char byBBPreEDRSSI
;
261 unsigned char byBBPreEDIndex
;
263 unsigned long dwDiagRefCount
;
266 unsigned char byFOETuning
;
268 /* For RF Power table */
269 unsigned char byCCKPwr
;
270 unsigned char byOFDMPwrG
;
271 unsigned char byCurPwr
;
273 unsigned char abyCCKPwrTbl
[CB_MAX_CHANNEL_24G
+ 1];
274 unsigned char abyOFDMPwrTbl
[CB_MAX_CHANNEL
+ 1];
275 char abyCCKDefaultPwr
[CB_MAX_CHANNEL_24G
+ 1];
276 char abyOFDMDefaultPwr
[CB_MAX_CHANNEL
+ 1];
277 char abyRegPwr
[CB_MAX_CHANNEL
+ 1];
278 char abyLocalPwr
[CB_MAX_CHANNEL
+ 1];
280 /* BaseBand Loopback Use */
281 unsigned char byBBCR4d
;
282 unsigned char byBBCRc9
;
283 unsigned char byBBCR88
;
284 unsigned char byBBCR09
;
286 unsigned char abyEEPROM
[EEP_MAX_CONTEXT_SIZE
]; /* unsigned long alignment */
288 unsigned short wBeaconInterval
;
291 struct work_struct interrupt_work
;
293 struct ieee80211_low_level_stats low_stats
;