From 1cac4a4b2a99295dbce2b34d87f2541482cb12b2 Mon Sep 17 00:00:00 2001 From: Andres More Date: Mon, 18 Mar 2013 20:33:50 -0500 Subject: [PATCH] staging: vt6656: removed custom 802.11 header usage Removed struct tagS802_11Header, switching to struct ieee80211_hdr instead. Checkpatch warnings and errors were not resolved. Signed-off-by: Andres More Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/aes_ccmp.c | 18 +++--- drivers/staging/vt6656/dpc.c | 80 +++++++++++++-------------- drivers/staging/vt6656/mib.c | 4 +- drivers/staging/vt6656/rxtx.c | 92 +++++++++++++++---------------- drivers/staging/vt6656/tether.h | 24 -------- drivers/staging/vt6656/wctl.c | 37 ++++++------- drivers/staging/vt6656/wctl.h | 39 +++++++------ 7 files changed, 134 insertions(+), 160 deletions(-) diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c index 0cf425e28eb3..31855e8c010b 100644 --- a/drivers/staging/vt6656/aes_ccmp.c +++ b/drivers/staging/vt6656/aes_ccmp.c @@ -243,7 +243,7 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize) u8 abyPlainText[16]; u8 abyLastCipher[16]; - PS802_11Header pMACHeader = (PS802_11Header) pbyFrame; + struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *) pbyFrame; u8 * pbyIV; u8 * pbyPayload; u16 wHLen = 22; @@ -265,7 +265,7 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize) pbyPayload = pbyIV + 8; /* IV-length */ abyNonce[0] = 0x00; /* now is 0, if Qos here will be priority */ - memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN); + memcpy(&(abyNonce[1]), pMACHeader->addr2, ETH_ALEN); abyNonce[7] = pbyIV[7]; abyNonce[8] = pbyIV[6]; abyNonce[9] = pbyIV[5]; @@ -282,22 +282,22 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize) /* MIC_HDR1 */ MIC_HDR1[0] = (u8)(wHLen >> 8); MIC_HDR1[1] = (u8)(wHLen & 0xff); - byTmp = (u8)(pMACHeader->wFrameCtl & 0xff); + byTmp = (u8)(pMACHeader->frame_control & 0xff); MIC_HDR1[2] = byTmp & 0x8f; - byTmp = (u8)(pMACHeader->wFrameCtl >> 8); + byTmp = (u8)(pMACHeader->frame_control >> 8); byTmp &= 0x87; MIC_HDR1[3] = byTmp | 0x40; - memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN); - memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN); + memcpy(&(MIC_HDR1[4]), pMACHeader->addr1, ETH_ALEN); + memcpy(&(MIC_HDR1[10]), pMACHeader->addr2, ETH_ALEN); /* MIC_HDR2 */ - memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN); - byTmp = (u8)(pMACHeader->wSeqCtl & 0xff); + memcpy(&(MIC_HDR2[0]), pMACHeader->addr3, ETH_ALEN); + byTmp = (u8)(pMACHeader->seq_ctrl & 0xff); MIC_HDR2[6] = byTmp & 0x0f; MIC_HDR2[7] = 0; if (bA4) { - memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, ETH_ALEN); + memcpy(&(MIC_HDR2[8]), pMACHeader->addr4, ETH_ALEN); } else { MIC_HDR2[8] = 0x00; MIC_HDR2[9] = 0x00; diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index 66266a9f1099..617155df09dd 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -129,11 +129,11 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, u8 *pbyRxBuffer; u32 cbHeaderSize = 0; u16 *pwType; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; int ii; - pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize); s_vGetDASA((u8 *)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader); @@ -221,44 +221,44 @@ s_vGetDASA ( ) { unsigned int cbHeaderSize = 0; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; int ii; - pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize); - if ((pMACHeader->wFrameCtl & FC_TODS) == 0) { - if (pMACHeader->wFrameCtl & FC_FROMDS) { + if ((pMACHeader->frame_control & FC_TODS) == 0) { + if (pMACHeader->frame_control & FC_FROMDS) { for (ii = 0; ii < ETH_ALEN; ii++) { psEthHeader->h_dest[ii] = - pMACHeader->abyAddr1[ii]; + pMACHeader->addr1[ii]; psEthHeader->h_source[ii] = - pMACHeader->abyAddr3[ii]; + pMACHeader->addr3[ii]; } } else { /* IBSS mode */ for (ii = 0; ii < ETH_ALEN; ii++) { psEthHeader->h_dest[ii] = - pMACHeader->abyAddr1[ii]; + pMACHeader->addr1[ii]; psEthHeader->h_source[ii] = - pMACHeader->abyAddr2[ii]; + pMACHeader->addr2[ii]; } } } else { /* Is AP mode.. */ - if (pMACHeader->wFrameCtl & FC_FROMDS) { + if (pMACHeader->frame_control & FC_FROMDS) { for (ii = 0; ii < ETH_ALEN; ii++) { psEthHeader->h_dest[ii] = - pMACHeader->abyAddr3[ii]; + pMACHeader->addr3[ii]; psEthHeader->h_source[ii] = - pMACHeader->abyAddr4[ii]; + pMACHeader->addr4[ii]; cbHeaderSize += 6; } } else { for (ii = 0; ii < ETH_ALEN; ii++) { psEthHeader->h_dest[ii] = - pMACHeader->abyAddr3[ii]; + pMACHeader->addr3[ii]; psEthHeader->h_source[ii] = - pMACHeader->abyAddr2[ii]; + pMACHeader->addr2[ii]; } } }; @@ -273,7 +273,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, struct sk_buff *skb; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_rx_mgmt *pRxPacket = &pMgmt->sRxPacket; - PS802_11Header p802_11Header; + struct ieee80211_hdr *p802_11Header; u8 *pbyRsr, *pbyNewRsr, *pbyRSSI, *pbyFrame; u64 *pqwTSFTime; u32 bDeFragRx = false; @@ -297,7 +297,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, u8 abyVaildRate[MAX_RATE] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; u16 wPLCPwithPadding; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; int bRxeapol_key = false; @@ -378,27 +378,27 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, ); - pMACHeader = (PS802_11Header) pbyFrame; + pMACHeader = (struct ieee80211_hdr *) pbyFrame; //mike add: to judge if current AP is activated? if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) || (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) { if (pMgmt->sNodeDBTable[0].bActive) { - if (!compare_ether_addr(pMgmt->abyCurrBSSID, pMACHeader->abyAddr2)) { + if (!compare_ether_addr(pMgmt->abyCurrBSSID, pMACHeader->addr2)) { if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) pMgmt->sNodeDBTable[0].uInActiveCount = 0; } } } - if (!is_multicast_ether_addr(pMACHeader->abyAddr1)) { - if ( WCTLbIsDuplicate(&(pDevice->sDupRxCache), (PS802_11Header) pbyFrame) ) { + if (!is_multicast_ether_addr(pMACHeader->addr1)) { + if (WCTLbIsDuplicate(&(pDevice->sDupRxCache), (struct ieee80211_hdr *) pbyFrame)) { pDevice->s802_11Counter.FrameDuplicateCount++; return false; } if (compare_ether_addr(pDevice->abyCurrentNetAddr, - pMACHeader->abyAddr1)) { + pMACHeader->addr1)) { return false; } } @@ -413,9 +413,9 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) { if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { - p802_11Header = (PS802_11Header) (pbyFrame); + p802_11Header = (struct ieee80211_hdr *) (pbyFrame); // get SA NodeIndex - if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(p802_11Header->abyAddr2), &iSANodeIndex)) { + if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(p802_11Header->addr2), &iSANodeIndex)) { pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = jiffies; pMgmt->sNodeDBTable[iSANodeIndex].uInActiveCount = 0; } @@ -508,7 +508,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, (IS_FRAGMENT_PKT((pbyFrame))) ) { // defragment - bDeFragRx = WCTLbHandleFragment(pDevice, (PS802_11Header) (pbyFrame), FrameSize, bIsWEP, bExtIV); + bDeFragRx = WCTLbHandleFragment(pDevice, (struct ieee80211_hdr *) (pbyFrame), FrameSize, bIsWEP, bExtIV); pDevice->s802_11Counter.ReceivedFragmentCount++; if (bDeFragRx) { // defrag complete @@ -818,7 +818,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } ev.src_addr.sa_family = ARPHRD_ETHER; - memcpy(ev.src_addr.sa_data, pMACHeader->abyAddr2, ETH_ALEN); + memcpy(ev.src_addr.sa_data, pMACHeader->addr2, ETH_ALEN); memset(&wrqu, 0, sizeof(wrqu)); wrqu.data.length = sizeof(ev); PRINT_K("wireless_send_event--->IWEVMICHAELMICFAILURE\n"); @@ -928,13 +928,13 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, s32 iSANodeIndex) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - PS802_11Header p802_11Header; + struct ieee80211_hdr *p802_11Header; CMD_STATUS Status; if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { - p802_11Header = (PS802_11Header) (pbyFrame); + p802_11Header = (struct ieee80211_hdr *) (pbyFrame); if (!IS_TYPE_MGMT(pbyFrame)) { // Data & PS-Poll packet @@ -946,7 +946,7 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, // reason = (6) class 2 received from nonauth sta vMgrDeAuthenBeginSta(pDevice, pMgmt, - (u8 *)(p802_11Header->abyAddr2), + (u8 *)(p802_11Header->addr2), (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); @@ -958,7 +958,7 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, // reason = (7) class 3 received from nonassoc sta vMgrDisassocBeginSta(pDevice, pMgmt, - (u8 *)(p802_11Header->abyAddr2), + (u8 *)(p802_11Header->addr2), (WLAN_MGMT_REASON_CLASS3_NONASSOC), &Status ); @@ -1011,18 +1011,18 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, else { vMgrDeAuthenBeginSta(pDevice, pMgmt, - (u8 *)(p802_11Header->abyAddr2), + (u8 *)(p802_11Header->addr2), (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%pM\n", - p802_11Header->abyAddr3); + p802_11Header->addr3); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%pM\n", - p802_11Header->abyAddr2); + p802_11Header->addr2); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n", - p802_11Header->abyAddr1); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl ); + p802_11Header->addr1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: frame_control= %x\n", p802_11Header->frame_control); return true; } } @@ -1149,8 +1149,8 @@ static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, (pDevice->byLocalID <= REV_ID_VT3253_A1)) { // Software TKIP // 1. 3253 A - PS802_11Header pMACHeader = (PS802_11Header) (pbyFrame); - TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); + struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *) (pbyFrame); + TKIPvMixKey(pKey->abyKey, pMACHeader->addr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { @@ -1173,7 +1173,7 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; u32 PayloadLen = FrameSize; u8 *pbyIV; u8 byKeyIdx; @@ -1252,8 +1252,8 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, // 1. 3253 A // 2. NotOnFly DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP \n"); - pMACHeader = (PS802_11Header) (pbyFrame); - TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); + pMACHeader = (struct ieee80211_hdr *) (pbyFrame); + TKIPvMixKey(pKey->abyKey, pMACHeader->addr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { diff --git a/drivers/staging/vt6656/mib.c b/drivers/staging/vt6656/mib.c index fd4202c14eab..3ab028bc03d4 100644 --- a/drivers/staging/vt6656/mib.c +++ b/drivers/staging/vt6656/mib.c @@ -157,7 +157,7 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, u8 * pbyBuffer, unsigned int cbFrameLength) { /* need change */ - PS802_11Header pHeader = (PS802_11Header)pbyBuffer; + struct ieee80211_hdr *pHeader = (struct ieee80211_hdr *)pbyBuffer; if (byRSR & RSR_ADDROK) pStatistic->dwRsrADDROk++; @@ -343,7 +343,7 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, else pStatistic->dwRsrDirected++; - if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl)) + if (WLAN_GET_FC_MOREFRAG(pHeader->frame_control)) pStatistic->dwRsrRxFragment++; if (cbFrameLength < ETH_ZLEN + 4) { diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 4faab45a98ff..b7e14e373a0a 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -208,7 +208,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, u32 *pdwIV = (u32 *)pbyIVHead; u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4); u16 wValue; - PS802_11Header pMACHeader = (PS802_11Header)pbyHdrBuf; + struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf; u32 dwRevIVCounter; @@ -275,7 +275,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, //Fill MICHDR0 *pMICHDR = 0x59; *((u8 *)(pMICHDR+1)) = 0; // TxPriority - memcpy(pMICHDR+2, &(pMACHeader->abyAddr2[0]), 6); + memcpy(pMICHDR+2, &(pMACHeader->addr2[0]), 6); *((u8 *)(pMICHDR+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16)); *((u8 *)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16)); *((u8 *)(pMICHDR+10)) = HIBYTE(LOWORD(pTransmitKey->dwTSC47_16)); @@ -292,19 +292,19 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, } else { *((u8 *)(pMICHDR+17)) = 22; // HLEN[7:0] } - wValue = cpu_to_le16(pMACHeader->wFrameCtl & 0xC78F); + wValue = cpu_to_le16(pMACHeader->frame_control & 0xC78F); memcpy(pMICHDR+18, (u8 *)&wValue, 2); // MSKFRACTL - memcpy(pMICHDR+20, &(pMACHeader->abyAddr1[0]), 6); - memcpy(pMICHDR+26, &(pMACHeader->abyAddr2[0]), 6); + memcpy(pMICHDR+20, &(pMACHeader->addr1[0]), 6); + memcpy(pMICHDR+26, &(pMACHeader->addr2[0]), 6); //Fill MICHDR2 - memcpy(pMICHDR+32, &(pMACHeader->abyAddr3[0]), 6); - wValue = pMACHeader->wSeqCtl; + memcpy(pMICHDR+32, &(pMACHeader->addr3[0]), 6); + wValue = pMACHeader->seq_ctrl; wValue &= 0x000F; wValue = cpu_to_le16(wValue); memcpy(pMICHDR+38, (u8 *)&wValue, 2); // MSKSEQCTL if (pDevice->bLongHeader) { - memcpy(pMICHDR+40, &(pMACHeader->abyAddr4[0]), 6); + memcpy(pMICHDR+40, &(pMACHeader->addr4[0]), 6); } } } @@ -1621,64 +1621,64 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice, u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx) { - PS802_11Header pMACHeader = (PS802_11Header)pbyBufferAddr; + struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyBufferAddr; - memset(pMACHeader, 0, (sizeof(S802_11Header))); //- sizeof(pMACHeader->dwIV))); + memset(pMACHeader, 0, (sizeof(struct ieee80211_hdr))); if (uDMAIdx == TYPE_ATIMDMA) { - pMACHeader->wFrameCtl = TYPE_802_11_ATIM; + pMACHeader->frame_control = TYPE_802_11_ATIM; } else { - pMACHeader->wFrameCtl = TYPE_802_11_DATA; + pMACHeader->frame_control = TYPE_802_11_DATA; } if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pMACHeader->abyAddr1[0]), + memcpy(&(pMACHeader->addr1[0]), &(psEthHeader->h_dest[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr3[0]), + memcpy(&(pMACHeader->addr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + memcpy(&(pMACHeader->addr3[0]), &(psEthHeader->h_source[0]), ETH_ALEN); - pMACHeader->wFrameCtl |= FC_FROMDS; + pMACHeader->frame_control |= FC_FROMDS; } else { if (pDevice->eOPMode == OP_MODE_ADHOC) { - memcpy(&(pMACHeader->abyAddr1[0]), + memcpy(&(pMACHeader->addr1[0]), &(psEthHeader->h_dest[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr2[0]), + memcpy(&(pMACHeader->addr2[0]), &(psEthHeader->h_source[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr3[0]), + memcpy(&(pMACHeader->addr3[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); } else { - memcpy(&(pMACHeader->abyAddr3[0]), + memcpy(&(pMACHeader->addr3[0]), &(psEthHeader->h_dest[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr2[0]), + memcpy(&(pMACHeader->addr2[0]), &(psEthHeader->h_source[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr1[0]), + memcpy(&(pMACHeader->addr1[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); - pMACHeader->wFrameCtl |= FC_TODS; + pMACHeader->frame_control |= FC_TODS; } } if (bNeedEncrypt) - pMACHeader->wFrameCtl |= cpu_to_le16((u16)WLAN_SET_FC_ISWEP(1)); + pMACHeader->frame_control |= cpu_to_le16((u16)WLAN_SET_FC_ISWEP(1)); - pMACHeader->wDurationID = cpu_to_le16(wDuration); + pMACHeader->duration_id = cpu_to_le16(wDuration); if (pDevice->bLongHeader) { PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr; - pMACHeader->wFrameCtl |= (FC_TODS | FC_FROMDS); + pMACHeader->frame_control |= (FC_TODS | FC_FROMDS); memcpy(pMACA4Header->abyAddr4, pDevice->abyBSSID, WLAN_ADDR_LEN); } - pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); + pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); //Set FragNumber in Sequence Control - pMACHeader->wSeqCtl |= cpu_to_le16((u16)uFragIdx); + pMACHeader->seq_ctrl |= cpu_to_le16((u16)uFragIdx); if ((wFragType == FRAGCTL_ENDFRAG) || (wFragType == FRAGCTL_NONFRAG)) { pDevice->wSeqCounter++; @@ -1687,7 +1687,7 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice, } if ((wFragType == FRAGCTL_STAFRAG) || (wFragType == FRAGCTL_MIDFRAG)) { //StartFrag or MidFrag - pMACHeader->wFrameCtl |= FC_MOREFRAG; + pMACHeader->frame_control |= FC_MOREFRAG; } } @@ -1717,7 +1717,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PTX_BUFFER pTX_Buffer; PSTxBufHead pTxBufHead; PUSB_SEND_CONTEXT pContext; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; PSCTS pCTS; struct ethhdr sEthHeader; u8 byPktType, *pbyTxBufferAddr; @@ -1897,7 +1897,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, 0, 0, 1, AUTO_FB_NONE); - pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + cbFrameBodySize; @@ -1947,7 +1947,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); } - pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); + pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); pDevice->wSeqCounter++ ; if (pDevice->wSeqCounter > 0x0fff) pDevice->wSeqCounter = 0; @@ -1975,11 +1975,11 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, pContext->Type = CONTEXT_MGMT_PACKET; pContext->uBufLen = (u16)cbReqCount + 4; //USB header - if (WLAN_GET_FC_TODS(pMACHeader->wFrameCtl) == 0) { - s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr1[0]),(u16)cbFrameSize,pTX_Buffer->wFIFOCtl); + if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr1[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } else { - s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr3[0]),(u16)cbFrameSize,pTX_Buffer->wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr3[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } PIPEnsSendBulkOut(pDevice,pContext); @@ -1994,7 +1994,7 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, u32 cbHeaderSize = 0; u16 wTxBufSize = sizeof(STxShortBufHead); PSTxShortBufHead pTxBufHead; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; PSTxDataHead_ab pTxDataHead; u16 wCurrentRate; u32 cbFrameBodySize; @@ -2048,11 +2048,11 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, } //Generate Beacon Header - pMACHeader = (PS802_11Header)(pbyTxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *)(pbyTxBufferAddr + cbHeaderSize); memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); - pMACHeader->wDurationID = 0; - pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); + pMACHeader->duration_id = 0; + pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); pDevice->wSeqCounter++ ; if (pDevice->wSeqCounter > 0x0fff) pDevice->wSeqCounter = 0; @@ -2080,7 +2080,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) u8 *pbyTxBufferAddr; void *pvRTS, *pvCTS, *pvTxDataHd; u32 uDuration, cbReqCount; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; u32 cbHeaderSize, cbFrameBodySize; int bNeedACK, bIsPSPOLL = false; PSTxBufHead pTxBufHead; @@ -2310,7 +2310,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, 0, 0, 1, AUTO_FB_NONE); - pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen) + cbExtSuppRate; @@ -2322,7 +2322,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) memcpy(pbyMacHdr, skb->data, cbMacHdLen); // version set to 0, patch for hostapd deamon - pMACHeader->wFrameCtl &= cpu_to_le16(0xfffc); + pMACHeader->frame_control &= cpu_to_le16(0xfffc); memcpy(pbyPayloadHead, (skb->data + cbMacHdLen), cbFrameBodySize); // replace support rate, patch for hostapd daemon( only support 11M) @@ -2406,7 +2406,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } } - pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); + pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); pDevice->wSeqCounter++ ; if (pDevice->wSeqCounter > 0x0fff) pDevice->wSeqCounter = 0; @@ -2434,11 +2434,11 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) pContext->Type = CONTEXT_MGMT_PACKET; pContext->uBufLen = (u16)cbReqCount + 4; //USB header - if (WLAN_GET_FC_TODS(pMACHeader->wFrameCtl) == 0) { - s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr1[0]),(u16)cbFrameSize,pTX_Buffer->wFIFOCtl); + if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr1[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } else { - s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr3[0]),(u16)cbFrameSize,pTX_Buffer->wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr3[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } PIPEnsSendBulkOut(pDevice,pContext); return ; diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h index cba18b103e74..4ecca753ab68 100644 --- a/drivers/staging/vt6656/tether.h +++ b/drivers/staging/vt6656/tether.h @@ -43,11 +43,6 @@ #define TYPE_MGMT_PROBE_RSP 0x5000 -// -// wFrameCtl field in the S802_11Header -// -// NOTE.... -// in network byte order, high byte is going first #define FC_TODS 0x0001 #define FC_FROMDS 0x0002 #define FC_MOREFRAG 0x0004 @@ -81,11 +76,6 @@ #define TYPE_MGMT_PROBE_RSP 0x0050 -// -// wFrameCtl field in the S802_11Header -// -// NOTE.... -// in network byte order, high byte is going first #define FC_TODS 0x0100 #define FC_FROMDS 0x0200 #define FC_MOREFRAG 0x0400 @@ -124,20 +114,6 @@ typedef struct tagS802_3Header { } __attribute__ ((__packed__)) S802_3Header, *PS802_3Header; -// -// 802_11 packet -// -typedef struct tagS802_11Header { - u16 wFrameCtl; - u16 wDurationID; - u8 abyAddr1[ETH_ALEN]; - u8 abyAddr2[ETH_ALEN]; - u8 abyAddr3[ETH_ALEN]; - u16 wSeqCtl; - u8 abyAddr4[ETH_ALEN]; -} __attribute__ ((__packed__)) -S802_11Header, *PS802_11Header; - /*--------------------- Export Macros ------------------------------*/ /*--------------------- Export Classes ----------------------------*/ diff --git a/drivers/staging/vt6656/wctl.c b/drivers/staging/vt6656/wctl.c index a02ea0328db5..c53bed32b02a 100644 --- a/drivers/staging/vt6656/wctl.c +++ b/drivers/staging/vt6656/wctl.c @@ -67,7 +67,7 @@ * */ -bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) +bool WCTLbIsDuplicate (PSCache pCache, struct ieee80211_hdr *pMACHeader) { unsigned int uIndex; unsigned int ii; @@ -78,10 +78,10 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) uIndex = pCache->uInPtr; for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) { pCacheEntry = &(pCache->asCacheEntry[uIndex]); - if ((pCacheEntry->wFmSequence == pMACHeader->wSeqCtl) && + if ((pCacheEntry->wFmSequence == pMACHeader->seq_ctrl) && (!compare_ether_addr(&(pCacheEntry->abyAddr2[0]), - &(pMACHeader->abyAddr2[0]))) && - (LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->wFrameCtl)) + &(pMACHeader->addr2[0]))) && + (LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->frame_control)) ) { /* Duplicate match */ return true; @@ -91,9 +91,9 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) } /* Not found in cache - insert */ pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr]; - pCacheEntry->wFmSequence = pMACHeader->wSeqCtl; - memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN); - pCacheEntry->wFrameCtl = pMACHeader->wFrameCtl; + pCacheEntry->wFmSequence = pMACHeader->seq_ctrl; + memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->addr2[0]), ETH_ALEN); + pCacheEntry->wFrameCtl = pMACHeader->frame_control; ADD_ONE_WITH_WRAP_AROUND(pCache->uInPtr, DUPLICATE_RX_CACHE_LENGTH); return false; } @@ -114,14 +114,14 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) */ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, - PS802_11Header pMACHeader) + struct ieee80211_hdr *pMACHeader) { unsigned int ii; for (ii = 0; ii < pDevice->cbDFCB; ii++) { if ((pDevice->sRxDFCB[ii].bInUse == true) && (!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]), - &(pMACHeader->abyAddr2[0])))) { + &(pMACHeader->addr2[0])))) { return ii; } } @@ -143,7 +143,7 @@ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, * */ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, - PS802_11Header pMACHeader) + struct ieee80211_hdr *pMACHeader) { unsigned int ii; @@ -154,10 +154,10 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, pDevice->cbFreeDFCB--; pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime; pDevice->sRxDFCB[ii].bInUse = true; - pDevice->sRxDFCB[ii].wSequence = (pMACHeader->wSeqCtl >> 4); - pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F); + pDevice->sRxDFCB[ii].wSequence = (pMACHeader->seq_ctrl >> 4); + pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->seq_ctrl & 0x000F); memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), - &(pMACHeader->abyAddr2[0]), + &(pMACHeader->addr2[0]), ETH_ALEN); return(ii); } @@ -182,8 +182,7 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, * Return Value: true if it is valid fragment packet and we have resource to defragment; otherwise false * */ -bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, - unsigned int cbFrameLength, bool bWEP, bool bExtIV) +bool WCTLbHandleFragment(struct vnt_private *pDevice, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV) { unsigned int uHeaderSize; @@ -203,8 +202,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, if (pDevice->uCurrentDFCBIdx < pDevice->cbDFCB) { // duplicate, we must flush previous DCB pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].uLifetime = pDevice->dwMaxReceiveLifetime; - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence = (pMACHeader->wSeqCtl >> 4); - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->wSeqCtl & 0x000F); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence = (pMACHeader->seq_ctrl >> 4); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->seq_ctrl & 0x000F); } else { pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader); @@ -225,8 +224,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, else { pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, pMACHeader); if (pDevice->uCurrentDFCBIdx != pDevice->cbDFCB) { - if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->wSeqCtl >> 4)) && - (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->wSeqCtl & 0x000F)) && + if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->seq_ctrl >> 4)) && + (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->seq_ctrl & 0x000F)) && ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength + cbFrameLength - uHeaderSize) < 2346)) { memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, ((u8 *) (pMACHeader) + uHeaderSize), (cbFrameLength - uHeaderSize)); diff --git a/drivers/staging/vt6656/wctl.h b/drivers/staging/vt6656/wctl.h index 4436108250f6..0ba41ee6181e 100644 --- a/drivers/staging/vt6656/wctl.h +++ b/drivers/staging/vt6656/wctl.h @@ -35,51 +35,51 @@ /*--------------------- Export Definitions -------------------------*/ #define IS_TYPE_DATA(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_DATA) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_DATA) #define IS_TYPE_MGMT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_MGMT) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_MGMT) #define IS_TYPE_CONTROL(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_CTL) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_CTL) #define IS_FC_MOREDATA(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREDATA) == FC_MOREDATA) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREDATA) == FC_MOREDATA) #define IS_FC_POWERMGT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_POWERMGT) == FC_POWERMGT) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_POWERMGT) == FC_POWERMGT) #define IS_FC_RETRY(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_RETRY) == FC_RETRY) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_RETRY) == FC_RETRY) #define IS_FC_WEP(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_WEP) == FC_WEP) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_WEP) == FC_WEP) #ifdef __BIG_ENDIAN #define IS_FRAGMENT_PKT(pMACHeader) \ - (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ - ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) != 0)) + (((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \ + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) != 0)) #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) == 0) + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) == 0) #else #define IS_FRAGMENT_PKT(pMACHeader) \ - (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ - ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) != 0)) + (((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \ + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) != 0)) #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) == 0) + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) == 0) #endif//#ifdef __BIG_ENDIAN #define IS_LAST_FRAGMENT_PKT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) == 0) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) == 0) #define IS_CTL_PSPOLL(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ @@ -95,10 +95,9 @@ /*--------------------- Export Functions --------------------------*/ -bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); -bool WCTLbHandleFragment(struct vnt_private *, PS802_11Header pMACHeader, - unsigned int cbFrameLength, bool bWEP, bool bExtIV); -unsigned int WCTLuSearchDFCB(struct vnt_private *, PS802_11Header pMACHeader); -unsigned int WCTLuInsertDFCB(struct vnt_private *, PS802_11Header pMACHeader); +bool WCTLbIsDuplicate(PSCache pCache, struct ieee80211_hdr *pMACHeader); +bool WCTLbHandleFragment(struct vnt_private *, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV); +unsigned int WCTLuSearchDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader); +unsigned int WCTLuInsertDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader); #endif /* __WCTL_H__ */ -- 2.39.5