Replace the variables with u64/__le64.
The endian variant is needed in some places endian correction is
needed.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */
- pFrame->pqwTimestamp = (PQWORD)
+ pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_BEACON_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *)
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */
- pFrame->pqwTimestamp = (PQWORD)
+ pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_BEACON_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *)
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */
- pFrame->pqwTimestamp = (PQWORD)
+ pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_PROBERESP_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *)
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */
- pFrame->pqwTimestamp = (PQWORD)
+ pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_PROBERESP_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *)
#ifndef __80211MGR_H__
#define __80211MGR_H__
+#include <linux/types.h>
+
#include "ttype.h"
#include "80211hdr.h"
unsigned int len;
unsigned char *pBuf;
PUWLAN_80211HDR pHdr;
- PQWORD pqwTimestamp;
+ __le64 *pqwTimestamp;
unsigned short *pwBeaconInterval;
unsigned short *pwCapInfo;
PWLAN_IE_SSID pSSID;
unsigned int len;
unsigned char *pBuf;
PUWLAN_80211HDR pHdr;
- PQWORD pqwTimestamp;
+ __le64 *pqwTimestamp;
unsigned short *pwBeaconInterval;
unsigned short *pwCapInfo;
PWLAN_IE_SSID pSSID;
BSSbInsertToBSSList(
void *hDeviceContext,
unsigned char *abyBSSIDAddr,
- QWORD qwTimestamp,
+ __le64 qwTimestamp,
unsigned short wBeaconInterval,
unsigned short wCapInfo,
unsigned char byCurrChannel,
/* save the BSS info */
pBSSList->bActive = true;
memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
- HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
- LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
+ pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
pBSSList->uClearCount = 0;
bool
BSSbUpdateToBSSList(
void *hDeviceContext,
- QWORD qwTimestamp,
+ __le64 qwTimestamp,
unsigned short wBeaconInterval,
unsigned short wCapInfo,
unsigned char byCurrChannel,
if (pBSSList == NULL)
return false;
- HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
- LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
+ pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
pBSSList->uClearCount = 0;
unsigned int uClearCount;
unsigned int uIELength;
- QWORD qwBSSTimestamp;
- QWORD qwLocalTSF;
+ u64 qwBSSTimestamp;
+ u64 qwLocalTSF;
CARD_PHY_TYPE eNetworkTypeInUse;
BSSbInsertToBSSList(
void *hDeviceContext,
unsigned char *abyBSSIDAddr,
- QWORD qwTimestamp,
+ __le64 qwTimestamp,
unsigned short wBeaconInterval,
unsigned short wCapInfo,
unsigned char byCurrChannel,
bool
BSSbUpdateToBSSList(
void *hDeviceContext,
- QWORD qwTimestamp,
+ __le64 qwTimestamp,
unsigned short wBeaconInterval,
unsigned short wCapInfo,
unsigned char byCurrChannel,
* 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;
- QWORD qwTSFOffset;
+ u64 qwTSFOffset = 0;
- HIDWORD(qwTSFOffset) = 0;
- LODWORD(qwTSFOffset) = 0;
-
- if ((HIDWORD(qwBSSTimestamp) != HIDWORD(qwLocalTSF)) ||
- (LODWORD(qwBSSTimestamp) != LODWORD(qwLocalTSF))) {
+ if (qwBSSTimestamp != qwLocalTSF) {
qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF);
// adjust TSF
// HW's TSF add TSF Offset reg
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, LODWORD(qwTSFOffset));
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, HIDWORD(qwTSFOffset));
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, (u32)qwTSFOffset);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, (u32)(qwTSFOffset >> 32));
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TSFSYNCEN);
}
return true;
unsigned int uLowNextTBTT = 0;
unsigned int uHighRemain = 0;
unsigned int uLowRemain = 0;
- QWORD qwNextTBTT;
+ u64 qwNextTBTT = 0;
- HIDWORD(qwNextTBTT) = 0;
- LODWORD(qwNextTBTT) = 0;
CARDbGetCurrentTSF(pDevice->PortOffset, &qwNextTBTT); //Get Local TSF counter
uBeaconInterval = wBeaconInterval * 1024;
// Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
- uLowNextTBTT = (LODWORD(qwNextTBTT) >> 10) << 10;
+ uLowNextTBTT = ((qwNextTBTT & 0xffffffffULL) >> 10) << 10;
uLowRemain = (uLowNextTBTT) % uBeaconInterval;
// high dword (mod) bcn
- uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwNextTBTT))
+ uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * (u32)(qwNextTBTT >> 32))
% uBeaconInterval;
uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
uLowRemain = uBeaconInterval - uLowRemain;
// check if carry when add one beacon interval
if ((~uLowNextTBTT) < uLowRemain)
- HIDWORD(qwNextTBTT)++;
+ qwNextTBTT = ((qwNextTBTT >> 32) + 1) << 32;
- LODWORD(qwNextTBTT) = uLowNextTBTT + uLowRemain;
+ qwNextTBTT = (qwNextTBTT & 0xffffffff00000000ULL) |
+ (u64)(uLowNextTBTT + uLowRemain);
// set HW beacon interval
VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, wBeaconInterval);
pDevice->wBeaconInterval = wBeaconInterval;
// Set NextTBTT
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT));
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT));
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32));
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
return true;
{
PSDevice pDevice = (PSDevice) pDeviceHandler;
PWLAN_IE_MEASURE_REQ pEID = (PWLAN_IE_MEASURE_REQ) pvMeasureEIDs;
- QWORD qwCurrTSF;
- QWORD qwStartTSF;
+ u64 qwCurrTSF;
+ u64 qwStartTSF;
bool bExpired = true;
unsigned short wDuration = 0;
pDevice->uNumOfMeasureEIDs--;
if (pDevice->byLocalID > REV_ID_VT3253_B1) {
- HIDWORD(qwStartTSF) = HIDWORD(*((PQWORD)(pDevice->pCurrMeasureEID->sReq.abyStartTime)));
- LODWORD(qwStartTSF) = LODWORD(*((PQWORD)(pDevice->pCurrMeasureEID->sReq.abyStartTime)));
+ qwStartTSF = *((u64 *)(pDevice->pCurrMeasureEID->sReq.abyStartTime));
wDuration = *((unsigned short *)(pDevice->pCurrMeasureEID->sReq.abyDuration));
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
- LODWORD(qwStartTSF) = LODWORD(qwCurrTSF) + 2048;
- HIDWORD(qwStartTSF) = HIDWORD(qwCurrTSF);
- if (LODWORD(qwCurrTSF) > LODWORD(qwStartTSF))
- HIDWORD(qwStartTSF)++;
+ qwStartTSF = qwCurrTSF + 2048;
bExpired = false;
break;
} else {
// start at setting start TSF - 1TU(for channel switching)
- if (LODWORD(qwStartTSF) < 1024)
- HIDWORD(qwStartTSF)--;
-
- LODWORD(qwStartTSF) -= 1024;
+ qwStartTSF -= 1024;
}
- if ((HIDWORD(qwCurrTSF) < HIDWORD(qwStartTSF)) ||
- ((HIDWORD(qwCurrTSF) == HIDWORD(qwStartTSF)) &&
- (LODWORD(qwCurrTSF) < LODWORD(qwStartTSF)))
-) {
+ if (qwCurrTSF < qwStartTSF) {
bExpired = false;
break;
}
if (!bExpired) {
MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, LODWORD(qwStartTSF));
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, HIDWORD(qwStartTSF));
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, (u32)qwStartTSF);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, (u32)(qwStartTSF >> 32));
VNSvOutPortW(pDevice->PortOffset + MAC_REG_MSRDURATION, wDuration);
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
MACvSelectPage0(pDevice->PortOffset);
* 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;
- HIDWORD(qwTSFOffset) = 0;
- LODWORD(qwTSFOffset) = 0;
wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate%MAX_RATE];
- (qwTSF2).u.dwLowDword += (unsigned long)(wRxBcnTSFOffst);
- if ((qwTSF2).u.dwLowDword < (unsigned long)(wRxBcnTSFOffst))
- (qwTSF2).u.dwHighDword++;
-
- 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);
- }
+
+ qwTSF2 += (u64)wRxBcnTSFOffst;
+
+ qwTSFOffset = qwTSF1 - qwTSF2;
+
return qwTSFOffset;
}
* 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 char byData;
}
if (ww == W_MAX_TIMEOUT)
return false;
- VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR, &LODWORD(*pqwCurrTSF));
- VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR + 4, &HIDWORD(*pqwCurrTSF));
+ VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR, (u32 *)pqwCurrTSF);
+ VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR + 4, (u32 *)pqwCurrTSF + 1);
return true;
}
* 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 uHighRemain, uLowRemain;
uBeaconInterval = wBeaconInterval * 1024;
// Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
- uLowNextTBTT = (LODWORD(qwTSF) >> 10) << 10;
+ uLowNextTBTT = ((qwTSF & 0xffffffffULL) >> 10) << 10;
// low dword (mod) bcn
uLowRemain = (uLowNextTBTT) % uBeaconInterval;
// high dword (mod) bcn
- uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwTSF))
+ uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * (u32)(qwTSF >> 32))
% uBeaconInterval;
uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
uLowRemain = uBeaconInterval - uLowRemain;
// check if carry when add one beacon interval
if ((~uLowNextTBTT) < uLowRemain)
- HIDWORD(qwTSF)++;
+ qwTSF = ((qwTSF >> 32) + 1) << 32;
- LODWORD(qwTSF) = uLowNextTBTT + uLowRemain;
+ qwTSF = (qwTSF & 0xffffffff00000000ULL) |
+ (u64)(uLowNextTBTT + uLowRemain);
return qwTSF;
}
*/
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
+
qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
// Set NextTBTT
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT));
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT));
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32));
MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
}
* 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);
// Set NextTBTT
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwTSF));
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwTSF));
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, (u32)qwTSF);
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, (u32)(qwTSF >> 32));
MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8xh:%8xh]\n",
- (unsigned int) HIDWORD(qwTSF), (unsigned int) LODWORD(qwTSF));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8llx]\n", qwTSF);
}
void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
bool CARDbSoftwareReset(void *pDeviceHandler);
void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
-void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval);
-bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF);
-QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval);
-QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2);
+void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval);
+bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF);
+u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval);
+u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2);
bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower);
unsigned char CARDbyGetPktType(void *pDeviceHandler);
void CARDvSafeResetTx(void *pDeviceHandler);
bool CARDbIsShortPreamble(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 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 CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval);
SKeyManagement sKey;
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;
RC4Ext SBox;
unsigned char *pbyRsr;
unsigned char *pbyNewRsr;
unsigned char *pbyRSSI;
- PQWORD pqwTSFTime;
+ __le64 *pqwTSFTime;
unsigned short *pwFrameSize;
unsigned char *pbyFrame;
bool bDeFragRx = false;
pbyRSSI = (unsigned char *)(skb->data + FrameSize - 2);
pbyNewRsr = (unsigned char *)(skb->data + FrameSize - 3);
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);
// get packet size
pRxPacket->cbMPDULen = FrameSize;
pRxPacket->uRSSI = *pbyRSSI;
pRxPacket->bySQ = *pbySQ;
- HIDWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(HIDWORD(*pqwTSFTime));
- LODWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(LODWORD(*pqwTSFTime));
+ pRxPacket->qwLocalTSF = le64_to_cpu(*pqwTSFTime);
if (bIsWEP) {
// strip IV
pbyData1 = WLAN_HDR_A3_DATA_PTR(skb->data+4);
RSC = dwRxTSC47_16;
RSC <<= 16;
RSC += wRxTSC15_0;
- memcpy(&(pKey->KeyRSC), &RSC, sizeof(QWORD));
+ pKey->KeyRSC = RSC;
if ((pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) &&
(pDevice->sMgmtObj.eCurrState == WMAC_STATE_ASSOC)) {
unsigned long dwKeyIndex = 0;
unsigned char abyKey[MAX_KEY_LEN];
unsigned char abySeq[MAX_KEY_LEN];
- unsigned long long KeyRSC;
+ u64 KeyRSC;
unsigned char byKeyDecMode = KEY_CTL_WEP;
int iNodeIndex = -1;
int ii;
¶m->sta_addr[0],
dwKeyIndex & ~(USE_KEYRSC),
param->u.crypt.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
KEY_CTL_WEP,
pDevice->PortOffset,
if (param->u.crypt.seq) {
memcpy(&abySeq, param->u.crypt.seq, 8);
for (ii = 0; ii < 8; ii++)
- KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8);
+ KeyRSC |= (u64)abySeq[ii] << (ii * 8);
dwKeyIndex |= 1 << 29;
pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = KeyRSC;
KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex,
param->u.crypt.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
abyKey,
byKeyDecMode,
pDevice->PortOffset,
¶m->sta_addr[0],
dwKeyIndex,
param->u.crypt.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
byKeyDecMode,
pDevice->PortOffset,
unsigned char *pbyBSSID,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ pKey->KeyRSC = 0;
} else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ pKey->KeyRSC = *pKeyRSC;
}
pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0;
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ pKey->KeyRSC = 0;
} else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ pKey->KeyRSC = *pKeyRSC;
}
pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0;
PSKeyManagement pTable,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ pKey->KeyRSC = 0;
} else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ pKey->KeyRSC = *pKeyRSC;
}
pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0;
PSKeyManagement pTable,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ pKey->KeyRSC = 0;
} else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ pKey->KeyRSC = *pKeyRSC;
}
pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0;
bool bKeyValid;
unsigned long uKeyLength;
unsigned char abyKey[MAX_KEY_LEN];
- QWORD KeyRSC;
+ u64 KeyRSC;
unsigned long dwTSC47_16;
unsigned short wTSC15_0;
unsigned char byCipherSuite;
unsigned char *pbyBSSID,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
PSKeyManagement pTable,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
PSKeyManagement pTable,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
#define Calcu_LinkQual
#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__
{
PKnownBSS pBSSList;
WLAN_FR_BEACON sFrame;
- QWORD qwTSFOffset;
+ u64 qwTSFOffset;
bool bIsBSSIDEqual = false;
bool bIsSSIDEqual = false;
bool bTSFLargeDiff = false;
unsigned char byTIMBitOn = 0;
unsigned short wAIDNumber = 0;
unsigned int uNodeIndex;
- QWORD qwTimestamp, qwLocalTSF;
- QWORD qwCurrTSF;
+ u64 qwTimestamp, qwLocalTSF;
+ u64 qwCurrTSF;
unsigned short wStartIndex = 0;
unsigned short wAIDIndex = 0;
unsigned char byCurrChannel = pRxPacket->byRxChannel;
}
}
- HIDWORD(qwTimestamp) = cpu_to_le32(HIDWORD(*sFrame.pqwTimestamp));
- LODWORD(qwTimestamp) = cpu_to_le32(LODWORD(*sFrame.pqwTimestamp));
- HIDWORD(qwLocalTSF) = HIDWORD(pRxPacket->qwLocalTSF);
- LODWORD(qwLocalTSF) = LODWORD(pRxPacket->qwLocalTSF);
+ qwTimestamp = le64_to_cpu(*sFrame.pqwTimestamp);
+ qwLocalTSF = pRxPacket->qwLocalTSF;
// check if beacon TSF larger or small than our local TSF
- if (HIDWORD(qwTimestamp) == HIDWORD(qwLocalTSF)) {
- if (LODWORD(qwTimestamp) >= LODWORD(qwLocalTSF))
- bTSFOffsetPostive = true;
- else
- bTSFOffsetPostive = false;
- } else if (HIDWORD(qwTimestamp) > HIDWORD(qwLocalTSF)) {
+ if (qwTimestamp >= qwLocalTSF)
bTSFOffsetPostive = true;
- } else if (HIDWORD(qwTimestamp) < HIDWORD(qwLocalTSF)) {
+ else
bTSFOffsetPostive = false;
- }
if (bTSFOffsetPostive)
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF));
else
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp));
- if (HIDWORD(qwTSFOffset) != 0 ||
- (LODWORD(qwTSFOffset) > TRIVIAL_SYNC_DIFFERENCE)) {
+ if (qwTSFOffset > TRIVIAL_SYNC_DIFFERENCE)
bTSFLargeDiff = true;
- }
// if infra mode
if (bIsAPBeacon) {
unsigned short wMaxSuppRate;
unsigned char byTopCCKBasicRate;
unsigned char byTopOFDMBasicRate;
- QWORD qwCurrTSF;
+ u64 qwCurrTSF;
unsigned int ii;
unsigned char abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, 0x12, 0x18, 0x60};
unsigned char abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96};
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
// BSSID selected must be randomized as spec 11.1.3
- pMgmt->abyCurrBSSID[5] = (unsigned char) (LODWORD(qwCurrTSF) & 0x000000ff);
- pMgmt->abyCurrBSSID[4] = (unsigned char)((LODWORD(qwCurrTSF) & 0x0000ff00) >> 8);
- pMgmt->abyCurrBSSID[3] = (unsigned char)((LODWORD(qwCurrTSF) & 0x00ff0000) >> 16);
- pMgmt->abyCurrBSSID[2] = (unsigned char)((LODWORD(qwCurrTSF) & 0x00000ff0) >> 4);
- pMgmt->abyCurrBSSID[1] = (unsigned char)((LODWORD(qwCurrTSF) & 0x000ff000) >> 12);
- pMgmt->abyCurrBSSID[0] = (unsigned char)((LODWORD(qwCurrTSF) & 0x0ff00000) >> 20);
+ pMgmt->abyCurrBSSID[5] = (u8) (qwCurrTSF & 0x000000ff);
+ pMgmt->abyCurrBSSID[4] = (u8) ((qwCurrTSF & 0x0000ff00) >> 8);
+ pMgmt->abyCurrBSSID[3] = (u8) ((qwCurrTSF & 0x00ff0000) >> 16);
+ pMgmt->abyCurrBSSID[2] = (u8) ((qwCurrTSF & 0x00000ff0) >> 4);
+ pMgmt->abyCurrBSSID[1] = (u8) ((qwCurrTSF & 0x000ff000) >> 12);
+ pMgmt->abyCurrBSSID[0] = (u8) ((qwCurrTSF & 0x0ff00000) >> 20);
pMgmt->abyCurrBSSID[5] ^= pMgmt->abyMACAddr[0];
pMgmt->abyCurrBSSID[4] ^= pMgmt->abyMACAddr[1];
pMgmt->abyCurrBSSID[3] ^= pMgmt->abyMACAddr[2];
// Rx Management Packet descriptor
typedef struct tagSRxMgmtPacket {
PUWLAN_80211HDR p80211Header;
- QWORD qwLocalTSF;
+ u64 qwLocalTSF;
unsigned int cbMPDULen;
unsigned int cbPayloadLen;
unsigned int uRSSI;
unsigned long dwKeyIndex = 0;
unsigned char abyKey[MAX_KEY_LEN];
unsigned char abySeq[MAX_KEY_LEN];
- QWORD KeyRSC;
+ u64 KeyRSC;
unsigned char byKeyDecMode = KEY_CTL_WEP;
int ret = 0;
int uu, ii;
if (param->u.wpa_key.seq_len > 0) {
for (ii = 0; ii < param->u.wpa_key.seq_len; ii++) {
if (ii < 4)
- LODWORD(KeyRSC) |= (abySeq[ii] << (ii * 8));
+ KeyRSC |= (u64)(abySeq[ii] << (ii * 8));
else
- HIDWORD(KeyRSC) |= (abySeq[ii] << ((ii-4) * 8));
+ KeyRSC |= (u64)(abySeq[ii] << ((ii-4) * 8));
}
dwKeyIndex |= 1 << 29;
}
if (KeybSetAllGroupKey(&(pDevice->sKey),
dwKeyIndex,
param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
byKeyDecMode,
pDevice->PortOffset,
KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex,
param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
byKeyDecMode,
pDevice->PortOffset,
¶m->addr[0],
dwKeyIndex,
param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
byKeyDecMode,
pDevice->PortOffset,