Commit 1cac4a4b authored by Andres More's avatar Andres More Committed by Greg Kroah-Hartman

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: default avatarAndres More <more.andres@gmail.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ceb8c5da
...@@ -243,7 +243,7 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize) ...@@ -243,7 +243,7 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize)
u8 abyPlainText[16]; u8 abyPlainText[16];
u8 abyLastCipher[16]; u8 abyLastCipher[16];
PS802_11Header pMACHeader = (PS802_11Header) pbyFrame; struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *) pbyFrame;
u8 * pbyIV; u8 * pbyIV;
u8 * pbyPayload; u8 * pbyPayload;
u16 wHLen = 22; u16 wHLen = 22;
...@@ -265,7 +265,7 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize) ...@@ -265,7 +265,7 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize)
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, ETH_ALEN); memcpy(&(abyNonce[1]), pMACHeader->addr2, 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];
...@@ -282,22 +282,22 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize) ...@@ -282,22 +282,22 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize)
/* MIC_HDR1 */ /* MIC_HDR1 */
MIC_HDR1[0] = (u8)(wHLen >> 8); MIC_HDR1[0] = (u8)(wHLen >> 8);
MIC_HDR1[1] = (u8)(wHLen & 0xff); MIC_HDR1[1] = (u8)(wHLen & 0xff);
byTmp = (u8)(pMACHeader->wFrameCtl & 0xff); byTmp = (u8)(pMACHeader->frame_control & 0xff);
MIC_HDR1[2] = byTmp & 0x8f; MIC_HDR1[2] = byTmp & 0x8f;
byTmp = (u8)(pMACHeader->wFrameCtl >> 8); byTmp = (u8)(pMACHeader->frame_control >> 8);
byTmp &= 0x87; byTmp &= 0x87;
MIC_HDR1[3] = byTmp | 0x40; MIC_HDR1[3] = byTmp | 0x40;
memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN); memcpy(&(MIC_HDR1[4]), pMACHeader->addr1, ETH_ALEN);
memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN); memcpy(&(MIC_HDR1[10]), pMACHeader->addr2, ETH_ALEN);
/* MIC_HDR2 */ /* MIC_HDR2 */
memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN); memcpy(&(MIC_HDR2[0]), pMACHeader->addr3, ETH_ALEN);
byTmp = (u8)(pMACHeader->wSeqCtl & 0xff); byTmp = (u8)(pMACHeader->seq_ctrl & 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, ETH_ALEN); memcpy(&(MIC_HDR2[8]), pMACHeader->addr4, ETH_ALEN);
} else { } else {
MIC_HDR2[8] = 0x00; MIC_HDR2[8] = 0x00;
MIC_HDR2[9] = 0x00; MIC_HDR2[9] = 0x00;
......
...@@ -129,11 +129,11 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, ...@@ -129,11 +129,11 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice,
u8 *pbyRxBuffer; u8 *pbyRxBuffer;
u32 cbHeaderSize = 0; u32 cbHeaderSize = 0;
u16 *pwType; u16 *pwType;
PS802_11Header pMACHeader; struct ieee80211_hdr *pMACHeader;
int ii; int ii;
pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize);
s_vGetDASA((u8 *)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader); s_vGetDASA((u8 *)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader);
...@@ -221,44 +221,44 @@ s_vGetDASA ( ...@@ -221,44 +221,44 @@ s_vGetDASA (
) )
{ {
unsigned int cbHeaderSize = 0; unsigned int cbHeaderSize = 0;
PS802_11Header pMACHeader; struct ieee80211_hdr *pMACHeader;
int ii; int ii;
pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize);
if ((pMACHeader->wFrameCtl & FC_TODS) == 0) { if ((pMACHeader->frame_control & FC_TODS) == 0) {
if (pMACHeader->wFrameCtl & FC_FROMDS) { if (pMACHeader->frame_control & FC_FROMDS) {
for (ii = 0; ii < ETH_ALEN; ii++) { for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->h_dest[ii] = psEthHeader->h_dest[ii] =
pMACHeader->abyAddr1[ii]; pMACHeader->addr1[ii];
psEthHeader->h_source[ii] = psEthHeader->h_source[ii] =
pMACHeader->abyAddr3[ii]; pMACHeader->addr3[ii];
} }
} else { } else {
/* IBSS mode */ /* IBSS mode */
for (ii = 0; ii < ETH_ALEN; ii++) { for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->h_dest[ii] = psEthHeader->h_dest[ii] =
pMACHeader->abyAddr1[ii]; pMACHeader->addr1[ii];
psEthHeader->h_source[ii] = psEthHeader->h_source[ii] =
pMACHeader->abyAddr2[ii]; pMACHeader->addr2[ii];
} }
} }
} else { } else {
/* Is AP mode.. */ /* Is AP mode.. */
if (pMACHeader->wFrameCtl & FC_FROMDS) { if (pMACHeader->frame_control & FC_FROMDS) {
for (ii = 0; ii < ETH_ALEN; ii++) { for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->h_dest[ii] = psEthHeader->h_dest[ii] =
pMACHeader->abyAddr3[ii]; pMACHeader->addr3[ii];
psEthHeader->h_source[ii] = psEthHeader->h_source[ii] =
pMACHeader->abyAddr4[ii]; pMACHeader->addr4[ii];
cbHeaderSize += 6; cbHeaderSize += 6;
} }
} else { } else {
for (ii = 0; ii < ETH_ALEN; ii++) { for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->h_dest[ii] = psEthHeader->h_dest[ii] =
pMACHeader->abyAddr3[ii]; pMACHeader->addr3[ii];
psEthHeader->h_source[ii] = psEthHeader->h_source[ii] =
pMACHeader->abyAddr2[ii]; pMACHeader->addr2[ii];
} }
} }
}; };
...@@ -273,7 +273,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, ...@@ -273,7 +273,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB,
struct sk_buff *skb; struct sk_buff *skb;
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
struct vnt_rx_mgmt *pRxPacket = &pMgmt->sRxPacket; struct vnt_rx_mgmt *pRxPacket = &pMgmt->sRxPacket;
PS802_11Header p802_11Header; struct ieee80211_hdr *p802_11Header;
u8 *pbyRsr, *pbyNewRsr, *pbyRSSI, *pbyFrame; u8 *pbyRsr, *pbyNewRsr, *pbyRSSI, *pbyFrame;
u64 *pqwTSFTime; u64 *pqwTSFTime;
u32 bDeFragRx = false; u32 bDeFragRx = false;
...@@ -297,7 +297,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, ...@@ -297,7 +297,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB,
u8 abyVaildRate[MAX_RATE] u8 abyVaildRate[MAX_RATE]
= {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108};
u16 wPLCPwithPadding; u16 wPLCPwithPadding;
PS802_11Header pMACHeader; struct ieee80211_hdr *pMACHeader;
int bRxeapol_key = false; int bRxeapol_key = false;
...@@ -378,27 +378,27 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, ...@@ -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? //mike add: to judge if current AP is activated?
if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) || if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) ||
(pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) { (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) {
if (pMgmt->sNodeDBTable[0].bActive) { 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) if (pMgmt->sNodeDBTable[0].uInActiveCount != 0)
pMgmt->sNodeDBTable[0].uInActiveCount = 0; pMgmt->sNodeDBTable[0].uInActiveCount = 0;
} }
} }
} }
if (!is_multicast_ether_addr(pMACHeader->abyAddr1)) { if (!is_multicast_ether_addr(pMACHeader->addr1)) {
if ( WCTLbIsDuplicate(&(pDevice->sDupRxCache), (PS802_11Header) pbyFrame) ) { if (WCTLbIsDuplicate(&(pDevice->sDupRxCache), (struct ieee80211_hdr *) pbyFrame)) {
pDevice->s802_11Counter.FrameDuplicateCount++; pDevice->s802_11Counter.FrameDuplicateCount++;
return false; return false;
} }
if (compare_ether_addr(pDevice->abyCurrentNetAddr, if (compare_ether_addr(pDevice->abyCurrentNetAddr,
pMACHeader->abyAddr1)) { pMACHeader->addr1)) {
return false; return false;
} }
} }
...@@ -413,9 +413,9 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, ...@@ -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 ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) {
if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) {
p802_11Header = (PS802_11Header) (pbyFrame); p802_11Header = (struct ieee80211_hdr *) (pbyFrame);
// get SA NodeIndex // 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].ulLastRxJiffer = jiffies;
pMgmt->sNodeDBTable[iSANodeIndex].uInActiveCount = 0; pMgmt->sNodeDBTable[iSANodeIndex].uInActiveCount = 0;
} }
...@@ -508,7 +508,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, ...@@ -508,7 +508,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB,
(IS_FRAGMENT_PKT((pbyFrame))) (IS_FRAGMENT_PKT((pbyFrame)))
) { ) {
// defragment // defragment
bDeFragRx = WCTLbHandleFragment(pDevice, (PS802_11Header) (pbyFrame), FrameSize, bIsWEP, bExtIV); bDeFragRx = WCTLbHandleFragment(pDevice, (struct ieee80211_hdr *) (pbyFrame), FrameSize, bIsWEP, bExtIV);
pDevice->s802_11Counter.ReceivedFragmentCount++; pDevice->s802_11Counter.ReceivedFragmentCount++;
if (bDeFragRx) { if (bDeFragRx) {
// defrag complete // defrag complete
...@@ -818,7 +818,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, ...@@ -818,7 +818,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB,
} }
ev.src_addr.sa_family = ARPHRD_ETHER; 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)); memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.length = sizeof(ev); wrqu.data.length = sizeof(ev);
PRINT_K("wireless_send_event--->IWEVMICHAELMICFAILURE\n"); PRINT_K("wireless_send_event--->IWEVMICHAELMICFAILURE\n");
...@@ -928,13 +928,13 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, ...@@ -928,13 +928,13 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame,
s32 iSANodeIndex) s32 iSANodeIndex)
{ {
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
PS802_11Header p802_11Header; struct ieee80211_hdr *p802_11Header;
CMD_STATUS Status; CMD_STATUS Status;
if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { 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)) { if (!IS_TYPE_MGMT(pbyFrame)) {
// Data & PS-Poll packet // Data & PS-Poll packet
...@@ -946,7 +946,7 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, ...@@ -946,7 +946,7 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame,
// reason = (6) class 2 received from nonauth sta // reason = (6) class 2 received from nonauth sta
vMgrDeAuthenBeginSta(pDevice, vMgrDeAuthenBeginSta(pDevice,
pMgmt, pMgmt,
(u8 *)(p802_11Header->abyAddr2), (u8 *)(p802_11Header->addr2),
(WLAN_MGMT_REASON_CLASS2_NONAUTH), (WLAN_MGMT_REASON_CLASS2_NONAUTH),
&Status &Status
); );
...@@ -958,7 +958,7 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, ...@@ -958,7 +958,7 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame,
// reason = (7) class 3 received from nonassoc sta // reason = (7) class 3 received from nonassoc sta
vMgrDisassocBeginSta(pDevice, vMgrDisassocBeginSta(pDevice,
pMgmt, pMgmt,
(u8 *)(p802_11Header->abyAddr2), (u8 *)(p802_11Header->addr2),
(WLAN_MGMT_REASON_CLASS3_NONASSOC), (WLAN_MGMT_REASON_CLASS3_NONASSOC),
&Status &Status
); );
...@@ -1011,18 +1011,18 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, ...@@ -1011,18 +1011,18 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame,
else { else {
vMgrDeAuthenBeginSta(pDevice, vMgrDeAuthenBeginSta(pDevice,
pMgmt, pMgmt,
(u8 *)(p802_11Header->abyAddr2), (u8 *)(p802_11Header->addr2),
(WLAN_MGMT_REASON_CLASS2_NONAUTH), (WLAN_MGMT_REASON_CLASS2_NONAUTH),
&Status &Status
); );
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%pM\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", 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", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n",
p802_11Header->abyAddr1); p802_11Header->addr1);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl ); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: frame_control= %x\n", p802_11Header->frame_control);
return true; return true;
} }
} }
...@@ -1149,8 +1149,8 @@ static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, ...@@ -1149,8 +1149,8 @@ static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame,
(pDevice->byLocalID <= REV_ID_VT3253_A1)) { (pDevice->byLocalID <= REV_ID_VT3253_A1)) {
// Software TKIP // Software TKIP
// 1. 3253 A // 1. 3253 A
PS802_11Header pMACHeader = (PS802_11Header) (pbyFrame); struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *) (pbyFrame);
TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); TKIPvMixKey(pKey->abyKey, pMACHeader->addr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG);
rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN);
rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen);
if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) {
...@@ -1173,7 +1173,7 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, ...@@ -1173,7 +1173,7 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame,
s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16) s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16)
{ {
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
PS802_11Header pMACHeader; struct ieee80211_hdr *pMACHeader;
u32 PayloadLen = FrameSize; u32 PayloadLen = FrameSize;
u8 *pbyIV; u8 *pbyIV;
u8 byKeyIdx; u8 byKeyIdx;
...@@ -1252,8 +1252,8 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, ...@@ -1252,8 +1252,8 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame,
// 1. 3253 A // 1. 3253 A
// 2. NotOnFly // 2. NotOnFly
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP \n");
pMACHeader = (PS802_11Header) (pbyFrame); pMACHeader = (struct ieee80211_hdr *) (pbyFrame);
TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); TKIPvMixKey(pKey->abyKey, pMACHeader->addr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG);
rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN);
rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen);
if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) {
......
...@@ -157,7 +157,7 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, ...@@ -157,7 +157,7 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
u8 * pbyBuffer, unsigned int cbFrameLength) u8 * pbyBuffer, unsigned int cbFrameLength)
{ {
/* need change */ /* need change */
PS802_11Header pHeader = (PS802_11Header)pbyBuffer; struct ieee80211_hdr *pHeader = (struct ieee80211_hdr *)pbyBuffer;
if (byRSR & RSR_ADDROK) if (byRSR & RSR_ADDROK)
pStatistic->dwRsrADDROk++; pStatistic->dwRsrADDROk++;
...@@ -343,7 +343,7 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, ...@@ -343,7 +343,7 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
else else
pStatistic->dwRsrDirected++; pStatistic->dwRsrDirected++;
if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl)) if (WLAN_GET_FC_MOREFRAG(pHeader->frame_control))
pStatistic->dwRsrRxFragment++; pStatistic->dwRsrRxFragment++;
if (cbFrameLength < ETH_ZLEN + 4) { if (cbFrameLength < ETH_ZLEN + 4) {
......
...@@ -208,7 +208,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, ...@@ -208,7 +208,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf,
u32 *pdwIV = (u32 *)pbyIVHead; u32 *pdwIV = (u32 *)pbyIVHead;
u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4); u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4);
u16 wValue; u16 wValue;
PS802_11Header pMACHeader = (PS802_11Header)pbyHdrBuf; struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf;
u32 dwRevIVCounter; u32 dwRevIVCounter;
...@@ -275,7 +275,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, ...@@ -275,7 +275,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf,
//Fill MICHDR0 //Fill MICHDR0
*pMICHDR = 0x59; *pMICHDR = 0x59;
*((u8 *)(pMICHDR+1)) = 0; // TxPriority *((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+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16));
*((u8 *)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16)); *((u8 *)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16));
*((u8 *)(pMICHDR+10)) = HIBYTE(LOWORD(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, ...@@ -292,19 +292,19 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf,
} else { } else {
*((u8 *)(pMICHDR+17)) = 22; // HLEN[7:0] *((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+18, (u8 *)&wValue, 2); // MSKFRACTL
memcpy(pMICHDR+20, &(pMACHeader->abyAddr1[0]), 6); memcpy(pMICHDR+20, &(pMACHeader->addr1[0]), 6);
memcpy(pMICHDR+26, &(pMACHeader->abyAddr2[0]), 6); memcpy(pMICHDR+26, &(pMACHeader->addr2[0]), 6);
//Fill MICHDR2 //Fill MICHDR2
memcpy(pMICHDR+32, &(pMACHeader->abyAddr3[0]), 6); memcpy(pMICHDR+32, &(pMACHeader->addr3[0]), 6);
wValue = pMACHeader->wSeqCtl; wValue = pMACHeader->seq_ctrl;
wValue &= 0x000F; wValue &= 0x000F;
wValue = cpu_to_le16(wValue); wValue = cpu_to_le16(wValue);
memcpy(pMICHDR+38, (u8 *)&wValue, 2); // MSKSEQCTL memcpy(pMICHDR+38, (u8 *)&wValue, 2); // MSKSEQCTL
if (pDevice->bLongHeader) { 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, ...@@ -1621,64 +1621,64 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice,
u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader,
int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx) 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) { if (uDMAIdx == TYPE_ATIMDMA) {
pMACHeader->wFrameCtl = TYPE_802_11_ATIM; pMACHeader->frame_control = TYPE_802_11_ATIM;
} else { } else {
pMACHeader->wFrameCtl = TYPE_802_11_DATA; pMACHeader->frame_control = TYPE_802_11_DATA;
} }
if (pDevice->eOPMode == OP_MODE_AP) { if (pDevice->eOPMode == OP_MODE_AP) {
memcpy(&(pMACHeader->abyAddr1[0]), memcpy(&(pMACHeader->addr1[0]),
&(psEthHeader->h_dest[0]), &(psEthHeader->h_dest[0]),
ETH_ALEN); ETH_ALEN);
memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); memcpy(&(pMACHeader->addr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr3[0]), memcpy(&(pMACHeader->addr3[0]),
&(psEthHeader->h_source[0]), &(psEthHeader->h_source[0]),
ETH_ALEN); ETH_ALEN);
pMACHeader->wFrameCtl |= FC_FROMDS; pMACHeader->frame_control |= FC_FROMDS;
} else { } else {
if (pDevice->eOPMode == OP_MODE_ADHOC) { if (pDevice->eOPMode == OP_MODE_ADHOC) {
memcpy(&(pMACHeader->abyAddr1[0]), memcpy(&(pMACHeader->addr1[0]),
&(psEthHeader->h_dest[0]), &(psEthHeader->h_dest[0]),
ETH_ALEN); ETH_ALEN);
memcpy(&(pMACHeader->abyAddr2[0]), memcpy(&(pMACHeader->addr2[0]),
&(psEthHeader->h_source[0]), &(psEthHeader->h_source[0]),
ETH_ALEN); ETH_ALEN);
memcpy(&(pMACHeader->abyAddr3[0]), memcpy(&(pMACHeader->addr3[0]),
&(pDevice->abyBSSID[0]), &(pDevice->abyBSSID[0]),
ETH_ALEN); ETH_ALEN);
} else { } else {
memcpy(&(pMACHeader->abyAddr3[0]), memcpy(&(pMACHeader->addr3[0]),
&(psEthHeader->h_dest[0]), &(psEthHeader->h_dest[0]),
ETH_ALEN); ETH_ALEN);
memcpy(&(pMACHeader->abyAddr2[0]), memcpy(&(pMACHeader->addr2[0]),
&(psEthHeader->h_source[0]), &(psEthHeader->h_source[0]),
ETH_ALEN); ETH_ALEN);
memcpy(&(pMACHeader->abyAddr1[0]), memcpy(&(pMACHeader->addr1[0]),
&(pDevice->abyBSSID[0]), &(pDevice->abyBSSID[0]),
ETH_ALEN); ETH_ALEN);
pMACHeader->wFrameCtl |= FC_TODS; pMACHeader->frame_control |= FC_TODS;
} }
} }
if (bNeedEncrypt) 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) { if (pDevice->bLongHeader) {
PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr; 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); 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 //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)) { if ((wFragType == FRAGCTL_ENDFRAG) || (wFragType == FRAGCTL_NONFRAG)) {
pDevice->wSeqCounter++; pDevice->wSeqCounter++;
...@@ -1687,7 +1687,7 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice, ...@@ -1687,7 +1687,7 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice,
} }
if ((wFragType == FRAGCTL_STAFRAG) || (wFragType == FRAGCTL_MIDFRAG)) { //StartFrag or MidFrag 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, ...@@ -1717,7 +1717,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
PTX_BUFFER pTX_Buffer; PTX_BUFFER pTX_Buffer;
PSTxBufHead pTxBufHead; PSTxBufHead pTxBufHead;
PUSB_SEND_CONTEXT pContext; PUSB_SEND_CONTEXT pContext;
PS802_11Header pMACHeader; struct ieee80211_hdr *pMACHeader;
PSCTS pCTS; PSCTS pCTS;
struct ethhdr sEthHeader; struct ethhdr sEthHeader;
u8 byPktType, *pbyTxBufferAddr; u8 byPktType, *pbyTxBufferAddr;
...@@ -1897,7 +1897,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, ...@@ -1897,7 +1897,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK,
0, 0, 1, AUTO_FB_NONE); 0, 0, 1, AUTO_FB_NONE);
pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize); pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize);
cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + cbFrameBodySize; cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + cbFrameBodySize;
...@@ -1947,7 +1947,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, ...@@ -1947,7 +1947,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); 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++ ; pDevice->wSeqCounter++ ;
if (pDevice->wSeqCounter > 0x0fff) if (pDevice->wSeqCounter > 0x0fff)
pDevice->wSeqCounter = 0; pDevice->wSeqCounter = 0;
...@@ -1975,11 +1975,11 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, ...@@ -1975,11 +1975,11 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
pContext->Type = CONTEXT_MGMT_PACKET; pContext->Type = CONTEXT_MGMT_PACKET;
pContext->uBufLen = (u16)cbReqCount + 4; //USB header pContext->uBufLen = (u16)cbReqCount + 4; //USB header
if (WLAN_GET_FC_TODS(pMACHeader->wFrameCtl) == 0) { if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) {
s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr1[0]),(u16)cbFrameSize,pTX_Buffer->wFIFOCtl); s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr1[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl);
} }
else { 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); PIPEnsSendBulkOut(pDevice,pContext);
...@@ -1994,7 +1994,7 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, ...@@ -1994,7 +1994,7 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,
u32 cbHeaderSize = 0; u32 cbHeaderSize = 0;
u16 wTxBufSize = sizeof(STxShortBufHead); u16 wTxBufSize = sizeof(STxShortBufHead);
PSTxShortBufHead pTxBufHead; PSTxShortBufHead pTxBufHead;
PS802_11Header pMACHeader; struct ieee80211_hdr *pMACHeader;
PSTxDataHead_ab pTxDataHead; PSTxDataHead_ab pTxDataHead;
u16 wCurrentRate; u16 wCurrentRate;
u32 cbFrameBodySize; u32 cbFrameBodySize;
...@@ -2048,11 +2048,11 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, ...@@ -2048,11 +2048,11 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,
} }
//Generate Beacon Header //Generate Beacon Header
pMACHeader = (PS802_11Header)(pbyTxBufferAddr + cbHeaderSize); pMACHeader = (struct ieee80211_hdr *)(pbyTxBufferAddr + cbHeaderSize);
memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen);
pMACHeader->wDurationID = 0; pMACHeader->duration_id = 0;
pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4);
pDevice->wSeqCounter++ ; pDevice->wSeqCounter++ ;
if (pDevice->wSeqCounter > 0x0fff) if (pDevice->wSeqCounter > 0x0fff)
pDevice->wSeqCounter = 0; pDevice->wSeqCounter = 0;
...@@ -2080,7 +2080,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) ...@@ -2080,7 +2080,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
u8 *pbyTxBufferAddr; u8 *pbyTxBufferAddr;
void *pvRTS, *pvCTS, *pvTxDataHd; void *pvRTS, *pvCTS, *pvTxDataHd;
u32 uDuration, cbReqCount; u32 uDuration, cbReqCount;
PS802_11Header pMACHeader; struct ieee80211_hdr *pMACHeader;
u32 cbHeaderSize, cbFrameBodySize; u32 cbHeaderSize, cbFrameBodySize;
int bNeedACK, bIsPSPOLL = false; int bNeedACK, bIsPSPOLL = false;
PSTxBufHead pTxBufHead; PSTxBufHead pTxBufHead;
...@@ -2310,7 +2310,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) ...@@ -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, uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK,
0, 0, 1, AUTO_FB_NONE); 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; cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen) + cbExtSuppRate;
...@@ -2322,7 +2322,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) ...@@ -2322,7 +2322,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
memcpy(pbyMacHdr, skb->data, cbMacHdLen); memcpy(pbyMacHdr, skb->data, cbMacHdLen);
// version set to 0, patch for hostapd deamon // 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); memcpy(pbyPayloadHead, (skb->data + cbMacHdLen), cbFrameBodySize);
// replace support rate, patch for hostapd daemon( only support 11M) // 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) ...@@ -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++ ; pDevice->wSeqCounter++ ;
if (pDevice->wSeqCounter > 0x0fff) if (pDevice->wSeqCounter > 0x0fff)
pDevice->wSeqCounter = 0; pDevice->wSeqCounter = 0;
...@@ -2434,11 +2434,11 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) ...@@ -2434,11 +2434,11 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
pContext->Type = CONTEXT_MGMT_PACKET; pContext->Type = CONTEXT_MGMT_PACKET;
pContext->uBufLen = (u16)cbReqCount + 4; //USB header pContext->uBufLen = (u16)cbReqCount + 4; //USB header
if (WLAN_GET_FC_TODS(pMACHeader->wFrameCtl) == 0) { if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) {
s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr1[0]),(u16)cbFrameSize,pTX_Buffer->wFIFOCtl); s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr1[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl);
} }
else { 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); PIPEnsSendBulkOut(pDevice,pContext);
return ; return ;
......
...@@ -43,11 +43,6 @@ ...@@ -43,11 +43,6 @@
#define TYPE_MGMT_PROBE_RSP 0x5000 #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_TODS 0x0001
#define FC_FROMDS 0x0002 #define FC_FROMDS 0x0002
#define FC_MOREFRAG 0x0004 #define FC_MOREFRAG 0x0004
...@@ -81,11 +76,6 @@ ...@@ -81,11 +76,6 @@
#define TYPE_MGMT_PROBE_RSP 0x0050 #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_TODS 0x0100
#define FC_FROMDS 0x0200 #define FC_FROMDS 0x0200
#define FC_MOREFRAG 0x0400 #define FC_MOREFRAG 0x0400
...@@ -124,20 +114,6 @@ typedef struct tagS802_3Header { ...@@ -124,20 +114,6 @@ typedef struct tagS802_3Header {
} __attribute__ ((__packed__)) } __attribute__ ((__packed__))
S802_3Header, *PS802_3Header; 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 Macros ------------------------------*/
/*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Classes ----------------------------*/
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
* *
*/ */
bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) bool WCTLbIsDuplicate (PSCache pCache, struct ieee80211_hdr *pMACHeader)
{ {
unsigned int uIndex; unsigned int uIndex;
unsigned int ii; unsigned int ii;
...@@ -78,10 +78,10 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) ...@@ -78,10 +78,10 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
uIndex = pCache->uInPtr; uIndex = pCache->uInPtr;
for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) { for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) {
pCacheEntry = &(pCache->asCacheEntry[uIndex]); pCacheEntry = &(pCache->asCacheEntry[uIndex]);
if ((pCacheEntry->wFmSequence == pMACHeader->wSeqCtl) && if ((pCacheEntry->wFmSequence == pMACHeader->seq_ctrl) &&
(!compare_ether_addr(&(pCacheEntry->abyAddr2[0]), (!compare_ether_addr(&(pCacheEntry->abyAddr2[0]),
&(pMACHeader->abyAddr2[0]))) && &(pMACHeader->addr2[0]))) &&
(LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->wFrameCtl)) (LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->frame_control))
) { ) {
/* Duplicate match */ /* Duplicate match */
return true; return true;
...@@ -91,9 +91,9 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) ...@@ -91,9 +91,9 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
} }
/* Not found in cache - insert */ /* Not found in cache - insert */
pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr]; pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr];
pCacheEntry->wFmSequence = pMACHeader->wSeqCtl; pCacheEntry->wFmSequence = pMACHeader->seq_ctrl;
memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN); memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->addr2[0]), ETH_ALEN);
pCacheEntry->wFrameCtl = pMACHeader->wFrameCtl; pCacheEntry->wFrameCtl = pMACHeader->frame_control;
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;
} }
...@@ -114,14 +114,14 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) ...@@ -114,14 +114,14 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
*/ */
unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice,
PS802_11Header pMACHeader) struct ieee80211_hdr *pMACHeader)
{ {
unsigned int ii; unsigned int ii;
for (ii = 0; ii < pDevice->cbDFCB; ii++) { for (ii = 0; ii < pDevice->cbDFCB; ii++) {
if ((pDevice->sRxDFCB[ii].bInUse == true) && if ((pDevice->sRxDFCB[ii].bInUse == true) &&
(!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]), (!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]),
&(pMACHeader->abyAddr2[0])))) { &(pMACHeader->addr2[0])))) {
return ii; return ii;
} }
} }
...@@ -143,7 +143,7 @@ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, ...@@ -143,7 +143,7 @@ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice,
* *
*/ */
unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice,
PS802_11Header pMACHeader) struct ieee80211_hdr *pMACHeader)
{ {
unsigned int ii; unsigned int ii;
...@@ -154,10 +154,10 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, ...@@ -154,10 +154,10 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice,
pDevice->cbFreeDFCB--; pDevice->cbFreeDFCB--;
pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime; pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime;
pDevice->sRxDFCB[ii].bInUse = true; pDevice->sRxDFCB[ii].bInUse = true;
pDevice->sRxDFCB[ii].wSequence = (pMACHeader->wSeqCtl >> 4); pDevice->sRxDFCB[ii].wSequence = (pMACHeader->seq_ctrl >> 4);
pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F); pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->seq_ctrl & 0x000F);
memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]),
&(pMACHeader->abyAddr2[0]), &(pMACHeader->addr2[0]),
ETH_ALEN); ETH_ALEN);
return(ii); return(ii);
} }
...@@ -182,8 +182,7 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, ...@@ -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 * 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, bool WCTLbHandleFragment(struct vnt_private *pDevice, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV)
unsigned int cbFrameLength, bool bWEP, bool bExtIV)
{ {
unsigned int uHeaderSize; unsigned int uHeaderSize;
...@@ -203,8 +202,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, ...@@ -203,8 +202,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader,
if (pDevice->uCurrentDFCBIdx < pDevice->cbDFCB) { if (pDevice->uCurrentDFCBIdx < pDevice->cbDFCB) {
// duplicate, we must flush previous DCB // duplicate, we must flush previous DCB
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].uLifetime = pDevice->dwMaxReceiveLifetime; pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].uLifetime = pDevice->dwMaxReceiveLifetime;
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence = (pMACHeader->wSeqCtl >> 4); pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence = (pMACHeader->seq_ctrl >> 4);
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->wSeqCtl & 0x000F); pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->seq_ctrl & 0x000F);
} }
else { else {
pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader); pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader);
...@@ -225,8 +224,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, ...@@ -225,8 +224,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader,
else { else {
pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, pMACHeader); pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, pMACHeader);
if (pDevice->uCurrentDFCBIdx != pDevice->cbDFCB) { if (pDevice->uCurrentDFCBIdx != pDevice->cbDFCB) {
if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->wSeqCtl >> 4)) && if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->seq_ctrl >> 4)) &&
(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->wSeqCtl & 0x000F)) && (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->seq_ctrl & 0x000F)) &&
((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength + cbFrameLength - uHeaderSize) < 2346)) { ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength + cbFrameLength - uHeaderSize) < 2346)) {
memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, ((u8 *) (pMACHeader) + uHeaderSize), (cbFrameLength - uHeaderSize)); memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, ((u8 *) (pMACHeader) + uHeaderSize), (cbFrameLength - uHeaderSize));
......
...@@ -35,51 +35,51 @@ ...@@ -35,51 +35,51 @@
/*--------------------- Export Definitions -------------------------*/ /*--------------------- Export Definitions -------------------------*/
#define IS_TYPE_DATA(pMACHeader) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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 #ifdef __BIG_ENDIAN
#define IS_FRAGMENT_PKT(pMACHeader) \ #define IS_FRAGMENT_PKT(pMACHeader) \
(((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ (((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \
((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) != 0)) ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) != 0))
#define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) == 0) ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) == 0)
#else #else
#define IS_FRAGMENT_PKT(pMACHeader) \ #define IS_FRAGMENT_PKT(pMACHeader) \
(((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ (((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \
((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) != 0)) ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) != 0))
#define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) == 0) ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) == 0)
#endif//#ifdef __BIG_ENDIAN #endif//#ifdef __BIG_ENDIAN
#define IS_LAST_FRAGMENT_PKT(pMACHeader) \ #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) \ #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) { \ #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
...@@ -95,10 +95,9 @@ ...@@ -95,10 +95,9 @@
/*--------------------- Export Functions --------------------------*/ /*--------------------- Export Functions --------------------------*/
bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); bool WCTLbIsDuplicate(PSCache pCache, struct ieee80211_hdr *pMACHeader);
bool WCTLbHandleFragment(struct vnt_private *, PS802_11Header pMACHeader, bool WCTLbHandleFragment(struct vnt_private *, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV);
unsigned int cbFrameLength, bool bWEP, bool bExtIV); unsigned int WCTLuSearchDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader);
unsigned int WCTLuSearchDFCB(struct vnt_private *, PS802_11Header pMACHeader); unsigned int WCTLuInsertDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader);
unsigned int WCTLuInsertDFCB(struct vnt_private *, PS802_11Header pMACHeader);
#endif /* __WCTL_H__ */ #endif /* __WCTL_H__ */
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