Commit 9a0e756c authored by Andres More's avatar Andres More Committed by Greg Kroah-Hartman

Staging: vt6656: incorporated ETH_ALEN macro instead of custom one

Replaced custom U_ETHER_ADDR_LEN by ETH_ALEN from <linux/if_ether.h>.
Resolved checkpatch findings on the changed lines, mostly indentation.
Signed-off-by: default avatarAndres More <more.andres@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 26e5b65b
...@@ -277,7 +277,7 @@ int ii,jj,kk; ...@@ -277,7 +277,7 @@ int ii,jj,kk;
pbyPayload = pbyIV + 8; //IV-length pbyPayload = pbyIV + 8; //IV-length
abyNonce[0] = 0x00; //now is 0, if Qos here will be priority abyNonce[0] = 0x00; //now is 0, if Qos here will be priority
memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN);
abyNonce[7] = pbyIV[7]; abyNonce[7] = pbyIV[7];
abyNonce[8] = pbyIV[6]; abyNonce[8] = pbyIV[6];
abyNonce[9] = pbyIV[5]; abyNonce[9] = pbyIV[5];
...@@ -299,16 +299,17 @@ int ii,jj,kk; ...@@ -299,16 +299,17 @@ int ii,jj,kk;
byTmp = (BYTE)(pMACHeader->wFrameCtl >> 8); byTmp = (BYTE)(pMACHeader->wFrameCtl >> 8);
byTmp &= 0x87; byTmp &= 0x87;
MIC_HDR1[3] = byTmp | 0x40; MIC_HDR1[3] = byTmp | 0x40;
memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, U_ETHER_ADDR_LEN); memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN);
memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN);
//MIC_HDR2 //MIC_HDR2
memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, U_ETHER_ADDR_LEN); memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN);
byTmp = (BYTE)(pMACHeader->wSeqCtl & 0xff); byTmp = (BYTE)(pMACHeader->wSeqCtl & 0xff);
MIC_HDR2[6] = byTmp & 0x0f; MIC_HDR2[6] = byTmp & 0x0f;
MIC_HDR2[7] = 0; MIC_HDR2[7] = 0;
if ( bA4 ) { if ( bA4 ) {
memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, U_ETHER_ADDR_LEN); memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, ETH_ALEN);
} else { } else {
MIC_HDR2[8] = 0x00; MIC_HDR2[8] = 0x00;
MIC_HDR2[9] = 0x00; MIC_HDR2[9] = 0x00;
......
...@@ -206,8 +206,8 @@ typedef const SRrvTime_atim *PCSRrvTime_atim; ...@@ -206,8 +206,8 @@ typedef const SRrvTime_atim *PCSRrvTime_atim;
typedef struct tagSRTSData { typedef struct tagSRTSData {
WORD wFrameControl; WORD wFrameControl;
WORD wDurationID; WORD wDurationID;
BYTE abyRA[U_ETHER_ADDR_LEN]; BYTE abyRA[ETH_ALEN];
BYTE abyTA[U_ETHER_ADDR_LEN]; BYTE abyTA[ETH_ALEN];
}__attribute__ ((__packed__)) }__attribute__ ((__packed__))
SRTSData, *PSRTSData; SRTSData, *PSRTSData;
typedef const SRTSData *PCSRTSData; typedef const SRTSData *PCSRTSData;
...@@ -282,7 +282,7 @@ typedef const SRTS_a_FB *PCSRTS_a_FB; ...@@ -282,7 +282,7 @@ typedef const SRTS_a_FB *PCSRTS_a_FB;
typedef struct tagSCTSData { typedef struct tagSCTSData {
WORD wFrameControl; WORD wFrameControl;
WORD wDurationID; WORD wDurationID;
BYTE abyRA[U_ETHER_ADDR_LEN]; BYTE abyRA[ETH_ALEN];
WORD wReserved; WORD wReserved;
}__attribute__ ((__packed__)) }__attribute__ ((__packed__))
SCTSData, *PSCTSData; SCTSData, *PSCTSData;
......
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
#define MAC_MAX_CONTEXT_REG (256+128) #define MAC_MAX_CONTEXT_REG (256+128)
#define MAX_MULTICAST_ADDRESS_NUM 32 #define MAX_MULTICAST_ADDRESS_NUM 32
#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * U_ETHER_ADDR_LEN) #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN)
//#define OP_MODE_INFRASTRUCTURE 0 //#define OP_MODE_INFRASTRUCTURE 0
...@@ -369,7 +369,7 @@ typedef struct tagSQuietControl { ...@@ -369,7 +369,7 @@ typedef struct tagSQuietControl {
// The receive duplicate detection cache entry // The receive duplicate detection cache entry
typedef struct tagSCacheEntry{ typedef struct tagSCacheEntry{
WORD wFmSequence; WORD wFmSequence;
BYTE abyAddr2[U_ETHER_ADDR_LEN]; BYTE abyAddr2[ETH_ALEN];
WORD wFrameCtl; WORD wFrameCtl;
} SCacheEntry, *PSCacheEntry; } SCacheEntry, *PSCacheEntry;
...@@ -387,7 +387,7 @@ typedef struct tagSDeFragControlBlock ...@@ -387,7 +387,7 @@ typedef struct tagSDeFragControlBlock
{ {
WORD wSequence; WORD wSequence;
WORD wFragNum; WORD wFragNum;
BYTE abyAddr2[U_ETHER_ADDR_LEN]; BYTE abyAddr2[ETH_ALEN];
UINT uLifetime; UINT uLifetime;
struct sk_buff* skb; struct sk_buff* skb;
PBYTE pbyRxBuffer; PBYTE pbyRxBuffer;
...@@ -547,10 +547,10 @@ typedef struct __device_info { ...@@ -547,10 +547,10 @@ typedef struct __device_info {
BYTE byOriginalZonetype; BYTE byOriginalZonetype;
BOOL bLinkPass; // link status: OK or fail BOOL bLinkPass; // link status: OK or fail
BYTE abyCurrentNetAddr[U_ETHER_ADDR_LEN]; BYTE abyCurrentNetAddr[ETH_ALEN];
BYTE abyPermanentNetAddr[U_ETHER_ADDR_LEN]; BYTE abyPermanentNetAddr[ETH_ALEN];
// SW network address // SW network address
// BYTE abySoftwareNetAddr[U_ETHER_ADDR_LEN]; /* u8 abySoftwareNetAddr[ETH_ALEN]; */
BOOL bExistSWNetAddr; BOOL bExistSWNetAddr;
// Adapter statistics // Adapter statistics
...@@ -671,8 +671,8 @@ typedef struct __device_info { ...@@ -671,8 +671,8 @@ typedef struct __device_info {
CARD_OP_MODE eOPMode; CARD_OP_MODE eOPMode;
BOOL bBSSIDFilter; BOOL bBSSIDFilter;
WORD wMaxTransmitMSDULifetime; WORD wMaxTransmitMSDULifetime;
BYTE abyBSSID[U_ETHER_ADDR_LEN]; BYTE abyBSSID[ETH_ALEN];
BYTE abyDesireBSSID[U_ETHER_ADDR_LEN]; BYTE abyDesireBSSID[ETH_ALEN];
WORD wCTSDuration; // update while speed change WORD wCTSDuration; // update while speed change
WORD wACKDuration; // update while speed change WORD wACKDuration; // update while speed change
WORD wRTSTransmitLen; // update while speed change WORD wRTSTransmitLen; // update while speed change
...@@ -826,9 +826,9 @@ typedef struct __device_info { ...@@ -826,9 +826,9 @@ typedef struct __device_info {
SEthernetHeader sTxEthHeader; SEthernetHeader sTxEthHeader;
SEthernetHeader sRxEthHeader; SEthernetHeader sRxEthHeader;
BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN]; BYTE abyBroadcastAddr[ETH_ALEN];
BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN]; BYTE abySNAP_RFC1042[ETH_ALEN];
BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN]; BYTE abySNAP_Bridgetunnel[ETH_ALEN];
// Pre-Authentication & PMK cache // Pre-Authentication & PMK cache
SPMKID gsPMKID; SPMKID gsPMKID;
......
...@@ -234,11 +234,11 @@ s_vProcessRxMACHeader ( ...@@ -234,11 +234,11 @@ s_vProcessRxMACHeader (
} }
} }
cbHeaderSize -= (U_ETHER_ADDR_LEN * 2); cbHeaderSize -= (ETH_ALEN * 2);
pbyRxBuffer = (PBYTE) (pbyRxBufferAddr + cbHeaderSize); pbyRxBuffer = (PBYTE) (pbyRxBufferAddr + cbHeaderSize);
for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) for (ii = 0; ii < ETH_ALEN; ii++)
*pbyRxBuffer++ = pDevice->sRxEthHeader.abyDstAddr[ii]; *pbyRxBuffer++ = pDevice->sRxEthHeader.abyDstAddr[ii];
for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) for (ii = 0; ii < ETH_ALEN; ii++)
*pbyRxBuffer++ = pDevice->sRxEthHeader.abySrcAddr[ii]; *pbyRxBuffer++ = pDevice->sRxEthHeader.abySrcAddr[ii];
*pcbHeadSize = cbHeaderSize; *pcbHeadSize = cbHeaderSize;
...@@ -275,32 +275,37 @@ s_vGetDASA ( ...@@ -275,32 +275,37 @@ s_vGetDASA (
if ((pMACHeader->wFrameCtl & FC_TODS) == 0) { if ((pMACHeader->wFrameCtl & FC_TODS) == 0) {
if (pMACHeader->wFrameCtl & FC_FROMDS) { if (pMACHeader->wFrameCtl & FC_FROMDS) {
for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii]; psEthHeader->abyDstAddr[ii] =
psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr3[ii]; pMACHeader->abyAddr1[ii];
} psEthHeader->abySrcAddr[ii] =
} pMACHeader->abyAddr3[ii];
else {
// IBSS mode
for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) {
psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii];
psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii];
} }
} else {
/* IBSS mode */
for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->abyDstAddr[ii] =
pMACHeader->abyAddr1[ii];
psEthHeader->abySrcAddr[ii] =
pMACHeader->abyAddr2[ii];
} }
} }
else { } else {
// Is AP mode.. /* Is AP mode.. */
if (pMACHeader->wFrameCtl & FC_FROMDS) { if (pMACHeader->wFrameCtl & FC_FROMDS) {
for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii]; psEthHeader->abyDstAddr[ii] =
psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr4[ii]; pMACHeader->abyAddr3[ii];
psEthHeader->abySrcAddr[ii] =
pMACHeader->abyAddr4[ii];
cbHeaderSize += 6; cbHeaderSize += 6;
} }
} } else {
else { for (ii = 0; ii < ETH_ALEN; ii++) {
for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { psEthHeader->abyDstAddr[ii] =
psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii]; pMACHeader->abyAddr3[ii];
psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii]; psEthHeader->abySrcAddr[ii] =
pMACHeader->abyAddr2[ii];
} }
} }
}; };
......
...@@ -480,7 +480,9 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { ...@@ -480,7 +480,9 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
}; };
if (sValue.dwValue == 1) { if (sValue.dwValue == 1) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n");
memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr, U_ETHER_ADDR_LEN); memcpy(pDevice->wpadev->dev_addr,
pDevice->dev->dev_addr,
ETH_ALEN);
pDevice->bWPADEVUp = TRUE; pDevice->bWPADEVUp = TRUE;
} }
else { else {
......
...@@ -312,7 +312,7 @@ BOOL KeybSetKey ( ...@@ -312,7 +312,7 @@ BOOL KeybSetKey (
} }
} }
if (j < (MAX_KEY_TABLE-1)) { if (j < (MAX_KEY_TABLE-1)) {
memcpy(pTable->KeyTable[j].abyBSSID,pbyBSSID,U_ETHER_ADDR_LEN); memcpy(pTable->KeyTable[j].abyBSSID, pbyBSSID, ETH_ALEN);
pTable->KeyTable[j].bInUse = TRUE; pTable->KeyTable[j].bInUse = TRUE;
if ((dwKeyIndex & PAIRWISE_KEY) != 0) { if ((dwKeyIndex & PAIRWISE_KEY) != 0) {
// Pairwise key // Pairwise key
...@@ -700,7 +700,7 @@ BOOL KeybSetDefaultKey ( ...@@ -700,7 +700,7 @@ BOOL KeybSetDefaultKey (
} }
pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE;
for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) for (ii = 0; ii < ETH_ALEN; ii++)
pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF;
// Group key // Group key
......
...@@ -71,7 +71,7 @@ typedef struct tagSKeyItem ...@@ -71,7 +71,7 @@ typedef struct tagSKeyItem
typedef struct tagSKeyTable typedef struct tagSKeyTable
{ {
BYTE abyBSSID[U_ETHER_ADDR_LEN]; //6 BYTE abyBSSID[ETH_ALEN]; /* 6 */
BYTE byReserved0[2]; //8 BYTE byReserved0[2]; //8
SKeyItem PairwiseKey; SKeyItem PairwiseKey;
SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328 SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328
......
...@@ -295,14 +295,13 @@ static void usb_device_reset(PSDevice pDevice); ...@@ -295,14 +295,13 @@ static void usb_device_reset(PSDevice pDevice);
static void static void
device_set_options(PSDevice pDevice) { device_set_options(PSDevice pDevice) {
BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; BYTE abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; BYTE abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00};
BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; u8 abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8};
memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN);
memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, U_ETHER_ADDR_LEN); memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN);
memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, U_ETHER_ADDR_LEN); memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN);
memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, U_ETHER_ADDR_LEN);
pDevice->cbTD = TX_DESC_DEF0; pDevice->cbTD = TX_DESC_DEF0;
pDevice->cbRD = RX_DESC_DEF0; pDevice->cbRD = RX_DESC_DEF0;
...@@ -359,9 +358,9 @@ static VOID device_init_diversity_timer(PSDevice pDevice) { ...@@ -359,9 +358,9 @@ static VOID device_init_diversity_timer(PSDevice pDevice) {
static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
{ {
BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; u8 abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00};
BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; u8 abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8};
BYTE byAntenna; BYTE byAntenna;
UINT ii; UINT ii;
CMD_CARD_INIT sInitCmd; CMD_CARD_INIT sInitCmd;
...@@ -376,9 +375,11 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) ...@@ -376,9 +375,11 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", InitType, pDevice->byPacketType); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", InitType, pDevice->byPacketType);
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
if (InitType == DEVICE_INIT_COLD) { if (InitType == DEVICE_INIT_COLD) {
memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, U_ETHER_ADDR_LEN); memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN);
memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, U_ETHER_ADDR_LEN); memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN);
memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, U_ETHER_ADDR_LEN); memcpy(pDevice->abySNAP_Bridgetunnel,
abySNAP_Bridgetunnel,
ETH_ALEN);
if ( !FIRMWAREbCheckVersion(pDevice) ) { if ( !FIRMWAREbCheckVersion(pDevice) ) {
if (FIRMWAREbDownload(pDevice) == TRUE) { if (FIRMWAREbDownload(pDevice) == TRUE) {
...@@ -603,7 +604,9 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) ...@@ -603,7 +604,9 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
// get Permanent network address // get Permanent network address
memcpy(pDevice->abyPermanentNetAddr,&(sInitRsp.byNetAddr[0]),6); memcpy(pDevice->abyPermanentNetAddr,&(sInitRsp.byNetAddr[0]),6);
memcpy(pDevice->abyCurrentNetAddr, pDevice->abyPermanentNetAddr, U_ETHER_ADDR_LEN); memcpy(pDevice->abyCurrentNetAddr,
pDevice->abyPermanentNetAddr,
ETH_ALEN);
// if exist SW network address, use SW network address. // if exist SW network address, use SW network address.
...@@ -757,7 +760,7 @@ static const struct net_device_ops device_netdev_ops = { ...@@ -757,7 +760,7 @@ static const struct net_device_ops device_netdev_ops = {
static int __devinit static int __devinit
vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
{ {
BYTE fake_mac[U_ETHER_ADDR_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01};//fake MAC address u8 fake_mac[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
struct usb_device *udev = interface_to_usbdev(intf); struct usb_device *udev = interface_to_usbdev(intf);
int rc = 0; int rc = 0;
struct net_device *netdev = NULL; struct net_device *netdev = NULL;
...@@ -798,7 +801,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -798,7 +801,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
//2007-0821-01<Add>by MikeLiu //2007-0821-01<Add>by MikeLiu
usb_set_intfdata(intf, pDevice); usb_set_intfdata(intf, pDevice);
SET_NETDEV_DEV(netdev, &intf->dev); SET_NETDEV_DEV(netdev, &intf->dev);
memcpy(pDevice->dev->dev_addr, fake_mac, U_ETHER_ADDR_LEN); //use fake mac address memcpy(pDevice->dev->dev_addr, fake_mac, ETH_ALEN);
rc = register_netdev(netdev); rc = register_netdev(netdev);
if (rc != 0) { if (rc != 0) {
printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n"); printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n");
...@@ -1101,8 +1104,8 @@ static int device_open(struct net_device *dev) { ...@@ -1101,8 +1104,8 @@ static int device_open(struct net_device *dev) {
// Init for Key Management // Init for Key Management
KeyvInitTable(pDevice,&pDevice->sKey); KeyvInitTable(pDevice,&pDevice->sKey);
memcpy(pDevice->sMgmtObj.abyMACAddr, pDevice->abyCurrentNetAddr, U_ETHER_ADDR_LEN); memcpy(pDevice->sMgmtObj.abyMACAddr, pDevice->abyCurrentNetAddr, ETH_ALEN);
memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, U_ETHER_ADDR_LEN); memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, ETH_ALEN);
pDevice->bStopTx0Pkt = FALSE; pDevice->bStopTx0Pkt = FALSE;
pDevice->bStopDataPkt = FALSE; pDevice->bStopDataPkt = FALSE;
pDevice->bRoaming = FALSE; //DavidWang pDevice->bRoaming = FALSE; //DavidWang
......
...@@ -156,18 +156,17 @@ void STAvUpdateRDStatCounter (PSStatCounter pStatistic, ...@@ -156,18 +156,17 @@ void STAvUpdateRDStatCounter (PSStatCounter pStatistic,
BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, BYTE byRxRate, BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, BYTE byRxRate,
PBYTE pbyBuffer, UINT cbFrameLength) PBYTE pbyBuffer, UINT cbFrameLength)
{ {
//need change /* need change */
PS802_11Header pHeader = (PS802_11Header)pbyBuffer; PS802_11Header pHeader = (PS802_11Header)pbyBuffer;
if (byRSR & RSR_ADDROK) if (byRSR & RSR_ADDROK)
pStatistic->dwRsrADDROk++; pStatistic->dwRsrADDROk++;
if (byRSR & RSR_CRCOK) { if (byRSR & RSR_CRCOK) {
pStatistic->dwRsrCRCOk++; pStatistic->dwRsrCRCOk++;
pStatistic->ullRsrOK++; pStatistic->ullRsrOK++;
if (cbFrameLength >= U_ETHER_ADDR_LEN) { if (cbFrameLength >= ETH_ALEN) {
// update counters in case that successful transmit /* update counters in case of successful transmission */
if (byRSR & RSR_ADDRBROAD) { if (byRSR & RSR_ADDRBROAD) {
pStatistic->ullRxBroadcastFrames++; pStatistic->ullRxBroadcastFrames++;
pStatistic->ullRxBroadcastBytes += (ULONGLONG)cbFrameLength; pStatistic->ullRxBroadcastBytes += (ULONGLONG)cbFrameLength;
......
...@@ -91,7 +91,7 @@ typedef struct tagSMib2Counter { ...@@ -91,7 +91,7 @@ typedef struct tagSMib2Counter {
LONG ifType; LONG ifType;
LONG ifMtu; LONG ifMtu;
DWORD ifSpeed; DWORD ifSpeed;
BYTE ifPhysAddress[U_ETHER_ADDR_LEN]; BYTE ifPhysAddress[ETH_ALEN];
LONG ifAdminStatus; LONG ifAdminStatus;
LONG ifOperStatus; LONG ifOperStatus;
DWORD ifLastChange; DWORD ifLastChange;
...@@ -231,7 +231,7 @@ typedef struct tagSTxPktInfo { ...@@ -231,7 +231,7 @@ typedef struct tagSTxPktInfo {
BYTE byBroadMultiUni; BYTE byBroadMultiUni;
WORD wLength; WORD wLength;
WORD wFIFOCtl; WORD wFIFOCtl;
BYTE abyDestAddr[U_ETHER_ADDR_LEN]; BYTE abyDestAddr[ETH_ALEN];
} STxPktInfo, *PSTxPktInfo; } STxPktInfo, *PSTxPktInfo;
......
This diff is collapsed.
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
typedef struct tagSRTSDataF { typedef struct tagSRTSDataF {
WORD wFrameControl; WORD wFrameControl;
WORD wDurationID; WORD wDurationID;
BYTE abyRA[U_ETHER_ADDR_LEN]; BYTE abyRA[ETH_ALEN];
BYTE abyTA[U_ETHER_ADDR_LEN]; BYTE abyTA[ETH_ALEN];
} SRTSDataF, *PSRTSDataF; } SRTSDataF, *PSRTSDataF;
// //
...@@ -53,7 +53,7 @@ typedef struct tagSRTSDataF { ...@@ -53,7 +53,7 @@ typedef struct tagSRTSDataF {
typedef struct tagSCTSDataF { typedef struct tagSCTSDataF {
WORD wFrameControl; WORD wFrameControl;
WORD wDurationID; WORD wDurationID;
BYTE abyRA[U_ETHER_ADDR_LEN]; BYTE abyRA[ETH_ALEN];
WORD wReserved; WORD wReserved;
} SCTSDataF, *PSCTSDataF; } SCTSDataF, *PSCTSDataF;
......
...@@ -68,7 +68,7 @@ BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr) ...@@ -68,7 +68,7 @@ BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr)
BYTE byHash = 0; BYTE byHash = 0;
/* get the least 6-bits from CRC generator */ /* get the least 6-bits from CRC generator */
byTmpHash = (BYTE)(CRCdwCrc32(pbyMultiAddr, U_ETHER_ADDR_LEN, byTmpHash = (BYTE)(CRCdwCrc32(pbyMultiAddr, ETH_ALEN,
0xFFFFFFFFL) & 0x3F); 0xFFFFFFFFL) & 0x3F);
/* reverse most bit to least bit */ /* reverse most bit to least bit */
for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) { for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) {
......
...@@ -29,17 +29,17 @@ ...@@ -29,17 +29,17 @@
#ifndef __TETHER_H__ #ifndef __TETHER_H__
#define __TETHER_H__ #define __TETHER_H__
#include <linux/if_ether.h>
#include "ttype.h" #include "ttype.h"
/*--------------------- Export Definitions -------------------------*/ /*--------------------- Export Definitions -------------------------*/
// //
// constants // constants
// //
#define U_ETHER_ADDR_LEN 6 // Ethernet address length
#define U_TYPE_LEN 2 // #define U_TYPE_LEN 2 //
#define U_CRC_LEN 4 // #define U_CRC_LEN 4 //
#define U_HEADER_LEN (U_ETHER_ADDR_LEN * 2 + U_TYPE_LEN) #define U_HEADER_LEN (ETH_ALEN * 2 + U_TYPE_LEN)
#define U_ETHER_ADDR_STR_LEN (U_ETHER_ADDR_LEN * 2 + 1) #define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1)
// Ethernet address string length // Ethernet address string length
#define MIN_DATA_LEN 46 // min data length #define MIN_DATA_LEN 46 // min data length
...@@ -167,8 +167,8 @@ ...@@ -167,8 +167,8 @@
// Ethernet packet // Ethernet packet
// //
typedef struct tagSEthernetHeader { typedef struct tagSEthernetHeader {
BYTE abyDstAddr[U_ETHER_ADDR_LEN]; BYTE abyDstAddr[ETH_ALEN];
BYTE abySrcAddr[U_ETHER_ADDR_LEN]; BYTE abySrcAddr[ETH_ALEN];
WORD wType; WORD wType;
}__attribute__ ((__packed__)) }__attribute__ ((__packed__))
SEthernetHeader, *PSEthernetHeader; SEthernetHeader, *PSEthernetHeader;
...@@ -178,8 +178,8 @@ SEthernetHeader, *PSEthernetHeader; ...@@ -178,8 +178,8 @@ SEthernetHeader, *PSEthernetHeader;
// 802_3 packet // 802_3 packet
// //
typedef struct tagS802_3Header { typedef struct tagS802_3Header {
BYTE abyDstAddr[U_ETHER_ADDR_LEN]; BYTE abyDstAddr[ETH_ALEN];
BYTE abySrcAddr[U_ETHER_ADDR_LEN]; BYTE abySrcAddr[ETH_ALEN];
WORD wLen; WORD wLen;
}__attribute__ ((__packed__)) }__attribute__ ((__packed__))
S802_3Header, *PS802_3Header; S802_3Header, *PS802_3Header;
...@@ -190,11 +190,11 @@ S802_3Header, *PS802_3Header; ...@@ -190,11 +190,11 @@ S802_3Header, *PS802_3Header;
typedef struct tagS802_11Header { typedef struct tagS802_11Header {
WORD wFrameCtl; WORD wFrameCtl;
WORD wDurationID; WORD wDurationID;
BYTE abyAddr1[U_ETHER_ADDR_LEN]; BYTE abyAddr1[ETH_ALEN];
BYTE abyAddr2[U_ETHER_ADDR_LEN]; BYTE abyAddr2[ETH_ALEN];
BYTE abyAddr3[U_ETHER_ADDR_LEN]; BYTE abyAddr3[ETH_ALEN];
WORD wSeqCtl; WORD wSeqCtl;
BYTE abyAddr4[U_ETHER_ADDR_LEN]; BYTE abyAddr4[ETH_ALEN];
}__attribute__ ((__packed__)) }__attribute__ ((__packed__))
S802_11Header, *PS802_11Header; S802_11Header, *PS802_11Header;
......
...@@ -91,7 +91,7 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) ...@@ -91,7 +91,7 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
/* Not fount in cache - insert */ /* Not fount in cache - insert */
pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr]; pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr];
pCacheEntry->wFmSequence = pMACHeader->wSeqCtl; pCacheEntry->wFmSequence = pMACHeader->wSeqCtl;
memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), U_ETHER_ADDR_LEN); memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN);
pCacheEntry->wFrameCtl = pMACHeader->wFrameCtl; pCacheEntry->wFrameCtl = pMACHeader->wFrameCtl;
ADD_ONE_WITH_WRAP_AROUND(pCache->uInPtr, DUPLICATE_RX_CACHE_LENGTH); ADD_ONE_WITH_WRAP_AROUND(pCache->uInPtr, DUPLICATE_RX_CACHE_LENGTH);
return FALSE; return FALSE;
...@@ -154,7 +154,9 @@ UINT ii; ...@@ -154,7 +154,9 @@ UINT ii;
pDevice->sRxDFCB[ii].bInUse = TRUE; pDevice->sRxDFCB[ii].bInUse = TRUE;
pDevice->sRxDFCB[ii].wSequence = (pMACHeader->wSeqCtl >> 4); pDevice->sRxDFCB[ii].wSequence = (pMACHeader->wSeqCtl >> 4);
pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F); pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F);
memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), &(pMACHeader->abyAddr2[0]), U_ETHER_ADDR_LEN); memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]),
&(pMACHeader->abyAddr2[0]),
ETH_ALEN);
return(ii); return(ii);
} }
} }
......
...@@ -3774,9 +3774,13 @@ s_MgrMakeAssocRequest( ...@@ -3774,9 +3774,13 @@ s_MgrMakeAssocRequest(
*pwPMKID = 0; // Initialize PMKID count *pwPMKID = 0; // Initialize PMKID count
pbyRSN += 2; // Point to PMKID list pbyRSN += 2; // Point to PMKID list
for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) {
if ( !memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0],
(*pwPMKID) ++; pMgmt->abyCurrBSSID,
memcpy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); ETH_ALEN)) {
(*pwPMKID)++;
memcpy(pbyRSN,
pDevice->gsPMKID.BSSIDInfo[ii].PMKID,
16);
pbyRSN += 16; pbyRSN += 16;
} }
} }
...@@ -4030,9 +4034,13 @@ s_MgrMakeReAssocRequest( ...@@ -4030,9 +4034,13 @@ s_MgrMakeReAssocRequest(
*pwPMKID = 0; // Initialize PMKID count *pwPMKID = 0; // Initialize PMKID count
pbyRSN += 2; // Point to PMKID list pbyRSN += 2; // Point to PMKID list
for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) {
if ( !memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0],
(*pwPMKID) ++; pMgmt->abyCurrBSSID,
memcpy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); ETH_ALEN)) {
(*pwPMKID)++;
memcpy(pbyRSN,
pDevice->gsPMKID.BSSIDInfo[ii].PMKID,
16);
pbyRSN += 16; pbyRSN += 16;
} }
} }
...@@ -4057,8 +4065,6 @@ s_MgrMakeReAssocRequest( ...@@ -4057,8 +4065,6 @@ s_MgrMakeReAssocRequest(
return pTxPacket; return pTxPacket;
} }
/*+ /*+
* *
* Routine Description: * Routine Description:
...@@ -4070,7 +4076,6 @@ s_MgrMakeReAssocRequest( ...@@ -4070,7 +4076,6 @@ s_MgrMakeReAssocRequest(
* *
-*/ -*/
PSTxMgmtPacket PSTxMgmtPacket
s_MgrMakeAssocResponse( s_MgrMakeAssocResponse(
IN PSDevice pDevice, IN PSDevice pDevice,
...@@ -4746,11 +4751,14 @@ bAdd_PMKID_Candidate ( ...@@ -4746,11 +4751,14 @@ bAdd_PMKID_Candidate (
// Update Old Candidate // Update Old Candidate
for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) {
pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii];
if ( !memcmp(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN)) { if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) {
if ((psRSNCapObj->bRSNCapExist == TRUE) && (psRSNCapObj->wRSNCap & BIT0)) { if ((psRSNCapObj->bRSNCapExist == TRUE)
pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; && (psRSNCapObj->wRSNCap & BIT0)) {
pCandidateList->Flags |=
NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED;
} else { } else {
pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); pCandidateList->Flags &=
~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED);
} }
return TRUE; return TRUE;
} }
...@@ -4763,7 +4771,7 @@ bAdd_PMKID_Candidate ( ...@@ -4763,7 +4771,7 @@ bAdd_PMKID_Candidate (
} else { } else {
pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED);
} }
memcpy(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN); memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN);
pDevice->gsPMKIDCandidate.NumCandidates++; pDevice->gsPMKIDCandidate.NumCandidates++;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates);
return TRUE; return TRUE;
......
...@@ -340,14 +340,19 @@ WPA2uSetIEs( ...@@ -340,14 +340,19 @@ WPA2uSetIEs(
if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) &&
(pMgmt->bRoaming == TRUE) && (pMgmt->bRoaming == TRUE) &&
(pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) {
// RSN PMKID /* RSN PMKID, pointer to PMKID count */
pwPMKID = (PWORD)(&pRSNIEs->abyRSN[18]); // Point to PMKID count pwPMKID = (PWORD)(&pRSNIEs->abyRSN[18]);
*pwPMKID = 0; // Initialize PMKID count *pwPMKID = 0; /* Initialize PMKID count */
pbyBuffer = &pRSNIEs->abyRSN[20]; // Point to PMKID list pbyBuffer = &pRSNIEs->abyRSN[20]; /* Point to PMKID list */
for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) { for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) {
if ( !memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { if (!memcmp(&pMgmt->
(*pwPMKID) ++; gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0],
memcpy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16); pMgmt->abyCurrBSSID,
ETH_ALEN)) {
(*pwPMKID)++;
memcpy(pbyBuffer,
pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID,
16);
pbyBuffer += 16; pbyBuffer += 16;
} }
} }
......
...@@ -103,7 +103,7 @@ static int wpa_init_wpadev(PSDevice pDevice) ...@@ -103,7 +103,7 @@ static int wpa_init_wpadev(PSDevice pDevice)
wpadev_priv = netdev_priv(pDevice->wpadev); wpadev_priv = netdev_priv(pDevice->wpadev);
*wpadev_priv = *pDevice; *wpadev_priv = *pDevice;
memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN); memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, ETH_ALEN);
pDevice->wpadev->base_addr = dev->base_addr; pDevice->wpadev->base_addr = dev->base_addr;
pDevice->wpadev->irq = dev->irq; pDevice->wpadev->irq = dev->irq;
pDevice->wpadev->mem_start = dev->mem_start; pDevice->wpadev->mem_start = dev->mem_start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment