alistair23-linux/drivers/staging/vt6655/device.h

752 lines
20 KiB
C
Raw Normal View History

/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* File: device.h
*
* Purpose: MAC Data structure
*
* Author: Tevin Chen
*
* Date: Mar 17, 1997
*
*/
#ifndef __DEVICE_H__
#define __DEVICE_H__
#include <linux/module.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/string.h>
#include <linux/wait.h>
#include <linux/if_arp.h>
#include <linux/sched.h>
#include <linux/io.h>
#include <linux/if.h>
#include <linux/crc32.h>
#include <linux/uaccess.h>
#include <linux/proc_fs.h>
#include <linux/inetdevice.h>
#include <linux/reboot.h>
#include <linux/ethtool.h>
/* Include Wireless Extension definition and check version - Jean II */
#include <net/mac80211.h>
#include <linux/wireless.h>
#include <net/iw_handler.h> /* New driver API */
#ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
#define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
#endif
/* device specific */
#include "device_cfg.h"
#include "ttype.h"
#include "80211hdr.h"
#include "tether.h"
#include "wmgr.h"
#include "wcmd.h"
#include "mib.h"
#include "srom.h"
#include "rc4.h"
#include "desc.h"
#include "key.h"
#include "mac.h"
/*--------------------- Export Definitions -------------------------*/
#define MAC_MAX_CONTEXT_REG (256+128)
#define MAX_MULTICAST_ADDRESS_NUM 32
#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN)
#define DUPLICATE_RX_CACHE_LENGTH 5
#define NUM_KEY_ENTRY 11
#define TX_WEP_NONE 0
#define TX_WEP_OTF 1
#define TX_WEP_SW 2
#define TX_WEP_SWOTP 3
#define TX_WEP_OTPSW 4
#define TX_WEP_SW232 5
#define KEYSEL_WEP40 0
#define KEYSEL_WEP104 1
#define KEYSEL_TKIP 2
#define KEYSEL_CCMP 3
#define AUTO_FB_NONE 0
#define AUTO_FB_0 1
#define AUTO_FB_1 2
#define FB_RATE0 0
#define FB_RATE1 1
/* Antenna Mode */
#define ANT_A 0
#define ANT_B 1
#define ANT_DIVERSITY 2
#define ANT_RXD_TXA 3
#define ANT_RXD_TXB 4
#define ANT_UNKNOWN 0xFF
#define MAXCHECKHANGCNT 4
#define BB_VGA_LEVEL 4
#define BB_VGA_CHANGE_THRESHOLD 16
#ifndef RUN_AT
#define RUN_AT(x) (jiffies+(x))
#endif
/* DMA related */
#define RESERV_AC0DMA 4
/* BUILD OBJ mode */
#define AVAIL_TD(p, q) ((p)->sOpts.nTxDescs[(q)] - ((p)->iTDUsed[(q)]))
#define NUM 64
#define PRIVATE_Message 0
/*--------------------- Export Types ------------------------------*/
#define PRINT_K(p, args...) \
do { \
if (PRIVATE_Message) \
printk(p, ##args); \
} while (0)
/* 0:11A 1:11B 2:11G */
typedef enum _VIA_BB_TYPE
{
BB_TYPE_11A = 0,
BB_TYPE_11B,
BB_TYPE_11G
} VIA_BB_TYPE, *PVIA_BB_TYPE;
/* 0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate) */
typedef enum _VIA_PKT_TYPE
{
PK_TYPE_11A = 0,
PK_TYPE_11B,
PK_TYPE_11GB,
PK_TYPE_11GA
} VIA_PKT_TYPE, *PVIA_PKT_TYPE;
typedef enum __device_msg_level {
MSG_LEVEL_ERR = 0, /* Errors that will cause abnormal operation. */
MSG_LEVEL_NOTICE = 1, /* Some errors need users to be notified. */
MSG_LEVEL_INFO = 2, /* Normal message. */
MSG_LEVEL_VERBOSE = 3, /* Will report all trival errors. */
MSG_LEVEL_DEBUG = 4 /* Only for debug purpose. */
} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
/* NDIS related */
#define MAX_BSSIDINFO_4_PMKID 16
#define MAX_PMKIDLIST 5
/* Flags for PMKID Candidate list structure */
#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
/* PMKID Structures */
typedef unsigned char NDIS_802_11_PMKID_VALUE[16];
typedef enum _NDIS_802_11_WEP_STATUS {
Ndis802_11WEPEnabled,
Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
Ndis802_11WEPDisabled,
Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
Ndis802_11WEPKeyAbsent,
Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
Ndis802_11WEPNotSupported,
Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
Ndis802_11Encryption2Enabled,
Ndis802_11Encryption2KeyAbsent,
Ndis802_11Encryption3Enabled,
Ndis802_11Encryption3KeyAbsent
} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
typedef enum _NDIS_802_11_STATUS_TYPE {
Ndis802_11StatusType_Authentication,
Ndis802_11StatusType_MediaStreamMode,
Ndis802_11StatusType_PMKID_CandidateList,
Ndis802_11StatusTypeMax /* defined as an upper bound */
} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
/* Added new types for PMKID Candidate lists. */
struct pmkid_candidate {
NDIS_802_11_MAC_ADDRESS BSSID;
unsigned long Flags;
};
typedef struct _BSSID_INFO {
NDIS_802_11_MAC_ADDRESS BSSID;
NDIS_802_11_PMKID_VALUE PMKID;
} BSSID_INFO, *PBSSID_INFO;
typedef struct tagSPMKID {
unsigned long Length;
unsigned long BSSIDInfoCount;
BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
} SPMKID, *PSPMKID;
typedef struct tagSPMKIDCandidateEvent {
NDIS_802_11_STATUS_TYPE StatusType;
unsigned long Version; /* Version of the structure */
unsigned long NumCandidates; /* No. of pmkid candidates */
struct pmkid_candidate CandidateList[MAX_PMKIDLIST];
} SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
/* 802.11h related */
#define MAX_QUIET_COUNT 8
typedef struct tagSQuietControl {
bool bEnable;
unsigned long dwStartTime;
unsigned char byPeriod;
unsigned short wDuration;
} SQuietControl, *PSQuietControl;
typedef struct __chip_info_tbl {
CHIP_TYPE chip_id;
char *name;
int io_size;
int nTxQueue;
u32 flags;
} CHIP_INFO, *PCHIP_INFO;
typedef enum {
OWNED_BY_HOST = 0,
OWNED_BY_NIC = 1
} DEVICE_OWNER_TYPE, *PDEVICE_OWNER_TYPE;
/* The receive duplicate detection cache entry */
typedef struct tagSCacheEntry {
unsigned short wFmSequence;
unsigned char abyAddr2[ETH_ALEN];
} SCacheEntry, *PSCacheEntry;
typedef struct tagSCache {
/* The receive cache is updated circularly. The next entry to be written is
* indexed by the "InPtr".
*/
unsigned int uInPtr; /* Place to use next */
SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
} SCache, *PSCache;
#define CB_MAX_RX_FRAG 64
/* DeFragment Control Block, used for collecting fragments prior to reassembly */
typedef struct tagSDeFragControlBlock {
unsigned short wSequence;
unsigned short wFragNum;
unsigned char abyAddr2[ETH_ALEN];
unsigned int uLifetime;
struct sk_buff *skb;
unsigned char *pbyRxBuffer;
unsigned int cbFrameLength;
bool bInUse;
} SDeFragControlBlock, *PSDeFragControlBlock;
/* flags for options */
#define DEVICE_FLAGS_IP_ALIGN 0x00000001UL
#define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL
#define DEVICE_FLAGS_OP_MODE 0x00000004UL
#define DEVICE_FLAGS_PS_MODE 0x00000008UL
#define DEVICE_FLAGS_80211h_MODE 0x00000010UL
#define DEVICE_FLAGS_DiversityANT 0x00000020UL
/* flags for driver status */
#define DEVICE_FLAGS_OPENED 0x00010000UL
#define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL
/* flags for capabilities */
#define DEVICE_FLAGS_TX_ALIGN 0x01000000UL
#define DEVICE_FLAGS_HAVE_CAM 0x02000000UL
#define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL
/* flags for MII status */
#define DEVICE_LINK_FAIL 0x00000001UL
#define DEVICE_SPEED_10 0x00000002UL
#define DEVICE_SPEED_100 0x00000004UL
#define DEVICE_SPEED_1000 0x00000008UL
#define DEVICE_DUPLEX_FULL 0x00000010UL
#define DEVICE_AUTONEG_ENABLE 0x00000020UL
#define DEVICE_FORCED_BY_EEPROM 0x00000040UL
/* for device_set_media_duplex */
#define DEVICE_LINK_CHANGE 0x00000001UL
typedef struct __device_opt {
int nRxDescs0; /* Number of RX descriptors0 */
int nRxDescs1; /* Number of RX descriptors1 */
int nTxDescs[2]; /* Number of TX descriptors 0, 1 */
int int_works; /* interrupt limits */
int rts_thresh; /* rts threshold */
int frag_thresh;
int data_rate;
int channel_num;
int short_retry;
int long_retry;
int bbp_type;
u32 flags;
} OPTIONS, *POPTIONS;
struct vnt_private {
struct pci_dev *pcid;
/* mac80211 */
struct ieee80211_hw *hw;
struct ieee80211_vif *vif;
unsigned long key_entry_inuse;
/* netdev */
struct net_device *dev;
/* dma addr, rx/tx pool */
dma_addr_t pool_dma;
dma_addr_t rd0_pool_dma;
dma_addr_t rd1_pool_dma;
dma_addr_t td0_pool_dma;
dma_addr_t td1_pool_dma;
dma_addr_t tx_bufs_dma0;
dma_addr_t tx_bufs_dma1;
dma_addr_t tx_beacon_dma;
unsigned char *tx0_bufs;
unsigned char *tx1_bufs;
unsigned char *tx_beacon_bufs;
CHIP_TYPE chip_id;
void __iomem *PortOffset;
unsigned long dwIsr;
u32 memaddr;
u32 ioaddr;
u32 io_size;
unsigned char byRevId;
staging: vt6655: replace memcpy() by ether_addr_copy() using coccinelle and pack variables This patch focuses on fixing the following warning generated by checkpatch.pl for the file rxtx.c : Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) The changes were applied using the following coccinelle rule: @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); After applying the rule, some referencing operations were adjusted manually to avoid a gcc compilation warning. According to ether_addr_copy() description and functionality, all Ethernet addresses should align to the u16 datatype. A check was made on the following datastructures: - vnt_mic_hdr - tagS802_11Header - tagSEthernetHeader - vnt_rts_g - ieee80211_rts - vnt_private To maintain that the array abyCurrentNetAddr in vnt_private is aligned, it was placed before the boolean bLinkPass in the struct definition. The definition can be found in device.h. A couple of variables were packed in holes detected by pahole. Output of pahole when running it on rxtx.o after the changes: truct tagSEthernetHeader { unsigned char abyDstAddr[6]; /* 0 6 */ unsigned char abySrcAddr[6]; /* 6 6 */ short unsigned int wType; /* 12 2 */ /* size: 14, cachelines: 1, members: 3 */ /* last cacheline: 14 bytes */ }; struct tagS802_11Header { short unsigned int wFrameCtl; /* 0 2 */ short unsigned int wDurationID; /* 2 2 */ unsigned char abyAddr1[6]; /* 4 6 */ unsigned char abyAddr2[6]; /* 10 6 */ unsigned char abyAddr3[6]; /* 16 6 */ short unsigned int wSeqCtl; /* 22 2 */ unsigned char abyAddr4[6]; /* 24 6 */ /* size: 30, cachelines: 1, members: 7 */ /* last cacheline: 30 bytes */ }; struct ieee80211_rts { __le16 frame_control; /* 0 2 */ __le16 duration; /* 2 2 */ u8 ra[6]; /* 4 6 */ u8 ta[6]; /* 10 6 */ /* size: 16, cachelines: 1, members: 4 */ /* last cacheline: 16 bytes */ }; struct vnt_private { struct pci_dev * pcid; /* 0 4 */ struct net_device * dev; /* 4 4 */ dma_addr_t pool_dma; /* 8 4 */ dma_addr_t rd0_pool_dma; /* 12 4 */ dma_addr_t rd1_pool_dma; /* 16 4 */ dma_addr_t td0_pool_dma; /* 20 4 */ dma_addr_t td1_pool_dma; /* 24 4 */ dma_addr_t tx_bufs_dma0; /* 28 4 */ dma_addr_t tx_bufs_dma1; /* 32 4 */ dma_addr_t tx_beacon_dma; /* 36 4 */ unsigned char * tx0_bufs; /* 40 4 */ unsigned char * tx1_bufs; /* 44 4 */ unsigned char * tx_beacon_bufs; /* 48 4 */ CHIP_TYPE chip_id; /* 52 4 */ void * PortOffset; /* 56 4 */ long unsigned int dwIsr; /* 60 4 */ /*--- cacheline 1 boundary (64 bytes) ---*/ u32 memaddr; /* 64 4 */ u32 ioaddr; /* 68 4 */ u32 io_size; /* 72 4 */ unsigned char byRevId; /* 76 1 */ unsigned char byRxMode; /* 77 1 */ short unsigned int SubSystemID; /* 78 2 */ short unsigned int SubVendorID; /* 80 2 */ spinlock_t lock; /* 82 2 */ int nTxQueues; /* 84 4 */ volatile int iTDUsed; /* 88 8 */ volatile PSTxDesc apCurrTD; /* 96 8 */ volatile PSTxDesc apTailTD; /* 104 8 */ volatile PSTxDesc apTD0Rings; /* 112 4 */ volatile PSTxDesc apTD1Rings; /* 116 4 */ volatile PSRxDesc aRD0Ring; /* 120 4 */ volatile PSRxDesc aRD1Ring; /* 124 4 */ /*--- cacheline 2 boundary (128 bytes) ---*/ volatile PSRxDesc pCurrRD; /* 128 8 */ SCache sDupRxCache; /* 136 44 */ SDeFragControlBlock sRxDFCB[64]; /* 180 2048 */ /*--- cacheline 34 boundary (2176 bytes) was 52 bytes ago ---*/ unsigned int cbDFCB; /* 2228 4 */ unsigned int cbFreeDFCB; /* 2232 4 */ unsigned int uCurrentDFCBIdx; /* 2236 4 */ /*--- cacheline 35 boundary (2240 bytes) ---*/ OPTIONS sOpts; /* 2240 52 */ u32 flags; /* 2292 4 */ u32 rx_buf_sz; /* 2296 4 */ int multicast_limit; /* 2300 4 */ /*--- cacheline 36 boundary (2304 bytes) ---*/ pid_t MLMEThr_pid; /* 2304 4 */ struct completion notify; /* 2308 16 */ struct semaphore mlme_semaphore; /* 2324 16 */ u32 rx_bytes; /* 2340 4 */ unsigned char byLocalID; /* 2344 1 */ unsigned char byRFType; /* 2345 1 */ unsigned char byMaxPwrLevel; /* 2346 1 */ unsigned char byZoneType; /* 2347 1 */ bool bZoneRegExist; /* 2348 1 */ unsigned char byOriginalZonetype; /* 2349 1 */ unsigned char abyMacContext[384]; /* 2350 384 */ /*--- cacheline 42 boundary (2688 bytes) was 46 bytes ago ---*/ unsigned char abyCurrentNetAddr[6]; /* 2734 6 */ bool bLinkPass; /* 2740 1 */ /* XXX 3 bytes hole, try to pack */ SStatCounter scStatistic; /* 2744 776 */ /*--- cacheline 55 boundary (3520 bytes) ---*/ SDot11Counters s802_11Counter; /* 3520 172 */ /*--- cacheline 57 boundary (3648 bytes) was 44 bytes ago ---*/ PSMgmtObject pMgmt; /* 3692 4 */ SMgmtObject sMgmtObj; /* 3696 95840 */ /*--- cacheline 1555 boundary (99520 bytes) was 16 bytes ago ---*/ /* Bitfield combined with previous fields */ unsigned int uCurrRSSI; /* 0 4 */ unsigned char byCurrSQ; /* 0 1 */ long unsigned int dwTxAntennaSel; /* 0 4 */ long unsigned int dwRxAntennaSel; /* 0 4 */ unsigned char byAntennaCount; /* 0 1 */ unsigned char byRxAntennaMode; /* 0 1 */ unsigned char byTxAntennaMode; /* 0 1 */ bool bTxRxAntInv; /* 0 1 */ unsigned char * pbyTmpBuff; /* 0 4 */ unsigned int uSIFS; /* 0 4 */ unsigned int uDIFS; /* 0 4 */ unsigned int uEIFS; /* 0 4 */ unsigned int uSlot; /* 0 4 */ unsigned int uCwMin; /* 0 4 */ unsigned int uCwMax; /* 0 4 */ unsigned char bySIFS; /* 0 1 */ unsigned char byDIFS; /* 0 1 */ unsigned char byEIFS; /* 0 1 */ unsigned char bySlot; /* 0 1 */ unsigned char byCWMaxMin; /* 0 1 */ CARD_PHY_TYPE eCurrentPHYType; /* 0 4 */ VIA_BB_TYPE byBBType; /* 0 4 */ VIA_PKT_TYPE byPacketType; /* 0 4 */ short unsigned int wBasicRate; /* 0 2 */ unsigned char byACKRate; /* 0 1 */ unsigned char byTopOFDMBasicRate; /* 0 1 */ unsigned char byTopCCKBasicRate; /* 0 1 */ unsigned char byMinChannel; /* 0 1 */ unsigned char byMaxChannel; /* 0 1 */ unsigned int uConnectionRate; /* 0 4 */ unsigned char byPreambleType; /* 0 1 */ unsigned char byShortPreamble; /* 0 1 */ short unsigned int wCurrentRate; /* 0 2 */ short unsigned int wRTSThreshold; /* 0 2 */ short unsigned int wFragmentationThreshold; /* 0 2 */ unsigned char byShortRetryLimit; /* 0 1 */ unsigned char byLongRetryLimit; /* 0 1 */ enum nl80211_iftype op_mode; /* 0 4 */ unsigned char byOpMode; /* 0 1 */ bool bBSSIDFilter; /* 0 1 */ short unsigned int wMaxTransmitMSDULifetime; /* 0 2 */ unsigned char abyBSSID[6]; /* 0 6 */ unsigned char abyDesireBSSID[6]; /* 0 6 */ short unsigned int wACKDuration; /* 0 2 */ short unsigned int wRTSTransmitLen; /* 0 2 */ unsigned char byRTSServiceField; /* 0 1 */ unsigned char byRTSSignalField; /* 0 1 */ long unsigned int dwMaxReceiveLifetime; /* 0 4 */ bool bEncryptionEnable; /* 0 1 */ bool bLongHeader; /* 0 1 */ bool bShortSlotTime; /* 0 1 */ bool bProtectMode; /* 0 1 */ bool bNonERPPresent; /* 0 1 */ bool bBarkerPreambleMd; /* 0 1 */ unsigned char byERPFlag; /* 0 1 */ short unsigned int wUseProtectCntDown; /* 0 2 */ bool bRadioControlOff; /* 0 1 */ bool bRadioOff; /* 0 1 */ bool bEnablePSMode; /* 0 1 */ short unsigned int wListenInterval; /* 0 2 */ bool bPWBitOn; /* 0 1 */ WMAC_POWER_MODE ePSMode; /* 0 4 */ unsigned char byRadioCtl; /* 0 1 */ unsigned char byGPIO; /* 0 1 */ bool bHWRadioOff; /* 0 1 */ bool bPrvActive4RadioOFF; /* 0 1 */ bool bGPIOBlockRead; /* 0 1 */ short unsigned int wSeqCounter; /* 0 2 */ short unsigned int wBCNBufLen; /* 0 2 */ bool bBeaconBufReady; /* 0 1 */ bool bBeaconSent; /* 0 1 */ bool bIsBeaconBufReadySet; /* 0 1 */ unsigned int cbBeaconBufReadySetCnt; /* 0 4 */ bool bFixRate; /* 0 1 */ unsigned char byCurrentCh; /* 0 1 */ unsigned int uScanTime; /* 0 4 */ CMD_STATE eCommandState; /* 0 4 */ CMD_CODE eCommand; /* 0 4 */ bool bBeaconTx; /* 0 1 */ bool bStopBeacon; /* 0 1 */ bool bStopDataPkt; /* 0 1 */ bool bStopTx0Pkt; /* 0 1 */ unsigned int uAutoReConnectTime; /* 0 4 */ CMD_ITEM eCmdQueue[32]; /* 0 1408 */ unsigned int uCmdDequeueIdx; /* 0 4 */ unsigned int uCmdEnqueueIdx; /* 0 4 */ unsigned int cbFreeCmdQueue; /* 0 4 */ bool bCmdRunning; /* 0 1 */ bool bCmdClear; /* 0 1 */ bool bRoaming; /* 0 1 */ unsigned char abyIPAddr[4]; /* 0 4 */ long unsigned int ulTxPower; /* 0 4 */ NDIS_802_11_WEP_STATUS eEncryptionStatus; /* 0 4 */ bool bTransmitKey; /* 0 1 */ NDIS_802_11_WEP_STATUS eOldEncryptionStatus; /* 0 4 */ SKeyManagement sKey; /* 0 3784 */ long unsigned int dwIVCounter; /* 0 4 */ u64 qwPacketNumber; /* 0 8 */ unsigned int uCurrentWEPMode; /* 0 4 */ RC4Ext SBox; /* 0 264 */ unsigned char abyPRNG[35]; /* 0 35 */ unsigned char byKeyIndex; /* 0 1 */ unsigned int uKeyLength; /* 0 4 */ unsigned char abyKey[29]; /* 0 29 */ bool bAES; /* 0 1 */ unsigned char byCntMeasure; /* 0 1 */ unsigned int uAssocCount; /* 0 4 */ bool bMoreData; /* 0 1 */ bool bGrpAckPolicy; /* 0 1 */ bool bAssocInfoSet; /* 0 1 */ unsigned char byAutoFBCtrl; /* 0 1 */ bool bTxMICFail; /* 0 1 */ bool bRxMICFail; /* 0 1 */ unsigned int uRATEIdx; /* 0 4 */ bool bUpdateBBVGA; /* 0 1 */ unsigned int uBBVGADiffCount; /* 0 4 */ unsigned char byBBVGANew; /* 0 1 */ unsigned char byBBVGACurrent; /* 0 1 */ unsigned char abyBBVGA[4]; /* 0 4 */ long int ldBmThreshold[4]; /* 0 16 */ unsigned char byBBPreEDRSSI; /* 0 1 */ unsigned char byBBPreEDIndex; /* 0 1 */ bool bRadioCmd; /* 0 1 */ long unsigned int dwDiagRefCount; /* 0 4 */ unsigned char byFOETuning; /* 0 1 */ unsigned char byAutoPwrTunning; /* 0 1 */ short int sPSetPointCCK; /* 0 2 */ short int sPSetPointOFDMG; /* 0 2 */ short int sPSetPointOFDMA; /* 0 2 */ long int lPFormulaOffset; /* 0 4 */ short int sPThreshold; /* 0 2 */ char cAdjustStep; /* 0 1 */ char cMinTxAGC; /* 0 1 */ unsigned char byCCKPwr; /* 0 1 */ unsigned char byOFDMPwrG; /* 0 1 */ unsigned char byCurPwr; /* 0 1 */ char byCurPwrdBm; /* 0 1 */ unsigned char abyCCKPwrTbl[15]; /* 0 15 */ unsigned char abyOFDMPwrTbl[57]; /* 0 57 */ char abyCCKDefaultPwr[15]; /* 0 15 */ char abyOFDMDefaultPwr[57]; /* 0 57 */ char abyRegPwr[57]; /* 0 57 */ char abyLocalPwr[57]; /* 0 57 */ unsigned char byBBCR4d; /* 0 1 */ unsigned char byBBCRc9; /* 0 1 */ unsigned char byBBCR88; /* 0 1 */ unsigned char byBBCR09; /* 0 1 */ struct timer_list sTimerCommand; /* 0 52 */ struct timer_list sTimerTxData; /* 0 52 */ long unsigned int nTxDataTimeCout; /* 0 4 */ bool fTxDataInSleep; /* 0 1 */ bool IsTxDataTrigger; /* 0 1 */ bool fWPA_Authened; /* 0 1 */ unsigned char byReAssocCount; /* 0 1 */ unsigned char byLinkWaitCount; /* 0 1 */ unsigned char abyNodeName[17]; /* 0 17 */ bool bDiversityRegCtlON; /* 0 1 */ bool bDiversityEnable; /* 0 1 */ long unsigned int ulDiversityNValue; /* 0 4 */ long unsigned int ulDiversityMValue; /* 0 4 */ unsigned char byTMax; /* 0 1 */ unsigned char byTMax2; /* 0 1 */ unsigned char byTMax3; /* 0 1 */ long unsigned int ulSQ3TH; /* 0 4 */ long unsigned int uDiversityCnt; /* 0 4 */ unsigned char byAntennaState; /* 0 1 */ long unsigned int ulRatio_State0; /* 0 4 */ long unsigned int ulRatio_State1; /* 0 4 */ struct timer_list TimerSQ3Tmax1; /* 0 52 */ struct timer_list TimerSQ3Tmax2; /* 0 52 */ struct timer_list TimerSQ3Tmax3; /* 0 52 */ long unsigned int uNumSQ3[12]; /* 0 48 */ short unsigned int wAntDiversityMaxRate; /* 0 2 */ SEthernetHeader sTxEthHeader; /* 0 14 */ SEthernetHeader sRxEthHeader; /* 0 14 */ unsigned char abyBroadcastAddr[6]; /* 0 6 */ unsigned char abySNAP_RFC1042[6]; /* 0 6 */ unsigned char abySNAP_Bridgetunnel[6]; /* 0 6 */ unsigned char abyEEPROM[256]; /* 0 256 */ SPMKID gsPMKID; /* 0 360 */ SPMKIDCandidateEvent gsPMKIDCandidate; /* 0 72 */ bool b11hEnable; /* 0 1 */ unsigned char abyCountryCode[3]; /* 0 3 */ unsigned int uNumOfMeasureEIDs; /* 0 4 */ PWLAN_IE_MEASURE_REQ pCurrMeasureEID; /* 0 4 */ bool bMeasureInProgress; /* 0 1 */ unsigned char byOrgChannel; /* 0 1 */ unsigned char byOrgRCR; /* 0 1 */ long unsigned int dwOrgMAR0; /* 0 4 */ long unsigned int dwOrgMAR4; /* 0 4 */ unsigned char byBasicMap; /* 0 1 */ unsigned char byCCAFraction; /* 0 1 */ unsigned char abyRPIs[8]; /* 0 8 */ long unsigned int dwRPIs[8]; /* 0 32 */ bool bChannelSwitch; /* 0 1 */ unsigned char byNewChannel; /* 0 1 */ unsigned char byChannelSwitchCount; /* 0 1 */ bool bQuietEnable; /* 0 1 */ bool bEnableFirstQuiet; /* 0 1 */ unsigned char byQuietStartCount; /* 0 1 */ unsigned int uQuietEnqueue; /* 0 4 */ long unsigned int dwCurrentQuietEndTime; /* 0 4 */ SQuietControl sQuiet[8]; /* 0 96 */ bool bCountryInfo5G; /* 0 1 */ bool bCountryInfo24G; /* 0 1 */ short unsigned int wBeaconInterval; /* 0 2 */ struct net_device * wpadev; /* 0 4 */ bool bWPADEVUp; /* 0 1 */ struct sk_buff * skb; /* 0 4 */ unsigned int bwextcount; /* 0 4 */ bool bWPASuppWextEnabled; /* 0 1 */ bool bEnableHostapd; /* 0 1 */ bool bEnable8021x; /* 0 1 */ bool bEnableHostWEP; /* 0 1 */ struct net_device * apdev; /* 0 4 */ int (*tx_80211)(struct sk_buff *, struct net_device *); /* 0 4 */ unsigned int uChannel; /* 0 4 */ bool bMACSuspend; /* 0 1 */ struct iw_statistics wstats; /* 0 32 */ bool bCommit; /* 0 1 */ /*--- cacheline 1672 boundary (107008 bytes) ---*/ /* size: 107008, cachelines: 1672, members: 279 */ /* sum members: 107005, holes: 1, sum holes: 3 */ /* padding: 41471 */ /* BRAIN FART ALERT! 107008 != 107005 + 3(holes), diff = 0 */ }; struct vnt_mic_hdr { u8 id; /* 0 1 */ u8 tx_priority; /* 1 1 */ u8 mic_addr2[6]; /* 2 6 */ u8 ccmp_pn[6]; /* 8 6 */ __be16 payload_len; /* 14 2 */ __be16 hlen; /* 16 2 */ __le16 frame_control; /* 18 2 */ u8 addr1[6]; /* 20 6 */ u8 addr2[6]; /* 26 6 */ u8 addr3[6]; /* 32 6 */ __le16 seq_ctrl; /* 38 2 */ u8 addr4[6]; /* 40 6 */ u16 packing; /* 46 2 */ /* size: 48, cachelines: 1, members: 13 */ /* last cacheline: 48 bytes */ }; struct vnt_rts_g { struct vnt_phy_field b; /* 0 4 */ struct vnt_phy_field a; /* 4 4 */ __le16 duration_ba; /* 8 2 */ __le16 duration_aa; /* 10 2 */ __le16 duration_bb; /* 12 2 */ u16 reserved; /* 14 2 */ struct ieee80211_rts data; /* 16 16 */ /* size: 32, cachelines: 1, members: 7 */ /* last cacheline: 32 bytes */ }; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-10 18:42:45 -06:00
unsigned char byRxMode;
unsigned short SubSystemID;
unsigned short SubVendorID;
staging: vt6655: replace memcpy() by ether_addr_copy() using coccinelle and pack variables This patch focuses on fixing the following warning generated by checkpatch.pl for the file rxtx.c : Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) The changes were applied using the following coccinelle rule: @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); After applying the rule, some referencing operations were adjusted manually to avoid a gcc compilation warning. According to ether_addr_copy() description and functionality, all Ethernet addresses should align to the u16 datatype. A check was made on the following datastructures: - vnt_mic_hdr - tagS802_11Header - tagSEthernetHeader - vnt_rts_g - ieee80211_rts - vnt_private To maintain that the array abyCurrentNetAddr in vnt_private is aligned, it was placed before the boolean bLinkPass in the struct definition. The definition can be found in device.h. A couple of variables were packed in holes detected by pahole. Output of pahole when running it on rxtx.o after the changes: truct tagSEthernetHeader { unsigned char abyDstAddr[6]; /* 0 6 */ unsigned char abySrcAddr[6]; /* 6 6 */ short unsigned int wType; /* 12 2 */ /* size: 14, cachelines: 1, members: 3 */ /* last cacheline: 14 bytes */ }; struct tagS802_11Header { short unsigned int wFrameCtl; /* 0 2 */ short unsigned int wDurationID; /* 2 2 */ unsigned char abyAddr1[6]; /* 4 6 */ unsigned char abyAddr2[6]; /* 10 6 */ unsigned char abyAddr3[6]; /* 16 6 */ short unsigned int wSeqCtl; /* 22 2 */ unsigned char abyAddr4[6]; /* 24 6 */ /* size: 30, cachelines: 1, members: 7 */ /* last cacheline: 30 bytes */ }; struct ieee80211_rts { __le16 frame_control; /* 0 2 */ __le16 duration; /* 2 2 */ u8 ra[6]; /* 4 6 */ u8 ta[6]; /* 10 6 */ /* size: 16, cachelines: 1, members: 4 */ /* last cacheline: 16 bytes */ }; struct vnt_private { struct pci_dev * pcid; /* 0 4 */ struct net_device * dev; /* 4 4 */ dma_addr_t pool_dma; /* 8 4 */ dma_addr_t rd0_pool_dma; /* 12 4 */ dma_addr_t rd1_pool_dma; /* 16 4 */ dma_addr_t td0_pool_dma; /* 20 4 */ dma_addr_t td1_pool_dma; /* 24 4 */ dma_addr_t tx_bufs_dma0; /* 28 4 */ dma_addr_t tx_bufs_dma1; /* 32 4 */ dma_addr_t tx_beacon_dma; /* 36 4 */ unsigned char * tx0_bufs; /* 40 4 */ unsigned char * tx1_bufs; /* 44 4 */ unsigned char * tx_beacon_bufs; /* 48 4 */ CHIP_TYPE chip_id; /* 52 4 */ void * PortOffset; /* 56 4 */ long unsigned int dwIsr; /* 60 4 */ /*--- cacheline 1 boundary (64 bytes) ---*/ u32 memaddr; /* 64 4 */ u32 ioaddr; /* 68 4 */ u32 io_size; /* 72 4 */ unsigned char byRevId; /* 76 1 */ unsigned char byRxMode; /* 77 1 */ short unsigned int SubSystemID; /* 78 2 */ short unsigned int SubVendorID; /* 80 2 */ spinlock_t lock; /* 82 2 */ int nTxQueues; /* 84 4 */ volatile int iTDUsed; /* 88 8 */ volatile PSTxDesc apCurrTD; /* 96 8 */ volatile PSTxDesc apTailTD; /* 104 8 */ volatile PSTxDesc apTD0Rings; /* 112 4 */ volatile PSTxDesc apTD1Rings; /* 116 4 */ volatile PSRxDesc aRD0Ring; /* 120 4 */ volatile PSRxDesc aRD1Ring; /* 124 4 */ /*--- cacheline 2 boundary (128 bytes) ---*/ volatile PSRxDesc pCurrRD; /* 128 8 */ SCache sDupRxCache; /* 136 44 */ SDeFragControlBlock sRxDFCB[64]; /* 180 2048 */ /*--- cacheline 34 boundary (2176 bytes) was 52 bytes ago ---*/ unsigned int cbDFCB; /* 2228 4 */ unsigned int cbFreeDFCB; /* 2232 4 */ unsigned int uCurrentDFCBIdx; /* 2236 4 */ /*--- cacheline 35 boundary (2240 bytes) ---*/ OPTIONS sOpts; /* 2240 52 */ u32 flags; /* 2292 4 */ u32 rx_buf_sz; /* 2296 4 */ int multicast_limit; /* 2300 4 */ /*--- cacheline 36 boundary (2304 bytes) ---*/ pid_t MLMEThr_pid; /* 2304 4 */ struct completion notify; /* 2308 16 */ struct semaphore mlme_semaphore; /* 2324 16 */ u32 rx_bytes; /* 2340 4 */ unsigned char byLocalID; /* 2344 1 */ unsigned char byRFType; /* 2345 1 */ unsigned char byMaxPwrLevel; /* 2346 1 */ unsigned char byZoneType; /* 2347 1 */ bool bZoneRegExist; /* 2348 1 */ unsigned char byOriginalZonetype; /* 2349 1 */ unsigned char abyMacContext[384]; /* 2350 384 */ /*--- cacheline 42 boundary (2688 bytes) was 46 bytes ago ---*/ unsigned char abyCurrentNetAddr[6]; /* 2734 6 */ bool bLinkPass; /* 2740 1 */ /* XXX 3 bytes hole, try to pack */ SStatCounter scStatistic; /* 2744 776 */ /*--- cacheline 55 boundary (3520 bytes) ---*/ SDot11Counters s802_11Counter; /* 3520 172 */ /*--- cacheline 57 boundary (3648 bytes) was 44 bytes ago ---*/ PSMgmtObject pMgmt; /* 3692 4 */ SMgmtObject sMgmtObj; /* 3696 95840 */ /*--- cacheline 1555 boundary (99520 bytes) was 16 bytes ago ---*/ /* Bitfield combined with previous fields */ unsigned int uCurrRSSI; /* 0 4 */ unsigned char byCurrSQ; /* 0 1 */ long unsigned int dwTxAntennaSel; /* 0 4 */ long unsigned int dwRxAntennaSel; /* 0 4 */ unsigned char byAntennaCount; /* 0 1 */ unsigned char byRxAntennaMode; /* 0 1 */ unsigned char byTxAntennaMode; /* 0 1 */ bool bTxRxAntInv; /* 0 1 */ unsigned char * pbyTmpBuff; /* 0 4 */ unsigned int uSIFS; /* 0 4 */ unsigned int uDIFS; /* 0 4 */ unsigned int uEIFS; /* 0 4 */ unsigned int uSlot; /* 0 4 */ unsigned int uCwMin; /* 0 4 */ unsigned int uCwMax; /* 0 4 */ unsigned char bySIFS; /* 0 1 */ unsigned char byDIFS; /* 0 1 */ unsigned char byEIFS; /* 0 1 */ unsigned char bySlot; /* 0 1 */ unsigned char byCWMaxMin; /* 0 1 */ CARD_PHY_TYPE eCurrentPHYType; /* 0 4 */ VIA_BB_TYPE byBBType; /* 0 4 */ VIA_PKT_TYPE byPacketType; /* 0 4 */ short unsigned int wBasicRate; /* 0 2 */ unsigned char byACKRate; /* 0 1 */ unsigned char byTopOFDMBasicRate; /* 0 1 */ unsigned char byTopCCKBasicRate; /* 0 1 */ unsigned char byMinChannel; /* 0 1 */ unsigned char byMaxChannel; /* 0 1 */ unsigned int uConnectionRate; /* 0 4 */ unsigned char byPreambleType; /* 0 1 */ unsigned char byShortPreamble; /* 0 1 */ short unsigned int wCurrentRate; /* 0 2 */ short unsigned int wRTSThreshold; /* 0 2 */ short unsigned int wFragmentationThreshold; /* 0 2 */ unsigned char byShortRetryLimit; /* 0 1 */ unsigned char byLongRetryLimit; /* 0 1 */ enum nl80211_iftype op_mode; /* 0 4 */ unsigned char byOpMode; /* 0 1 */ bool bBSSIDFilter; /* 0 1 */ short unsigned int wMaxTransmitMSDULifetime; /* 0 2 */ unsigned char abyBSSID[6]; /* 0 6 */ unsigned char abyDesireBSSID[6]; /* 0 6 */ short unsigned int wACKDuration; /* 0 2 */ short unsigned int wRTSTransmitLen; /* 0 2 */ unsigned char byRTSServiceField; /* 0 1 */ unsigned char byRTSSignalField; /* 0 1 */ long unsigned int dwMaxReceiveLifetime; /* 0 4 */ bool bEncryptionEnable; /* 0 1 */ bool bLongHeader; /* 0 1 */ bool bShortSlotTime; /* 0 1 */ bool bProtectMode; /* 0 1 */ bool bNonERPPresent; /* 0 1 */ bool bBarkerPreambleMd; /* 0 1 */ unsigned char byERPFlag; /* 0 1 */ short unsigned int wUseProtectCntDown; /* 0 2 */ bool bRadioControlOff; /* 0 1 */ bool bRadioOff; /* 0 1 */ bool bEnablePSMode; /* 0 1 */ short unsigned int wListenInterval; /* 0 2 */ bool bPWBitOn; /* 0 1 */ WMAC_POWER_MODE ePSMode; /* 0 4 */ unsigned char byRadioCtl; /* 0 1 */ unsigned char byGPIO; /* 0 1 */ bool bHWRadioOff; /* 0 1 */ bool bPrvActive4RadioOFF; /* 0 1 */ bool bGPIOBlockRead; /* 0 1 */ short unsigned int wSeqCounter; /* 0 2 */ short unsigned int wBCNBufLen; /* 0 2 */ bool bBeaconBufReady; /* 0 1 */ bool bBeaconSent; /* 0 1 */ bool bIsBeaconBufReadySet; /* 0 1 */ unsigned int cbBeaconBufReadySetCnt; /* 0 4 */ bool bFixRate; /* 0 1 */ unsigned char byCurrentCh; /* 0 1 */ unsigned int uScanTime; /* 0 4 */ CMD_STATE eCommandState; /* 0 4 */ CMD_CODE eCommand; /* 0 4 */ bool bBeaconTx; /* 0 1 */ bool bStopBeacon; /* 0 1 */ bool bStopDataPkt; /* 0 1 */ bool bStopTx0Pkt; /* 0 1 */ unsigned int uAutoReConnectTime; /* 0 4 */ CMD_ITEM eCmdQueue[32]; /* 0 1408 */ unsigned int uCmdDequeueIdx; /* 0 4 */ unsigned int uCmdEnqueueIdx; /* 0 4 */ unsigned int cbFreeCmdQueue; /* 0 4 */ bool bCmdRunning; /* 0 1 */ bool bCmdClear; /* 0 1 */ bool bRoaming; /* 0 1 */ unsigned char abyIPAddr[4]; /* 0 4 */ long unsigned int ulTxPower; /* 0 4 */ NDIS_802_11_WEP_STATUS eEncryptionStatus; /* 0 4 */ bool bTransmitKey; /* 0 1 */ NDIS_802_11_WEP_STATUS eOldEncryptionStatus; /* 0 4 */ SKeyManagement sKey; /* 0 3784 */ long unsigned int dwIVCounter; /* 0 4 */ u64 qwPacketNumber; /* 0 8 */ unsigned int uCurrentWEPMode; /* 0 4 */ RC4Ext SBox; /* 0 264 */ unsigned char abyPRNG[35]; /* 0 35 */ unsigned char byKeyIndex; /* 0 1 */ unsigned int uKeyLength; /* 0 4 */ unsigned char abyKey[29]; /* 0 29 */ bool bAES; /* 0 1 */ unsigned char byCntMeasure; /* 0 1 */ unsigned int uAssocCount; /* 0 4 */ bool bMoreData; /* 0 1 */ bool bGrpAckPolicy; /* 0 1 */ bool bAssocInfoSet; /* 0 1 */ unsigned char byAutoFBCtrl; /* 0 1 */ bool bTxMICFail; /* 0 1 */ bool bRxMICFail; /* 0 1 */ unsigned int uRATEIdx; /* 0 4 */ bool bUpdateBBVGA; /* 0 1 */ unsigned int uBBVGADiffCount; /* 0 4 */ unsigned char byBBVGANew; /* 0 1 */ unsigned char byBBVGACurrent; /* 0 1 */ unsigned char abyBBVGA[4]; /* 0 4 */ long int ldBmThreshold[4]; /* 0 16 */ unsigned char byBBPreEDRSSI; /* 0 1 */ unsigned char byBBPreEDIndex; /* 0 1 */ bool bRadioCmd; /* 0 1 */ long unsigned int dwDiagRefCount; /* 0 4 */ unsigned char byFOETuning; /* 0 1 */ unsigned char byAutoPwrTunning; /* 0 1 */ short int sPSetPointCCK; /* 0 2 */ short int sPSetPointOFDMG; /* 0 2 */ short int sPSetPointOFDMA; /* 0 2 */ long int lPFormulaOffset; /* 0 4 */ short int sPThreshold; /* 0 2 */ char cAdjustStep; /* 0 1 */ char cMinTxAGC; /* 0 1 */ unsigned char byCCKPwr; /* 0 1 */ unsigned char byOFDMPwrG; /* 0 1 */ unsigned char byCurPwr; /* 0 1 */ char byCurPwrdBm; /* 0 1 */ unsigned char abyCCKPwrTbl[15]; /* 0 15 */ unsigned char abyOFDMPwrTbl[57]; /* 0 57 */ char abyCCKDefaultPwr[15]; /* 0 15 */ char abyOFDMDefaultPwr[57]; /* 0 57 */ char abyRegPwr[57]; /* 0 57 */ char abyLocalPwr[57]; /* 0 57 */ unsigned char byBBCR4d; /* 0 1 */ unsigned char byBBCRc9; /* 0 1 */ unsigned char byBBCR88; /* 0 1 */ unsigned char byBBCR09; /* 0 1 */ struct timer_list sTimerCommand; /* 0 52 */ struct timer_list sTimerTxData; /* 0 52 */ long unsigned int nTxDataTimeCout; /* 0 4 */ bool fTxDataInSleep; /* 0 1 */ bool IsTxDataTrigger; /* 0 1 */ bool fWPA_Authened; /* 0 1 */ unsigned char byReAssocCount; /* 0 1 */ unsigned char byLinkWaitCount; /* 0 1 */ unsigned char abyNodeName[17]; /* 0 17 */ bool bDiversityRegCtlON; /* 0 1 */ bool bDiversityEnable; /* 0 1 */ long unsigned int ulDiversityNValue; /* 0 4 */ long unsigned int ulDiversityMValue; /* 0 4 */ unsigned char byTMax; /* 0 1 */ unsigned char byTMax2; /* 0 1 */ unsigned char byTMax3; /* 0 1 */ long unsigned int ulSQ3TH; /* 0 4 */ long unsigned int uDiversityCnt; /* 0 4 */ unsigned char byAntennaState; /* 0 1 */ long unsigned int ulRatio_State0; /* 0 4 */ long unsigned int ulRatio_State1; /* 0 4 */ struct timer_list TimerSQ3Tmax1; /* 0 52 */ struct timer_list TimerSQ3Tmax2; /* 0 52 */ struct timer_list TimerSQ3Tmax3; /* 0 52 */ long unsigned int uNumSQ3[12]; /* 0 48 */ short unsigned int wAntDiversityMaxRate; /* 0 2 */ SEthernetHeader sTxEthHeader; /* 0 14 */ SEthernetHeader sRxEthHeader; /* 0 14 */ unsigned char abyBroadcastAddr[6]; /* 0 6 */ unsigned char abySNAP_RFC1042[6]; /* 0 6 */ unsigned char abySNAP_Bridgetunnel[6]; /* 0 6 */ unsigned char abyEEPROM[256]; /* 0 256 */ SPMKID gsPMKID; /* 0 360 */ SPMKIDCandidateEvent gsPMKIDCandidate; /* 0 72 */ bool b11hEnable; /* 0 1 */ unsigned char abyCountryCode[3]; /* 0 3 */ unsigned int uNumOfMeasureEIDs; /* 0 4 */ PWLAN_IE_MEASURE_REQ pCurrMeasureEID; /* 0 4 */ bool bMeasureInProgress; /* 0 1 */ unsigned char byOrgChannel; /* 0 1 */ unsigned char byOrgRCR; /* 0 1 */ long unsigned int dwOrgMAR0; /* 0 4 */ long unsigned int dwOrgMAR4; /* 0 4 */ unsigned char byBasicMap; /* 0 1 */ unsigned char byCCAFraction; /* 0 1 */ unsigned char abyRPIs[8]; /* 0 8 */ long unsigned int dwRPIs[8]; /* 0 32 */ bool bChannelSwitch; /* 0 1 */ unsigned char byNewChannel; /* 0 1 */ unsigned char byChannelSwitchCount; /* 0 1 */ bool bQuietEnable; /* 0 1 */ bool bEnableFirstQuiet; /* 0 1 */ unsigned char byQuietStartCount; /* 0 1 */ unsigned int uQuietEnqueue; /* 0 4 */ long unsigned int dwCurrentQuietEndTime; /* 0 4 */ SQuietControl sQuiet[8]; /* 0 96 */ bool bCountryInfo5G; /* 0 1 */ bool bCountryInfo24G; /* 0 1 */ short unsigned int wBeaconInterval; /* 0 2 */ struct net_device * wpadev; /* 0 4 */ bool bWPADEVUp; /* 0 1 */ struct sk_buff * skb; /* 0 4 */ unsigned int bwextcount; /* 0 4 */ bool bWPASuppWextEnabled; /* 0 1 */ bool bEnableHostapd; /* 0 1 */ bool bEnable8021x; /* 0 1 */ bool bEnableHostWEP; /* 0 1 */ struct net_device * apdev; /* 0 4 */ int (*tx_80211)(struct sk_buff *, struct net_device *); /* 0 4 */ unsigned int uChannel; /* 0 4 */ bool bMACSuspend; /* 0 1 */ struct iw_statistics wstats; /* 0 32 */ bool bCommit; /* 0 1 */ /*--- cacheline 1672 boundary (107008 bytes) ---*/ /* size: 107008, cachelines: 1672, members: 279 */ /* sum members: 107005, holes: 1, sum holes: 3 */ /* padding: 41471 */ /* BRAIN FART ALERT! 107008 != 107005 + 3(holes), diff = 0 */ }; struct vnt_mic_hdr { u8 id; /* 0 1 */ u8 tx_priority; /* 1 1 */ u8 mic_addr2[6]; /* 2 6 */ u8 ccmp_pn[6]; /* 8 6 */ __be16 payload_len; /* 14 2 */ __be16 hlen; /* 16 2 */ __le16 frame_control; /* 18 2 */ u8 addr1[6]; /* 20 6 */ u8 addr2[6]; /* 26 6 */ u8 addr3[6]; /* 32 6 */ __le16 seq_ctrl; /* 38 2 */ u8 addr4[6]; /* 40 6 */ u16 packing; /* 46 2 */ /* size: 48, cachelines: 1, members: 13 */ /* last cacheline: 48 bytes */ }; struct vnt_rts_g { struct vnt_phy_field b; /* 0 4 */ struct vnt_phy_field a; /* 4 4 */ __le16 duration_ba; /* 8 2 */ __le16 duration_aa; /* 10 2 */ __le16 duration_bb; /* 12 2 */ u16 reserved; /* 14 2 */ struct ieee80211_rts data; /* 16 16 */ /* size: 32, cachelines: 1, members: 7 */ /* last cacheline: 32 bytes */ }; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-10 18:42:45 -06:00
spinlock_t lock;
int nTxQueues;
volatile int iTDUsed[TYPE_MAXTD];
volatile PSTxDesc apCurrTD[TYPE_MAXTD];
volatile PSTxDesc apTailTD[TYPE_MAXTD];
volatile PSTxDesc apTD0Rings;
volatile PSTxDesc apTD1Rings;
volatile PSRxDesc aRD0Ring;
volatile PSRxDesc aRD1Ring;
volatile PSRxDesc pCurrRD[TYPE_MAXRD];
SCache sDupRxCache;
SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
unsigned int cbDFCB;
unsigned int cbFreeDFCB;
unsigned int uCurrentDFCBIdx;
OPTIONS sOpts;
u32 flags;
u32 rx_buf_sz;
u8 rx_rate;
int multicast_limit;
pid_t MLMEThr_pid;
struct completion notify;
struct semaphore mlme_semaphore;
u32 rx_bytes;
/* Version control */
unsigned char byLocalID;
unsigned char byRFType;
unsigned char byMaxPwrLevel;
unsigned char byZoneType;
bool bZoneRegExist;
unsigned char byOriginalZonetype;
unsigned char abyMacContext[MAC_MAX_CONTEXT_REG];
unsigned char abyCurrentNetAddr[ETH_ALEN];
bool bLinkPass; /* link status: OK or fail */
/* Adapter statistics */
SStatCounter scStatistic;
/* 802.11 counter */
SDot11Counters s802_11Counter;
/* 802.11 management */
PSMgmtObject pMgmt;
SMgmtObject sMgmtObj;
/* 802.11 MAC specific */
unsigned int uCurrRSSI;
unsigned char byCurrSQ;
unsigned long dwTxAntennaSel;
unsigned long dwRxAntennaSel;
unsigned char byAntennaCount;
unsigned char byRxAntennaMode;
unsigned char byTxAntennaMode;
bool bTxRxAntInv;
unsigned char *pbyTmpBuff;
unsigned int uSIFS; /* Current SIFS */
unsigned int uDIFS; /* Current DIFS */
unsigned int uEIFS; /* Current EIFS */
unsigned int uSlot; /* Current SlotTime */
unsigned int uCwMin; /* Current CwMin */
unsigned int uCwMax; /* CwMax is fixed on 1023. */
/* PHY parameter */
unsigned char bySIFS;
unsigned char byDIFS;
unsigned char byEIFS;
unsigned char bySlot;
unsigned char byCWMaxMin;
CARD_PHY_TYPE eCurrentPHYType;
VIA_BB_TYPE byBBType; /* 0:11A, 1:11B, 2:11G */
VIA_PKT_TYPE byPacketType; /*
* 0:11a,1:11b,2:11gb (only CCK
* in BasicRate), 3:11ga (OFDM in
* Basic Rate)
*/
unsigned short wBasicRate;
unsigned char byACKRate;
unsigned char byTopOFDMBasicRate;
unsigned char byTopCCKBasicRate;
unsigned char byMinChannel;
unsigned char byMaxChannel;
unsigned int uConnectionRate;
unsigned char byPreambleType;
unsigned char byShortPreamble;
unsigned short wCurrentRate;
unsigned short wRTSThreshold;
unsigned short wFragmentationThreshold;
unsigned char byShortRetryLimit;
unsigned char byLongRetryLimit;
enum nl80211_iftype op_mode;
unsigned char byOpMode;
bool bBSSIDFilter;
unsigned short wMaxTransmitMSDULifetime;
unsigned char abyBSSID[ETH_ALEN];
unsigned char abyDesireBSSID[ETH_ALEN];
unsigned short wACKDuration; /* update while speed change */
unsigned short wRTSTransmitLen; /* update while speed change */
unsigned char byRTSServiceField; /* update while speed change */
unsigned char byRTSSignalField; /* update while speed change */
unsigned long dwMaxReceiveLifetime; /* dot11MaxReceiveLifetime */
bool bEncryptionEnable;
bool bLongHeader;
bool bShortSlotTime;
bool bProtectMode;
bool bNonERPPresent;
bool bBarkerPreambleMd;
unsigned char byERPFlag;
unsigned short wUseProtectCntDown;
bool bRadioControlOff;
bool bRadioOff;
bool bEnablePSMode;
unsigned short wListenInterval;
bool bPWBitOn;
WMAC_POWER_MODE ePSMode;
/* GPIO Radio Control */
unsigned char byRadioCtl;
unsigned char byGPIO;
bool bHWRadioOff;
bool bPrvActive4RadioOFF;
bool bGPIOBlockRead;
/* Beacon related */
unsigned short wSeqCounter;
unsigned short wBCNBufLen;
bool bBeaconBufReady;
bool bBeaconSent;
bool bIsBeaconBufReadySet;
unsigned int cbBeaconBufReadySetCnt;
bool bFixRate;
unsigned char byCurrentCh;
unsigned int uScanTime;
CMD_STATE eCommandState;
CMD_CODE eCommand;
bool bBeaconTx;
bool bStopBeacon;
bool bStopDataPkt;
bool bStopTx0Pkt;
unsigned int uAutoReConnectTime;
/* 802.11 counter */
CMD_ITEM eCmdQueue[CMD_Q_SIZE];
unsigned int uCmdDequeueIdx;
unsigned int uCmdEnqueueIdx;
unsigned int cbFreeCmdQueue;
bool bCmdRunning;
bool bCmdClear;
bool bRoaming;
unsigned char abyIPAddr[4];
unsigned long ulTxPower;
NDIS_802_11_WEP_STATUS eEncryptionStatus;
bool bTransmitKey;
NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
SKeyManagement sKey;
unsigned long dwIVCounter;
u64 qwPacketNumber; /* For CCMP and TKIP as TSC(6 bytes) */
unsigned int uCurrentWEPMode;
RC4Ext SBox;
unsigned char abyPRNG[WLAN_WEPMAX_KEYLEN+3];
unsigned char byKeyIndex;
unsigned int uKeyLength;
unsigned char abyKey[WLAN_WEP232_KEYLEN];
bool bAES;
unsigned char byCntMeasure;
/* for AP mode */
unsigned int uAssocCount;
bool bMoreData;
/* QoS */
bool bGrpAckPolicy;
/* for OID_802_11_ASSOCIATION_INFORMATION */
bool bAssocInfoSet;
unsigned char byAutoFBCtrl;
bool bTxMICFail;
bool bRxMICFail;
unsigned int uRATEIdx;
/* For Update BaseBand VGA Gain Offset */
bool bUpdateBBVGA;
unsigned int uBBVGADiffCount;
unsigned char byBBVGANew;
unsigned char byBBVGACurrent;
unsigned char abyBBVGA[BB_VGA_LEVEL];
long ldBmThreshold[BB_VGA_LEVEL];
unsigned char byBBPreEDRSSI;
unsigned char byBBPreEDIndex;
bool bRadioCmd;
unsigned long dwDiagRefCount;
/* For FOE Tuning */
unsigned char byFOETuning;
/* For Auto Power Tunning */
unsigned char byAutoPwrTunning;
short sPSetPointCCK;
short sPSetPointOFDMG;
short sPSetPointOFDMA;
long lPFormulaOffset;
short sPThreshold;
char cAdjustStep;
char cMinTxAGC;
/* For RF Power table */
unsigned char byCCKPwr;
unsigned char byOFDMPwrG;
unsigned char byCurPwr;
char byCurPwrdBm;
unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G+1];
unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL+1];
char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G+1];
char abyOFDMDefaultPwr[CB_MAX_CHANNEL+1];
char abyRegPwr[CB_MAX_CHANNEL+1];
char abyLocalPwr[CB_MAX_CHANNEL+1];
/* BaseBand Loopback Use */
unsigned char byBBCR4d;
unsigned char byBBCRc9;
unsigned char byBBCR88;
unsigned char byBBCR09;
/* command timer */
struct timer_list sTimerCommand;
struct timer_list sTimerTxData;
unsigned long nTxDataTimeCout;
bool fTxDataInSleep;
bool IsTxDataTrigger;
#ifdef WPA_SM_Transtatus
bool fWPA_Authened; /* is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */
#endif
unsigned char byReAssocCount;
unsigned char byLinkWaitCount;
unsigned char abyNodeName[17];
bool bDiversityRegCtlON;
bool bDiversityEnable;
unsigned long ulDiversityNValue;
unsigned long ulDiversityMValue;
unsigned char byTMax;
unsigned char byTMax2;
unsigned char byTMax3;
unsigned long ulSQ3TH;
/* ANT diversity */
unsigned long uDiversityCnt;
unsigned char byAntennaState;
unsigned long ulRatio_State0;
unsigned long ulRatio_State1;
/* SQ3 functions for antenna diversity */
struct timer_list TimerSQ3Tmax1;
struct timer_list TimerSQ3Tmax2;
struct timer_list TimerSQ3Tmax3;
unsigned long uNumSQ3[MAX_RATE];
unsigned short wAntDiversityMaxRate;
SEthernetHeader sTxEthHeader;
SEthernetHeader sRxEthHeader;
unsigned char abyBroadcastAddr[ETH_ALEN];
unsigned char abySNAP_RFC1042[ETH_ALEN];
unsigned char abySNAP_Bridgetunnel[ETH_ALEN];
unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */
/* Pre-Authentication & PMK cache */
SPMKID gsPMKID;
SPMKIDCandidateEvent gsPMKIDCandidate;
/* for 802.11h */
bool b11hEnable;
unsigned char abyCountryCode[3];
/* for 802.11h DFS */
unsigned int uNumOfMeasureEIDs;
PWLAN_IE_MEASURE_REQ pCurrMeasureEID;
bool bMeasureInProgress;
unsigned char byOrgChannel;
unsigned char byOrgRCR;
unsigned long dwOrgMAR0;
unsigned long dwOrgMAR4;
unsigned char byBasicMap;
unsigned char byCCAFraction;
unsigned char abyRPIs[8];
unsigned long dwRPIs[8];
bool bChannelSwitch;
unsigned char byNewChannel;
unsigned char byChannelSwitchCount;
bool bQuietEnable;
bool bEnableFirstQuiet;
unsigned char byQuietStartCount;
unsigned int uQuietEnqueue;
unsigned long dwCurrentQuietEndTime;
SQuietControl sQuiet[MAX_QUIET_COUNT];
/* for 802.11h TPC */
bool bCountryInfo5G;
bool bCountryInfo24G;
unsigned short wBeaconInterval;
/* WPA supplicant deamon */
struct net_device *wpadev;
bool bWPADEVUp;
struct sk_buff *skb;
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
unsigned int bwextcount;
bool bWPASuppWextEnabled;
#endif
#ifdef HOSTAP
/* user space daemon: hostapd, is used for HOSTAP */
bool bEnableHostapd;
bool bEnable8021x;
bool bEnableHostWEP;
struct net_device *apdev;
int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
#endif
unsigned int uChannel;
bool bMACSuspend;
struct iw_statistics wstats; /* wireless stats */
bool bCommit;
};
static inline bool device_get_ip(struct vnt_private *pInfo)
{
struct in_device *in_dev = (struct in_device *)pInfo->dev->ip_ptr;
struct in_ifaddr *ifa;
if (in_dev != NULL) {
ifa = (struct in_ifaddr *)in_dev->ifa_list;
if (ifa != NULL) {
memcpy(pInfo->abyIPAddr, &ifa->ifa_address, 4);
return true;
}
}
return false;
}
static inline PDEVICE_RD_INFO alloc_rd_info(void)
{
return kzalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC);
}
static inline PDEVICE_TD_INFO alloc_td_info(void)
{
return kzalloc(sizeof(DEVICE_TD_INFO), GFP_ATOMIC);
}
/*--------------------- Export Functions --------------------------*/
bool device_dma0_xmit(struct vnt_private *pDevice,
struct sk_buff *skb, unsigned int uNodeIndex);
bool device_alloc_frag_buf(struct vnt_private *pDevice,
PSDeFragControlBlock pDeF);
int Config_FileOperation(struct vnt_private *pDevice,
bool fwrite, unsigned char *Parameter);
#endif