Commit 0fc2a76e authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

staging: vt6655: Replace and remove typedef QWORD/ DQWORD

Replace the variables with u64/__le64.

The endian variant is needed in some places endian correction is
needed.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c98323a7
...@@ -91,7 +91,7 @@ vMgrEncodeBeacon( ...@@ -91,7 +91,7 @@ vMgrEncodeBeacon(
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */ /* Fixed Fields */
pFrame->pqwTimestamp = (PQWORD) pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_BEACON_OFF_TS); WLAN_BEACON_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *) pFrame->pwBeaconInterval = (unsigned short *)
...@@ -125,7 +125,7 @@ vMgrDecodeBeacon( ...@@ -125,7 +125,7 @@ vMgrDecodeBeacon(
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */ /* Fixed Fields */
pFrame->pqwTimestamp = (PQWORD) pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_BEACON_OFF_TS); WLAN_BEACON_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *) pFrame->pwBeaconInterval = (unsigned short *)
...@@ -695,7 +695,7 @@ vMgrEncodeProbeResponse( ...@@ -695,7 +695,7 @@ vMgrEncodeProbeResponse(
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */ /* Fixed Fields */
pFrame->pqwTimestamp = (PQWORD) pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_PROBERESP_OFF_TS); WLAN_PROBERESP_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *) pFrame->pwBeaconInterval = (unsigned short *)
...@@ -730,7 +730,7 @@ vMgrDecodeProbeResponse( ...@@ -730,7 +730,7 @@ vMgrDecodeProbeResponse(
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */ /* Fixed Fields */
pFrame->pqwTimestamp = (PQWORD) pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_PROBERESP_OFF_TS); WLAN_PROBERESP_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *) pFrame->pwBeaconInterval = (unsigned short *)
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#ifndef __80211MGR_H__ #ifndef __80211MGR_H__
#define __80211MGR_H__ #define __80211MGR_H__
#include <linux/types.h>
#include "ttype.h" #include "ttype.h"
#include "80211hdr.h" #include "80211hdr.h"
...@@ -464,7 +466,7 @@ typedef struct tagWLAN_FR_BEACON { ...@@ -464,7 +466,7 @@ typedef struct tagWLAN_FR_BEACON {
unsigned int len; unsigned int len;
unsigned char *pBuf; unsigned char *pBuf;
PUWLAN_80211HDR pHdr; PUWLAN_80211HDR pHdr;
PQWORD pqwTimestamp; __le64 *pqwTimestamp;
unsigned short *pwBeaconInterval; unsigned short *pwBeaconInterval;
unsigned short *pwCapInfo; unsigned short *pwCapInfo;
PWLAN_IE_SSID pSSID; PWLAN_IE_SSID pSSID;
...@@ -577,7 +579,7 @@ typedef struct tagWLAN_FR_PROBERESP { ...@@ -577,7 +579,7 @@ typedef struct tagWLAN_FR_PROBERESP {
unsigned int len; unsigned int len;
unsigned char *pBuf; unsigned char *pBuf;
PUWLAN_80211HDR pHdr; PUWLAN_80211HDR pHdr;
PQWORD pqwTimestamp; __le64 *pqwTimestamp;
unsigned short *pwBeaconInterval; unsigned short *pwBeaconInterval;
unsigned short *pwCapInfo; unsigned short *pwCapInfo;
PWLAN_IE_SSID pSSID; PWLAN_IE_SSID pSSID;
......
...@@ -316,7 +316,7 @@ bool ...@@ -316,7 +316,7 @@ bool
BSSbInsertToBSSList( BSSbInsertToBSSList(
void *hDeviceContext, void *hDeviceContext,
unsigned char *abyBSSIDAddr, unsigned char *abyBSSIDAddr,
QWORD qwTimestamp, __le64 qwTimestamp,
unsigned short wBeaconInterval, unsigned short wBeaconInterval,
unsigned short wCapInfo, unsigned short wCapInfo,
unsigned char byCurrChannel, unsigned char byCurrChannel,
...@@ -356,8 +356,7 @@ BSSbInsertToBSSList( ...@@ -356,8 +356,7 @@ BSSbInsertToBSSList(
/* save the BSS info */ /* save the BSS info */
pBSSList->bActive = true; pBSSList->bActive = true;
memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN); memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp)); pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
pBSSList->wCapInfo = cpu_to_le16(wCapInfo); pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
pBSSList->uClearCount = 0; pBSSList->uClearCount = 0;
...@@ -521,7 +520,7 @@ BSSbInsertToBSSList( ...@@ -521,7 +520,7 @@ BSSbInsertToBSSList(
bool bool
BSSbUpdateToBSSList( BSSbUpdateToBSSList(
void *hDeviceContext, void *hDeviceContext,
QWORD qwTimestamp, __le64 qwTimestamp,
unsigned short wBeaconInterval, unsigned short wBeaconInterval,
unsigned short wCapInfo, unsigned short wCapInfo,
unsigned char byCurrChannel, unsigned char byCurrChannel,
...@@ -551,8 +550,7 @@ BSSbUpdateToBSSList( ...@@ -551,8 +550,7 @@ BSSbUpdateToBSSList(
if (pBSSList == NULL) if (pBSSList == NULL)
return false; return false;
HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp)); pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
pBSSList->wCapInfo = cpu_to_le16(wCapInfo); pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
pBSSList->uClearCount = 0; pBSSList->uClearCount = 0;
......
...@@ -131,8 +131,8 @@ typedef struct tagKnownBSS { ...@@ -131,8 +131,8 @@ typedef struct tagKnownBSS {
unsigned int uClearCount; unsigned int uClearCount;
unsigned int uIELength; unsigned int uIELength;
QWORD qwBSSTimestamp; u64 qwBSSTimestamp;
QWORD qwLocalTSF; u64 qwLocalTSF;
CARD_PHY_TYPE eNetworkTypeInUse; CARD_PHY_TYPE eNetworkTypeInUse;
...@@ -233,7 +233,7 @@ bool ...@@ -233,7 +233,7 @@ bool
BSSbInsertToBSSList( BSSbInsertToBSSList(
void *hDeviceContext, void *hDeviceContext,
unsigned char *abyBSSIDAddr, unsigned char *abyBSSIDAddr,
QWORD qwTimestamp, __le64 qwTimestamp,
unsigned short wBeaconInterval, unsigned short wBeaconInterval,
unsigned short wCapInfo, unsigned short wCapInfo,
unsigned char byCurrChannel, unsigned char byCurrChannel,
...@@ -253,7 +253,7 @@ BSSbInsertToBSSList( ...@@ -253,7 +253,7 @@ BSSbInsertToBSSList(
bool bool
BSSbUpdateToBSSList( BSSbUpdateToBSSList(
void *hDeviceContext, void *hDeviceContext,
QWORD qwTimestamp, __le64 qwTimestamp,
unsigned short wBeaconInterval, unsigned short wBeaconInterval,
unsigned short wCapInfo, unsigned short wCapInfo,
unsigned char byCurrChannel, unsigned char byCurrChannel,
......
...@@ -573,21 +573,17 @@ bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned ...@@ -573,21 +573,17 @@ bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned
* Return Value: none * Return Value: none
* *
*/ */
bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF) bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, u64 qwBSSTimestamp, u64 qwLocalTSF)
{ {
PSDevice pDevice = (PSDevice) pDeviceHandler; PSDevice pDevice = (PSDevice) pDeviceHandler;
QWORD qwTSFOffset; u64 qwTSFOffset = 0;
HIDWORD(qwTSFOffset) = 0; if (qwBSSTimestamp != qwLocalTSF) {
LODWORD(qwTSFOffset) = 0;
if ((HIDWORD(qwBSSTimestamp) != HIDWORD(qwLocalTSF)) ||
(LODWORD(qwBSSTimestamp) != LODWORD(qwLocalTSF))) {
qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF); qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF);
// adjust TSF // adjust TSF
// HW's TSF add TSF Offset reg // HW's TSF add TSF Offset reg
VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, LODWORD(qwTSFOffset)); VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, (u32)qwTSFOffset);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, HIDWORD(qwTSFOffset)); VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, (u32)(qwTSFOffset >> 32));
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TSFSYNCEN); MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TSFSYNCEN);
} }
return true; return true;
...@@ -614,33 +610,32 @@ bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval) ...@@ -614,33 +610,32 @@ bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval)
unsigned int uLowNextTBTT = 0; unsigned int uLowNextTBTT = 0;
unsigned int uHighRemain = 0; unsigned int uHighRemain = 0;
unsigned int uLowRemain = 0; unsigned int uLowRemain = 0;
QWORD qwNextTBTT; u64 qwNextTBTT = 0;
HIDWORD(qwNextTBTT) = 0;
LODWORD(qwNextTBTT) = 0;
CARDbGetCurrentTSF(pDevice->PortOffset, &qwNextTBTT); //Get Local TSF counter CARDbGetCurrentTSF(pDevice->PortOffset, &qwNextTBTT); //Get Local TSF counter
uBeaconInterval = wBeaconInterval * 1024; uBeaconInterval = wBeaconInterval * 1024;
// Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval // Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
uLowNextTBTT = (LODWORD(qwNextTBTT) >> 10) << 10; uLowNextTBTT = ((qwNextTBTT & 0xffffffffULL) >> 10) << 10;
uLowRemain = (uLowNextTBTT) % uBeaconInterval; uLowRemain = (uLowNextTBTT) % uBeaconInterval;
// high dword (mod) bcn // high dword (mod) bcn
uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwNextTBTT)) uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * (u32)(qwNextTBTT >> 32))
% uBeaconInterval; % uBeaconInterval;
uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval; uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
uLowRemain = uBeaconInterval - uLowRemain; uLowRemain = uBeaconInterval - uLowRemain;
// check if carry when add one beacon interval // check if carry when add one beacon interval
if ((~uLowNextTBTT) < uLowRemain) if ((~uLowNextTBTT) < uLowRemain)
HIDWORD(qwNextTBTT)++; qwNextTBTT = ((qwNextTBTT >> 32) + 1) << 32;
LODWORD(qwNextTBTT) = uLowNextTBTT + uLowRemain; qwNextTBTT = (qwNextTBTT & 0xffffffff00000000ULL) |
(u64)(uLowNextTBTT + uLowRemain);
// set HW beacon interval // set HW beacon interval
VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, wBeaconInterval); VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, wBeaconInterval);
pDevice->wBeaconInterval = wBeaconInterval; pDevice->wBeaconInterval = wBeaconInterval;
// Set NextTBTT // Set NextTBTT
VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT)); VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT)); VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32));
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
return true; return true;
...@@ -1077,8 +1072,8 @@ CARDbStartMeasure( ...@@ -1077,8 +1072,8 @@ CARDbStartMeasure(
{ {
PSDevice pDevice = (PSDevice) pDeviceHandler; PSDevice pDevice = (PSDevice) pDeviceHandler;
PWLAN_IE_MEASURE_REQ pEID = (PWLAN_IE_MEASURE_REQ) pvMeasureEIDs; PWLAN_IE_MEASURE_REQ pEID = (PWLAN_IE_MEASURE_REQ) pvMeasureEIDs;
QWORD qwCurrTSF; u64 qwCurrTSF;
QWORD qwStartTSF; u64 qwStartTSF;
bool bExpired = true; bool bExpired = true;
unsigned short wDuration = 0; unsigned short wDuration = 0;
...@@ -1109,32 +1104,22 @@ CARDbStartMeasure( ...@@ -1109,32 +1104,22 @@ CARDbStartMeasure(
pDevice->uNumOfMeasureEIDs--; pDevice->uNumOfMeasureEIDs--;
if (pDevice->byLocalID > REV_ID_VT3253_B1) { if (pDevice->byLocalID > REV_ID_VT3253_B1) {
HIDWORD(qwStartTSF) = HIDWORD(*((PQWORD)(pDevice->pCurrMeasureEID->sReq.abyStartTime))); qwStartTSF = *((u64 *)(pDevice->pCurrMeasureEID->sReq.abyStartTime));
LODWORD(qwStartTSF) = LODWORD(*((PQWORD)(pDevice->pCurrMeasureEID->sReq.abyStartTime)));
wDuration = *((unsigned short *)(pDevice->pCurrMeasureEID->sReq.abyDuration)); wDuration = *((unsigned short *)(pDevice->pCurrMeasureEID->sReq.abyDuration));
wDuration += 1; // 1 TU for channel switching wDuration += 1; // 1 TU for channel switching
if ((LODWORD(qwStartTSF) == 0) && (HIDWORD(qwStartTSF) == 0)) { if (qwStartTSF == 0) {
// start immediately by setting start TSF == current TSF + 2 TU // start immediately by setting start TSF == current TSF + 2 TU
LODWORD(qwStartTSF) = LODWORD(qwCurrTSF) + 2048; qwStartTSF = qwCurrTSF + 2048;
HIDWORD(qwStartTSF) = HIDWORD(qwCurrTSF);
if (LODWORD(qwCurrTSF) > LODWORD(qwStartTSF))
HIDWORD(qwStartTSF)++;
bExpired = false; bExpired = false;
break; break;
} else { } else {
// start at setting start TSF - 1TU(for channel switching) // start at setting start TSF - 1TU(for channel switching)
if (LODWORD(qwStartTSF) < 1024) qwStartTSF -= 1024;
HIDWORD(qwStartTSF)--;
LODWORD(qwStartTSF) -= 1024;
} }
if ((HIDWORD(qwCurrTSF) < HIDWORD(qwStartTSF)) || if (qwCurrTSF < qwStartTSF) {
((HIDWORD(qwCurrTSF) == HIDWORD(qwStartTSF)) &&
(LODWORD(qwCurrTSF) < LODWORD(qwStartTSF)))
) {
bExpired = false; bExpired = false;
break; break;
} }
...@@ -1161,8 +1146,8 @@ CARDbStartMeasure( ...@@ -1161,8 +1146,8 @@ CARDbStartMeasure(
if (!bExpired) { if (!bExpired) {
MACvSelectPage1(pDevice->PortOffset); MACvSelectPage1(pDevice->PortOffset);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, LODWORD(qwStartTSF)); VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, (u32)qwStartTSF);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, HIDWORD(qwStartTSF)); VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, (u32)(qwStartTSF >> 32));
VNSvOutPortW(pDevice->PortOffset + MAC_REG_MSRDURATION, wDuration); VNSvOutPortW(pDevice->PortOffset + MAC_REG_MSRDURATION, wDuration);
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN); MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
MACvSelectPage0(pDevice->PortOffset); MACvSelectPage0(pDevice->PortOffset);
...@@ -1948,25 +1933,17 @@ bool CARDbSoftwareReset(void *pDeviceHandler) ...@@ -1948,25 +1933,17 @@ bool CARDbSoftwareReset(void *pDeviceHandler)
* Return Value: TSF Offset value * Return Value: TSF Offset value
* *
*/ */
QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2) u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2)
{ {
QWORD qwTSFOffset; u64 qwTSFOffset = 0;
unsigned short wRxBcnTSFOffst = 0; unsigned short wRxBcnTSFOffst = 0;
HIDWORD(qwTSFOffset) = 0;
LODWORD(qwTSFOffset) = 0;
wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate%MAX_RATE]; wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate%MAX_RATE];
(qwTSF2).u.dwLowDword += (unsigned long)(wRxBcnTSFOffst);
if ((qwTSF2).u.dwLowDword < (unsigned long)(wRxBcnTSFOffst)) qwTSF2 += (u64)wRxBcnTSFOffst;
(qwTSF2).u.dwHighDword++;
qwTSFOffset = qwTSF1 - qwTSF2;
LODWORD(qwTSFOffset) = LODWORD(qwTSF1) - LODWORD(qwTSF2);
if (LODWORD(qwTSF1) < LODWORD(qwTSF2)) {
// if borrow needed
HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2) - 1;
} else {
HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2);
}
return qwTSFOffset; return qwTSFOffset;
} }
...@@ -1983,7 +1960,7 @@ QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2) ...@@ -1983,7 +1960,7 @@ QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2)
* Return Value: true if success; otherwise false * Return Value: true if success; otherwise false
* *
*/ */
bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF) bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF)
{ {
unsigned short ww; unsigned short ww;
unsigned char byData; unsigned char byData;
...@@ -1996,8 +1973,8 @@ bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF) ...@@ -1996,8 +1973,8 @@ bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF)
} }
if (ww == W_MAX_TIMEOUT) if (ww == W_MAX_TIMEOUT)
return false; return false;
VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR, &LODWORD(*pqwCurrTSF)); VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR, (u32 *)pqwCurrTSF);
VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR + 4, &HIDWORD(*pqwCurrTSF)); VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR + 4, (u32 *)pqwCurrTSF + 1);
return true; return true;
} }
...@@ -2016,7 +1993,7 @@ bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF) ...@@ -2016,7 +1993,7 @@ bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF)
* Return Value: TSF value of next Beacon * Return Value: TSF value of next Beacon
* *
*/ */
QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval) u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval)
{ {
unsigned int uLowNextTBTT; unsigned int uLowNextTBTT;
unsigned int uHighRemain, uLowRemain; unsigned int uHighRemain, uLowRemain;
...@@ -2024,20 +2001,21 @@ QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval) ...@@ -2024,20 +2001,21 @@ QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval)
uBeaconInterval = wBeaconInterval * 1024; uBeaconInterval = wBeaconInterval * 1024;
// Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval // Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
uLowNextTBTT = (LODWORD(qwTSF) >> 10) << 10; uLowNextTBTT = ((qwTSF & 0xffffffffULL) >> 10) << 10;
// low dword (mod) bcn // low dword (mod) bcn
uLowRemain = (uLowNextTBTT) % uBeaconInterval; uLowRemain = (uLowNextTBTT) % uBeaconInterval;
// high dword (mod) bcn // high dword (mod) bcn
uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwTSF)) uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * (u32)(qwTSF >> 32))
% uBeaconInterval; % uBeaconInterval;
uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval; uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
uLowRemain = uBeaconInterval - uLowRemain; uLowRemain = uBeaconInterval - uLowRemain;
// check if carry when add one beacon interval // check if carry when add one beacon interval
if ((~uLowNextTBTT) < uLowRemain) if ((~uLowNextTBTT) < uLowRemain)
HIDWORD(qwTSF)++; qwTSF = ((qwTSF >> 32) + 1) << 32;
LODWORD(qwTSF) = uLowNextTBTT + uLowRemain; qwTSF = (qwTSF & 0xffffffff00000000ULL) |
(u64)(uLowNextTBTT + uLowRemain);
return qwTSF; return qwTSF;
} }
...@@ -2058,15 +2036,14 @@ QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval) ...@@ -2058,15 +2036,14 @@ QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval)
*/ */
void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval) void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval)
{ {
QWORD qwNextTBTT; u64 qwNextTBTT = 0;
HIDWORD(qwNextTBTT) = 0;
LODWORD(qwNextTBTT) = 0;
CARDbGetCurrentTSF(dwIoBase, &qwNextTBTT); //Get Local TSF counter CARDbGetCurrentTSF(dwIoBase, &qwNextTBTT); //Get Local TSF counter
qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
// Set NextTBTT // Set NextTBTT
VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT)); VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT)); VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32));
MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
} }
...@@ -2085,13 +2062,12 @@ void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterva ...@@ -2085,13 +2062,12 @@ void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterva
* Return Value: none * Return Value: none
* *
*/ */
void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval) void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval)
{ {
qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval); qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval);
// Set NextTBTT // Set NextTBTT
VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwTSF)); VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, (u32)qwTSF);
VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwTSF)); VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, (u32)(qwTSF >> 32));
MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8xh:%8xh]\n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8llx]\n", qwTSF);
(unsigned int) HIDWORD(qwTSF), (unsigned int) LODWORD(qwTSF));
} }
...@@ -85,10 +85,10 @@ bool CARDbIsOFDMinBasicRate(void *pDeviceHandler); ...@@ -85,10 +85,10 @@ bool CARDbIsOFDMinBasicRate(void *pDeviceHandler);
void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode); void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
bool CARDbSoftwareReset(void *pDeviceHandler); bool CARDbSoftwareReset(void *pDeviceHandler);
void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval); void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval); void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval);
bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF); bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF);
QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval); u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval);
QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2); u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2);
bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower); bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower);
unsigned char CARDbyGetPktType(void *pDeviceHandler); unsigned char CARDbyGetPktType(void *pDeviceHandler);
void CARDvSafeResetTx(void *pDeviceHandler); void CARDvSafeResetTx(void *pDeviceHandler);
...@@ -99,7 +99,7 @@ bool CARDbRadioPowerOn(void *pDeviceHandler); ...@@ -99,7 +99,7 @@ bool CARDbRadioPowerOn(void *pDeviceHandler);
bool CARDbIsShortPreamble(void *pDeviceHandler); bool CARDbIsShortPreamble(void *pDeviceHandler);
bool CARDbIsShorSlotTime(void *pDeviceHandler); bool CARDbIsShorSlotTime(void *pDeviceHandler);
bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs); bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs);
bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF); bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, u64 qwBSSTimestamp, u64 qwLocalTSF);
bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType); bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType); bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval); bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval);
......
...@@ -566,7 +566,7 @@ typedef struct __device_info { ...@@ -566,7 +566,7 @@ typedef struct __device_info {
SKeyManagement sKey; SKeyManagement sKey;
unsigned long dwIVCounter; unsigned long dwIVCounter;
QWORD qwPacketNumber; //For CCMP and TKIP as TSC(6 bytes) u64 qwPacketNumber; /* For CCMP and TKIP as TSC(6 bytes) */
unsigned int uCurrentWEPMode; unsigned int uCurrentWEPMode;
RC4Ext SBox; RC4Ext SBox;
......
...@@ -283,7 +283,7 @@ device_receive_frame( ...@@ -283,7 +283,7 @@ device_receive_frame(
unsigned char *pbyRsr; unsigned char *pbyRsr;
unsigned char *pbyNewRsr; unsigned char *pbyNewRsr;
unsigned char *pbyRSSI; unsigned char *pbyRSSI;
PQWORD pqwTSFTime; __le64 *pqwTSFTime;
unsigned short *pwFrameSize; unsigned short *pwFrameSize;
unsigned char *pbyFrame; unsigned char *pbyFrame;
bool bDeFragRx = false; bool bDeFragRx = false;
...@@ -334,7 +334,7 @@ device_receive_frame( ...@@ -334,7 +334,7 @@ device_receive_frame(
pbyRSSI = (unsigned char *)(skb->data + FrameSize - 2); pbyRSSI = (unsigned char *)(skb->data + FrameSize - 2);
pbyNewRsr = (unsigned char *)(skb->data + FrameSize - 3); pbyNewRsr = (unsigned char *)(skb->data + FrameSize - 3);
pbySQ = (unsigned char *)(skb->data + FrameSize - 4); pbySQ = (unsigned char *)(skb->data + FrameSize - 4);
pqwTSFTime = (PQWORD)(skb->data + FrameSize - 12); pqwTSFTime = (__le64 *)(skb->data + FrameSize - 12);
pbyFrame = (unsigned char *)(skb->data + 4); pbyFrame = (unsigned char *)(skb->data + 4);
// get packet size // get packet size
...@@ -515,8 +515,7 @@ device_receive_frame( ...@@ -515,8 +515,7 @@ device_receive_frame(
pRxPacket->cbMPDULen = FrameSize; pRxPacket->cbMPDULen = FrameSize;
pRxPacket->uRSSI = *pbyRSSI; pRxPacket->uRSSI = *pbyRSSI;
pRxPacket->bySQ = *pbySQ; pRxPacket->bySQ = *pbySQ;
HIDWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(HIDWORD(*pqwTSFTime)); pRxPacket->qwLocalTSF = le64_to_cpu(*pqwTSFTime);
LODWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(LODWORD(*pqwTSFTime));
if (bIsWEP) { if (bIsWEP) {
// strip IV // strip IV
pbyData1 = WLAN_HDR_A3_DATA_PTR(skb->data+4); pbyData1 = WLAN_HDR_A3_DATA_PTR(skb->data+4);
...@@ -796,7 +795,7 @@ device_receive_frame( ...@@ -796,7 +795,7 @@ device_receive_frame(
RSC = dwRxTSC47_16; RSC = dwRxTSC47_16;
RSC <<= 16; RSC <<= 16;
RSC += wRxTSC15_0; RSC += wRxTSC15_0;
memcpy(&(pKey->KeyRSC), &RSC, sizeof(QWORD)); pKey->KeyRSC = RSC;
if ((pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) && if ((pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) &&
(pDevice->sMgmtObj.eCurrState == WMAC_STATE_ASSOC)) { (pDevice->sMgmtObj.eCurrState == WMAC_STATE_ASSOC)) {
......
...@@ -417,7 +417,7 @@ static int hostap_set_encryption(PSDevice pDevice, ...@@ -417,7 +417,7 @@ static int hostap_set_encryption(PSDevice pDevice,
unsigned long dwKeyIndex = 0; unsigned long dwKeyIndex = 0;
unsigned char abyKey[MAX_KEY_LEN]; unsigned char abyKey[MAX_KEY_LEN];
unsigned char abySeq[MAX_KEY_LEN]; unsigned char abySeq[MAX_KEY_LEN];
unsigned long long KeyRSC; u64 KeyRSC;
unsigned char byKeyDecMode = KEY_CTL_WEP; unsigned char byKeyDecMode = KEY_CTL_WEP;
int iNodeIndex = -1; int iNodeIndex = -1;
int ii; int ii;
...@@ -509,7 +509,7 @@ static int hostap_set_encryption(PSDevice pDevice, ...@@ -509,7 +509,7 @@ static int hostap_set_encryption(PSDevice pDevice,
&param->sta_addr[0], &param->sta_addr[0],
dwKeyIndex & ~(USE_KEYRSC), dwKeyIndex & ~(USE_KEYRSC),
param->u.crypt.key_len, param->u.crypt.key_len,
(PQWORD) &(KeyRSC), (u64 *) &KeyRSC,
(unsigned char *)abyKey, (unsigned char *)abyKey,
KEY_CTL_WEP, KEY_CTL_WEP,
pDevice->PortOffset, pDevice->PortOffset,
...@@ -534,7 +534,7 @@ static int hostap_set_encryption(PSDevice pDevice, ...@@ -534,7 +534,7 @@ static int hostap_set_encryption(PSDevice pDevice,
if (param->u.crypt.seq) { if (param->u.crypt.seq) {
memcpy(&abySeq, param->u.crypt.seq, 8); memcpy(&abySeq, param->u.crypt.seq, 8);
for (ii = 0; ii < 8; ii++) for (ii = 0; ii < 8; ii++)
KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8); KeyRSC |= (u64)abySeq[ii] << (ii * 8);
dwKeyIndex |= 1 << 29; dwKeyIndex |= 1 << 29;
pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = KeyRSC; pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = KeyRSC;
...@@ -563,7 +563,7 @@ static int hostap_set_encryption(PSDevice pDevice, ...@@ -563,7 +563,7 @@ static int hostap_set_encryption(PSDevice pDevice,
KeybSetDefaultKey(&(pDevice->sKey), KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex, dwKeyIndex,
param->u.crypt.key_len, param->u.crypt.key_len,
(PQWORD) &(KeyRSC), (u64 *) &KeyRSC,
abyKey, abyKey,
byKeyDecMode, byKeyDecMode,
pDevice->PortOffset, pDevice->PortOffset,
...@@ -576,7 +576,7 @@ static int hostap_set_encryption(PSDevice pDevice, ...@@ -576,7 +576,7 @@ static int hostap_set_encryption(PSDevice pDevice,
&param->sta_addr[0], &param->sta_addr[0],
dwKeyIndex, dwKeyIndex,
param->u.crypt.key_len, param->u.crypt.key_len,
(PQWORD) &(KeyRSC), (u64 *) &KeyRSC,
(unsigned char *)abyKey, (unsigned char *)abyKey,
byKeyDecMode, byKeyDecMode,
pDevice->PortOffset, pDevice->PortOffset,
......
...@@ -184,7 +184,7 @@ bool KeybSetKey( ...@@ -184,7 +184,7 @@ bool KeybSetKey(
unsigned char *pbyBSSID, unsigned char *pbyBSSID,
unsigned long dwKeyIndex, unsigned long dwKeyIndex,
unsigned long uKeyLength, unsigned long uKeyLength,
PQWORD pKeyRSC, u64 *pKeyRSC,
unsigned char *pbyKey, unsigned char *pbyKey,
unsigned char byKeyDecMode, unsigned char byKeyDecMode,
void __iomem *dwIoBase, void __iomem *dwIoBase,
...@@ -245,9 +245,9 @@ bool KeybSetKey( ...@@ -245,9 +245,9 @@ bool KeybSetKey(
if ((dwKeyIndex & USE_KEYRSC) == 0) { if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC // RSC set by NIC
memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); pKey->KeyRSC = 0;
} else { } else {
memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); pKey->KeyRSC = *pKeyRSC;
} }
pKey->dwTSC47_16 = 0; pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0; pKey->wTSC15_0 = 0;
...@@ -308,9 +308,9 @@ bool KeybSetKey( ...@@ -308,9 +308,9 @@ bool KeybSetKey(
if ((dwKeyIndex & USE_KEYRSC) == 0) { if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC // RSC set by NIC
memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); pKey->KeyRSC = 0;
} else { } else {
memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); pKey->KeyRSC = *pKeyRSC;
} }
pKey->dwTSC47_16 = 0; pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0; pKey->wTSC15_0 = 0;
...@@ -606,7 +606,7 @@ bool KeybSetDefaultKey( ...@@ -606,7 +606,7 @@ bool KeybSetDefaultKey(
PSKeyManagement pTable, PSKeyManagement pTable,
unsigned long dwKeyIndex, unsigned long dwKeyIndex,
unsigned long uKeyLength, unsigned long uKeyLength,
PQWORD pKeyRSC, u64 *pKeyRSC,
unsigned char *pbyKey, unsigned char *pbyKey,
unsigned char byKeyDecMode, unsigned char byKeyDecMode,
void __iomem *dwIoBase, void __iomem *dwIoBase,
...@@ -669,9 +669,9 @@ bool KeybSetDefaultKey( ...@@ -669,9 +669,9 @@ bool KeybSetDefaultKey(
if ((dwKeyIndex & USE_KEYRSC) == 0) { if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC // RSC set by NIC
memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); pKey->KeyRSC = 0;
} else { } else {
memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); pKey->KeyRSC = *pKeyRSC;
} }
pKey->dwTSC47_16 = 0; pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0; pKey->wTSC15_0 = 0;
...@@ -712,7 +712,7 @@ bool KeybSetAllGroupKey( ...@@ -712,7 +712,7 @@ bool KeybSetAllGroupKey(
PSKeyManagement pTable, PSKeyManagement pTable,
unsigned long dwKeyIndex, unsigned long dwKeyIndex,
unsigned long uKeyLength, unsigned long uKeyLength,
PQWORD pKeyRSC, u64 *pKeyRSC,
unsigned char *pbyKey, unsigned char *pbyKey,
unsigned char byKeyDecMode, unsigned char byKeyDecMode,
void __iomem *dwIoBase, void __iomem *dwIoBase,
...@@ -764,9 +764,9 @@ bool KeybSetAllGroupKey( ...@@ -764,9 +764,9 @@ bool KeybSetAllGroupKey(
if ((dwKeyIndex & USE_KEYRSC) == 0) { if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC // RSC set by NIC
memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); pKey->KeyRSC = 0;
} else { } else {
memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); pKey->KeyRSC = *pKeyRSC;
} }
pKey->dwTSC47_16 = 0; pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0; pKey->wTSC15_0 = 0;
......
...@@ -57,7 +57,7 @@ typedef struct tagSKeyItem { ...@@ -57,7 +57,7 @@ typedef struct tagSKeyItem {
bool bKeyValid; bool bKeyValid;
unsigned long uKeyLength; unsigned long uKeyLength;
unsigned char abyKey[MAX_KEY_LEN]; unsigned char abyKey[MAX_KEY_LEN];
QWORD KeyRSC; u64 KeyRSC;
unsigned long dwTSC47_16; unsigned long dwTSC47_16;
unsigned short wTSC15_0; unsigned short wTSC15_0;
unsigned char byCipherSuite; unsigned char byCipherSuite;
...@@ -108,7 +108,7 @@ bool KeybSetKey( ...@@ -108,7 +108,7 @@ bool KeybSetKey(
unsigned char *pbyBSSID, unsigned char *pbyBSSID,
unsigned long dwKeyIndex, unsigned long dwKeyIndex,
unsigned long uKeyLength, unsigned long uKeyLength,
PQWORD pKeyRSC, u64 *pKeyRSC,
unsigned char *pbyKey, unsigned char *pbyKey,
unsigned char byKeyDecMode, unsigned char byKeyDecMode,
void __iomem *dwIoBase, void __iomem *dwIoBase,
...@@ -119,7 +119,7 @@ bool KeybSetDefaultKey( ...@@ -119,7 +119,7 @@ bool KeybSetDefaultKey(
PSKeyManagement pTable, PSKeyManagement pTable,
unsigned long dwKeyIndex, unsigned long dwKeyIndex,
unsigned long uKeyLength, unsigned long uKeyLength,
PQWORD pKeyRSC, u64 *pKeyRSC,
unsigned char *pbyKey, unsigned char *pbyKey,
unsigned char byKeyDecMode, unsigned char byKeyDecMode,
void __iomem *dwIoBase, void __iomem *dwIoBase,
...@@ -166,7 +166,7 @@ bool KeybSetAllGroupKey( ...@@ -166,7 +166,7 @@ bool KeybSetAllGroupKey(
PSKeyManagement pTable, PSKeyManagement pTable,
unsigned long dwKeyIndex, unsigned long dwKeyIndex,
unsigned long uKeyLength, unsigned long uKeyLength,
PQWORD pKeyRSC, u64 *pKeyRSC,
unsigned char *pbyKey, unsigned char *pbyKey,
unsigned char byKeyDecMode, unsigned char byKeyDecMode,
void __iomem *dwIoBase, void __iomem *dwIoBase,
......
...@@ -39,27 +39,4 @@ ...@@ -39,27 +39,4 @@
#define Calcu_LinkQual #define Calcu_LinkQual
#endif #endif
/****** Simple typedefs ***************************************************/
/* These lines assume that your compiler's longs are 32 bits and
* shorts are 16 bits. It is already assumed that chars are 8 bits,
* but it doesn't matter if they're signed or unsigned.
*/
// QWORD is for those situation that we want
// an 8-byte-aligned 8 byte long structure
// which is NOT really a floating point number.
typedef union tagUQuadWord {
struct {
unsigned int dwLowDword;
unsigned int dwHighDword;
} u;
double DoNotUseThisField;
} UQuadWord;
typedef UQuadWord QWORD; // 64-bit
/****** Common pointer types ***********************************************/
typedef QWORD *PQWORD;
#endif // __TTYPE_H__ #endif // __TTYPE_H__
...@@ -1721,7 +1721,7 @@ s_vMgrRxBeacon( ...@@ -1721,7 +1721,7 @@ s_vMgrRxBeacon(
{ {
PKnownBSS pBSSList; PKnownBSS pBSSList;
WLAN_FR_BEACON sFrame; WLAN_FR_BEACON sFrame;
QWORD qwTSFOffset; u64 qwTSFOffset;
bool bIsBSSIDEqual = false; bool bIsBSSIDEqual = false;
bool bIsSSIDEqual = false; bool bIsSSIDEqual = false;
bool bTSFLargeDiff = false; bool bTSFLargeDiff = false;
...@@ -1733,8 +1733,8 @@ s_vMgrRxBeacon( ...@@ -1733,8 +1733,8 @@ s_vMgrRxBeacon(
unsigned char byTIMBitOn = 0; unsigned char byTIMBitOn = 0;
unsigned short wAIDNumber = 0; unsigned short wAIDNumber = 0;
unsigned int uNodeIndex; unsigned int uNodeIndex;
QWORD qwTimestamp, qwLocalTSF; u64 qwTimestamp, qwLocalTSF;
QWORD qwCurrTSF; u64 qwCurrTSF;
unsigned short wStartIndex = 0; unsigned short wStartIndex = 0;
unsigned short wAIDIndex = 0; unsigned short wAIDIndex = 0;
unsigned char byCurrChannel = pRxPacket->byRxChannel; unsigned char byCurrChannel = pRxPacket->byRxChannel;
...@@ -1972,32 +1972,22 @@ s_vMgrRxBeacon( ...@@ -1972,32 +1972,22 @@ s_vMgrRxBeacon(
} }
} }
HIDWORD(qwTimestamp) = cpu_to_le32(HIDWORD(*sFrame.pqwTimestamp)); qwTimestamp = le64_to_cpu(*sFrame.pqwTimestamp);
LODWORD(qwTimestamp) = cpu_to_le32(LODWORD(*sFrame.pqwTimestamp)); qwLocalTSF = pRxPacket->qwLocalTSF;
HIDWORD(qwLocalTSF) = HIDWORD(pRxPacket->qwLocalTSF);
LODWORD(qwLocalTSF) = LODWORD(pRxPacket->qwLocalTSF);
// check if beacon TSF larger or small than our local TSF // check if beacon TSF larger or small than our local TSF
if (HIDWORD(qwTimestamp) == HIDWORD(qwLocalTSF)) { if (qwTimestamp >= qwLocalTSF)
if (LODWORD(qwTimestamp) >= LODWORD(qwLocalTSF))
bTSFOffsetPostive = true;
else
bTSFOffsetPostive = false;
} else if (HIDWORD(qwTimestamp) > HIDWORD(qwLocalTSF)) {
bTSFOffsetPostive = true; bTSFOffsetPostive = true;
} else if (HIDWORD(qwTimestamp) < HIDWORD(qwLocalTSF)) { else
bTSFOffsetPostive = false; bTSFOffsetPostive = false;
}
if (bTSFOffsetPostive) if (bTSFOffsetPostive)
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF)); qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF));
else else
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp)); qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp));
if (HIDWORD(qwTSFOffset) != 0 || if (qwTSFOffset > TRIVIAL_SYNC_DIFFERENCE)
(LODWORD(qwTSFOffset) > TRIVIAL_SYNC_DIFFERENCE)) {
bTSFLargeDiff = true; bTSFLargeDiff = true;
}
// if infra mode // if infra mode
if (bIsAPBeacon) { if (bIsAPBeacon) {
...@@ -2194,7 +2184,7 @@ vMgrCreateOwnIBSS( ...@@ -2194,7 +2184,7 @@ vMgrCreateOwnIBSS(
unsigned short wMaxSuppRate; unsigned short wMaxSuppRate;
unsigned char byTopCCKBasicRate; unsigned char byTopCCKBasicRate;
unsigned char byTopOFDMBasicRate; unsigned char byTopOFDMBasicRate;
QWORD qwCurrTSF; u64 qwCurrTSF;
unsigned int ii; unsigned int ii;
unsigned char abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, 0x12, 0x18, 0x60}; unsigned char abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, 0x12, 0x18, 0x60};
unsigned char abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96}; unsigned char abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96};
...@@ -2316,12 +2306,12 @@ vMgrCreateOwnIBSS( ...@@ -2316,12 +2306,12 @@ vMgrCreateOwnIBSS(
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
// BSSID selected must be randomized as spec 11.1.3 // BSSID selected must be randomized as spec 11.1.3
pMgmt->abyCurrBSSID[5] = (unsigned char) (LODWORD(qwCurrTSF) & 0x000000ff); pMgmt->abyCurrBSSID[5] = (u8) (qwCurrTSF & 0x000000ff);
pMgmt->abyCurrBSSID[4] = (unsigned char)((LODWORD(qwCurrTSF) & 0x0000ff00) >> 8); pMgmt->abyCurrBSSID[4] = (u8) ((qwCurrTSF & 0x0000ff00) >> 8);
pMgmt->abyCurrBSSID[3] = (unsigned char)((LODWORD(qwCurrTSF) & 0x00ff0000) >> 16); pMgmt->abyCurrBSSID[3] = (u8) ((qwCurrTSF & 0x00ff0000) >> 16);
pMgmt->abyCurrBSSID[2] = (unsigned char)((LODWORD(qwCurrTSF) & 0x00000ff0) >> 4); pMgmt->abyCurrBSSID[2] = (u8) ((qwCurrTSF & 0x00000ff0) >> 4);
pMgmt->abyCurrBSSID[1] = (unsigned char)((LODWORD(qwCurrTSF) & 0x000ff000) >> 12); pMgmt->abyCurrBSSID[1] = (u8) ((qwCurrTSF & 0x000ff000) >> 12);
pMgmt->abyCurrBSSID[0] = (unsigned char)((LODWORD(qwCurrTSF) & 0x0ff00000) >> 20); pMgmt->abyCurrBSSID[0] = (u8) ((qwCurrTSF & 0x0ff00000) >> 20);
pMgmt->abyCurrBSSID[5] ^= pMgmt->abyMACAddr[0]; pMgmt->abyCurrBSSID[5] ^= pMgmt->abyMACAddr[0];
pMgmt->abyCurrBSSID[4] ^= pMgmt->abyMACAddr[1]; pMgmt->abyCurrBSSID[4] ^= pMgmt->abyMACAddr[1];
pMgmt->abyCurrBSSID[3] ^= pMgmt->abyMACAddr[2]; pMgmt->abyCurrBSSID[3] ^= pMgmt->abyMACAddr[2];
......
...@@ -175,7 +175,7 @@ typedef struct tagSTxMgmtPacket { ...@@ -175,7 +175,7 @@ typedef struct tagSTxMgmtPacket {
// Rx Management Packet descriptor // Rx Management Packet descriptor
typedef struct tagSRxMgmtPacket { typedef struct tagSRxMgmtPacket {
PUWLAN_80211HDR p80211Header; PUWLAN_80211HDR p80211Header;
QWORD qwLocalTSF; u64 qwLocalTSF;
unsigned int cbMPDULen; unsigned int cbMPDULen;
unsigned int cbPayloadLen; unsigned int cbPayloadLen;
unsigned int uRSSI; unsigned int uRSSI;
......
...@@ -196,7 +196,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, ...@@ -196,7 +196,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
unsigned long dwKeyIndex = 0; unsigned long dwKeyIndex = 0;
unsigned char abyKey[MAX_KEY_LEN]; unsigned char abyKey[MAX_KEY_LEN];
unsigned char abySeq[MAX_KEY_LEN]; unsigned char abySeq[MAX_KEY_LEN];
QWORD KeyRSC; u64 KeyRSC;
unsigned char byKeyDecMode = KEY_CTL_WEP; unsigned char byKeyDecMode = KEY_CTL_WEP;
int ret = 0; int ret = 0;
int uu, ii; int uu, ii;
...@@ -276,9 +276,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, ...@@ -276,9 +276,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
if (param->u.wpa_key.seq_len > 0) { if (param->u.wpa_key.seq_len > 0) {
for (ii = 0; ii < param->u.wpa_key.seq_len; ii++) { for (ii = 0; ii < param->u.wpa_key.seq_len; ii++) {
if (ii < 4) if (ii < 4)
LODWORD(KeyRSC) |= (abySeq[ii] << (ii * 8)); KeyRSC |= (u64)(abySeq[ii] << (ii * 8));
else else
HIDWORD(KeyRSC) |= (abySeq[ii] << ((ii-4) * 8)); KeyRSC |= (u64)(abySeq[ii] << ((ii-4) * 8));
} }
dwKeyIndex |= 1 << 29; dwKeyIndex |= 1 << 29;
} }
...@@ -341,7 +341,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, ...@@ -341,7 +341,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
if (KeybSetAllGroupKey(&(pDevice->sKey), if (KeybSetAllGroupKey(&(pDevice->sKey),
dwKeyIndex, dwKeyIndex,
param->u.wpa_key.key_len, param->u.wpa_key.key_len,
(PQWORD) &(KeyRSC), (u64 *) &KeyRSC,
(unsigned char *)abyKey, (unsigned char *)abyKey,
byKeyDecMode, byKeyDecMode,
pDevice->PortOffset, pDevice->PortOffset,
...@@ -349,7 +349,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, ...@@ -349,7 +349,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
KeybSetDefaultKey(&(pDevice->sKey), KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex, dwKeyIndex,
param->u.wpa_key.key_len, param->u.wpa_key.key_len,
(PQWORD) &(KeyRSC), (u64 *) &KeyRSC,
(unsigned char *)abyKey, (unsigned char *)abyKey,
byKeyDecMode, byKeyDecMode,
pDevice->PortOffset, pDevice->PortOffset,
...@@ -377,7 +377,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, ...@@ -377,7 +377,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
&param->addr[0], &param->addr[0],
dwKeyIndex, dwKeyIndex,
param->u.wpa_key.key_len, param->u.wpa_key.key_len,
(PQWORD) &(KeyRSC), (u64 *) &KeyRSC,
(unsigned char *)abyKey, (unsigned char *)abyKey,
byKeyDecMode, byKeyDecMode,
pDevice->PortOffset, pDevice->PortOffset,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment