diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/staging/vt6656 | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/staging/vt6656')
26 files changed, 952 insertions, 845 deletions
diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c index 6c76939..28a4c4c 100644 --- a/drivers/staging/vt6656/aes_ccmp.c +++ b/drivers/staging/vt6656/aes_ccmp.c @@ -96,9 +96,9 @@ u8 dot3_table[256] = { static void xor_128(u8 *a, u8 *b, u8 *out) { - u32 *dwPtrA = (u32 *) a; - u32 *dwPtrB = (u32 *) b; - u32 *dwPtrOut = (u32 *) out; + u32 * dwPtrA = (u32 *) a; + u32 * dwPtrB = (u32 *) b; + u32 * dwPtrOut = (u32 *) out; (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); @@ -108,9 +108,9 @@ static void xor_128(u8 *a, u8 *b, u8 *out) static void xor_32(u8 *a, u8 *b, u8 *out) { - u32 *dwPtrA = (u32 *) a; - u32 *dwPtrB = (u32 *) b; - u32 *dwPtrOut = (u32 *) out; + u32 * dwPtrA = (u32 *) a; + u32 * dwPtrB = (u32 *) b; + u32 * dwPtrOut = (u32 *) out; (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); } @@ -218,7 +218,7 @@ void AESv128(u8 *key, u8 *data, u8 *ciphertext) * */ -bool AESbGenCCMP(u8 *pbyRxKey, u8 *pbyFrame, u16 wFrameSize) +bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize) { u8 abyNonce[13]; u8 MIC_IV[16]; @@ -231,8 +231,8 @@ bool AESbGenCCMP(u8 *pbyRxKey, u8 *pbyFrame, u16 wFrameSize) u8 abyLastCipher[16]; struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *) pbyFrame; - u8 *pbyIV; - u8 *pbyPayload; + u8 * pbyIV; + u8 * pbyPayload; u16 wHLen = 22; /* 8 is IV, 8 is MIC, 4 is CRC */ u16 wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN; diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 4aa5ef5..1e8b841 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -939,7 +939,6 @@ int BBbVT3184Init(struct vnt_private *pDevice) u8 * pbyAgc; u16 wLengthAgc; u8 abyArray[256]; - u8 data; ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, @@ -1105,16 +1104,6 @@ else { ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01); RFbRFTableDownload(pDevice); - - /* Fix for TX USB resets from vendors driver */ - CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, USB_REG4, - MESSAGE_REQUEST_MEM, sizeof(data), &data); - - data |= 0x2; - - CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, USB_REG4, - MESSAGE_REQUEST_MEM, sizeof(data), &data); - return true;//ntStatus; } diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index dad3f8c..ee79bbd 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -57,7 +57,6 @@ #include "control.h" #include "rndis.h" #include "iowpa.h" -#include "power.h" static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; @@ -127,7 +126,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, if ((pCurrBSS->bActive) && (pCurrBSS->bSelected == false)) { - if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) { + if (!compare_ether_addr(pCurrBSS->abyBSSID, pbyBSSID)) { if (pSSID != NULL) { // compare ssid if ( !memcmp(pSSID->abySSID, @@ -243,8 +242,8 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (bKeepCurrBSSID) { if (pMgmt->sBSSList[ii].bActive && - ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, - pMgmt->abyCurrBSSID)) { + !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, + pMgmt->abyCurrBSSID)) { //mike mark: there are two BSSID's in list. If that AP is in hidden ssid mode, one SSID is null, // but other's might not be obvious, so if it associate's with your STA, // you must keep the two of them!! @@ -278,7 +277,7 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice, for (ii = 0; ii < MAX_BSS_NUM; ii++) { pBSSList = &(pMgmt->sBSSList[ii]); if (pBSSList->bActive) { - if (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) { + if (!compare_ether_addr(pBSSList->abyBSSID, abyBSSID)) { if (pSSID->len == ((PWLAN_IE_SSID)pBSSList->abySSID)->len){ if (memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pBSSList->abySSID)->abySSID, @@ -624,8 +623,8 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice, // Index = 0 reserved for AP Node for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive) { - if (ether_addr_equal(abyDstAddr, - pMgmt->sNodeDBTable[ii].abyMACAddr)) { + if (!compare_ether_addr(abyDstAddr, + pMgmt->sNodeDBTable[ii].abyMACAddr)) { *puNodeIndex = ii; return true; } @@ -814,10 +813,8 @@ void BSSvAddMulticastNode(struct vnt_private *pDevice) * -*/ -void BSSvSecondCallBack(struct work_struct *work) +void BSSvSecondCallBack(struct vnt_private *pDevice) { - struct vnt_private *pDevice = container_of(work, - struct vnt_private, second_callback_work.work); struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int ii; PWLAN_IE_SSID pItemSSID, pCurrSSID; @@ -825,9 +822,6 @@ void BSSvSecondCallBack(struct work_struct *work) u32 uNonShortSlotSTACnt = 0; u32 uLongPreambleSTACnt = 0; - if (pDevice->Flags & fMP_DISCONNECTED) - return; - spin_lock_irq(&pDevice->lock); pDevice->uAssocCount = 0; @@ -1125,26 +1119,15 @@ else { } } - if (pDevice->bLinkPass == true) { - if (pMgmt->eAuthenMode < WMAC_AUTH_WPA || - pDevice->fWPA_Authened == true) { - if (++pDevice->tx_data_time_out > 40) { - pDevice->tx_trigger = true; - - PSbSendNullPacket(pDevice); - - pDevice->tx_trigger = false; - pDevice->tx_data_time_out = 0; - } - } - - if (netif_queue_stopped(pDevice->dev)) - netif_wake_queue(pDevice->dev); - } + if (pDevice->bLinkPass == true) { + if (netif_queue_stopped(pDevice->dev)) + netif_wake_queue(pDevice->dev); + } spin_unlock_irq(&pDevice->lock); - schedule_delayed_work(&pDevice->second_callback_work, HZ); + pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ); + add_timer(&pMgmt->sTimerSecondCallback); } /*+ diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h index fc41855..bce3b46 100644 --- a/drivers/staging/vt6656/bssdb.h +++ b/drivers/staging/vt6656/bssdb.h @@ -262,7 +262,7 @@ void BSSvCreateOneNode(struct vnt_private *, u32 *puNodeIndex); void BSSvUpdateAPNode(struct vnt_private *, u16 *pwCapInfo, PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pExtSuppRates); -void BSSvSecondCallBack(struct work_struct *work); +void BSSvSecondCallBack(struct vnt_private *); void BSSvUpdateNodeTxCounter(struct vnt_private *, PSStatCounter pStatistic, u8 byTSR, u8 byPktNO); diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index e430b35..5158ff4 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -403,7 +403,7 @@ exit: void CHvInitChannelTable(struct vnt_private *pDevice) { - bool bMultiBand = false; + int bMultiBand = false; int ii; for (ii = 1; ii <= CB_MAX_CHANNEL; ii++) diff --git a/drivers/staging/vt6656/datarate.c b/drivers/staging/vt6656/datarate.c index af9eab0..17fbc35 100644 --- a/drivers/staging/vt6656/datarate.c +++ b/drivers/staging/vt6656/datarate.c @@ -44,9 +44,9 @@ #include "rf.h" /* static int msglevel = MSG_LEVEL_DEBUG; */ -static int msglevel = MSG_LEVEL_INFO; -const u8 acbyIERate[MAX_RATE] = {0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, - 0x24, 0x30, 0x48, 0x60, 0x6C}; +static int msglevel =MSG_LEVEL_INFO; +const u8 acbyIERate[MAX_RATE] = +{0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; #define AUTORATE_TXOK_CNT 0x0400 #define AUTORATE_TXFAIL_CNT 0x0064 @@ -56,13 +56,13 @@ void s_vResetCounter(PKnownNodeDB psNodeDBTable); void s_vResetCounter(PKnownNodeDB psNodeDBTable) { - u8 ii; + u8 ii; - /* clear statistics counter for auto_rate */ - for (ii = 0; ii <= MAX_RATE; ii++) { - psNodeDBTable->uTxOk[ii] = 0; - psNodeDBTable->uTxFail[ii] = 0; - } + /* clear statistics counter for auto_rate */ + for (ii = 0; ii <= MAX_RATE; ii++) { + psNodeDBTable->uTxOk[ii] = 0; + psNodeDBTable->uTxFail[ii] = 0; + } } /*+ @@ -97,18 +97,21 @@ void s_vResetCounter(PKnownNodeDB psNodeDBTable) * Return Value: RateIdx * -*/ -u16 RATEwGetRateIdx(u8 byRate) +u16 +RATEwGetRateIdx( + u8 byRate + ) { - u16 ii; + u16 ii; - /* erase BasicRate flag */ - byRate = byRate & 0x7F; + /* erase BasicRate flag */ + byRate = byRate & 0x7F; - for (ii = 0; ii < MAX_RATE; ii++) { - if (acbyIERate[ii] == byRate) - return ii; - } - return 0; + for (ii = 0; ii < MAX_RATE; ii ++) { + if (acbyIERate[ii] == byRate) + return ii; + } + return 0; } /*+ @@ -136,7 +139,7 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, int bUpdateBasicRate, u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, u16 *pwSuppRate, u8 *pbyTopCCKRate, u8 *pbyTopOFDMRate) { - int ii; + int ii; u8 byHighSuppRate = 0, byRate = 0; u16 wOldBasicRate = pDevice->wBasicRate; u32 uRateLen; @@ -144,88 +147,83 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, if (pItemRates == NULL) return; - *pwSuppRate = 0; - uRateLen = pItemRates->len; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate Len: %d\n", uRateLen); - if (pDevice->byBBType != BB_TYPE_11B) { - if (uRateLen > WLAN_RATES_MAXLEN) - uRateLen = WLAN_RATES_MAXLEN; - } else { - if (uRateLen > WLAN_RATES_MAXLEN_11B) - uRateLen = WLAN_RATES_MAXLEN_11B; - } - - for (ii = 0; ii < uRateLen; ii++) { - byRate = (u8)(pItemRates->abyRates[ii]); - if (WLAN_MGMT_IS_BASICRATE(byRate) && - (bUpdateBasicRate == true)) { - /* - * add to basic rate set, update pDevice->byTopCCKBasicRate and - * pDevice->byTopOFDMBasicRate - */ - CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO"ParseMaxRate AddBasicRate: %d\n", - RATEwGetRateIdx(byRate)); - } - byRate = (u8)(pItemRates->abyRates[ii]&0x7F); - if (byHighSuppRate == 0) - byHighSuppRate = byRate; - if (byRate > byHighSuppRate) - byHighSuppRate = byRate; - *pwSuppRate |= (1<<RATEwGetRateIdx(byRate)); - } - if ((pItemExtRates != NULL) && (pItemExtRates->byElementID == WLAN_EID_EXTSUPP_RATES) && - (pDevice->byBBType != BB_TYPE_11B)) { - - unsigned int uExtRateLen = pItemExtRates->len; - - if (uExtRateLen > WLAN_RATES_MAXLEN) - uExtRateLen = WLAN_RATES_MAXLEN; - - for (ii = 0; ii < uExtRateLen; ii++) { - byRate = (u8)(pItemExtRates->abyRates[ii]); - /* select highest basic rate */ - if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) { - /* - * add to basic rate set, update pDevice->byTopCCKBasicRate and - * pDevice->byTopOFDMBasicRate - */ - CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO"ParseMaxRate AddBasicRate: %d\n", - RATEwGetRateIdx(byRate)); - } - byRate = (u8)(pItemExtRates->abyRates[ii]&0x7F); - if (byHighSuppRate == 0) - byHighSuppRate = byRate; - if (byRate > byHighSuppRate) - byHighSuppRate = byRate; - *pwSuppRate |= (1<<RATEwGetRateIdx(byRate)); - - /* DBG_PRN_GRP09(("ParseMaxRate : HighSuppRate: %d, %X\n", - * RATEwGetRateIdx(byRate), byRate)); - */ - } - } - - if ((pDevice->byPacketType == PK_TYPE_11GB) - && CARDbIsOFDMinBasicRate((void *)pDevice)) { - pDevice->byPacketType = PK_TYPE_11GA; - } - - *pbyTopCCKRate = pDevice->byTopCCKBasicRate; - *pbyTopOFDMRate = pDevice->byTopOFDMBasicRate; - *pwMaxSuppRate = RATEwGetRateIdx(byHighSuppRate); - if ((pDevice->byPacketType == PK_TYPE_11B) || (pDevice->byPacketType == PK_TYPE_11GB)) - *pwMaxBasicRate = pDevice->byTopCCKBasicRate; - else - *pwMaxBasicRate = pDevice->byTopOFDMBasicRate; - if (wOldBasicRate != pDevice->wBasicRate) - CARDvSetRSPINF((void *)pDevice, pDevice->byBBType); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Exit ParseMaxRate\n"); + *pwSuppRate = 0; + uRateLen = pItemRates->len; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate Len: %d\n", uRateLen); + if (pDevice->byBBType != BB_TYPE_11B) { + if (uRateLen > WLAN_RATES_MAXLEN) + uRateLen = WLAN_RATES_MAXLEN; + } else { + if (uRateLen > WLAN_RATES_MAXLEN_11B) + uRateLen = WLAN_RATES_MAXLEN_11B; + } + + for (ii = 0; ii < uRateLen; ii++) { + byRate = (u8)(pItemRates->abyRates[ii]); + if (WLAN_MGMT_IS_BASICRATE(byRate) && + (bUpdateBasicRate == true)) { + /* + * add to basic rate set, update pDevice->byTopCCKBasicRate and + * pDevice->byTopOFDMBasicRate + */ + CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", RATEwGetRateIdx(byRate)); + } + byRate = (u8)(pItemRates->abyRates[ii]&0x7F); + if (byHighSuppRate == 0) + byHighSuppRate = byRate; + if (byRate > byHighSuppRate) + byHighSuppRate = byRate; + *pwSuppRate |= (1<<RATEwGetRateIdx(byRate)); + } + if ((pItemExtRates != NULL) && (pItemExtRates->byElementID == WLAN_EID_EXTSUPP_RATES) && + (pDevice->byBBType != BB_TYPE_11B)) { + + unsigned int uExtRateLen = pItemExtRates->len; + + if (uExtRateLen > WLAN_RATES_MAXLEN) + uExtRateLen = WLAN_RATES_MAXLEN; + + for (ii = 0; ii < uExtRateLen ; ii++) { + byRate = (u8)(pItemExtRates->abyRates[ii]); + /* select highest basic rate */ + if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) { + /* + * add to basic rate set, update pDevice->byTopCCKBasicRate and + * pDevice->byTopOFDMBasicRate + */ + CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", RATEwGetRateIdx(byRate)); + } + byRate = (u8)(pItemExtRates->abyRates[ii]&0x7F); + if (byHighSuppRate == 0) + byHighSuppRate = byRate; + if (byRate > byHighSuppRate) + byHighSuppRate = byRate; + *pwSuppRate |= (1<<RATEwGetRateIdx(byRate)); + + /* DBG_PRN_GRP09(("ParseMaxRate : HighSuppRate: %d, %X\n", + RATEwGetRateIdx(byRate), byRate)); */ + } + } + + if ((pDevice->byPacketType == PK_TYPE_11GB) + && CARDbIsOFDMinBasicRate((void *)pDevice)) { + pDevice->byPacketType = PK_TYPE_11GA; + } + + *pbyTopCCKRate = pDevice->byTopCCKBasicRate; + *pbyTopOFDMRate = pDevice->byTopOFDMBasicRate; + *pwMaxSuppRate = RATEwGetRateIdx(byHighSuppRate); + if ((pDevice->byPacketType==PK_TYPE_11B) || (pDevice->byPacketType==PK_TYPE_11GB)) + *pwMaxBasicRate = pDevice->byTopCCKBasicRate; + else + *pwMaxBasicRate = pDevice->byTopOFDMBasicRate; + if (wOldBasicRate != pDevice->wBasicRate) + CARDvSetRSPINF((void *)pDevice, pDevice->byBBType); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Exit ParseMaxRate\n"); } /*+ @@ -265,68 +263,71 @@ void RATEvTxRateFallBack(struct vnt_private *pDevice, psNodeDBTable->uTimeCount++; - if (psNodeDBTable->uTxFail[MAX_RATE] > psNodeDBTable->uTxOk[MAX_RATE]) - dwTxDiff = psNodeDBTable->uTxFail[MAX_RATE] - psNodeDBTable->uTxOk[MAX_RATE]; - - if ((psNodeDBTable->uTxOk[MAX_RATE] < AUTORATE_TXOK_CNT) && - (dwTxDiff < AUTORATE_TXFAIL_CNT) && - (psNodeDBTable->uTimeCount < AUTORATE_TIMEOUT)) { - return; - } - - if (psNodeDBTable->uTimeCount >= AUTORATE_TIMEOUT) - psNodeDBTable->uTimeCount = 0; - - for (ii = 0; ii < MAX_RATE; ii++) { - if (psNodeDBTable->wSuppRate & (0x0001<<ii)) { - if (bAutoRate[ii] == true) - wIdxUpRate = (u16) ii; - } else { - bAutoRate[ii] = false; - } - } - - for (ii = 0; ii <= psNodeDBTable->wTxDataRate; ii++) { - if ((psNodeDBTable->uTxOk[ii] != 0) || - (psNodeDBTable->uTxFail[ii] != 0)) { - dwThroughputTbl[ii] *= psNodeDBTable->uTxOk[ii]; - if (ii < RATE_11M) - psNodeDBTable->uTxFail[ii] *= 4; - dwThroughputTbl[ii] /= (psNodeDBTable->uTxOk[ii] + psNodeDBTable->uTxFail[ii]); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Rate %d,Ok: %d, Fail:%d, Throughput:%d\n", - ii, (int)psNodeDBTable->uTxOk[ii], (int)psNodeDBTable->uTxFail[ii], (int)dwThroughputTbl[ii]); - } - dwThroughput = dwThroughputTbl[psNodeDBTable->wTxDataRate]; - - wIdxDownRate = psNodeDBTable->wTxDataRate; - for (ii = psNodeDBTable->wTxDataRate; ii > 0;) { - ii--; - if ((dwThroughputTbl[ii] > dwThroughput) && - (bAutoRate[ii] == true)) { - dwThroughput = dwThroughputTbl[ii]; - wIdxDownRate = (u16) ii; - } - } - psNodeDBTable->wTxDataRate = wIdxDownRate; - if (psNodeDBTable->uTxOk[MAX_RATE]) { - if (psNodeDBTable->uTxOk[MAX_RATE] > - (psNodeDBTable->uTxFail[MAX_RATE] * 4)) { - psNodeDBTable->wTxDataRate = wIdxUpRate; - } - } else { /* adhoc, if uTxOk(total) == 0 & uTxFail(total) == 0 */ - if (psNodeDBTable->uTxFail[MAX_RATE] == 0) - psNodeDBTable->wTxDataRate = wIdxUpRate; - } - - if (pDevice->byBBType == BB_TYPE_11A) { - if (psNodeDBTable->wTxDataRate <= RATE_11M) - psNodeDBTable->wTxDataRate = RATE_6M; - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uTxOk[MAX_RATE] %d, uTxFail[MAX_RATE]:%d\n", (int)psNodeDBTable->uTxOk[MAX_RATE], (int)psNodeDBTable->uTxFail[MAX_RATE]); - s_vResetCounter(psNodeDBTable); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Rate: %d, U:%d, D:%d\n", (int)psNodeDBTable->wTxDataRate, (int)wIdxUpRate, (int)wIdxDownRate); - return; + if (psNodeDBTable->uTxFail[MAX_RATE] > psNodeDBTable->uTxOk[MAX_RATE]) + dwTxDiff = psNodeDBTable->uTxFail[MAX_RATE] - psNodeDBTable->uTxOk[MAX_RATE]; + + if ((psNodeDBTable->uTxOk[MAX_RATE] < AUTORATE_TXOK_CNT) && + (dwTxDiff < AUTORATE_TXFAIL_CNT) && + (psNodeDBTable->uTimeCount < AUTORATE_TIMEOUT)) { + return; + } + + if (psNodeDBTable->uTimeCount >= AUTORATE_TIMEOUT) { + psNodeDBTable->uTimeCount = 0; + } + + for (ii = 0; ii < MAX_RATE; ii++) { + if (psNodeDBTable->wSuppRate & (0x0001<<ii)) { + if (bAutoRate[ii] == true) { + wIdxUpRate = (u16) ii; + } + } else { + bAutoRate[ii] = false; + } + } + + for (ii = 0; ii <= psNodeDBTable->wTxDataRate; ii++) { + if ( (psNodeDBTable->uTxOk[ii] != 0) || + (psNodeDBTable->uTxFail[ii] != 0) ) { + dwThroughputTbl[ii] *= psNodeDBTable->uTxOk[ii]; + if (ii < RATE_11M) { + psNodeDBTable->uTxFail[ii] *= 4; + } + dwThroughputTbl[ii] /= (psNodeDBTable->uTxOk[ii] + psNodeDBTable->uTxFail[ii]); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Rate %d,Ok: %d, Fail:%d, Throughput:%d\n", + ii, (int)psNodeDBTable->uTxOk[ii], (int)psNodeDBTable->uTxFail[ii], (int)dwThroughputTbl[ii]); + } + dwThroughput = dwThroughputTbl[psNodeDBTable->wTxDataRate]; + + wIdxDownRate = psNodeDBTable->wTxDataRate; + for (ii = psNodeDBTable->wTxDataRate; ii > 0;) { + ii--; + if ( (dwThroughputTbl[ii] > dwThroughput) && + (bAutoRate[ii]==true) ) { + dwThroughput = dwThroughputTbl[ii]; + wIdxDownRate = (u16) ii; + } + } + psNodeDBTable->wTxDataRate = wIdxDownRate; + if (psNodeDBTable->uTxOk[MAX_RATE]) { + if (psNodeDBTable->uTxOk[MAX_RATE] > + (psNodeDBTable->uTxFail[MAX_RATE] * 4) ) { + psNodeDBTable->wTxDataRate = wIdxUpRate; + } + } else { /* adhoc, if uTxOk(total) == 0 & uTxFail(total) == 0 */ + if (psNodeDBTable->uTxFail[MAX_RATE] == 0) + psNodeDBTable->wTxDataRate = wIdxUpRate; + } + + if (pDevice->byBBType == BB_TYPE_11A) { + if (psNodeDBTable->wTxDataRate <= RATE_11M) + psNodeDBTable->wTxDataRate = RATE_6M; + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uTxOk[MAX_RATE] %d, uTxFail[MAX_RATE]:%d\n",(int)psNodeDBTable->uTxOk[MAX_RATE], (int)psNodeDBTable->uTxFail[MAX_RATE]); + s_vResetCounter(psNodeDBTable); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Rate: %d, U:%d, D:%d\n", (int)psNodeDBTable->wTxDataRate, (int)wIdxUpRate, (int)wIdxDownRate); + return; } /*+ @@ -342,24 +343,29 @@ void RATEvTxRateFallBack(struct vnt_private *pDevice, * Return Value: None * -*/ -u8 RATEuSetIE(PWLAN_IE_SUPP_RATES pSrcRates, PWLAN_IE_SUPP_RATES pDstRates, - unsigned int uRateLen) +u8 +RATEuSetIE ( + PWLAN_IE_SUPP_RATES pSrcRates, + PWLAN_IE_SUPP_RATES pDstRates, + unsigned int uRateLen + ) { - unsigned int ii, uu, uRateCnt = 0; - - if ((pSrcRates == NULL) || (pDstRates == NULL)) - return 0; - - if (pSrcRates->len == 0) - return 0; - - for (ii = 0; ii < uRateLen; ii++) { - for (uu = 0; uu < pSrcRates->len; uu++) { - if ((pSrcRates->abyRates[uu] & 0x7F) == acbyIERate[ii]) { - pDstRates->abyRates[uRateCnt++] = pSrcRates->abyRates[uu]; - break; - } - } - } - return (u8)uRateCnt; + unsigned int ii, uu, uRateCnt = 0; + + if ((pSrcRates == NULL) || (pDstRates == NULL)) + return 0; + + if (pSrcRates->len == 0) + return 0; + + for (ii = 0; ii < uRateLen; ii++) { + for (uu = 0; uu < pSrcRates->len; uu++) { + if ((pSrcRates->abyRates[uu] & 0x7F) == acbyIERate[ii]) { + pDstRates->abyRates[uRateCnt ++] = pSrcRates->abyRates[uu]; + break; + } + } + } + return (u8)uRateCnt; } + diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h index afe7074..4675135 100644 --- a/drivers/staging/vt6656/desc.h +++ b/drivers/staging/vt6656/desc.h @@ -146,6 +146,15 @@ /* * TX FIFO header */ +typedef struct tagSTxBufHead { + u32 adwTxKey[4]; + u16 wFIFOCtl; + u16 wTimeStamp; + u16 wFragCtl; + u16 wReserved; +} __attribute__ ((__packed__)) +STxBufHead, *PSTxBufHead; +typedef const STxBufHead *PCSTxBufHead; typedef struct tagSTxShortBufHead { u16 wFIFOCtl; diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 62b7de1..8e39634 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -384,8 +384,8 @@ struct vnt_private { struct tasklet_struct CmdWorkItem; struct tasklet_struct EventWorkItem; - struct work_struct read_work_item; - struct work_struct rx_mng_work_item; + struct tasklet_struct ReadWorkItem; + struct tasklet_struct RxMngWorkItem; u32 rx_buf_sz; int multicast_limit; @@ -579,9 +579,6 @@ struct vnt_private { u8 abyOFDMAPwrTbl[42]; u16 wCurrentRate; - u16 tx_rate_fb0; - u16 tx_rate_fb1; - u16 wRTSThreshold; u16 wFragmentationThreshold; u8 byShortRetryLimit; @@ -710,12 +707,13 @@ struct vnt_private { u8 byBBCR09; /* command timer */ - struct delayed_work run_command_work; - /* One second callback */ - struct delayed_work second_callback_work; + struct timer_list sTimerCommand; + + struct timer_list sTimerTxData; + unsigned long nTxDataTimeCout; + int fTxDataInSleep; + int IsTxDataTrigger; - u8 tx_data_time_out; - bool tx_trigger; int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */ u8 byReAssocCount; u8 byLinkWaitCount; diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index 75dc92d..ea7d443 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -136,9 +136,9 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, }; pbyRxBuffer = (u8 *) (pbyRxBufferAddr + cbHeaderSize); - if (ether_addr_equal(pbyRxBuffer, pDevice->abySNAP_Bridgetunnel)) { + if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_Bridgetunnel[0])) { cbHeaderSize += 6; - } else if (ether_addr_equal(pbyRxBuffer, pDevice->abySNAP_RFC1042)) { + } else if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_RFC1042[0])) { cbHeaderSize += 6; pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); if ((*pwType == cpu_to_be16(ETH_P_IPX)) || @@ -361,7 +361,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB, if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) || (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) { if (pMgmt->sNodeDBTable[0].bActive) { - if (ether_addr_equal(pMgmt->abyCurrBSSID, pMACHeader->addr2)) { + if (!compare_ether_addr(pMgmt->abyCurrBSSID, pMACHeader->addr2)) { if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) pMgmt->sNodeDBTable[0].uInActiveCount = 0; } @@ -374,7 +374,8 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB, return false; } - if (!ether_addr_equal(pDevice->abyCurrentNetAddr, pMACHeader->addr1)) { + if (compare_ether_addr(pDevice->abyCurrentNetAddr, + pMACHeader->addr1)) { return false; } } @@ -382,8 +383,8 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB, // Use for TKIP MIC s_vGetDASA(pbyFrame, &cbHeaderSize, &pDevice->sRxEthHeader); - if (ether_addr_equal((u8 *)pDevice->sRxEthHeader.h_source, - pDevice->abyCurrentNetAddr)) + if (!compare_ether_addr((u8 *)&(pDevice->sRxEthHeader.h_source[0]), + pDevice->abyCurrentNetAddr)) return false; if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) { @@ -559,7 +560,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB, } if (pDevice->bIsRxMngWorkItemQueued == false) { pDevice->bIsRxMngWorkItemQueued = true; - schedule_work(&pDevice->rx_mng_work_item); + tasklet_schedule(&pDevice->RxMngWorkItem); } } @@ -1332,16 +1333,11 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, return true; } -void RXvWorkItem(struct work_struct *work) +void RXvWorkItem(struct vnt_private *pDevice) { - struct vnt_private *pDevice = - container_of(work, struct vnt_private, read_work_item); int ntStatus; struct vnt_rcb *pRCB = NULL; - if (pDevice->Flags & fMP_DISCONNECTED) - return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Rx Polling Thread\n"); spin_lock_irq(&pDevice->lock); @@ -1388,22 +1384,17 @@ void RXvFreeRCB(struct vnt_rcb *pRCB, int bReAllocSkb) (pDevice->bIsRxWorkItemQueued == false) ) { pDevice->bIsRxWorkItemQueued = true; - schedule_work(&pDevice->read_work_item); + tasklet_schedule(&pDevice->ReadWorkItem); } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----RXFreeRCB %d %d\n",pDevice->NumRecvFreeList, pDevice->NumRecvMngList); } -void RXvMngWorkItem(struct work_struct *work) +void RXvMngWorkItem(struct vnt_private *pDevice) { - struct vnt_private *pDevice = - container_of(work, struct vnt_private, rx_mng_work_item); struct vnt_rcb *pRCB = NULL; struct vnt_rx_mgmt *pRxPacket; int bReAllocSkb = false; - if (pDevice->Flags & fMP_DISCONNECTED) - return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Rx Mng Thread\n"); spin_lock_irq(&pDevice->lock); diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h index 8d52434..95388dc 100644 --- a/drivers/staging/vt6656/dpc.h +++ b/drivers/staging/vt6656/dpc.h @@ -32,9 +32,9 @@ #include "device.h" #include "wcmd.h" -void RXvWorkItem(struct work_struct *work); +void RXvWorkItem(void *Context); -void RXvMngWorkItem(struct work_struct *work); +void RXvMngWorkItem(void *Context); void RXvFreeRCB(struct vnt_rcb *pRCB, int bReAllocSkb); diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index cd2ea76..a1dc3a4 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -35,8 +35,8 @@ #include "control.h" #include "rndis.h" -static int msglevel = MSG_LEVEL_INFO; -/* static int msglevel = MSG_LEVEL_DEBUG; */ +static int msglevel =MSG_LEVEL_INFO; +//static int msglevel =MSG_LEVEL_DEBUG; #define FIRMWARE_VERSION 0x133 /* version 1.51 */ #define FIRMWARE_NAME "vntwusb.fw" @@ -72,17 +72,18 @@ int FIRMWAREbDownload(struct vnt_private *pDevice) memcpy(pBuffer, fw->data + ii, wLength); NdisStatus = CONTROLnsRequestOutAsyn(pDevice, - 0, - 0x1200+ii, - 0x0000, - wLength, - pBuffer); + 0, + 0x1200+ii, + 0x0000, + wLength, + pBuffer + ); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Download firmware...%d %zu\n", ii, fw->size); if (NdisStatus != STATUS_SUCCESS) goto free_fw; - } + } result = true; free_fw: @@ -100,47 +101,48 @@ int FIRMWAREbBrach2Sram(struct vnt_private *pDevice) { int NdisStatus; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Branch to Sram\n"); - - NdisStatus = CONTROLnsRequestOut(pDevice, - 1, - 0x1200, - 0x0000, - 0, - NULL); - if (NdisStatus != STATUS_SUCCESS) - return false; - else - return true; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Branch to Sram\n"); + + NdisStatus = CONTROLnsRequestOut(pDevice, + 1, + 0x1200, + 0x0000, + 0, + NULL + ); + + if (NdisStatus != STATUS_SUCCESS) { + return (false); + } else { + return (true); + } } int FIRMWAREbCheckVersion(struct vnt_private *pDevice) { int ntStatus; - ntStatus = CONTROLnsRequestIn(pDevice, - MESSAGE_TYPE_READ, - 0, - MESSAGE_REQUEST_VERSION, - 2, - (u8 *) &(pDevice->wFirmwareVersion)); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", - pDevice->wFirmwareVersion); - if (ntStatus != STATUS_SUCCESS) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Invalid.\n"); - return false; - } - if (pDevice->wFirmwareVersion == 0xFFFF) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"In Loader.\n"); - return false; - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", - pDevice->wFirmwareVersion); - if (pDevice->wFirmwareVersion < FIRMWARE_VERSION) { - /* branch to loader for download new firmware */ - FIRMWAREbBrach2Sram(pDevice); - return false; - } - return true; + ntStatus = CONTROLnsRequestIn(pDevice, + MESSAGE_TYPE_READ, + 0, + MESSAGE_REQUEST_VERSION, + 2, + (u8 *) &(pDevice->wFirmwareVersion)); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", pDevice->wFirmwareVersion); + if (ntStatus != STATUS_SUCCESS) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Invalid.\n"); + return false; + } + if (pDevice->wFirmwareVersion == 0xFFFF) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"In Loader.\n"); + return false; + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", pDevice->wFirmwareVersion); + if (pDevice->wFirmwareVersion < FIRMWARE_VERSION) { + // branch to loader for download new firmware + FIRMWAREbBrach2Sram(pDevice); + return false; + } + return true; } diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index 67ba48b..c699a30 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -133,8 +133,7 @@ static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", pDevice->dev->name, pDevice->apdev->name); } - if (pDevice->apdev) - free_netdev(pDevice->apdev); + free_netdev(pDevice->apdev); pDevice->apdev = NULL; pDevice->bEnable8021x = false; pDevice->bEnableHostWEP = false; @@ -415,7 +414,7 @@ static int hostap_set_encryption(struct vnt_private *pDevice, int ret = 0; s32 iNodeIndex = -1; int ii; - bool bKeyTableFull = false; + int bKeyTableFull = false; u16 wKeyCtl = 0; param->u.crypt.err = 0; @@ -686,7 +685,7 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) p->length > VIAWGET_HOSTAPD_MAX_BUF_SIZE || !p->pointer) return -EINVAL; - param = kmalloc((int)p->length, GFP_KERNEL); + param = kmalloc((int)p->length, (int)GFP_KERNEL); if (param == NULL) return -ENOMEM; diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 63917ab..8872e0f 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -60,7 +60,7 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) pDevice->wstats.status = pDevice->eOPMode; if (pDevice->scStatistic.LinkQuality > 100) pDevice->scStatistic.LinkQuality = 100; - pDevice->wstats.qual.qual = (u8)pDevice->scStatistic.LinkQuality; + pDevice->wstats.qual.qual =(u8)pDevice->scStatistic.LinkQuality; RFvRSSITodBm(pDevice, (u8)(pDevice->uCurrRSSI), &ldBm); pDevice->wstats.qual.level = ldBm; pDevice->wstats.qual.noise = 0; @@ -190,7 +190,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, return -EAGAIN; } pBSS = &(pMgmt->sBSSList[0]); - for (ii = 0, jj = 0; jj < MAX_BSS_NUM; jj++) { + for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) { if (current_ev >= end_buf) break; pBSS = &(pMgmt->sBSSList[jj]); @@ -225,7 +225,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.u.freq.m = pBSS->uChannel; iwe.u.freq.e = 0; iwe.u.freq.i = 0; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); + current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); { int f = (int)pBSS->uChannel - 1; if (f < 0) @@ -400,7 +400,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, if (pDevice->flags & DEVICE_FLAGS_OPENED) pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); break; case IW_MODE_AUTO: case IW_MODE_INFRA: @@ -409,7 +409,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, if (pDevice->flags & DEVICE_FLAGS_OPENED) pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); break; case IW_MODE_MASTER: @@ -422,7 +422,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, if (pDevice->flags & DEVICE_FLAGS_OPENED) pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); break; case IW_MODE_REPEAT: @@ -657,8 +657,8 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, unsigned uSameBssidNum = 0; for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && - ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, - pMgmt->abyDesireBSSID)) { + !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, + pMgmt->abyDesireBSSID)) { uSameBssidNum++; } } @@ -786,8 +786,8 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, if (wrq->flags == 0) { // Just send an empty SSID list memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - memset(pMgmt->abyDesireBSSID, 0xFF, 6); - PRINT_K("set essid to 'any'\n"); + memset(pMgmt->abyDesireBSSID, 0xFF,6); + PRINT_K("set essid to 'any' \n"); // Unknown desired AP, so here need not associate?? return 0; } else { @@ -798,15 +798,15 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, memcpy(pItemSSID->abySSID, extra, wrq->length); if (pItemSSID->abySSID[wrq->length] == '\0') { - if (wrq->length > 0) + if (wrq->length>0) pItemSSID->len = wrq->length; } else { pItemSSID->len = wrq->length; } - PRINT_K("set essid to %s\n", pItemSSID->abySSID); + PRINT_K("set essid to %s \n", pItemSSID->abySSID); // mike: need clear desiredBSSID - if (pItemSSID->len == 0) { + if (pItemSSID->len==0) { memset(pMgmt->abyDesireBSSID, 0xFF, 6); return 0; } @@ -840,8 +840,8 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, // are two same BSSID exist in list ? for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && - ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, - pCurr->abyBSSID)) { + !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, + pCurr->abyBSSID)) { uSameBssidNum++; } } @@ -860,7 +860,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, return 0; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s\n", pItemSSID->abySSID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); } if (pDevice->flags & DEVICE_FLAGS_OPENED) @@ -893,7 +893,7 @@ int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, memcpy(extra, pItemSSID->abySSID, pItemSSID->len); extra[pItemSSID->len] = '\0'; - wrq->length = pItemSSID->len; + wrq->length = pItemSSID->len; wrq->flags = 1; // active return 0; @@ -915,7 +915,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, 0x60, 0x6C, 0x90 }; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; return rc; @@ -953,7 +953,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, } // Check that it is valid // brate is index of abySupportedRates[] - if (brate > 13) { + if (brate > 13 ) { rc = -EINVAL; return rc; } @@ -967,7 +967,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, pDevice->uConnectionRate = 3; } else { pDevice->uConnectionRate = brate; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d\n", pDevice->uConnectionRate); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); } } else { pDevice->bFixRate = false; @@ -1017,7 +1017,7 @@ int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, if (pDevice->byBBType == BB_TYPE_11A) brate = 0x6C; } - if (pDevice->uConnectionRate == 13) + if (pDevice->uConnectionRate == 13) brate = abySupportedRates[pDevice->wCurrentRate]; wrq->value = brate * 500000; // If more than one rate, set auto @@ -1286,7 +1286,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, if (index < 1) { // get default key if (pDevice->byKeyIndex < WLAN_WEP_NKEYS) index = pDevice->byKeyIndex; - else + else index = 0; } else { index--; @@ -1366,14 +1366,14 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, switch (wrq->flags & IW_POWER_MODE) { case IW_POWER_UNICAST_R: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n"); rc = -EINVAL; break; case IW_POWER_ALL_R: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n"); rc = -EINVAL; case IW_POWER_ON: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n"); break; default: rc = -EINVAL; @@ -1465,7 +1465,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, case IW_AUTH_CIPHER_PAIRWISE: pairwise = wrq->value; PRINT_K("iwctl_siwauth:set pairwise=%d\n", pairwise); - if (pairwise == IW_AUTH_CIPHER_CCMP) { + if (pairwise == IW_AUTH_CIPHER_CCMP){ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; } else if (pairwise == IW_AUTH_CIPHER_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; @@ -1490,13 +1490,13 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, } break; case IW_AUTH_KEY_MGMT: - PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n", wpa_version, wrq->value); - if (wpa_version == IW_AUTH_WPA_VERSION_WPA2) { + PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n", wpa_version,wrq->value); + if (wpa_version == IW_AUTH_WPA_VERSION_WPA2){ if (wrq->value == IW_AUTH_KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA2; } else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) { - if (wrq->value == 0) { + if (wrq->value == 0){ pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; } else if (wrq->value == IW_AUTH_KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; @@ -1558,17 +1558,17 @@ int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, if (pMgmt == NULL) return -EFAULT; - if (wrq->length) { + if (wrq->length){ if ((wrq->length < 2) || (extra[1] + 2 != wrq->length)) { ret = -EINVAL; goto out; } - if (wrq->length > MAX_WPA_IE_LEN) { + if (wrq->length > MAX_WPA_IE_LEN){ ret = -ENOMEM; goto out; } memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN); - if (copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)) { + if (copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){ ret = -EFAULT; goto out; } @@ -1615,7 +1615,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; - struct viawget_wpa_param *param = NULL; + struct viawget_wpa_param *param=NULL; // original member wpa_alg alg_name; u8 addr[6]; @@ -1658,8 +1658,8 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, alg_name = WPA_ALG_CCMP; break; default: - PRINT_K("Unknown alg = %d\n", ext->alg); - ret = -ENOMEM; + PRINT_K("Unknown alg = %d\n",ext->alg); + ret= -ENOMEM; goto error; } // recover addr @@ -1671,7 +1671,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, set_tx = 1; // recover seq,seq_len if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - seq_len = IW_ENCODE_SEQ_MAX_SIZE; + seq_len=IW_ENCODE_SEQ_MAX_SIZE; memcpy(seq, ext->rx_seq, seq_len); } // recover key,key_len @@ -1702,7 +1702,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, /****set if current action is Network Manager count?? */ /****this method is so foolish,but there is no other way??? */ if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { - if (param->u.wpa_key.key_index == 0) { + if (param->u.wpa_key.key_index ==0) { pDevice->bwextstep0 = true; } if ((pDevice->bwextstep0 == true) && (param->u.wpa_key.key_index == 1)) { @@ -1761,7 +1761,7 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, ret = -EINVAL; return ret; } - switch (mlme->cmd) { + switch (mlme->cmd){ case IW_MLME_DEAUTH: case IW_MLME_DISASSOC: if (pDevice->bLinkPass == true) { @@ -1815,6 +1815,7 @@ static const iw_handler iwctl_handler[] = { IW_HANDLER(SIOCGIWPOWER, iwctl_giwpower), IW_HANDLER(SIOCSIWGENIE, iwctl_siwgenie), IW_HANDLER(SIOCGIWGENIE, iwctl_giwgenie), + IW_HANDLER(SIOCSIWMLME, iwctl_siwmlme), IW_HANDLER(SIOCSIWAUTH, iwctl_siwauth), IW_HANDLER(SIOCGIWAUTH, iwctl_giwauth), IW_HANDLER(SIOCSIWENCODEEXT, iwctl_siwencodeext), diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index be92c04..205590b 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -151,7 +151,7 @@ int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, *pKey = NULL; for (i=0;i<MAX_KEY_TABLE;i++) { if ((pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if (dwKeyIndex == 0xFFFFFFFF) { if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { *pKey = &(pTable->KeyTable[i].PairwiseKey); @@ -213,7 +213,7 @@ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, j = i; } if ((pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { // found table already exist if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key @@ -395,7 +395,7 @@ int KeybRemoveKey(struct vnt_private *pDevice, PSKeyManagement pTable, } else { for (i=0;i<MAX_KEY_TABLE;i++) { if ( (pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if ((dwKeyIndex & PAIRWISE_KEY) != 0) { pTable->KeyTable[i].PairwiseKey.bKeyValid = false; @@ -445,7 +445,7 @@ int KeybRemoveAllKey(struct vnt_private *pDevice, PSKeyManagement pTable, for (i=0;i<MAX_KEY_TABLE;i++) { if ((pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { pTable->KeyTable[i].PairwiseKey.bKeyValid = false; for (u = 0; u < MAX_GROUP_KEY; u++) pTable->KeyTable[i].GroupKey[u].bKeyValid = false; @@ -480,7 +480,7 @@ int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, for (i = 0; i < MAX_KEY_TABLE; i++) { if ((pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if (dwKeyType == PAIRWISE_KEY) { diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index aae228c..6f9d281 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -702,16 +702,6 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) device_set_options(pDevice); spin_lock_init(&pDevice->lock); - INIT_DELAYED_WORK(&pDevice->run_command_work, vRunCommand); - INIT_DELAYED_WORK(&pDevice->second_callback_work, BSSvSecondCallBack); - INIT_WORK(&pDevice->read_work_item, RXvWorkItem); - INIT_WORK(&pDevice->rx_mng_work_item, RXvMngWorkItem); - - pDevice->pControlURB = usb_alloc_urb(0, GFP_ATOMIC); - if (!pDevice->pControlURB) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR"Failed to alloc control urb\n"); - goto err_netdev; - } pDevice->tx_80211 = device_dma0_tx_80211; pDevice->vnt_mgmt.pAdapter = (void *) pDevice; @@ -723,15 +713,14 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) usb_set_intfdata(intf, pDevice); SET_NETDEV_DEV(netdev, &intf->dev); memcpy(pDevice->dev->dev_addr, fake_mac, ETH_ALEN); - - usb_device_reset(pDevice); - rc = register_netdev(netdev); if (rc) { printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n"); goto err_netdev; } + usb_device_reset(pDevice); + return 0; err_netdev: @@ -860,15 +849,23 @@ static bool device_alloc_bufs(struct vnt_private *pDevice) pRCB++; } + pDevice->pControlURB = usb_alloc_urb(0, GFP_ATOMIC); + if (pDevice->pControlURB == NULL) { + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc control urb\n"); + goto free_rx_tx; + } + pDevice->pInterruptURB = usb_alloc_urb(0, GFP_ATOMIC); if (pDevice->pInterruptURB == NULL) { DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc int urb\n"); + usb_free_urb(pDevice->pControlURB); goto free_rx_tx; } pDevice->intBuf.pDataBuf = kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL); if (pDevice->intBuf.pDataBuf == NULL) { DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc int buf\n"); + usb_free_urb(pDevice->pControlURB); usb_free_urb(pDevice->pInterruptURB); goto free_rx_tx; } @@ -984,11 +981,10 @@ static int device_open(struct net_device *dev) } vMgrObjectInit(pDevice); - + tasklet_init(&pDevice->RxMngWorkItem, (void *)RXvMngWorkItem, (unsigned long)pDevice); + tasklet_init(&pDevice->ReadWorkItem, (void *)RXvWorkItem, (unsigned long)pDevice); tasklet_init(&pDevice->EventWorkItem, (void *)INTvWorkItem, (unsigned long)pDevice); - - schedule_delayed_work(&pDevice->second_callback_work, HZ); - + add_timer(&pDevice->vnt_mgmt.sTimerSecondCallback); pDevice->int_interval = 100; /* max 100 microframes */ pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; @@ -1004,7 +1000,7 @@ static int device_open(struct net_device *dev) pDevice->bWPASuppWextEnabled = false; pDevice->byReAssocCount = 0; - schedule_work(&pDevice->read_work_item); + RXvWorkItem(pDevice); INTvWorkItem(pDevice); /* if WEP key already set by iwconfig but device not yet open */ @@ -1039,7 +1035,9 @@ free_rx_tx: device_free_rx_bufs(pDevice); device_free_tx_bufs(pDevice); device_free_int_bufs(pDevice); + usb_kill_urb(pDevice->pControlURB); usb_kill_urb(pDevice->pInterruptURB); + usb_free_urb(pDevice->pControlURB); usb_free_urb(pDevice->pInterruptURB); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open fail.. \n"); @@ -1078,19 +1076,18 @@ static int device_close(struct net_device *dev) MP_CLEAR_FLAG(pDevice, fMP_POST_WRITES); MP_CLEAR_FLAG(pDevice, fMP_POST_READS); pDevice->fKillEventPollingThread = true; + del_timer(&pDevice->sTimerCommand); + del_timer(&pMgmt->sTimerSecondCallback); - cancel_delayed_work_sync(&pDevice->run_command_work); - cancel_delayed_work_sync(&pDevice->second_callback_work); + del_timer(&pDevice->sTimerTxData); if (pDevice->bDiversityRegCtlON) { del_timer(&pDevice->TimerSQ3Tmax1); del_timer(&pDevice->TimerSQ3Tmax2); del_timer(&pDevice->TimerSQ3Tmax3); } - - cancel_work_sync(&pDevice->rx_mng_work_item); - cancel_work_sync(&pDevice->read_work_item); - + tasklet_kill(&pDevice->RxMngWorkItem); + tasklet_kill(&pDevice->ReadWorkItem); tasklet_kill(&pDevice->EventWorkItem); pDevice->bRoaming = false; @@ -1108,7 +1105,9 @@ static int device_close(struct net_device *dev) device_free_int_bufs(pDevice); device_free_frag_bufs(pDevice); + usb_kill_urb(pDevice->pControlURB); usb_kill_urb(pDevice->pInterruptURB); + usb_free_urb(pDevice->pControlURB); usb_free_urb(pDevice->pInterruptURB); BSSvClearNodeDBTable(pDevice, 0); @@ -1132,12 +1131,9 @@ static void vt6656_disconnect(struct usb_interface *intf) if (device->dev) { unregister_netdev(device->dev); - - usb_kill_urb(device->pControlURB); - usb_free_urb(device->pControlURB); - free_netdev(device->dev); } + } static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c index e7d5487..edc8975 100644 --- a/drivers/staging/vt6656/power.c +++ b/drivers/staging/vt6656/power.c @@ -233,8 +233,9 @@ void PSvSendPSPOLL(struct vnt_private *pDevice) pTxPacket->cbPayloadLen = 0; /* log failure if sending failed */ - if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) + if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n"); + } } /* @@ -256,8 +257,10 @@ int PSbSendNullPacket(struct vnt_private *pDevice) if (pDevice->bLinkPass == false) return false; - if (pDevice->bEnablePSMode == false && pDevice->tx_trigger == false) - return false; + if ((pDevice->bEnablePSMode == false) && + (pDevice->fTxDataInSleep == false)) { + return false; + } memset(pMgmt->pbyPSPacketPool, 0, sizeof(struct vnt_tx_mgmt) + WLAN_NULLDATA_FR_MAXLEN); @@ -266,7 +269,7 @@ int PSbSendNullPacket(struct vnt_private *pDevice) + sizeof(struct vnt_tx_mgmt)); flags = WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL); + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL); if (pDevice->bEnablePSMode) flags |= WLAN_SET_FC_PWRMGT(1); diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h index 5cf5e73..5e07306 100644 --- a/drivers/staging/vt6656/rndis.h +++ b/drivers/staging/vt6656/rndis.h @@ -66,8 +66,6 @@ #define VIAUSB20_PACKET_HEADER 0x04 -#define USB_REG4 0x604 - typedef struct _CMD_MESSAGE { u8 byData[256]; diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 35a3ddb..14f3e85 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -98,18 +98,21 @@ static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, static void *s_vGetFreeContext(struct vnt_private *pDevice); -static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, - u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer, - struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize, - int bNeedACK, u32 uDMAIdx, struct ethhdr *psEthHeader, bool need_rts); +static void s_vGenerateTxParameter(struct vnt_private *pDevice, + u8 byPktType, u16 wCurrentRate, void *pTxBufHead, void *pvRrvTime, + void *rts_cts, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx, + struct ethhdr *psEthHeader, bool need_rts); + +static u32 s_uFillDataHead(struct vnt_private *pDevice, + u8 byPktType, u16 wCurrentRate, void *pTxDataHead, u32 cbFrameLength, + u32 uDMAIdx, int bNeedAck, u8 byFBOption); static void s_vGenerateMACHeader(struct vnt_private *pDevice, u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx); -static void s_vFillTxKey(struct vnt_private *pDevice, - struct vnt_tx_fifo_head *fifo_head, u8 *pbyIVHead, - PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen, +static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, + u8 *pbyIVHead, PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen, struct vnt_mic_hdr *mic_hdr); static void s_vSWencryption(struct vnt_private *pDevice, @@ -121,11 +124,11 @@ static unsigned int s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType, static u16 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice, u8 byRTSRsvType, u8 byPktType, u32 cbFrameLength, u16 wCurrentRate); -static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, +static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck, u16 wCurrentRate, u8 byFBOption); -static u16 s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, +static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck, struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption); @@ -180,12 +183,10 @@ static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, ETH_ALEN); } -static void s_vFillTxKey(struct vnt_private *pDevice, - struct vnt_tx_fifo_head *fifo_head, u8 *pbyIVHead, - PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen, - struct vnt_mic_hdr *mic_hdr) +static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, + u8 *pbyIVHead, PSKeyItem pTransmitKey, u8 *pbyHdrBuf, + u16 wPayloadLen, struct vnt_mic_hdr *mic_hdr) { - u8 *pbyBuf = (u8 *)&fifo_head->adwTxKey[0]; u32 *pdwIV = (u32 *)pbyIVHead; u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4); struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf; @@ -430,114 +431,185 @@ static u16 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, { u32 uCTSTime = 0, uDurTime = 0; - switch (byDurType) { - case RTSDUR_BB: - case RTSDUR_BA: - case RTSDUR_BA_F0: - case RTSDUR_BA_F1: - uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, - 14, pDevice->byTopCCKBasicRate); - uDurTime = uCTSTime + 2 * pDevice->uSIFS + - s_uGetTxRsvTime(pDevice, byPktType, - cbFrameLength, wRate, bNeedAck); - break; - - case RTSDUR_AA: - case RTSDUR_AA_F0: - case RTSDUR_AA_F1: - uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, - 14, pDevice->byTopOFDMBasicRate); - uDurTime = uCTSTime + 2 * pDevice->uSIFS + - s_uGetTxRsvTime(pDevice, byPktType, - cbFrameLength, wRate, bNeedAck); - break; - - case CTSDUR_BA: - case CTSDUR_BA_F0: - case CTSDUR_BA_F1: - uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, - byPktType, cbFrameLength, wRate, bNeedAck); - break; - - default: - break; - } - - return cpu_to_le16((u16)uDurTime); -} - -static u16 vnt_rxtx_datahead_g(struct vnt_private *priv, u8 pkt_type, u16 rate, - struct vnt_tx_datahead_g *buf, u32 frame_len, int need_ack) -{ - /* Get SignalField,ServiceField,Length */ - BBvCalculateParameter(priv, frame_len, rate, pkt_type, &buf->a); - BBvCalculateParameter(priv, frame_len, priv->byTopCCKBasicRate, - PK_TYPE_11B, &buf->b); - - /* Get Duration and TimeStamp */ - buf->wDuration_a = s_uGetDataDuration(priv, pkt_type, need_ack); - buf->wDuration_b = s_uGetDataDuration(priv, PK_TYPE_11B, need_ack); - - buf->wTimeStampOff_a = vnt_time_stamp_off(priv, rate); - buf->wTimeStampOff_b = vnt_time_stamp_off(priv, - priv->byTopCCKBasicRate); + switch (byDurType) { - return buf->wDuration_a; -} - -static u16 vnt_rxtx_datahead_g_fb(struct vnt_private *priv, u8 pkt_type, - u16 rate, struct vnt_tx_datahead_g_fb *buf, - u32 frame_len, int need_ack) -{ - /* Get SignalField,ServiceField,Length */ - BBvCalculateParameter(priv, frame_len, rate, pkt_type, &buf->a); + case RTSDUR_BB: //RTSDuration_bb + uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); + break; - BBvCalculateParameter(priv, frame_len, priv->byTopCCKBasicRate, - PK_TYPE_11B, &buf->b); + case RTSDUR_BA: //RTSDuration_ba + uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); + break; - /* Get Duration and TimeStamp */ - buf->wDuration_a = s_uGetDataDuration(priv, pkt_type, need_ack); - buf->wDuration_b = s_uGetDataDuration(priv, PK_TYPE_11B, need_ack); + case RTSDUR_AA: //RTSDuration_aa + uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); + break; - buf->wDuration_a_f0 = s_uGetDataDuration(priv, pkt_type, need_ack); - buf->wDuration_a_f1 = s_uGetDataDuration(priv, pkt_type, need_ack); + case CTSDUR_BA: //CTSDuration_ba + uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); + break; - buf->wTimeStampOff_a = vnt_time_stamp_off(priv, rate); - buf->wTimeStampOff_b = vnt_time_stamp_off(priv, - priv->byTopCCKBasicRate); + case RTSDUR_BA_F0: //RTSDuration_ba_f0 + uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); + if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck); + } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck); + } + break; + + case RTSDUR_AA_F0: //RTSDuration_aa_f0 + uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); + if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck); + } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck); + } + break; - return buf->wDuration_a; -} + case RTSDUR_BA_F1: //RTSDuration_ba_f1 + uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); + if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck); + } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck); + } + break; + + case RTSDUR_AA_F1: //RTSDuration_aa_f1 + uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); + if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck); + } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck); + } + break; -static u16 vnt_rxtx_datahead_a_fb(struct vnt_private *priv, u8 pkt_type, - u16 rate, struct vnt_tx_datahead_a_fb *buf, - u32 frame_len, int need_ack) -{ - /* Get SignalField,ServiceField,Length */ - BBvCalculateParameter(priv, frame_len, rate, pkt_type, &buf->a); - /* Get Duration and TimeStampOff */ - buf->wDuration = s_uGetDataDuration(priv, pkt_type, need_ack); + case CTSDUR_BA_F0: //CTSDuration_ba_f0 + if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck); + } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck); + } + break; - buf->wDuration_f0 = s_uGetDataDuration(priv, pkt_type, need_ack); - buf->wDuration_f1 = s_uGetDataDuration(priv, pkt_type, need_ack); + case CTSDUR_BA_F1: //CTSDuration_ba_f1 + if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck); + } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) { + uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck); + } + break; - buf->wTimeStampOff = vnt_time_stamp_off(priv, rate); + default: + break; + } - return buf->wDuration; + return cpu_to_le16((u16)uDurTime); } -static u16 vnt_rxtx_datahead_ab(struct vnt_private *priv, u8 pkt_type, - u16 rate, struct vnt_tx_datahead_ab *buf, - u32 frame_len, int need_ack) +static u32 s_uFillDataHead(struct vnt_private *pDevice, + u8 byPktType, u16 wCurrentRate, void *pTxDataHead, u32 cbFrameLength, + u32 uDMAIdx, int bNeedAck, u8 byFBOption) { - /* Get SignalField,ServiceField,Length */ - BBvCalculateParameter(priv, frame_len, rate, pkt_type, &buf->ab); - /* Get Duration and TimeStampOff */ - buf->wDuration = s_uGetDataDuration(priv, pkt_type, need_ack); - buf->wTimeStampOff = vnt_time_stamp_off(priv, rate); + if (pTxDataHead == NULL) { + return 0; + } - return buf->wDuration; + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { + if (byFBOption == AUTO_FB_NONE) { + struct vnt_tx_datahead_g *pBuf = + (struct vnt_tx_datahead_g *)pTxDataHead; + //Get SignalField,ServiceField,Length + BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, + byPktType, &pBuf->a); + BBvCalculateParameter(pDevice, cbFrameLength, + pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b); + //Get Duration and TimeStamp + pBuf->wDuration_a = s_uGetDataDuration(pDevice, + byPktType, bNeedAck); + pBuf->wDuration_b = s_uGetDataDuration(pDevice, + PK_TYPE_11B, bNeedAck); + + pBuf->wTimeStampOff_a = vnt_time_stamp_off(pDevice, + wCurrentRate); + pBuf->wTimeStampOff_b = vnt_time_stamp_off(pDevice, + pDevice->byTopCCKBasicRate); + return (pBuf->wDuration_a); + } else { + // Auto Fallback + struct vnt_tx_datahead_g_fb *pBuf = + (struct vnt_tx_datahead_g_fb *)pTxDataHead; + //Get SignalField,ServiceField,Length + BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, + byPktType, &pBuf->a); + BBvCalculateParameter(pDevice, cbFrameLength, + pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b); + //Get Duration and TimeStamp + pBuf->wDuration_a = s_uGetDataDuration(pDevice, + byPktType, bNeedAck); + pBuf->wDuration_b = s_uGetDataDuration(pDevice, + PK_TYPE_11B, bNeedAck); + pBuf->wDuration_a_f0 = s_uGetDataDuration(pDevice, + byPktType, bNeedAck); + pBuf->wDuration_a_f1 = s_uGetDataDuration(pDevice, + byPktType, bNeedAck); + pBuf->wTimeStampOff_a = vnt_time_stamp_off(pDevice, + wCurrentRate); + pBuf->wTimeStampOff_b = vnt_time_stamp_off(pDevice, + pDevice->byTopCCKBasicRate); + return (pBuf->wDuration_a); + } //if (byFBOption == AUTO_FB_NONE) + } + else if (byPktType == PK_TYPE_11A) { + if (byFBOption != AUTO_FB_NONE) { + struct vnt_tx_datahead_a_fb *pBuf = + (struct vnt_tx_datahead_a_fb *)pTxDataHead; + //Get SignalField,ServiceField,Length + BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, + byPktType, &pBuf->a); + //Get Duration and TimeStampOff + pBuf->wDuration = s_uGetDataDuration(pDevice, + byPktType, bNeedAck); + pBuf->wDuration_f0 = s_uGetDataDuration(pDevice, + byPktType, bNeedAck); + pBuf->wDuration_f1 = s_uGetDataDuration(pDevice, + byPktType, bNeedAck); + pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, + wCurrentRate); + return (pBuf->wDuration); + } else { + struct vnt_tx_datahead_ab *pBuf = + (struct vnt_tx_datahead_ab *)pTxDataHead; + //Get SignalField,ServiceField,Length + BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, + byPktType, &pBuf->ab); + //Get Duration and TimeStampOff + pBuf->wDuration = s_uGetDataDuration(pDevice, + byPktType, bNeedAck); + pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, + wCurrentRate); + return (pBuf->wDuration); + } + } + else if (byPktType == PK_TYPE_11B) { + struct vnt_tx_datahead_ab *pBuf = + (struct vnt_tx_datahead_ab *)pTxDataHead; + //Get SignalField,ServiceField,Length + BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, + byPktType, &pBuf->ab); + //Get Duration and TimeStampOff + pBuf->wDuration = s_uGetDataDuration(pDevice, + byPktType, bNeedAck); + pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, + wCurrentRate); + return (pBuf->wDuration); + } + return 0; } static int vnt_fill_ieee80211_rts(struct vnt_private *priv, @@ -560,7 +632,7 @@ static int vnt_fill_ieee80211_rts(struct vnt_private *priv, return 0; } -static u16 vnt_rxtx_rts_g_head(struct vnt_private *priv, +static int vnt_rxtx_rts_g_head(struct vnt_private *priv, struct vnt_rts_g *buf, struct ethhdr *eth_hdr, u8 pkt_type, u32 frame_len, int need_ack, u16 current_rate, u8 fb_option) @@ -581,11 +653,10 @@ static u16 vnt_rxtx_rts_g_head(struct vnt_private *priv, vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->wDuration_aa); - return vnt_rxtx_datahead_g(priv, pkt_type, current_rate, - &buf->data_head, frame_len, need_ack); + return 0; } -static u16 vnt_rxtx_rts_g_fb_head(struct vnt_private *priv, +static int vnt_rxtx_rts_g_fb_head(struct vnt_private *priv, struct vnt_rts_g_fb *buf, struct ethhdr *eth_hdr, u8 pkt_type, u32 frame_len, int need_ack, u16 current_rate, u8 fb_option) @@ -607,21 +678,20 @@ static u16 vnt_rxtx_rts_g_fb_head(struct vnt_private *priv, buf->wRTSDuration_ba_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_BA_F0, - frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option); + frame_len, pkt_type, current_rate, need_ack, fb_option); buf->wRTSDuration_aa_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F0, - frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option); + frame_len, pkt_type, current_rate, need_ack, fb_option); buf->wRTSDuration_ba_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_BA_F1, - frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option); + frame_len, pkt_type, current_rate, need_ack, fb_option); buf->wRTSDuration_aa_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F1, - frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option); + frame_len, pkt_type, current_rate, need_ack, fb_option); vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->wDuration_aa); - return vnt_rxtx_datahead_g_fb(priv, pkt_type, current_rate, - &buf->data_head, frame_len, need_ack); + return 0; } -static u16 vnt_rxtx_rts_ab_head(struct vnt_private *priv, +static int vnt_rxtx_rts_ab_head(struct vnt_private *priv, struct vnt_rts_ab *buf, struct ethhdr *eth_hdr, u8 pkt_type, u32 frame_len, int need_ack, u16 current_rate, u8 fb_option) @@ -636,11 +706,10 @@ static u16 vnt_rxtx_rts_ab_head(struct vnt_private *priv, vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->wDuration); - return vnt_rxtx_datahead_ab(priv, pkt_type, current_rate, - &buf->data_head, frame_len, need_ack); + return 0; } -static u16 vnt_rxtx_rts_a_fb_head(struct vnt_private *priv, +static int vnt_rxtx_rts_a_fb_head(struct vnt_private *priv, struct vnt_rts_a_fb *buf, struct ethhdr *eth_hdr, u8 pkt_type, u32 frame_len, int need_ack, u16 current_rate, u8 fb_option) @@ -654,24 +723,23 @@ static u16 vnt_rxtx_rts_a_fb_head(struct vnt_private *priv, pkt_type, current_rate, need_ack, fb_option); buf->wRTSDuration_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F0, - frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option); + frame_len, pkt_type, current_rate, need_ack, fb_option); buf->wRTSDuration_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F1, - frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option); + frame_len, pkt_type, current_rate, need_ack, fb_option); vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->wDuration); - return vnt_rxtx_datahead_a_fb(priv, pkt_type, current_rate, - &buf->data_head, frame_len, need_ack); + return 0; } -static u16 s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, +static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck, struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption) { if (!head) - return 0; + return; /* Note: So far RTSHead doesn't appear in ATIM * & Beacom DMA, so we don't need to take them @@ -682,38 +750,36 @@ static u16 s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, case PK_TYPE_11GB: case PK_TYPE_11GA: if (byFBOption == AUTO_FB_NONE) - return vnt_rxtx_rts_g_head(pDevice, &head->rts_g, + vnt_rxtx_rts_g_head(pDevice, &head->rts_g, psEthHeader, byPktType, cbFrameLength, bNeedAck, wCurrentRate, byFBOption); else - return vnt_rxtx_rts_g_fb_head(pDevice, &head->rts_g_fb, + vnt_rxtx_rts_g_fb_head(pDevice, &head->rts_g_fb, psEthHeader, byPktType, cbFrameLength, bNeedAck, wCurrentRate, byFBOption); break; case PK_TYPE_11A: if (byFBOption) { - return vnt_rxtx_rts_a_fb_head(pDevice, &head->rts_a_fb, + vnt_rxtx_rts_a_fb_head(pDevice, &head->rts_a_fb, psEthHeader, byPktType, cbFrameLength, bNeedAck, wCurrentRate, byFBOption); break; } case PK_TYPE_11B: - return vnt_rxtx_rts_ab_head(pDevice, &head->rts_ab, + vnt_rxtx_rts_ab_head(pDevice, &head->rts_ab, psEthHeader, byPktType, cbFrameLength, bNeedAck, wCurrentRate, byFBOption); } - - return 0; } -static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, +static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck, u16 wCurrentRate, u8 byFBOption) { u32 uCTSFrameLen = 14; if (!head) - return 0; + return; if (byFBOption != AUTO_FB_NONE) { /* Auto Fall back */ @@ -726,19 +792,16 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, wCurrentRate, bNeedAck, byFBOption); /* Get CTSDuration_ba_f0 */ pBuf->wCTSDuration_ba_f0 = s_uGetRTSCTSDuration(pDevice, - CTSDUR_BA_F0, cbFrameLength, byPktType, - pDevice->tx_rate_fb0, bNeedAck, byFBOption); + CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, + bNeedAck, byFBOption); /* Get CTSDuration_ba_f1 */ pBuf->wCTSDuration_ba_f1 = s_uGetRTSCTSDuration(pDevice, - CTSDUR_BA_F1, cbFrameLength, byPktType, - pDevice->tx_rate_fb1, bNeedAck, byFBOption); + CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, + bNeedAck, byFBOption); /* Get CTS Frame body */ pBuf->data.duration = pBuf->wDuration_ba; pBuf->data.frame_control = TYPE_CTL_CTS; memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN); - - return vnt_rxtx_datahead_g_fb(pDevice, byPktType, wCurrentRate, - &pBuf->data_head, cbFrameLength, bNeedAck); } else { struct vnt_cts *pBuf = &head->cts_g; /* Get SignalField,ServiceField,Length */ @@ -752,12 +815,7 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, pBuf->data.duration = pBuf->wDuration_ba; pBuf->data.frame_control = TYPE_CTL_CTS; memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN); - - return vnt_rxtx_datahead_g(pDevice, byPktType, wCurrentRate, - &pBuf->data_head, cbFrameLength, bNeedAck); } - - return 0; } /*+ @@ -783,160 +841,112 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, * -*/ -static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, - u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer, - struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize, - int bNeedACK, u32 uDMAIdx, struct ethhdr *psEthHeader, bool need_rts) +static void s_vGenerateTxParameter(struct vnt_private *pDevice, + u8 byPktType, u16 wCurrentRate, void *pTxBufHead, void *pvRrvTime, + void *rts_cts, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx, + struct ethhdr *psEthHeader, bool need_rts) { - struct vnt_tx_fifo_head *pFifoHead = &tx_buffer->fifo_head; - union vnt_tx_data_head *head = NULL; + union vnt_tx_data_head *head = rts_cts; u32 cbMACHdLen = WLAN_HDR_ADDR3_LEN; /* 24 */ u16 wFifoCtl; u8 byFBOption = AUTO_FB_NONE; - pFifoHead->wReserved = wCurrentRate; - wFifoCtl = pFifoHead->wFIFOCtl; + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter...\n"); + PSTxBufHead pFifoHead = (PSTxBufHead)pTxBufHead; + pFifoHead->wReserved = wCurrentRate; + wFifoCtl = pFifoHead->wFIFOCtl; - if (wFifoCtl & FIFOCTL_AUTO_FB_0) - byFBOption = AUTO_FB_0; - else if (wFifoCtl & FIFOCTL_AUTO_FB_1) - byFBOption = AUTO_FB_1; + if (wFifoCtl & FIFOCTL_AUTO_FB_0) { + byFBOption = AUTO_FB_0; + } + else if (wFifoCtl & FIFOCTL_AUTO_FB_1) { + byFBOption = AUTO_FB_1; + } - if (!pFifoHead) - return 0; + if (!pvRrvTime) + return; - if (pDevice->bLongHeader) - cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6; + if (pDevice->bLongHeader) + cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6; - if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { - if (need_rts) { - struct vnt_rrv_time_rts *pBuf = - &tx_buffer->tx_head.tx_rts.rts; - - pBuf->wRTSTxRrvTime_aa = s_uGetRTSCTSRsvTime(pDevice, 2, - byPktType, cbFrameSize, wCurrentRate); - pBuf->wRTSTxRrvTime_ba = s_uGetRTSCTSRsvTime(pDevice, 1, - byPktType, cbFrameSize, wCurrentRate); - pBuf->wRTSTxRrvTime_bb = s_uGetRTSCTSRsvTime(pDevice, 0, + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { + if (need_rts) { + //Fill RsvTime + struct vnt_rrv_time_rts *pBuf = + (struct vnt_rrv_time_rts *)pvRrvTime; + pBuf->wRTSTxRrvTime_aa = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate); - - pBuf->wTxRrvTime_a = vnt_rxtx_rsvtime_le16(pDevice, - byPktType, cbFrameSize, wCurrentRate, bNeedACK); - pBuf->wTxRrvTime_b = vnt_rxtx_rsvtime_le16(pDevice, - PK_TYPE_11B, cbFrameSize, - pDevice->byTopCCKBasicRate, bNeedACK); - - if (need_mic) { - *mic_hdr = &tx_buffer-> - tx_head.tx_rts.tx.mic.hdr; - head = &tx_buffer->tx_head.tx_rts.tx.mic.head; - } else { - head = &tx_buffer->tx_head.tx_rts.tx.head; - } - - /* Fill RTS */ - return s_vFillRTSHead(pDevice, byPktType, head, - cbFrameSize, bNeedACK, psEthHeader, - wCurrentRate, byFBOption); - - } else { - struct vnt_rrv_time_cts *pBuf = &tx_buffer-> - tx_head.tx_cts.cts; - - pBuf->wTxRrvTime_a = vnt_rxtx_rsvtime_le16(pDevice, - byPktType, cbFrameSize, wCurrentRate, bNeedACK); - pBuf->wTxRrvTime_b = vnt_rxtx_rsvtime_le16(pDevice, - PK_TYPE_11B, cbFrameSize, - pDevice->byTopCCKBasicRate, bNeedACK); - - pBuf->wCTSTxRrvTime_ba = s_uGetRTSCTSRsvTime(pDevice, 3, - byPktType, cbFrameSize, wCurrentRate); - - if (need_mic) { - *mic_hdr = &tx_buffer-> - tx_head.tx_cts.tx.mic.hdr; - head = &tx_buffer->tx_head.tx_cts.tx.mic.head; - } else { - head = &tx_buffer->tx_head.tx_cts.tx.head; - } - - /* Fill CTS */ - return s_vFillCTSHead(pDevice, uDMAIdx, byPktType, - head, cbFrameSize, bNeedACK, wCurrentRate, - byFBOption); - } - } else if (byPktType == PK_TYPE_11A) { - if (need_mic) { - *mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr; - head = &tx_buffer->tx_head.tx_ab.tx.mic.head; - } else { - head = &tx_buffer->tx_head.tx_ab.tx.head; - } - - if (need_rts) { - struct vnt_rrv_time_ab *pBuf = &tx_buffer-> - tx_head.tx_ab.ab; - - pBuf->wRTSTxRrvTime = s_uGetRTSCTSRsvTime(pDevice, 2, + pBuf->wRTSTxRrvTime_ba = s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate); - - pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, - byPktType, cbFrameSize, wCurrentRate, bNeedACK); - - /* Fill RTS */ - return s_vFillRTSHead(pDevice, byPktType, head, - cbFrameSize, bNeedACK, psEthHeader, - wCurrentRate, byFBOption); - } else { - struct vnt_rrv_time_ab *pBuf = &tx_buffer-> - tx_head.tx_ab.ab; - - pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, - PK_TYPE_11A, cbFrameSize, - wCurrentRate, bNeedACK); - - return vnt_rxtx_datahead_a_fb(pDevice, byPktType, - wCurrentRate, &head->data_head_a_fb, - cbFrameSize, bNeedACK); - } - } else if (byPktType == PK_TYPE_11B) { - if (need_mic) { - *mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr; - head = &tx_buffer->tx_head.tx_ab.tx.mic.head; - } else { - head = &tx_buffer->tx_head.tx_ab.tx.head; - } - - if (need_rts) { - struct vnt_rrv_time_ab *pBuf = &tx_buffer-> - tx_head.tx_ab.ab; - - pBuf->wRTSTxRrvTime = s_uGetRTSCTSRsvTime(pDevice, 0, + pBuf->wRTSTxRrvTime_bb = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate); - - pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, - PK_TYPE_11B, cbFrameSize, wCurrentRate, - bNeedACK); - - /* Fill RTS */ - return s_vFillRTSHead(pDevice, byPktType, head, - cbFrameSize, + pBuf->wTxRrvTime_a = vnt_rxtx_rsvtime_le16(pDevice, + byPktType, cbFrameSize, wCurrentRate, bNeedACK); + pBuf->wTxRrvTime_b = vnt_rxtx_rsvtime_le16(pDevice, + PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, + bNeedACK); + /* Fill RTS */ + s_vFillRTSHead(pDevice, byPktType, head, cbFrameSize, bNeedACK, psEthHeader, wCurrentRate, byFBOption); - } else { - struct vnt_rrv_time_ab *pBuf = &tx_buffer-> - tx_head.tx_ab.ab; - - pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, - PK_TYPE_11B, cbFrameSize, - wCurrentRate, bNeedACK); - - return vnt_rxtx_datahead_ab(pDevice, byPktType, - wCurrentRate, &head->data_head_ab, - cbFrameSize, bNeedACK); - } - } - - return 0; + } + else {//RTS_needless, PCF mode + //Fill RsvTime + struct vnt_rrv_time_cts *pBuf = + (struct vnt_rrv_time_cts *)pvRrvTime; + pBuf->wTxRrvTime_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, + cbFrameSize, wCurrentRate, bNeedACK); + pBuf->wTxRrvTime_b = vnt_rxtx_rsvtime_le16(pDevice, + PK_TYPE_11B, cbFrameSize, + pDevice->byTopCCKBasicRate, bNeedACK); + pBuf->wCTSTxRrvTime_ba = s_uGetRTSCTSRsvTime(pDevice, 3, + byPktType, cbFrameSize, wCurrentRate); + /* Fill CTS */ + s_vFillCTSHead(pDevice, uDMAIdx, byPktType, head, + cbFrameSize, bNeedACK, wCurrentRate, byFBOption); + } + } + else if (byPktType == PK_TYPE_11A) { + if (need_rts) { + //Fill RsvTime + struct vnt_rrv_time_ab *pBuf = + (struct vnt_rrv_time_ab *)pvRrvTime; + pBuf->wRTSTxRrvTime = s_uGetRTSCTSRsvTime(pDevice, 2, + byPktType, cbFrameSize, wCurrentRate); + pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, byPktType, + cbFrameSize, wCurrentRate, bNeedACK); + /* Fill RTS */ + s_vFillRTSHead(pDevice, byPktType, head, cbFrameSize, + bNeedACK, psEthHeader, wCurrentRate, byFBOption); + } else { + //Fill RsvTime + struct vnt_rrv_time_ab *pBuf = + (struct vnt_rrv_time_ab *)pvRrvTime; + pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11A, + cbFrameSize, wCurrentRate, bNeedACK); + } + } + else if (byPktType == PK_TYPE_11B) { + if (need_rts) { + //Fill RsvTime + struct vnt_rrv_time_ab *pBuf = + (struct vnt_rrv_time_ab *)pvRrvTime; + pBuf->wRTSTxRrvTime = s_uGetRTSCTSRsvTime(pDevice, 0, + byPktType, cbFrameSize, wCurrentRate); + pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, + cbFrameSize, wCurrentRate, bNeedACK); + /* Fill RTS */ + s_vFillRTSHead(pDevice, byPktType, head, cbFrameSize, + bNeedACK, psEthHeader, wCurrentRate, byFBOption); + } + else { //RTS_needless, non PCF mode + //Fill RsvTime + struct vnt_rrv_time_ab *pBuf = + (struct vnt_rrv_time_ab *)pvRrvTime; + pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, + cbFrameSize, wCurrentRate, bNeedACK); + } + } + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter END.\n"); } /* u8 * pbyBuffer,//point to pTxBufHead @@ -945,12 +955,11 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, */ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, - struct vnt_tx_buffer *tx_buffer, int bNeedEncryption, + struct vnt_tx_buffer *pTxBufHead, int bNeedEncryption, u32 uSkbPacketLen, u32 uDMAIdx, struct ethhdr *psEthHeader, u8 *pPacket, PSKeyItem pTransmitKey, u32 uNodeIndex, u16 wCurrentRate, u32 *pcbHeaderLen, u32 *pcbTotalLen) { - struct vnt_tx_fifo_head *pTxBufHead = &tx_buffer->fifo_head; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; u32 cbFrameSize, cbFrameBodySize; u32 cb802_1_H_len; @@ -964,14 +973,17 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; u32 uDuration; u32 cbHeaderLength = 0, uPadding = 0; + void *pvRrvTime; struct vnt_mic_hdr *pMICHDR; + void *rts_cts = NULL; + void *pvTxDataHd; u8 byFBOption = AUTO_FB_NONE, byFragType; u16 wTxBufSize; u32 dwMICKey0, dwMICKey1, dwMIC_Priority; u32 *pdwMIC_L, *pdwMIC_R; int bSoftWEP = false; - pMICHDR = NULL; + pvRrvTime = pMICHDR = pvTxDataHd = NULL; if (bNeedEncryption && pTransmitKey->pvKeyTable) { if (((PSKeyTable)pTransmitKey->pvKeyTable)->bSoftWEP == true) @@ -1035,27 +1047,16 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; } - /* Set Auto Fallback Ctl */ - if (wCurrentRate >= RATE_18M) { - if (pDevice->byAutoFBCtrl == AUTO_FB_0) { - pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_0; - - pDevice->tx_rate_fb0 = - wFB_Opt0[FB_RATE0][wCurrentRate - RATE_18M]; - pDevice->tx_rate_fb1 = - wFB_Opt0[FB_RATE1][wCurrentRate - RATE_18M]; - - byFBOption = AUTO_FB_0; - } else if (pDevice->byAutoFBCtrl == AUTO_FB_1) { - pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_1; - pDevice->tx_rate_fb0 = - wFB_Opt1[FB_RATE0][wCurrentRate - RATE_18M]; - pDevice->tx_rate_fb1 = - wFB_Opt1[FB_RATE1][wCurrentRate - RATE_18M]; - - byFBOption = AUTO_FB_1; - } - } + //Set Auto Fallback Ctl + if (wCurrentRate >= RATE_18M) { + if (pDevice->byAutoFBCtrl == AUTO_FB_0) { + pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_0; + byFBOption = AUTO_FB_0; + } else if (pDevice->byAutoFBCtrl == AUTO_FB_1) { + pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_1; + byFBOption = AUTO_FB_1; + } + } if (bSoftWEP != true) { if ((bNeedEncryption) && (pTransmitKey != NULL)) { //WEP enabled @@ -1104,47 +1105,118 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, } pbyTxBufferAddr = (u8 *) &(pTxBufHead->adwTxKey[0]); - wTxBufSize = sizeof(struct vnt_tx_fifo_head); - + wTxBufSize = sizeof(STxBufHead); if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet if (byFBOption == AUTO_FB_NONE) { if (bRTS == true) {//RTS_need + pvRrvTime = (struct vnt_rrv_time_rts *) + (pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_rts)); + rts_cts = (struct vnt_rts_g *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_rts) + cbMICHDR); + pvTxDataHd = (struct vnt_tx_datahead_g *) (pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + + cbMICHDR + sizeof(struct vnt_rts_g)); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + - cbMICHDR + sizeof(struct vnt_rts_g); + cbMICHDR + sizeof(struct vnt_rts_g) + + sizeof(struct vnt_tx_datahead_g); } else { //RTS_needless + pvRrvTime = (struct vnt_rrv_time_cts *) + (pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts)); + rts_cts = (struct vnt_cts *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts) + cbMICHDR); + pvTxDataHd = (struct vnt_tx_datahead_g *)(pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + + cbMICHDR + sizeof(struct vnt_cts)); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + - cbMICHDR + sizeof(struct vnt_cts); + cbMICHDR + sizeof(struct vnt_cts) + + sizeof(struct vnt_tx_datahead_g); } } else { // Auto Fall Back if (bRTS == true) {//RTS_need + pvRrvTime = (struct vnt_rrv_time_rts *)(pbyTxBufferAddr + + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_rts)); + rts_cts = (struct vnt_rts_g_fb *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_rts) + cbMICHDR); + pvTxDataHd = (struct vnt_tx_datahead_g_fb *) (pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + + cbMICHDR + sizeof(struct vnt_rts_g_fb)); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + - cbMICHDR + sizeof(struct vnt_rts_g_fb); + cbMICHDR + sizeof(struct vnt_rts_g_fb) + + sizeof(struct vnt_tx_datahead_g_fb); } else if (bRTS == false) { //RTS_needless + pvRrvTime = (struct vnt_rrv_time_cts *) + (pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts)); + rts_cts = (struct vnt_cts_fb *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts) + cbMICHDR); + pvTxDataHd = (struct vnt_tx_datahead_g_fb *) (pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + + cbMICHDR + sizeof(struct vnt_cts_fb)); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + - cbMICHDR + sizeof(struct vnt_cts_fb); + cbMICHDR + sizeof(struct vnt_cts_fb) + + sizeof(struct vnt_tx_datahead_g_fb); } } // Auto Fall Back } else {//802.11a/b packet if (byFBOption == AUTO_FB_NONE) { if (bRTS == true) {//RTS_need + pvRrvTime = (struct vnt_rrv_time_ab *) (pbyTxBufferAddr + + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_ab)); + rts_cts = (struct vnt_rts_ab *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); + pvTxDataHd = (struct vnt_tx_datahead_ab *)(pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + + sizeof(struct vnt_rts_ab)); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + - cbMICHDR + sizeof(struct vnt_rts_ab); + cbMICHDR + sizeof(struct vnt_rts_ab) + + sizeof(struct vnt_tx_datahead_ab); } else if (bRTS == false) { //RTS_needless, no MICHDR + pvRrvTime = (struct vnt_rrv_time_ab *)(pbyTxBufferAddr + + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_ab)); + pvTxDataHd = (struct vnt_tx_datahead_ab *)(pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(struct vnt_tx_datahead_ab); } } else { // Auto Fall Back if (bRTS == true) {//RTS_need + pvRrvTime = (struct vnt_rrv_time_ab *)(pbyTxBufferAddr + + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_ab)); + rts_cts = (struct vnt_rts_a_fb *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); + pvTxDataHd = (struct vnt_tx_datahead_a_fb *)(pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + + sizeof(struct vnt_rts_a_fb)); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + - cbMICHDR + sizeof(struct vnt_rts_a_fb); + cbMICHDR + sizeof(struct vnt_rts_a_fb) + + sizeof(struct vnt_tx_datahead_a_fb); } else if (bRTS == false) { //RTS_needless + pvRrvTime = (struct vnt_rrv_time_ab *)(pbyTxBufferAddr + + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_ab)); + pvTxDataHd = (struct vnt_tx_datahead_a_fb *)(pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(struct vnt_tx_datahead_a_fb); } @@ -1163,18 +1235,20 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, //uDMAIdx = TYPE_AC0DMA; //pTxBufHead = (PSTxBufHead) &(pTxBufHead->adwTxKey[0]); - /* Fill FIFO, RrvTime, RTS and CTS */ - uDuration = s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, - tx_buffer, &pMICHDR, cbMICHDR, - cbFrameSize, bNeedACK, uDMAIdx, psEthHeader, bRTS); - + //Fill FIFO,RrvTime,RTS,and CTS + s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, + (void *)pbyTxBufferAddr, pvRrvTime, rts_cts, + cbFrameSize, bNeedACK, uDMAIdx, psEthHeader, bRTS); + //Fill DataHead + uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK, + byFBOption); // Generate TX MAC Header s_vGenerateMACHeader(pDevice, pbyMacHdr, (u16)uDuration, psEthHeader, bNeedEncryption, byFragType, uDMAIdx, 0); if (bNeedEncryption == true) { //Fill TXKEY - s_vFillTxKey(pDevice, pTxBufHead, pbyIVHead, pTransmitKey, + s_vFillTxKey(pDevice, (u8 *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, pbyMacHdr, (u16)cbFrameBodySize, pMICHDR); if (pDevice->bEnableHostWEP) { @@ -1395,12 +1469,13 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_tx_buffer *pTX_Buffer; + PSTxBufHead pTxBufHead; struct vnt_usb_send_context *pContext; - struct vnt_tx_fifo_head *pTxBufHead; struct ieee80211_hdr *pMACHeader; struct ethhdr sEthHeader; u8 byPktType, *pbyTxBufferAddr; - struct vnt_mic_hdr *pMICHDR = NULL; + void *rts_cts = NULL; + void *pvTxDataHd, *pvRrvTime, *pMICHDR; u32 uDuration, cbReqCount, cbHeaderSize, cbFrameBodySize, cbFrameSize; int bNeedACK, bIsPSPOLL = false; u32 cbIVlen = 0, cbICVlen = 0, cbMIClen = 0, cbFCSlen = 4; @@ -1417,10 +1492,10 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, } pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0]; + pbyTxBufferAddr = (u8 *)&(pTX_Buffer->adwTxKey[0]); cbFrameBodySize = pPacket->cbPayloadLen; - pTxBufHead = &pTX_Buffer->fifo_head; - pbyTxBufferAddr = (u8 *)&pTxBufHead->adwTxKey[0]; - wTxBufSize = sizeof(struct vnt_tx_fifo_head); + pTxBufHead = (PSTxBufHead) pbyTxBufferAddr; + wTxBufSize = sizeof(STxBufHead); if (pDevice->byBBType == BB_TYPE_11A) { wCurrentRate = RATE_6M; @@ -1532,10 +1607,21 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, //Set RrvTime/RTS/CTS Buffer if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet + + pvRrvTime = (struct vnt_rrv_time_cts *) (pbyTxBufferAddr + wTxBufSize); + pMICHDR = NULL; + rts_cts = (struct vnt_cts *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts)); + pvTxDataHd = (struct vnt_tx_datahead_g *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts) + sizeof(struct vnt_cts)); cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + - sizeof(struct vnt_cts); + sizeof(struct vnt_cts) + sizeof(struct vnt_tx_datahead_g); } else { // 802.11a/b packet + pvRrvTime = (struct vnt_rrv_time_ab *) (pbyTxBufferAddr + wTxBufSize); + pMICHDR = NULL; + pvTxDataHd = (struct vnt_tx_datahead_ab *) (pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + sizeof(struct vnt_tx_datahead_ab); } @@ -1552,10 +1638,14 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; /* Fill FIFO,RrvTime,RTS,and CTS */ - uDuration = s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, - pTX_Buffer, &pMICHDR, 0, + s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, + pbyTxBufferAddr, pvRrvTime, rts_cts, cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false); + //Fill DataHead + uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, + AUTO_FB_NONE); + pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + cbFrameBodySize; @@ -1594,7 +1684,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, } } while(false); //Fill TXKEY - s_vFillTxKey(pDevice, pTxBufHead, pbyIVHead, pTransmitKey, + s_vFillTxKey(pDevice, (u8 *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, (u8 *)pMACHeader, (u16)cbFrameBodySize, NULL); memcpy(pMACHeader, pPacket->p80211Header, cbMacHdLen); @@ -1618,16 +1708,12 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, // in the same place of other packet's Duration-field). // And it will cause Cisco-AP to issue Disassociation-packet if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { - struct vnt_tx_datahead_g *data_head = &pTX_Buffer->tx_head. - tx_cts.tx.head.cts_g.data_head; - data_head->wDuration_a = + ((struct vnt_tx_datahead_g *)pvTxDataHd)->wDuration_a = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); - data_head->wDuration_b = + ((struct vnt_tx_datahead_g *)pvTxDataHd)->wDuration_b = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); } else { - struct vnt_tx_datahead_ab *data_head = &pTX_Buffer->tx_head. - tx_ab.tx.head.data_head_ab; - data_head->wDuration = + ((struct vnt_tx_datahead_ab *)pvTxDataHd)->wDuration = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); } } @@ -1641,14 +1727,10 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, pContext->uBufLen = (u16)cbReqCount + 4; //USB header if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), - &pMACHeader->addr1[0], (u16)cbFrameSize, - pTxBufHead->wFIFOCtl); + 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->addr3[0], (u16)cbFrameSize, - pTxBufHead->wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr3[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } PIPEnsSendBulkOut(pDevice,pContext); @@ -1743,13 +1825,15 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_tx_buffer *pTX_Buffer; - struct vnt_tx_fifo_head *pTxBufHead; u8 byPktType; u8 *pbyTxBufferAddr; + void *rts_cts = NULL; + void *pvTxDataHd; u32 uDuration, cbReqCount; struct ieee80211_hdr *pMACHeader; u32 cbHeaderSize, cbFrameBodySize; int bNeedACK, bIsPSPOLL = false; + PSTxBufHead pTxBufHead; u32 cbFrameSize; u32 cbIVlen = 0, cbICVlen = 0, cbMIClen = 0, cbFCSlen = 4; u32 uPadding = 0; @@ -1760,7 +1844,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) u16 wTxBufSize; u32 cbMacHdLen; struct ethhdr sEthHeader; - struct vnt_mic_hdr *pMICHDR; + void *pvRrvTime, *pMICHDR; u32 wCurrentRate = RATE_1M; PUWLAN_80211HDR p80211Header; u32 uNodeIndex = 0; @@ -1771,7 +1855,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) u32 cbExtSuppRate = 0; struct vnt_usb_send_context *pContext; - pMICHDR = NULL; + pvRrvTime = pMICHDR = pvTxDataHd = NULL; if(skb->len <= WLAN_HDR_ADDR3_LEN) { cbFrameBodySize = 0; @@ -1790,9 +1874,9 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0]; - pTxBufHead = &pTX_Buffer->fifo_head; - pbyTxBufferAddr = (u8 *)&pTxBufHead->adwTxKey[0]; - wTxBufSize = sizeof(struct vnt_tx_fifo_head); + pbyTxBufferAddr = (u8 *)(&pTX_Buffer->adwTxKey[0]); + pTxBufHead = (PSTxBufHead) pbyTxBufferAddr; + wTxBufSize = sizeof(STxBufHead); if (pDevice->byBBType == BB_TYPE_11A) { wCurrentRate = RATE_6M; @@ -1930,11 +2014,25 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet + pvRrvTime = (struct vnt_rrv_time_cts *) (pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts)); + rts_cts = (struct vnt_cts *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts) + cbMICHDR); + pvTxDataHd = (struct vnt_tx_datahead_g *) (pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + + sizeof(struct vnt_cts)); cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + - sizeof(struct vnt_cts); + sizeof(struct vnt_cts) + sizeof(struct vnt_tx_datahead_g); } else {//802.11a/b packet + + pvRrvTime = (struct vnt_rrv_time_ab *) (pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_ab)); + pvTxDataHd = (struct vnt_tx_datahead_ab *)(pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(struct vnt_tx_datahead_ab); } @@ -1950,11 +2048,15 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; /* Fill FIFO,RrvTime,RTS,and CTS */ - uDuration = s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, - pTX_Buffer, &pMICHDR, cbMICHDR, + s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, + pbyTxBufferAddr, pvRrvTime, rts_cts, cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false); - pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); + //Fill DataHead + uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, + AUTO_FB_NONE); + + pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen) + cbExtSuppRate; @@ -2037,7 +2139,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } - s_vFillTxKey(pDevice, pTxBufHead, pbyIVHead, pTransmitKey, + s_vFillTxKey(pDevice, (u8 *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, pbyMacHdr, (u16)cbFrameBodySize, pMICHDR); if (pDevice->bEnableHostWEP) { @@ -2062,16 +2164,12 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) // in the same place of other packet's Duration-field). // And it will cause Cisco-AP to issue Disassociation-packet if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { - struct vnt_tx_datahead_g *data_head = &pTX_Buffer->tx_head. - tx_cts.tx.head.cts_g.data_head; - data_head->wDuration_a = + ((struct vnt_tx_datahead_g *)pvTxDataHd)->wDuration_a = cpu_to_le16(p80211Header->sA2.wDurationID); - data_head->wDuration_b = + ((struct vnt_tx_datahead_g *)pvTxDataHd)->wDuration_b = cpu_to_le16(p80211Header->sA2.wDurationID); } else { - struct vnt_tx_datahead_ab *data_head = &pTX_Buffer->tx_head. - tx_ab.tx.head.data_head_ab; - data_head->wDuration = + ((struct vnt_tx_datahead_ab *)pvTxDataHd)->wDuration = cpu_to_le16(p80211Header->sA2.wDurationID); } } @@ -2085,14 +2183,10 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) pContext->uBufLen = (u16)cbReqCount + 4; //USB header if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), - &pMACHeader->addr1[0], (u16)cbFrameSize, - pTxBufHead->wFIFOCtl); + 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->addr3[0], (u16)cbFrameSize, - pTxBufHead->wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr3[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } PIPEnsSendBulkOut(pDevice,pContext); return ; @@ -2474,10 +2568,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, pContext->Type = CONTEXT_DATA_PACKET; pContext->uBufLen = (u16)BytesToWrite + 4 ; //USB header - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), - &pContext->sEthHeader.h_dest[0], - (u16)(BytesToWrite-uHeaderLen), - pTX_Buffer->fifo_head.wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pContext->sEthHeader.h_dest[0]), (u16) (BytesToWrite-uHeaderLen), pTX_Buffer->wFIFOCtl); status = PIPEnsSendBulkOut(pDevice,pContext); @@ -2628,10 +2719,7 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, pContext->Type = CONTEXT_DATA_PACKET; pContext->uBufLen = (u16)BytesToWrite + 4 ; //USB header - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), - &pContext->sEthHeader.h_dest[0], - (u16)(BytesToWrite - uHeaderLen), - pTX_Buffer->fifo_head.wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pContext->sEthHeader.h_dest[0]), (u16) (BytesToWrite-uHeaderLen), pTX_Buffer->wFIFOCtl); status = PIPEnsSendBulkOut(pDevice,pContext); diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h index eecbe89..4bbee1c 100644 --- a/drivers/staging/vt6656/rxtx.h +++ b/drivers/staging/vt6656/rxtx.h @@ -117,7 +117,6 @@ struct vnt_rts_g { u16 wDuration_bb; u16 wReserved; struct ieee80211_rts data; - struct vnt_tx_datahead_g data_head; } __packed; struct vnt_rts_g_fb { @@ -132,7 +131,6 @@ struct vnt_rts_g_fb { u16 wRTSDuration_ba_f1; u16 wRTSDuration_aa_f1; struct ieee80211_rts data; - struct vnt_tx_datahead_g_fb data_head; } __packed; struct vnt_rts_ab { @@ -140,7 +138,6 @@ struct vnt_rts_ab { u16 wDuration; u16 wReserved; struct ieee80211_rts data; - struct vnt_tx_datahead_ab data_head; } __packed; struct vnt_rts_a_fb { @@ -150,7 +147,6 @@ struct vnt_rts_a_fb { u16 wRTSDuration_f0; u16 wRTSDuration_f1; struct ieee80211_rts data; - struct vnt_tx_datahead_a_fb data_head; } __packed; /* CTS buffer header */ @@ -160,7 +156,6 @@ struct vnt_cts { u16 wReserved; struct ieee80211_cts data; u16 reserved2; - struct vnt_tx_datahead_g data_head; } __packed; struct vnt_cts_fb { @@ -171,7 +166,6 @@ struct vnt_cts_fb { u16 wCTSDuration_ba_f1; struct ieee80211_cts data; u16 reserved2; - struct vnt_tx_datahead_g_fb data_head; } __packed; union vnt_tx_data_head { @@ -184,37 +178,12 @@ union vnt_tx_data_head { /* cts g */ struct vnt_cts cts_g; struct vnt_cts_fb cts_g_fb; - /* no rts/cts */ - struct vnt_tx_datahead_a_fb data_head_a_fb; - struct vnt_tx_datahead_ab data_head_ab; }; -struct vnt_tx_mic_hdr { - struct vnt_mic_hdr hdr; - union vnt_tx_data_head head; -} __packed; - -union vnt_tx { - struct vnt_tx_mic_hdr mic; - union vnt_tx_data_head head; -}; - -union vnt_tx_head { - struct { - struct vnt_rrv_time_rts rts; - union vnt_tx tx; - } __packed tx_rts; - struct { - struct vnt_rrv_time_cts cts; - union vnt_tx tx; - } __packed tx_cts; - struct { - struct vnt_rrv_time_ab ab; - union vnt_tx tx; - } __packed tx_ab; -}; - -struct vnt_tx_fifo_head { +struct vnt_tx_buffer { + u8 byType; + u8 byPKTNO; + u16 wTxByteCount; u32 adwTxKey[4]; u16 wFIFOCtl; u16 wTimeStamp; @@ -222,14 +191,6 @@ struct vnt_tx_fifo_head { u16 wReserved; } __packed; -struct vnt_tx_buffer { - u8 byType; - u8 byPKTNO; - u16 wTxByteCount; - struct vnt_tx_fifo_head fifo_head; - union vnt_tx_head tx_head; -} __packed; - struct vnt_beacon_buffer { u8 byType; u8 byPKTNO; diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index 5fc18ad..3a03f1d 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -118,9 +118,6 @@ int PIPEnsControlOut(struct vnt_private *pDevice, u8 byRequest, u16 wValue, if (pDevice->Flags & fMP_CONTROL_READS) return STATUS_FAILURE; - if (pDevice->pControlURB->hcpriv) - return STATUS_FAILURE; - MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES); pDevice->sUsbCtlRequest.bRequestType = 0x40; @@ -180,9 +177,6 @@ int PIPEnsControlIn(struct vnt_private *pDevice, u8 byRequest, u16 wValue, if (pDevice->Flags & fMP_CONTROL_WRITES) return STATUS_FAILURE; - if (pDevice->pControlURB->hcpriv) - return STATUS_FAILURE; - MP_SET_FLAG(pDevice, fMP_CONTROL_READS); pDevice->sUsbCtlRequest.bRequestType = 0xC0; @@ -662,6 +656,8 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Write %d bytes\n",(int)ulBufLen); pDevice->ulBulkOutBytesWrite += ulBufLen; pDevice->ulBulkOutContCRCError = 0; + pDevice->nTxDataTimeCout = 0; + } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BULK Out failed %d\n", status); pDevice->ulBulkOutError++; diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 2f8e2a8..0013cb7 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -268,14 +268,20 @@ struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, void vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond) { - schedule_delayed_work(&pDevice->run_command_work, - msecs_to_jiffies(MSecond)); + + init_timer(&pDevice->sTimerCommand); + + pDevice->sTimerCommand.data = (unsigned long)pDevice; + pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; + pDevice->sTimerCommand.expires = RUN_AT((MSecond * HZ) / 1000); + + add_timer(&pDevice->sTimerCommand); + + return; } -void vRunCommand(struct work_struct *work) +void vRunCommand(struct vnt_private *pDevice) { - struct vnt_private *pDevice = - container_of(work, struct vnt_private, run_command_work.work); struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PWLAN_IE_SSID pItemSSID; PWLAN_IE_SSID pItemSSIDCurr; @@ -286,9 +292,6 @@ void vRunCommand(struct work_struct *work) u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; u8 byData; - if (pDevice->Flags & fMP_DISCONNECTED) - return; - if (pDevice->dwDiagRefCount != 0) return; if (pDevice->bCmdRunning != true) @@ -657,6 +660,22 @@ void vRunCommand(struct work_struct *work) netif_wake_queue(pDevice->dev); } + if(pDevice->IsTxDataTrigger != false) { //TxDataTimer is not triggered at the first time + // printk("Re-initial TxDataTimer****\n"); + del_timer(&pDevice->sTimerTxData); + init_timer(&pDevice->sTimerTxData); + pDevice->sTimerTxData.data = (unsigned long) pDevice; + pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData; + pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback + pDevice->fTxDataInSleep = false; + pDevice->nTxDataTimeCout = 0; + } + else { + // printk("mike:-->First time trigger TimerTxData InSleep\n"); + } + pDevice->IsTxDataTrigger = true; + add_timer(&pDevice->sTimerTxData); + } else if(pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); @@ -668,6 +687,7 @@ void vRunCommand(struct work_struct *work) vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT/2); return; } + pDevice->byLinkWaitCount = 0; s_bCommandComplete(pDevice); break; @@ -676,7 +696,7 @@ void vRunCommand(struct work_struct *work) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { - cancel_delayed_work_sync(&pDevice->second_callback_work); + del_timer(&pMgmt->sTimerSecondCallback); pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pDevice->bLinkPass = false; @@ -704,7 +724,7 @@ void vRunCommand(struct work_struct *work) } pDevice->bLinkPass = true; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); - schedule_delayed_work(&pDevice->second_callback_work, HZ); + add_timer(&pMgmt->sTimerSecondCallback); } s_bCommandComplete(pDevice); break; @@ -1136,8 +1156,14 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) //mike add:reset command timer void vResetCommandTimer(struct vnt_private *pDevice) { - cancel_delayed_work_sync(&pDevice->run_command_work); + //delete timer + del_timer(&pDevice->sTimerCommand); + //init timer + init_timer(&pDevice->sTimerCommand); + pDevice->sTimerCommand.data = (unsigned long)pDevice; + pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; + pDevice->sTimerCommand.expires = RUN_AT(HZ); pDevice->cbFreeCmdQueue = CMD_Q_SIZE; pDevice->uCmdDequeueIdx = 0; pDevice->uCmdEnqueueIdx = 0; @@ -1145,3 +1171,33 @@ void vResetCommandTimer(struct vnt_private *pDevice) pDevice->bCmdRunning = false; pDevice->bCmdClear = false; } + +void BSSvSecondTxData(struct vnt_private *pDevice) +{ + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + + pDevice->nTxDataTimeCout++; + + if (pDevice->nTxDataTimeCout < 4) { //don't tx data if timer less than 40s + // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__, + // (int)pDevice->nTxDataTimeCout); + pDevice->sTimerTxData.expires = RUN_AT(10 * HZ); //10s callback + add_timer(&pDevice->sTimerTxData); + return; + } + + spin_lock_irq(&pDevice->lock); + //is wap_supplicant running successful OR only open && sharekey mode! + if (((pDevice->bLinkPass == true) && + (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking + (pDevice->fWPA_Authened == true)) { //wpa linking + // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__); + pDevice->fTxDataInSleep = true; + PSbSendNullPacket(pDevice); //send null packet + pDevice->fTxDataInSleep = false; + } + spin_unlock_irq(&pDevice->lock); + + pDevice->sTimerTxData.expires = RUN_AT(10 * HZ); //10s callback + add_timer(&pDevice->sTimerTxData); +} diff --git a/drivers/staging/vt6656/wcmd.h b/drivers/staging/vt6656/wcmd.h index caf2684..db8b4cf 100644 --- a/drivers/staging/vt6656/wcmd.h +++ b/drivers/staging/vt6656/wcmd.h @@ -105,6 +105,15 @@ void vResetCommandTimer(struct vnt_private *); int bScheduleCommand(struct vnt_private *, CMD_CODE eCommand, u8 *pbyItem0); -void vRunCommand(struct work_struct *work); +void vRunCommand(struct vnt_private *); + +/* +void +WCMDvCommandThread( + void * Context + ); +*/ + +void BSSvSecondTxData(struct vnt_private *); #endif /* __WCMD_H__ */ diff --git a/drivers/staging/vt6656/wctl.c b/drivers/staging/vt6656/wctl.c index 814342c..47a655d 100644 --- a/drivers/staging/vt6656/wctl.c +++ b/drivers/staging/vt6656/wctl.c @@ -69,7 +69,8 @@ bool WCTLbIsDuplicate (PSCache pCache, struct ieee80211_hdr *pMACHeader) for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) { pCacheEntry = &(pCache->asCacheEntry[uIndex]); if ((pCacheEntry->wFmSequence == pMACHeader->seq_ctrl) && - ether_addr_equal(pCacheEntry->abyAddr2, pMACHeader->addr2) && + (!compare_ether_addr(&(pCacheEntry->abyAddr2[0]), + &(pMACHeader->addr2[0]))) && (LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->frame_control)) ) { /* Duplicate match */ @@ -109,8 +110,8 @@ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, for (ii = 0; ii < pDevice->cbDFCB; ii++) { if ((pDevice->sRxDFCB[ii].bInUse == true) && - ether_addr_equal(pDevice->sRxDFCB[ii].abyAddr2, - pMACHeader->addr2)) { + (!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]), + &(pMACHeader->addr2[0])))) { return ii; } } diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index e26c415..b6cbd13 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -81,7 +81,7 @@ #include "control.h" #include "rndis.h" -static int msglevel = MSG_LEVEL_INFO; +static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; static int ChannelExceedZoneType(struct vnt_private *, u8 byCurrChannel); @@ -213,6 +213,24 @@ void vMgrObjectInit(struct vnt_private *pDevice) pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI; BSSvClearBSSList((void *) pDevice, false); + init_timer(&pMgmt->sTimerSecondCallback); + pMgmt->sTimerSecondCallback.data = (unsigned long)pDevice; + pMgmt->sTimerSecondCallback.function = (TimerFunction)BSSvSecondCallBack; + pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ); + + init_timer(&pDevice->sTimerCommand); + pDevice->sTimerCommand.data = (unsigned long)pDevice; + pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; + pDevice->sTimerCommand.expires = RUN_AT(HZ); + + init_timer(&pDevice->sTimerTxData); + pDevice->sTimerTxData.data = (unsigned long)pDevice; + pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData; + pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback + pDevice->fTxDataInSleep = false; + pDevice->IsTxDataTrigger = false; + pDevice->nTxDataTimeCout = 0; + pDevice->cbFreeCmdQueue = CMD_Q_SIZE; pDevice->uCmdDequeueIdx = 0; pDevice->uCmdEnqueueIdx = 0; @@ -826,8 +844,8 @@ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice, pDevice->bwextstep3 = false; pDevice->bWPASuppWextEnabled = false; - if (pMgmt->eCurrState == WMAC_STATE_ASSOC) - schedule_delayed_work(&pDevice->run_command_work, 0); +if(pMgmt->eCurrState == WMAC_STATE_ASSOC) + timer_expire(pDevice->sTimerCommand, 0); return; } @@ -1109,7 +1127,7 @@ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n"); pMgmt->eCurrState = WMAC_STATE_AUTH; - schedule_delayed_work(&pDevice->run_command_work, 0); + timer_expire(pDevice->sTimerCommand, 0); } else { DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n"); @@ -1284,7 +1302,7 @@ static void s_vMgrRxAuthenSequence_4(struct vnt_private *pDevice, if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n"); pMgmt->eCurrState = WMAC_STATE_AUTH; - schedule_delayed_work(&pDevice->run_command_work, 0); + timer_expire(pDevice->sTimerCommand, 0); } else{ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n"); @@ -1404,8 +1422,8 @@ static void s_vMgrRxDeauthentication(struct vnt_private *pDevice, pDevice->fWPA_Authened = false; DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason)))); // TODO: update BSS list for specific BSSID if pre-authentication case - if (ether_addr_equal(sFrame.pHdr->sA3.abyAddr3, - pMgmt->abyCurrBSSID)) { + if (!compare_ether_addr(sFrame.pHdr->sA3.abyAddr3, + pMgmt->abyCurrBSSID)) { if (pMgmt->eCurrState >= WMAC_STATE_AUTHPENDING) { pMgmt->sNodeDBTable[0].bActive = false; pMgmt->eCurrMode = WMAC_MODE_STANDBY; @@ -3077,7 +3095,7 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, * * * Return Value: - * A ptr to frame or NULL on allocation failure + * A ptr to frame or NULL on allocation failue * -*/ diff --git a/drivers/staging/vt6656/wmgr.h b/drivers/staging/vt6656/wmgr.h index 26ba47d..5424c7f 100644 --- a/drivers/staging/vt6656/wmgr.h +++ b/drivers/staging/vt6656/wmgr.h @@ -310,6 +310,9 @@ struct vnt_manager { u8 byMgmtPacketPool[sizeof(struct vnt_tx_mgmt) + WLAN_A3FR_MAXLEN]; + /* One second callback timer */ + struct timer_list sTimerSecondCallback; + /* Temporarily Rx Mgmt Packet Descriptor */ struct vnt_rx_mgmt sRxPacket; diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c index 003bd7c..9f1b413 100644 --- a/drivers/staging/vt6656/wpactl.c +++ b/drivers/staging/vt6656/wpactl.c @@ -227,7 +227,7 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); } else { // Key Table Full - if (ether_addr_equal(param->addr, pDevice->abyBSSID)) { + if (!compare_ether_addr(¶m->addr[0], pDevice->abyBSSID)) { //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA -Key Table Full.2\n")); return -EINVAL; } else { |