diff options
Diffstat (limited to 'drivers/staging/vt6655')
48 files changed, 2406 insertions, 2638 deletions
diff --git a/drivers/staging/vt6655/80211hdr.h b/drivers/staging/vt6655/80211hdr.h index e05d13544ea2..36e14ec50564 100644 --- a/drivers/staging/vt6655/80211hdr.h +++ b/drivers/staging/vt6655/80211hdr.h @@ -83,7 +83,8 @@ #define WLAN_RATES_MAXLEN_11B 4 #define WLAN_RSN_MAXLEN 32 #define WLAN_DATA_MAXLEN 2312 -#define WLAN_A3FR_MAXLEN (WLAN_HDR_ADDR3_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) +#define WLAN_A3FR_MAXLEN (WLAN_HDR_ADDR3_LEN + WLAN_DATA_MAXLEN + \ + WLAN_CRC_LEN) #define WLAN_BEACON_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0) diff --git a/drivers/staging/vt6655/80211mgr.c b/drivers/staging/vt6655/80211mgr.c index 96b0d61623e4..7d2c6472ec9a 100644 --- a/drivers/staging/vt6655/80211mgr.c +++ b/drivers/staging/vt6655/80211mgr.c @@ -63,10 +63,6 @@ /*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ - -static int msglevel = MSG_LEVEL_INFO; -/* static int msglevel =MSG_LEVEL_DEBUG; */ /*--------------------- Static Functions --------------------------*/ /*--------------------- Export Variables --------------------------*/ @@ -91,7 +87,7 @@ vMgrEncodeBeacon( 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 *) @@ -125,7 +121,7 @@ vMgrDecodeBeacon( 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 *) @@ -218,9 +214,8 @@ vMgrDecodeBeacon( break; default: - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", - pItem->byElementID); + pr_debug("Unrecognized EID=%dd in beacon decode\n", + pItem->byElementID); break; } @@ -406,9 +401,8 @@ vMgrDecodeAssocRequest( break; default: - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n", - pItem->byElementID); + pr_debug("Unrecognized EID=%dd in assocreq decode\n", + pItem->byElementID); break; } pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); @@ -489,9 +483,7 @@ vMgrDecodeAssocResponse( if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) { pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "pFrame->pExtSuppRates=[%p].\n", - pItem); + pr_debug("pFrame->pExtSuppRates=[%p]\n", pItem); } else { pFrame->pExtSuppRates = NULL; } @@ -594,9 +586,8 @@ vMgrDecodeReassocRequest( (PWLAN_IE_SUPP_RATES)pItem; break; default: - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n", - pItem->byElementID); + pr_debug("Unrecognized EID=%dd in reassocreq decode\n", + pItem->byElementID); break; } pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); @@ -666,9 +657,8 @@ vMgrDecodeProbeRequest( break; default: - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Bad EID=%dd in probereq\n", - pItem->byElementID); + pr_debug("Bad EID=%dd in probereq\n", + pItem->byElementID); break; } @@ -695,7 +685,7 @@ vMgrEncodeProbeResponse( 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 *) @@ -730,7 +720,7 @@ vMgrDecodeProbeResponse( 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 *) @@ -819,9 +809,8 @@ vMgrDecodeProbeResponse( break; default: - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Bad EID=%dd in proberesp\n", - pItem->byElementID); + pr_debug("Bad EID=%dd in proberesp\n", + pItem->byElementID); break; } diff --git a/drivers/staging/vt6655/80211mgr.h b/drivers/staging/vt6655/80211mgr.h index 8b126bbd9fa5..d462a8af087b 100644 --- a/drivers/staging/vt6655/80211mgr.h +++ b/drivers/staging/vt6655/80211mgr.h @@ -31,23 +31,19 @@ #ifndef __80211MGR_H__ #define __80211MGR_H__ +#include <linux/types.h> +#include "linux/ieee80211.h" + #include "ttype.h" #include "80211hdr.h" #define WLAN_MIN_ARRAY 1 /* Information Element ID value */ -#define WLAN_EID_SSID 0 -#define WLAN_EID_SUPP_RATES 1 #define WLAN_EID_FH_PARMS 2 #define WLAN_EID_DS_PARMS 3 #define WLAN_EID_CF_PARMS 4 -#define WLAN_EID_TIM 5 #define WLAN_EID_IBSS_PARMS 6 -#define WLAN_EID_COUNTRY 7 -#define WLAN_EID_CHALLENGE 16 -#define WLAN_EID_PWR_CONSTRAINT 32 -#define WLAN_EID_PWR_CAPABILITY 33 #define WLAN_EID_TPC_REQ 34 #define WLAN_EID_TPC_REP 35 #define WLAN_EID_SUPP_CH 36 @@ -58,7 +54,6 @@ #define WLAN_EID_IBSS_DFS 41 #define WLAN_EID_ERP 42 /* reference 802.11i 7.3.2 table 20 */ -#define WLAN_EID_RSN 48 #define WLAN_EID_EXTSUPP_RATES 50 /* reference WiFi WPA spec. */ #define WLAN_EID_RSN_WPA 221 @@ -464,7 +459,7 @@ typedef struct tagWLAN_FR_BEACON { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - PQWORD pqwTimestamp; + __le64 *pqwTimestamp; unsigned short *pwBeaconInterval; unsigned short *pwCapInfo; PWLAN_IE_SSID pSSID; @@ -577,7 +572,7 @@ typedef struct tagWLAN_FR_PROBERESP { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - PQWORD pqwTimestamp; + __le64 *pqwTimestamp; unsigned short *pwBeaconInterval; unsigned short *pwCapInfo; PWLAN_IE_SSID pSSID; diff --git a/drivers/staging/vt6655/aes_ccmp.c b/drivers/staging/vt6655/aes_ccmp.c index a25e6cf844ed..1dfcfcb3c69c 100644 --- a/drivers/staging/vt6655/aes_ccmp.c +++ b/drivers/staging/vt6655/aes_ccmp.c @@ -370,8 +370,5 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor /* =>above is the dec-MIC from packet */ /* -------------------------------------------- */ - if (!memcmp(abyMIC, abyTmp, 8)) - return true; - else - return false; + return !memcmp(abyMIC, abyTmp, 8); } diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index f212b88c8cec..de54923e8861 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -56,10 +56,6 @@ #include "srom.h" #include "rf.h" -/*--------------------- Static Definitions -------------------------*/ -/* static int msglevel =MSG_LEVEL_DEBUG; */ -static int msglevel = MSG_LEVEL_INFO; - /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ @@ -1704,25 +1700,26 @@ static unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = { {0xF0, 0x00}, }; -static const unsigned short awcFrameTime[MAX_RATE] = -{10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216}; +static const unsigned short awcFrameTime[MAX_RATE] = { + 10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216 +}; /*--------------------- Static Functions --------------------------*/ static unsigned long -s_ulGetRatio(PSDevice pDevice); +s_ulGetRatio(struct vnt_private *pDevice); static void s_vChangeAntenna( - PSDevice pDevice + struct vnt_private *pDevice ); static void s_vChangeAntenna( - PSDevice pDevice + struct vnt_private *pDevice ) { if (pDevice->dwRxAntennaSel == 0) { @@ -1814,163 +1811,147 @@ BBuGetFrameTime( * * Parameters: * In: - * pDevice - Device Structure - * cbFrameLength - Tx Frame Length - * wRate - Tx Rate + * priv - Device Structure + * frame_length - Tx Frame Length + * tx_rate - Tx Rate * Out: - * pwPhyLen - pointer to Phy Length field - * pbyPhySrv - pointer to Phy Service field - * pbyPhySgn - pointer to Phy Signal field + * struct vnt_phy_field *phy + * - pointer to Phy Length field + * - pointer to Phy Service field + * - pointer to Phy Signal field * * Return Value: none * */ -void -BBvCalculateParameter( - PSDevice pDevice, - unsigned int cbFrameLength, - unsigned short wRate, - unsigned char byPacketType, - unsigned short *pwPhyLen, - unsigned char *pbyPhySrv, - unsigned char *pbyPhySgn -) +void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, + u16 tx_rate, u8 pkt_type, struct vnt_phy_field *phy) { - unsigned int cbBitCount; - unsigned int cbUsCount = 0; - unsigned int cbTmp; - bool bExtBit; - unsigned char byPreambleType = pDevice->byPreambleType; - bool bCCK = pDevice->bCCK; + u32 bit_count; + u32 count = 0; + u32 tmp; + int ext_bit; + u8 preamble_type = priv->byPreambleType; - cbBitCount = cbFrameLength * 8; - bExtBit = false; + bit_count = frame_length * 8; + ext_bit = false; - switch (wRate) { + switch (tx_rate) { case RATE_1M: - cbUsCount = cbBitCount; - *pbyPhySgn = 0x00; - break; + count = bit_count; + + phy->signal = 0x00; - case RATE_2M: - cbUsCount = cbBitCount / 2; - if (byPreambleType == 1) - *pbyPhySgn = 0x09; - else /* long preamble */ - *pbyPhySgn = 0x01; break; + case RATE_2M: + count = bit_count / 2; + + if (preamble_type == 1) + phy->signal = 0x09; + else + phy->signal = 0x01; - case RATE_5M: - if (!bCCK) - cbBitCount++; - cbUsCount = (cbBitCount * 10) / 55; - cbTmp = (cbUsCount * 55) / 10; - if (cbTmp != cbBitCount) - cbUsCount++; - if (byPreambleType == 1) - *pbyPhySgn = 0x0a; - else /* long preamble */ - *pbyPhySgn = 0x02; break; + case RATE_5M: + count = (bit_count * 10) / 55; + tmp = (count * 55) / 10; - case RATE_11M: + if (tmp != bit_count) + count++; + + if (preamble_type == 1) + phy->signal = 0x0a; + else + phy->signal = 0x02; - if (!bCCK) - cbBitCount++; - cbUsCount = cbBitCount / 11; - cbTmp = cbUsCount * 11; - if (cbTmp != cbBitCount) { - cbUsCount++; - if ((cbBitCount - cbTmp) <= 3) - bExtBit = true; - } - if (byPreambleType == 1) - *pbyPhySgn = 0x0b; - else /* long preamble */ - *pbyPhySgn = 0x03; break; + case RATE_11M: + count = bit_count / 11; + tmp = count * 11; - case RATE_6M: - if (byPacketType == PK_TYPE_11A) { /*11a, 5GHZ */ - *pbyPhySgn = 0x9B; /* 1001 1011 */ - } else {/* 11g, 2.4GHZ */ - *pbyPhySgn = 0x8B; /* 1000 1011 */ + if (tmp != bit_count) { + count++; + + if ((bit_count - tmp) <= 3) + ext_bit = true; } + + if (preamble_type == 1) + phy->signal = 0x0b; + else + phy->signal = 0x03; + break; + case RATE_6M: + if (pkt_type == PK_TYPE_11A) + phy->signal = 0x9b; + else + phy->signal = 0x8b; - case RATE_9M: - if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ - *pbyPhySgn = 0x9F; /* 1001 1111 */ - } else {/* 11g, 2.4GHZ */ - *pbyPhySgn = 0x8F; /* 1000 1111 */ - } break; + case RATE_9M: + if (pkt_type == PK_TYPE_11A) + phy->signal = 0x9f; + else + phy->signal = 0x8f; - case RATE_12M: - if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ - *pbyPhySgn = 0x9A; /* 1001 1010 */ - } else {/* 11g, 2.4GHZ */ - *pbyPhySgn = 0x8A; /* 1000 1010 */ - } break; + case RATE_12M: + if (pkt_type == PK_TYPE_11A) + phy->signal = 0x9a; + else + phy->signal = 0x8a; - case RATE_18M: - if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ - *pbyPhySgn = 0x9E; /* 1001 1110 */ - } else {/* 11g, 2.4GHZ */ - *pbyPhySgn = 0x8E; /* 1000 1110 */ - } break; + case RATE_18M: + if (pkt_type == PK_TYPE_11A) + phy->signal = 0x9e; + else + phy->signal = 0x8e; - case RATE_24M: - if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ - *pbyPhySgn = 0x99; /* 1001 1001 */ - } else {/* 11g, 2.4GHZ */ - *pbyPhySgn = 0x89; /* 1000 1001 */ - } break; + case RATE_24M: + if (pkt_type == PK_TYPE_11A) + phy->signal = 0x99; + else + phy->signal = 0x89; - case RATE_36M: - if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ - *pbyPhySgn = 0x9D; /* 1001 1101 */ - } else {/* 11g, 2.4GHZ */ - *pbyPhySgn = 0x8D; /* 1000 1101 */ - } break; + case RATE_36M: + if (pkt_type == PK_TYPE_11A) + phy->signal = 0x9d; + else + phy->signal = 0x8d; - case RATE_48M: - if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ - *pbyPhySgn = 0x98; /* 1001 1000 */ - } else {/* 11g, 2.4GHZ */ - *pbyPhySgn = 0x88; /* 1000 1000 */ - } break; + case RATE_48M: + if (pkt_type == PK_TYPE_11A) + phy->signal = 0x98; + else + phy->signal = 0x88; + break; case RATE_54M: - if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ - *pbyPhySgn = 0x9C; /* 1001 1100 */ - } else {/* 11g, 2.4GHZ */ - *pbyPhySgn = 0x8C; /* 1000 1100 */ - } + if (pkt_type == PK_TYPE_11A) + phy->signal = 0x9c; + else + phy->signal = 0x8c; break; - default: - if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ - *pbyPhySgn = 0x9C; /* 1001 1100 */ - } else {/* 11g, 2.4GHZ */ - *pbyPhySgn = 0x8C; /* 1000 1100 */ - } + if (pkt_type == PK_TYPE_11A) + phy->signal = 0x9c; + else + phy->signal = 0x8c; break; } - if (byPacketType == PK_TYPE_11B) { - *pbyPhySrv = 0x00; - if (bExtBit) - *pbyPhySrv = *pbyPhySrv | 0x80; - *pwPhyLen = (unsigned short)cbUsCount; + if (pkt_type == PK_TYPE_11B) { + phy->service = 0x00; + if (ext_bit) + phy->service |= 0x80; + phy->len = cpu_to_le16((u16)count); } else { - *pbyPhySrv = 0x00; - *pwPhyLen = (unsigned short)cbFrameLength; + phy->service = 0x00; + phy->len = cpu_to_le16((u16)frame_length); } } @@ -2009,7 +1990,7 @@ bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned ch if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x30); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x30)\n"); + pr_debug(" DBG_PORT80(0x30)\n"); return false; } return true; @@ -2050,7 +2031,7 @@ bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned c if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x31); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x31)\n"); + pr_debug(" DBG_PORT80(0x31)\n"); return false; } return true; @@ -2115,7 +2096,7 @@ bool BBbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned ch * */ -bool BBbVT3253Init(PSDevice pDevice) +bool BBbVT3253Init(struct vnt_private *pDevice) { bool bResult = true; int ii; @@ -2310,7 +2291,7 @@ void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyBBRegs) * */ -void BBvLoopbackOn(PSDevice pDevice) +void BBvLoopbackOn(struct vnt_private *pDevice) { unsigned char byData; void __iomem *dwIoBase = pDevice->PortOffset; @@ -2363,7 +2344,7 @@ void BBvLoopbackOn(PSDevice pDevice) * Return Value: none * */ -void BBvLoopbackOff(PSDevice pDevice) +void BBvLoopbackOff(struct vnt_private *pDevice) { unsigned char byData; void __iomem *dwIoBase = pDevice->PortOffset; @@ -2398,7 +2379,7 @@ void BBvLoopbackOff(PSDevice pDevice) * */ void -BBvSetShortSlotTime(PSDevice pDevice) +BBvSetShortSlotTime(struct vnt_private *pDevice) { unsigned char byBBRxConf = 0; unsigned char byBBVGA = 0; @@ -2418,7 +2399,7 @@ BBvSetShortSlotTime(PSDevice pDevice) BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf); /* CR10 */ } -void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData) +void BBvSetVGAGainOffset(struct vnt_private *pDevice, unsigned char byData) { unsigned char byBBRxConf = 0; @@ -2594,7 +2575,7 @@ BBvExitDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID) static unsigned long -s_ulGetRatio(PSDevice pDevice) +s_ulGetRatio(struct vnt_private *pDevice) { unsigned long ulRatio = 0; unsigned long ulMaxPacket; @@ -2689,7 +2670,7 @@ s_ulGetRatio(PSDevice pDevice) } void -BBvClearAntDivSQ3Value(PSDevice pDevice) +BBvClearAntDivSQ3Value(struct vnt_private *pDevice) { unsigned int ii; @@ -2713,8 +2694,8 @@ BBvClearAntDivSQ3Value(PSDevice pDevice) * */ -void -BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ3) +void BBvAntennaDiversity(struct vnt_private *pDevice, + unsigned char byRxRate, unsigned char bySQ3) { if ((byRxRate >= MAX_RATE) || (pDevice->wAntDiversityMaxRate >= MAX_RATE)) return; @@ -2725,18 +2706,22 @@ BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ if (pDevice->byAntennaState == 0) { if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ulDiversityNValue=[%d],54M-[%d]\n", - (int)pDevice->ulDiversityNValue, (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate]); + pr_debug("ulDiversityNValue=[%d],54M-[%d]\n", + (int)pDevice->ulDiversityNValue, + (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate]); if (pDevice->uNumSQ3[pDevice->wAntDiversityMaxRate] < pDevice->uDiversityCnt/2) { pDevice->ulRatio_State0 = s_ulGetRatio(pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SQ3_State0, rate = [%08x]\n", (int)pDevice->ulRatio_State0); + pr_debug("SQ3_State0, rate = [%08x]\n", + (int)pDevice->ulRatio_State0); if (pDevice->byTMax == 0) return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1.[%08x], uNumSQ3[%d]=%d, %d\n", - (int)pDevice->ulRatio_State0, (int)pDevice->wAntDiversityMaxRate, - (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt); + pr_debug("1.[%08x], uNumSQ3[%d]=%d, %d\n", + (int)pDevice->ulRatio_State0, + (int)pDevice->wAntDiversityMaxRate, + (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], + (int)pDevice->uDiversityCnt); s_vChangeAntenna(pDevice); pDevice->byAntennaState = 1; @@ -2758,14 +2743,17 @@ BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ del_timer(&pDevice->TimerSQ3Tmax1); pDevice->ulRatio_State1 = s_ulGetRatio(pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RX:SQ3_State1, rate0 = %08x,rate1 = %08x\n", - (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1); + pr_debug("RX:SQ3_State1, rate0 = %08x,rate1 = %08x\n", + (int)pDevice->ulRatio_State0, + (int)pDevice->ulRatio_State1); if (pDevice->ulRatio_State1 < pDevice->ulRatio_State0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n", - (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, - (int)pDevice->wAntDiversityMaxRate, - (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt); + pr_debug("2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n", + (int)pDevice->ulRatio_State0, + (int)pDevice->ulRatio_State1, + (int)pDevice->wAntDiversityMaxRate, + (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], + (int)pDevice->uDiversityCnt); s_vChangeAntenna(pDevice); pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); @@ -2798,12 +2786,14 @@ TimerSQ3CallBack( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TimerSQ3CallBack..."); + pr_debug("TimerSQ3CallBack...\n"); spin_lock_irq(&pDevice->lock); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "3.[%08x][%08x], %d\n", (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, (int)pDevice->uDiversityCnt); + pr_debug("3.[%08x][%08x], %d\n", + (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, + (int)pDevice->uDiversityCnt); s_vChangeAntenna(pDevice); pDevice->byAntennaState = 0; @@ -2840,9 +2830,9 @@ TimerState1CallBack( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TimerState1CallBack..."); + pr_debug("TimerState1CallBack...\n"); spin_lock_irq(&pDevice->lock); if (pDevice->uDiversityCnt < pDevice->ulDiversityMValue/100) { @@ -2853,14 +2843,17 @@ TimerState1CallBack( add_timer(&pDevice->TimerSQ3Tmax2); } else { pDevice->ulRatio_State1 = s_ulGetRatio(pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SQ3_State1, rate0 = %08x,rate1 = %08x\n", - (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1); + pr_debug("SQ3_State1, rate0 = %08x,rate1 = %08x\n", + (int)pDevice->ulRatio_State0, + (int)pDevice->ulRatio_State1); if (pDevice->ulRatio_State1 < pDevice->ulRatio_State0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n", - (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, - (int)pDevice->wAntDiversityMaxRate, - (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt); + pr_debug("2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n", + (int)pDevice->ulRatio_State0, + (int)pDevice->ulRatio_State1, + (int)pDevice->wAntDiversityMaxRate, + (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], + (int)pDevice->uDiversityCnt); s_vChangeAntenna(pDevice); diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h index fcf1f9373672..31f2255519cf 100644 --- a/drivers/staging/vt6655/baseband.h +++ b/drivers/staging/vt6655/baseband.h @@ -34,14 +34,14 @@ #include "tether.h" #include "device.h" -// -// Registers in the BASEBAND -// +/* + * Registers in the BASEBAND + */ #define BB_MAX_CONTEXT_SIZE 256 -// -// Baseband RF pair definition in eeprom (Bits 6..0) -// +/* + * Baseband RF pair definition in eeprom (Bits 6..0) + */ #define PREAMBLE_LONG 0 #define PREAMBLE_SHORT 1 @@ -76,30 +76,22 @@ BBuGetFrameTime( unsigned short wRate ); -void -BBvCalculateParameter( - PSDevice pDevice, - unsigned int cbFrameLength, - unsigned short wRate, - unsigned char byPacketType, - unsigned short *pwPhyLen, - unsigned char *pbyPhySrv, - unsigned char *pbyPhySgn -); +void vnt_get_phy_field(struct vnt_private *, u32 frame_length, + u16 tx_rate, u8 pkt_type, struct vnt_phy_field *); bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData); bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData); void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyBBRegs); -void BBvLoopbackOn(PSDevice pDevice); -void BBvLoopbackOff(PSDevice pDevice); -void BBvSetShortSlotTime(PSDevice pDevice); +void BBvLoopbackOn(struct vnt_private *pDevice); +void BBvLoopbackOff(struct vnt_private *pDevice); +void BBvSetShortSlotTime(struct vnt_private *pDevice); bool BBbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits); bool BBbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits); -void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData); +void BBvSetVGAGainOffset(struct vnt_private *pDevice, unsigned char byData); -// VT3253 Baseband -bool BBbVT3253Init(PSDevice pDevice); +/* VT3253 Baseband */ +bool BBbVT3253Init(struct vnt_private *pDevice); void BBvSoftwareReset(void __iomem *dwIoBase); void BBvPowerSaveModeON(void __iomem *dwIoBase); void BBvPowerSaveModeOFF(void __iomem *dwIoBase); @@ -108,7 +100,7 @@ void BBvSetRxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode); void BBvSetDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID); void BBvExitDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID); -// timer for antenna diversity +/* timer for antenna diversity */ void TimerSQ3CallBack( @@ -120,8 +112,9 @@ TimerState1CallBack( void *hDeviceContext ); -void BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ3); +void BBvAntennaDiversity(struct vnt_private *pDevice, + unsigned char byRxRate, unsigned char bySQ3); void -BBvClearAntDivSQ3Value(PSDevice pDevice); +BBvClearAntDivSQ3Value(struct vnt_private *pDevice); -#endif // __BASEBAND_H__ +#endif /* __BASEBAND_H__ */ diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 9569f43a3ed7..996d3302ce3d 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -63,8 +63,6 @@ /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; - static const unsigned short awHWRetry0[5][5] = { {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M}, {RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M}, @@ -117,7 +115,7 @@ BSSpSearchBSSList( CARD_PHY_TYPE ePhyType ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned char *pbyBSSID = NULL; PWLAN_IE_SSID pSSID = NULL; @@ -127,8 +125,7 @@ BSSpSearchBSSList( unsigned int ii = 0; if (pbyDesireBSSID != NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID); + pr_debug("BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID); if ((!is_broadcast_ether_addr(pbyDesireBSSID)) && (memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)) pbyBSSID = pbyDesireBSSID; @@ -194,7 +191,9 @@ BSSpSearchBSSList( ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ) { /* Type not match skip this BSS */ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo); + pr_debug("BSS type mismatch.... Config[%d] BSS[0x%04x]\n", + pMgmt->eConfigMode, + pCurrBSS->wCapInfo); continue; } @@ -202,7 +201,9 @@ BSSpSearchBSSList( if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) || ((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) { /* PhyType not match skip this BSS */ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse); + pr_debug("Physical type mismatch.... ePhyType[%d] BSS[%d]\n", + ePhyType, + pCurrBSS->eNetworkTypeInUse); continue; } } @@ -240,7 +241,7 @@ BSSvClearBSSList( bool bKeepCurrBSSID ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int ii; @@ -280,7 +281,7 @@ BSSpAddrIsInBSSList( PWLAN_IE_SSID pSSID ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; PKnownBSS pBSSList = NULL; unsigned int ii; @@ -316,7 +317,7 @@ bool BSSbInsertToBSSList( void *hDeviceContext, unsigned char *abyBSSIDAddr, - QWORD qwTimestamp, + __le64 qwTimestamp, unsigned short wBeaconInterval, unsigned short wCapInfo, unsigned char byCurrChannel, @@ -333,7 +334,7 @@ BSSbInsertToBSSList( void *pRxPacketContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext; PKnownBSS pBSSList = NULL; @@ -350,14 +351,13 @@ BSSbInsertToBSSList( } if (ii == MAX_BSS_NUM) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n"); + pr_debug("Get free KnowBSS node failed\n"); return false; } /* 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; @@ -376,7 +376,8 @@ BSSbInsertToBSSList( if (pExtSuppRates->len > WLAN_RATES_MAXLEN) pExtSuppRates->len = WLAN_RATES_MAXLEN; memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSbInsertToBSSList: pExtSuppRates->len = %d\n", pExtSuppRates->len); + pr_debug("BSSbInsertToBSSList: pExtSuppRates->len = %d\n", + pExtSuppRates->len); } else { memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); @@ -521,7 +522,7 @@ BSSbInsertToBSSList( bool BSSbUpdateToBSSList( void *hDeviceContext, - QWORD qwTimestamp, + __le64 qwTimestamp, unsigned short wBeaconInterval, unsigned short wCapInfo, unsigned char byCurrChannel, @@ -541,7 +542,7 @@ BSSbUpdateToBSSList( ) { int ii; - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext; long ldBm; @@ -551,8 +552,7 @@ BSSbUpdateToBSSList( 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; @@ -717,7 +717,7 @@ BSSDBbIsSTAInNodeDB(void *pMgmtObject, unsigned char *abyDstAddr, void BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int ii; unsigned int BigestCount = 0; @@ -742,7 +742,7 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) /* if not found replace uInActiveCount is largest one */ if (ii == (MAX_NODE_NUM + 1)) { *puNodeIndex = SelectIndex; - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Replace inactive node = %d\n", SelectIndex); + pr_info("Replace inactive node = %d\n", SelectIndex); /* clear ps buffer */ if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) { while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL) @@ -759,7 +759,7 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue); pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0; pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii); + pr_debug("Create node index = %d\n", ii); return; }; @@ -779,7 +779,7 @@ BSSvRemoveOneNode( unsigned int uNodeIndex ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; struct sk_buff *skb; @@ -812,7 +812,7 @@ BSSvUpdateAPNode( PWLAN_IE_SUPP_RATES pExtSuppRates ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int uRateLen = WLAN_RATES_MAXLEN; @@ -844,7 +844,8 @@ BSSvUpdateAPNode( netdev_dbg(pDevice->dev, "BSSvUpdateAPNode:MaxSuppRate is %d\n", pMgmt->sNodeDBTable[0].wMaxSuppRate); /* auto rate fallback function initiation */ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); + pr_debug("pMgmt->sNodeDBTable[0].wTxDataRate = %d\n", + pMgmt->sNodeDBTable[0].wTxDataRate); }; /*+ @@ -863,7 +864,7 @@ BSSvAddMulticastNode( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; if (!pDevice->bEnableHostWEP) @@ -906,7 +907,7 @@ BSSvSecondCallBack( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int ii; PWLAN_IE_SSID pItemSSID, pCurrSSID; @@ -961,8 +962,8 @@ BSSvSecondCallBack( if (ii > 0) { if (pMgmt->sNodeDBTable[ii].uInActiveCount > MAX_INACTIVE_COUNT) { BSSvRemoveOneNode(pDevice, ii); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Inactive timeout [%d] sec, STA index = [%d] remove\n", MAX_INACTIVE_COUNT, ii); + pr_debug("Inactive timeout [%d] sec, STA index = [%d] remove\n", + MAX_INACTIVE_COUNT, ii); continue; } @@ -1012,11 +1013,13 @@ BSSvSecondCallBack( /* check if pending PS queue */ if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending\n", - ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); + pr_debug("Index= %d, Queue = %d pending\n", + ii, + pMgmt->sNodeDBTable[ii].wEnQueueCnt); if ((ii > 0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) { BSSvRemoveOneNode(pDevice, ii); - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove\n", ii); + pr_info("Pending many queues PS STA Index = %d remove\n", + ii); continue; } } @@ -1100,7 +1103,8 @@ BSSvSecondCallBack( netif_stop_queue(pDevice->dev); pDevice->bLinkPass = false; pDevice->bRoaming = true; - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount); + pr_info("Lost AP beacon [%d] sec, disconnected !\n", + pMgmt->sNodeDBTable[0].uInActiveCount); if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) { wpahdr = (viawget_wpa_header *)pDevice->skb->data; wpahdr->type = VIAWGET_DISASSOC_MSG; @@ -1145,7 +1149,7 @@ BSSvSecondCallBack( if (pDevice->bWPADEVUp) pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n"); + pr_debug("Roaming ...\n"); BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); pMgmt->eScanType = WMAC_SCAN_ACTIVE; bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); @@ -1161,7 +1165,7 @@ BSSvSecondCallBack( if (pDevice->uAutoReConnectTime < 10) { pDevice->uAutoReConnectTime++; } else { - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scanning ...\n"); + pr_info("Adhoc re-scanning ...\n"); pMgmt->eScanType = WMAC_SCAN_ACTIVE; bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL); @@ -1172,7 +1176,8 @@ BSSvSecondCallBack( if (pDevice->bUpdateBBVGA) s_vCheckPreEDThreshold((void *)pDevice); if (pMgmt->sNodeDBTable[0].uInActiveCount >= ADHOC_LOST_BEACON_COUNT) { - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount); + pr_info("Lost other STA beacon [%d] sec, started !\n", + pMgmt->sNodeDBTable[0].uInActiveCount); pMgmt->sNodeDBTable[0].uInActiveCount = 0; pMgmt->eCurrState = WMAC_STATE_STARTED; netif_stop_queue(pDevice->dev); @@ -1209,7 +1214,7 @@ BSSvUpdateNodeTxCounter( unsigned int uFIFOHeaderSize ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int uNodeIndex = 0; unsigned char byTxRetry = (byTsr0 & TSR0_NCR); @@ -1231,7 +1236,8 @@ BSSvUpdateNodeTxCounter( /* Only Unicast using support rates */ if (pTxBufHead->wFIFOCtl & FIFOCTL_NEEDACK) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wRate %04X, byTsr0 %02X, byTsr1 %02X\n", wRate, byTsr0, byTsr1); + pr_debug("wRate %04X, byTsr0 %02X, byTsr1 %02X\n", + wRate, byTsr0, byTsr1); if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { pMgmt->sNodeDBTable[0].uTxAttempts += 1; if ((byTsr1 & TSR1_TERR) == 0) { @@ -1362,7 +1368,7 @@ BSSvClearNodeDBTable( ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; struct sk_buff *skb; unsigned int ii; @@ -1372,7 +1378,7 @@ BSSvClearNodeDBTable( /* check if sTxPSQueue has been initial */ if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next != NULL) { while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii); + pr_debug("PS skb != NULL %d\n", ii); dev_kfree_skb(skb); } } @@ -1387,7 +1393,7 @@ void s_vCheckSensitivity( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PKnownBSS pBSSList = NULL; PSMgmtObject pMgmt = pDevice->pMgmt; int ii; @@ -1414,7 +1420,10 @@ void s_vCheckSensitivity( if (uNumofdBm > 0) { LocalldBmAverage = LocalldBmAverage/uNumofdBm; for (ii = 0; ii < BB_VGA_LEVEL; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LocalldBmAverage:%ld, %ld %02x\n", LocalldBmAverage, pDevice->ldBmThreshold[ii], pDevice->abyBBVGA[ii]); + pr_debug("LocalldBmAverage:%ld, %ld %02x\n", + LocalldBmAverage, + pDevice->ldBmThreshold[ii], + pDevice->abyBBVGA[ii]); if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) { pDevice->byBBVGANew = pDevice->abyBBVGA[ii]; break; @@ -1437,7 +1446,7 @@ BSSvClearAnyBSSJoinRecord( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int ii; @@ -1450,7 +1459,7 @@ void s_uCalculateLinkQual( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; unsigned long TxOkRatio, TxCnt; unsigned long RxOkRatio, RxCnt; unsigned long RssiRatio; @@ -1490,7 +1499,7 @@ void s_vCheckPreEDThreshold( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PKnownBSS pBSSList = NULL; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); diff --git a/drivers/staging/vt6655/bssdb.h b/drivers/staging/vt6655/bssdb.h index bf299e3b8acf..5d4dd28b6223 100644 --- a/drivers/staging/vt6655/bssdb.h +++ b/drivers/staging/vt6655/bssdb.h @@ -131,8 +131,8 @@ typedef struct tagKnownBSS { unsigned int uClearCount; unsigned int uIELength; - QWORD qwBSSTimestamp; - QWORD qwLocalTSF; + u64 qwBSSTimestamp; + u64 qwLocalTSF; CARD_PHY_TYPE eNetworkTypeInUse; @@ -233,7 +233,7 @@ bool BSSbInsertToBSSList( void *hDeviceContext, unsigned char *abyBSSIDAddr, - QWORD qwTimestamp, + __le64 qwTimestamp, unsigned short wBeaconInterval, unsigned short wCapInfo, unsigned char byCurrChannel, @@ -253,7 +253,7 @@ BSSbInsertToBSSList( bool BSSbUpdateToBSSList( void *hDeviceContext, - QWORD qwTimestamp, + __le64 qwTimestamp, unsigned short wBeaconInterval, unsigned short wCapInfo, unsigned char byCurrChannel, diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index 4ae8d9362edf..5a6950264bdc 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -59,8 +59,6 @@ /*--------------------- Static Definitions -------------------------*/ -static int msglevel = MSG_LEVEL_INFO; - #define C_SIFS_A 16 // micro sec. #define C_SIFS_BG 10 @@ -224,59 +222,54 @@ s_vCalculateOFDMRParameter( */ static void -s_vSetRSPINF(PSDevice pDevice, CARD_PHY_TYPE ePHYType, void *pvSupportRateIEs, void *pvExtSupportRateIEs) +s_vSetRSPINF(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType, + void *pvSupportRateIEs, void *pvExtSupportRateIEs) { - unsigned char byServ = 0, bySignal = 0; // For CCK - unsigned short wLen = 0; + union vnt_phy_field_swap phy; unsigned char byTxRate = 0, byRsvTime = 0; // For OFDM //Set to Page1 MACvSelectPage1(pDevice->PortOffset); - //RSPINF_b_1 - BBvCalculateParameter(pDevice, - 14, - VNTWIFIbyGetACKTxRate(RATE_1M, pvSupportRateIEs, pvExtSupportRateIEs), - PK_TYPE_11B, - &wLen, - &byServ, - &bySignal -); + /* RSPINF_b_1 */ + vnt_get_phy_field(pDevice, + 14, + VNTWIFIbyGetACKTxRate(RATE_1M, pvSupportRateIEs, pvExtSupportRateIEs), + PK_TYPE_11B, + &phy.field_read); - VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ))); - ///RSPINF_b_2 - BBvCalculateParameter(pDevice, - 14, - VNTWIFIbyGetACKTxRate(RATE_2M, pvSupportRateIEs, pvExtSupportRateIEs), - PK_TYPE_11B, - &wLen, - &byServ, - &bySignal -); + /* swap over to get correct write order */ + swap(phy.swap[0], phy.swap[1]); - VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ))); - //RSPINF_b_5 - BBvCalculateParameter(pDevice, - 14, - VNTWIFIbyGetACKTxRate(RATE_5M, pvSupportRateIEs, pvExtSupportRateIEs), - PK_TYPE_11B, - &wLen, - &byServ, - &bySignal -); + VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, phy.field_write); - VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ))); - //RSPINF_b_11 - BBvCalculateParameter(pDevice, - 14, - VNTWIFIbyGetACKTxRate(RATE_11M, pvSupportRateIEs, pvExtSupportRateIEs), - PK_TYPE_11B, - &wLen, - &byServ, - &bySignal -); + /* RSPINF_b_2 */ + vnt_get_phy_field(pDevice, 14, + VNTWIFIbyGetACKTxRate(RATE_2M, pvSupportRateIEs, pvExtSupportRateIEs), + PK_TYPE_11B, &phy.field_read); + + swap(phy.swap[0], phy.swap[1]); + + VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, phy.field_write); + + /* RSPINF_b_5 */ + vnt_get_phy_field(pDevice, 14, + VNTWIFIbyGetACKTxRate(RATE_5M, pvSupportRateIEs, pvExtSupportRateIEs), + PK_TYPE_11B, &phy.field_read); + + swap(phy.swap[0], phy.swap[1]); + + VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, phy.field_write); + + /* RSPINF_b_11 */ + vnt_get_phy_field(pDevice, 14, + VNTWIFIbyGetACKTxRate(RATE_11M, pvSupportRateIEs, pvExtSupportRateIEs), + PK_TYPE_11B, &phy.field_read); + + swap(phy.swap[0], phy.swap[1]); + + VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, phy.field_write); - VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ))); //RSPINF_a_6 s_vCalculateOFDMRParameter(RATE_6M, ePHYType, @@ -348,9 +341,8 @@ s_vSetRSPINF(PSDevice pDevice, CARD_PHY_TYPE ePHYType, void *pvSupportRateIEs, v * Return Value: true if short preamble; otherwise false * */ -bool CARDbIsShortPreamble(void *pDeviceHandler) +bool CARDbIsShortPreamble(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; if (pDevice->byPreambleType == 0) return false; @@ -370,9 +362,8 @@ bool CARDbIsShortPreamble(void *pDeviceHandler) * Return Value: true if short slot time; otherwise false * */ -bool CARDbIsShorSlotTime(void *pDeviceHandler) +bool CARDbIsShorSlotTime(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; return pDevice->bShortSlotTime; } @@ -389,9 +380,10 @@ bool CARDbIsShorSlotTime(void *pDeviceHandler) * Return Value: None. * */ -bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs) +bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType, + unsigned short wCapInfo, unsigned char byERPField, + void *pvSupportRateIEs, void *pvExtSupportRateIEs) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned char byCWMaxMin = 0; unsigned char bySlot = 0; unsigned char bySIFS = 0; @@ -573,21 +565,17 @@ bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned * Return Value: none * */ -bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF) +bool CARDbUpdateTSF(struct vnt_private *pDevice, 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; @@ -607,40 +595,21 @@ bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTim * Return Value: true if succeed; otherwise false * */ -bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval) +bool CARDbSetBeaconPeriod(struct vnt_private *pDevice, + unsigned short wBeaconInterval) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - unsigned int uBeaconInterval = 0; - unsigned int uLowNextTBTT = 0; - unsigned int uHighRemain = 0; - unsigned int uLowRemain = 0; - QWORD qwNextTBTT; - - HIDWORD(qwNextTBTT) = 0; - LODWORD(qwNextTBTT) = 0; + u64 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; - uLowRemain = (uLowNextTBTT) % uBeaconInterval; - // high dword (mod) bcn - uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwNextTBTT)) - % uBeaconInterval; - uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval; - uLowRemain = uBeaconInterval - uLowRemain; - - // check if carry when add one beacon interval - if ((~uLowNextTBTT) < uLowRemain) - HIDWORD(qwNextTBTT)++; - - LODWORD(qwNextTBTT) = uLowNextTBTT + uLowRemain; + + qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); // 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; @@ -659,9 +628,8 @@ bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval) * Return Value: true if all data packet complete; otherwise false. * */ -bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType) +bool CARDbStopTxPacket(struct vnt_private *pDevice, CARD_PKT_TYPE ePktType) { - PSDevice pDevice = (PSDevice) pDeviceHandler; if (ePktType == PKT_TYPE_802_11_ALL) { pDevice->bStopBeacon = true; @@ -713,9 +681,8 @@ bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType) * Return Value: true if success; false if failed. * */ -bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType) +bool CARDbStartTxPacket(struct vnt_private *pDevice, CARD_PKT_TYPE ePktType) { - PSDevice pDevice = (PSDevice) pDeviceHandler; if (ePktType == PKT_TYPE_802_11_ALL) { pDevice->bStopBeacon = false; @@ -731,7 +698,7 @@ bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType) if ((pDevice->bStopBeacon == false) && (pDevice->bBeaconBufReady == true) && - (pDevice->eOPMode == OP_MODE_ADHOC)) { + (pDevice->op_mode == NL80211_IFTYPE_ADHOC)) { MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX); } @@ -752,37 +719,37 @@ bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType) * Return Value: true if success; false if failed. * */ -bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE eOPMode) +bool CARDbSetBSSID(struct vnt_private *pDevice, + unsigned char *pbyBSSID, enum nl80211_iftype op_mode) { - PSDevice pDevice = (PSDevice) pDeviceHandler; MACvWriteBSSIDAddress(pDevice->PortOffset, pbyBSSID); memcpy(pDevice->abyBSSID, pbyBSSID, WLAN_BSSID_LEN); - if (eOPMode == OP_MODE_ADHOC) + if (op_mode == NL80211_IFTYPE_ADHOC) MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_ADHOC); else MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_ADHOC); - if (eOPMode == OP_MODE_AP) + if (op_mode == NL80211_IFTYPE_AP) MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_AP); else MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_AP); - if (eOPMode == OP_MODE_UNKNOWN) { + if (op_mode == NL80211_IFTYPE_UNSPECIFIED) { MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID); pDevice->bBSSIDFilter = false; pDevice->byRxMode &= ~RCR_BSSID; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode); + pr_debug("wcmd: rx_mode = %x\n", pDevice->byRxMode); } else { if (is_zero_ether_addr(pDevice->abyBSSID) == false) { MACvRegBitsOn(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID); pDevice->bBSSIDFilter = true; pDevice->byRxMode |= RCR_BSSID; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: rx_mode = %x\n", pDevice->byRxMode); + pr_debug("wmgr: rx_mode = %x\n", pDevice->byRxMode); } // Adopt BSS state in Adapter Device Object - pDevice->eOPMode = eOPMode; + pDevice->op_mode = op_mode; return true; } @@ -818,11 +785,10 @@ bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE e * */ bool CARDbSetTxDataRate( - void *pDeviceHandler, + struct vnt_private *pDevice, unsigned short wDataRate ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; pDevice->wCurrentRate = wDataRate; return true; @@ -844,10 +810,9 @@ bool CARDbSetTxDataRate( -*/ bool CARDbPowerDown( - void *pDeviceHandler + struct vnt_private *pDevice ) { - PSDevice pDevice = (PSDevice)pDeviceHandler; unsigned int uIdx; // check if already in Doze mode @@ -865,7 +830,7 @@ CARDbPowerDown( } MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n"); + pr_debug("Go to Doze ZZZZZZZZZZZZZZZ\n"); return true; } @@ -881,9 +846,8 @@ CARDbPowerDown( * Return Value: true if success; otherwise false * */ -bool CARDbRadioPowerOff(void *pDeviceHandler) +bool CARDbRadioPowerOff(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)pDeviceHandler; bool bResult = true; if (pDevice->bRadioOff == true) @@ -927,9 +891,8 @@ bool CARDbRadioPowerOff(void *pDeviceHandler) * Return Value: true if success; otherwise false * */ -bool CARDbRadioPowerOn(void *pDeviceHandler) +bool CARDbRadioPowerOn(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; bool bResult = true; pr_debug("chester power on\n"); @@ -970,9 +933,8 @@ bool CARDbRadioPowerOn(void *pDeviceHandler) return bResult; } -bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID) +bool CARDbRemoveKey(struct vnt_private *pDevice, unsigned char *pbyBSSID) { - PSDevice pDevice = (PSDevice) pDeviceHandler; KeybRemoveAllKey(&(pDevice->sKey), pbyBSSID, pDevice->PortOffset); return true; @@ -996,27 +958,27 @@ bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID) -*/ bool CARDbAdd_PMKID_Candidate( - void *pDeviceHandler, + struct vnt_private *pDevice, unsigned char *pbyBSSID, bool bRSNCapExist, unsigned short wRSNCap ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; struct pmkid_candidate *pCandidateList; unsigned int ii = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + pr_debug("bAdd_PMKID_Candidate START: (%d)\n", + (int)pDevice->gsPMKIDCandidate.NumCandidates); if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFlush_PMKID_Candidate: 3\n"); + pr_debug("vFlush_PMKID_Candidate: 3\n"); memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent)); } for (ii = 0; ii < 6; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02X ", *(pbyBSSID + ii)); + pr_debug("%02X ", *(pbyBSSID + ii)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n"); + pr_debug("\n"); // Update Old Candidate for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { @@ -1040,16 +1002,16 @@ CARDbAdd_PMKID_Candidate( memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN); pDevice->gsPMKIDCandidate.NumCandidates++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + pr_debug("NumCandidates:%d\n", + (int)pDevice->gsPMKIDCandidate.NumCandidates); return true; } void * CARDpGetCurrentAddress( - void *pDeviceHandler + struct vnt_private *pDevice ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; return pDevice->abyCurrentNetAddr; } @@ -1070,15 +1032,14 @@ CARDpGetCurrentAddress( -*/ bool CARDbStartMeasure( - void *pDeviceHandler, + struct vnt_private *pDevice, void *pvMeasureEIDs, unsigned int uNumOfMeasureEIDs ) { - 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; @@ -1109,32 +1070,22 @@ CARDbStartMeasure( 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; } @@ -1161,8 +1112,8 @@ CARDbStartMeasure( 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); @@ -1196,13 +1147,12 @@ CARDbStartMeasure( -*/ bool CARDbChannelSwitch( - void *pDeviceHandler, + struct vnt_private *pDevice, unsigned char byMode, unsigned char byNewChannel, unsigned char byCount ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; bool bResult = true; if (byCount == 0) { @@ -1238,7 +1188,7 @@ CARDbChannelSwitch( -*/ bool CARDbSetQuiet( - void *pDeviceHandler, + struct vnt_private *pDevice, bool bResetQuiet, unsigned char byQuietCount, unsigned char byQuietPeriod, @@ -1246,7 +1196,6 @@ CARDbSetQuiet( unsigned short wQuietOffset ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int ii = 0; if (bResetQuiet) { @@ -1291,10 +1240,9 @@ CARDbSetQuiet( -*/ bool CARDbStartQuiet( - void *pDeviceHandler + struct vnt_private *pDevice ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int ii = 0; unsigned long dwStartTime = 0xFFFFFFFF; unsigned int uCurrentQuietIndex = 0; @@ -1391,12 +1339,11 @@ CARDbStartQuiet( -*/ void CARDvSetPowerConstraint( - void *pDeviceHandler, + struct vnt_private *pDevice, unsigned char byChannel, char byPower ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; if (byChannel > CB_MAX_CHANNEL_24G) { if (pDevice->bCountryInfo5G == true) @@ -1425,12 +1372,11 @@ CARDvSetPowerConstraint( -*/ void CARDvGetPowerCapability( - void *pDeviceHandler, + struct vnt_private *pDevice, unsigned char *pbyMinPower, unsigned char *pbyMaxPower ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned char byDec = 0; *pbyMaxPower = pDevice->abyOFDMDefaultPwr[pDevice->byCurrentCh]; @@ -1460,10 +1406,9 @@ CARDvGetPowerCapability( */ char CARDbyGetTransmitPower( - void *pDeviceHandler + struct vnt_private *pDevice ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; return pDevice->byCurPwrdBm; } @@ -1471,10 +1416,9 @@ CARDbyGetTransmitPower( //xxx void CARDvSafeResetTx( - void *pDeviceHandler + struct vnt_private *pDevice ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int uu; PSTxDesc pCurrTD; @@ -1524,10 +1468,9 @@ CARDvSafeResetTx( -*/ void CARDvSafeResetRx( - void *pDeviceHandler + struct vnt_private *pDevice ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int uu; PSRxDesc pDesc; @@ -1578,9 +1521,9 @@ CARDvSafeResetRx( * Return Value: response Control frame rate * */ -static unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRateIdx) +static unsigned short CARDwGetCCKControlRate(struct vnt_private *pDevice, + unsigned short wRateIdx) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int ui = (unsigned int) wRateIdx; while (ui > RATE_1M) { @@ -1605,27 +1548,27 @@ static unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned shor * Return Value: response Control frame rate * */ -static unsigned short CARDwGetOFDMControlRate(void *pDeviceHandler, unsigned short wRateIdx) +static unsigned short CARDwGetOFDMControlRate(struct vnt_private *pDevice, + unsigned short wRateIdx) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int ui = (unsigned int) wRateIdx; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BASIC RATE: %X\n", pDevice->wBasicRate); + pr_debug("BASIC RATE: %X\n", pDevice->wBasicRate); if (!CARDbIsOFDMinBasicRate((void *)pDevice)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); + pr_debug("CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); if (wRateIdx > RATE_24M) wRateIdx = RATE_24M; return wRateIdx; } while (ui > RATE_11M) { if (pDevice->wBasicRate & ((unsigned short)1 << ui)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDwGetOFDMControlRate : %d\n", ui); + pr_debug("CARDwGetOFDMControlRate : %d\n", ui); return (unsigned short)ui; } ui--; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDwGetOFDMControlRate: 6M\n"); + pr_debug("CARDwGetOFDMControlRate: 6M\n"); return (unsigned short)RATE_24M; } @@ -1641,60 +1584,51 @@ static unsigned short CARDwGetOFDMControlRate(void *pDeviceHandler, unsigned sho * Return Value: None. * */ -void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType) +void CARDvSetRSPINF(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - unsigned char byServ = 0x00, bySignal = 0x00; //For CCK - unsigned short wLen = 0x0000; + union vnt_phy_field_swap phy; unsigned char byTxRate, byRsvTime; //For OFDM //Set to Page1 MACvSelectPage1(pDevice->PortOffset); - //RSPINF_b_1 - BBvCalculateParameter(pDevice, - 14, - CARDwGetCCKControlRate((void *)pDevice, RATE_1M), - PK_TYPE_11B, - &wLen, - &byServ, - &bySignal -); + /* RSPINF_b_1 */ + vnt_get_phy_field(pDevice, 14, + CARDwGetCCKControlRate(pDevice, RATE_1M), + PK_TYPE_11B, &phy.field_read); - VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ))); - ///RSPINF_b_2 - BBvCalculateParameter(pDevice, - 14, - CARDwGetCCKControlRate((void *)pDevice, RATE_2M), - PK_TYPE_11B, - &wLen, - &byServ, - &bySignal -); + /* swap over to get correct write order */ + swap(phy.swap[0], phy.swap[1]); - VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ))); - //RSPINF_b_5 - BBvCalculateParameter(pDevice, - 14, - CARDwGetCCKControlRate((void *)pDevice, RATE_5M), - PK_TYPE_11B, - &wLen, - &byServ, - &bySignal -); + VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, phy.field_write); - VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ))); - //RSPINF_b_11 - BBvCalculateParameter(pDevice, - 14, - CARDwGetCCKControlRate((void *)pDevice, RATE_11M), - PK_TYPE_11B, - &wLen, - &byServ, - &bySignal -); + /* RSPINF_b_2 */ + vnt_get_phy_field(pDevice, 14, + CARDwGetCCKControlRate(pDevice, RATE_2M), + PK_TYPE_11B, &phy.field_read); + + swap(phy.swap[0], phy.swap[1]); + + VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, phy.field_write); + + /* RSPINF_b_5 */ + vnt_get_phy_field(pDevice, 14, + CARDwGetCCKControlRate(pDevice, RATE_5M), + PK_TYPE_11B, &phy.field_read); + + swap(phy.swap[0], phy.swap[1]); + + VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, phy.field_write); + + /* RSPINF_b_11 */ + vnt_get_phy_field(pDevice, 14, + CARDwGetCCKControlRate(pDevice, RATE_11M), + PK_TYPE_11B, &phy.field_read); + + swap(phy.swap[0], phy.swap[1]); + + VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, phy.field_write); - VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ))); //RSPINF_a_6 s_vCalculateOFDMRParameter(RATE_6M, ePHYType, @@ -1766,10 +1700,9 @@ void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType) * Return Value: None. * */ -void vUpdateIFS(void *pDeviceHandler) +void vUpdateIFS(struct vnt_private *pDevice) { - //Set SIFS, DIFS, EIFS, SlotTime, CwMin - PSDevice pDevice = (PSDevice) pDeviceHandler; + /* Set SIFS, DIFS, EIFS, SlotTime, CwMin */ unsigned char byMaxMin = 0; @@ -1818,9 +1751,8 @@ void vUpdateIFS(void *pDeviceHandler) VNSvOutPortB(pDevice->PortOffset + MAC_REG_CWMAXMIN0, (unsigned char)byMaxMin); } -void CARDvUpdateBasicTopRate(void *pDeviceHandler) +void CARDvUpdateBasicTopRate(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned char byTopOFDM = RATE_24M, byTopCCK = RATE_1M; unsigned char ii; @@ -1844,9 +1776,8 @@ void CARDvUpdateBasicTopRate(void *pDeviceHandler) pDevice->byTopCCKBasicRate = byTopCCK; } -bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx) +bool CARDbAddBasicRate(struct vnt_private *pDevice, unsigned short wRateIdx) { - PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned short wRate = (unsigned short)(1<<wRateIdx); pDevice->wBasicRate |= wRate; @@ -1857,9 +1788,8 @@ bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx) return true; } -bool CARDbIsOFDMinBasicRate(void *pDeviceHandler) +bool CARDbIsOFDMinBasicRate(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)pDeviceHandler; int ii; for (ii = RATE_54M; ii >= RATE_6M; ii--) { @@ -1869,9 +1799,8 @@ bool CARDbIsOFDMinBasicRate(void *pDeviceHandler) return false; } -unsigned char CARDbyGetPktType(void *pDeviceHandler) +unsigned char CARDbyGetPktType(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) return (unsigned char)pDevice->byBBType; @@ -1922,9 +1851,8 @@ void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode) * Return Value: none * */ -bool CARDbSoftwareReset(void *pDeviceHandler) +bool CARDbSoftwareReset(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; // reset MAC if (!MACbSafeSoftwareReset(pDevice->PortOffset)) @@ -1948,25 +1876,17 @@ bool CARDbSoftwareReset(void *pDeviceHandler) * 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; } @@ -1983,7 +1903,7 @@ QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2) * 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; @@ -1996,8 +1916,8 @@ bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF) } 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; } @@ -2016,28 +1936,20 @@ bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF) * 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; - unsigned int uBeaconInterval; - - uBeaconInterval = wBeaconInterval * 1024; - // Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval - uLowNextTBTT = (LODWORD(qwTSF) >> 10) << 10; - // low dword (mod) bcn - uLowRemain = (uLowNextTBTT) % uBeaconInterval; - // high dword (mod) bcn - uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwTSF)) - % uBeaconInterval; - uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval; - uLowRemain = uBeaconInterval - uLowRemain; - - // check if carry when add one beacon interval - if ((~uLowNextTBTT) < uLowRemain) - HIDWORD(qwTSF)++; - - LODWORD(qwTSF) = uLowNextTBTT + uLowRemain; + u32 beacon_int; + + beacon_int = wBeaconInterval * 1024; + + /* Next TBTT = + * ((local_current_TSF / beacon_interval) + 1) * beacon_interval + */ + if (beacon_int) { + do_div(qwTSF, beacon_int); + qwTSF += 1; + qwTSF *= beacon_int; + } return qwTSF; } @@ -2058,15 +1970,14 @@ QWORD CARDqGetNextTBTT(QWORD qwTSF, 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 + 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); } @@ -2085,13 +1996,12 @@ void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterva * 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)); + pr_debug("Card:Update Next TBTT[%8llx]\n", qwTSF); } diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h index 2f1a05ef44a1..96f5b6c46e82 100644 --- a/drivers/staging/vt6655/card.h +++ b/drivers/staging/vt6655/card.h @@ -31,6 +31,7 @@ #include "ttype.h" #include <linux/types.h> +#include <linux/nl80211.h> // // Loopback mode @@ -70,56 +71,48 @@ typedef enum _CARD_STATUS_TYPE { CARD_STATUS_PMKID } CARD_STATUS_TYPE, *PCARD_STATUS_TYPE; -typedef enum _CARD_OP_MODE { - OP_MODE_INFRASTRUCTURE, - OP_MODE_ADHOC, - OP_MODE_AP, - OP_MODE_UNKNOWN -} CARD_OP_MODE, *PCARD_OP_MODE; - -void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType); -void vUpdateIFS(void *pDeviceHandler); -void CARDvUpdateBasicTopRate(void *pDeviceHandler); -bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx); -bool CARDbIsOFDMinBasicRate(void *pDeviceHandler); +struct vnt_private; + +void CARDvSetRSPINF(struct vnt_private *, CARD_PHY_TYPE ePHYType); +void vUpdateIFS(struct vnt_private *); +void CARDvUpdateBasicTopRate(struct vnt_private *); +bool CARDbAddBasicRate(struct vnt_private *, unsigned short wRateIdx); +bool CARDbIsOFDMinBasicRate(struct vnt_private *); void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode); -bool CARDbSoftwareReset(void *pDeviceHandler); +bool CARDbSoftwareReset(struct vnt_private *); 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); -bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower); -unsigned char CARDbyGetPktType(void *pDeviceHandler); -void CARDvSafeResetTx(void *pDeviceHandler); -void CARDvSafeResetRx(void *pDeviceHandler); - -bool CARDbRadioPowerOff(void *pDeviceHandler); -bool CARDbRadioPowerOn(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 CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType); -bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType); -bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval); -bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE eOPMode); - -bool -CARDbPowerDown( - void *pDeviceHandler -); - -bool CARDbSetTxDataRate( - void *pDeviceHandler, - unsigned short wDataRate -); - -bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID); +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(struct vnt_private *, unsigned long ulTxPower); +unsigned char CARDbyGetPktType(struct vnt_private *); +void CARDvSafeResetTx(struct vnt_private *); +void CARDvSafeResetRx(struct vnt_private *); +bool CARDbRadioPowerOff(struct vnt_private *); +bool CARDbRadioPowerOn(struct vnt_private *); +bool CARDbIsShortPreamble(struct vnt_private *); +bool CARDbIsShorSlotTime(struct vnt_private *); +bool CARDbSetPhyParameter(struct vnt_private *, CARD_PHY_TYPE ePHYType, + unsigned short wCapInfo, unsigned char byERPField, + void *pvSupportRateIEs, void *pvExtSupportRateIEs); +bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate, + u64 qwBSSTimestamp, u64 qwLocalTSF); +bool CARDbStopTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType); +bool CARDbStartTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType); +bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval); +bool CARDbSetBSSID(struct vnt_private *, + unsigned char *pbyBSSID, enum nl80211_iftype); + +bool CARDbPowerDown(struct vnt_private *); + +bool CARDbSetTxDataRate(struct vnt_private *, unsigned short wDataRate); + +bool CARDbRemoveKey(struct vnt_private *, unsigned char *pbyBSSID); bool CARDbAdd_PMKID_Candidate( - void *pDeviceHandler, + struct vnt_private *, unsigned char *pbyBSSID, bool bRSNCapExist, unsigned short wRSNCap @@ -127,19 +120,19 @@ CARDbAdd_PMKID_Candidate( void * CARDpGetCurrentAddress( - void *pDeviceHandler + struct vnt_private * ); bool CARDbStartMeasure( - void *pDeviceHandler, + struct vnt_private *, void *pvMeasureEIDs, unsigned int uNumOfMeasureEIDs ); bool CARDbChannelSwitch( - void *pDeviceHandler, + struct vnt_private *, unsigned char byMode, unsigned char byNewChannel, unsigned char byCount @@ -147,7 +140,7 @@ CARDbChannelSwitch( bool CARDbSetQuiet( - void *pDeviceHandler, + struct vnt_private *, bool bResetQuiet, unsigned char byQuietCount, unsigned char byQuietPeriod, @@ -157,26 +150,26 @@ CARDbSetQuiet( bool CARDbStartQuiet( - void *pDeviceHandler + struct vnt_private * ); void CARDvSetPowerConstraint( - void *pDeviceHandler, + struct vnt_private *, unsigned char byChannel, char byPower ); void CARDvGetPowerCapability( - void *pDeviceHandler, + struct vnt_private *, unsigned char *pbyMinPower, unsigned char *pbyMaxPower ); char CARDbyGetTransmitPower( - void *pDeviceHandler + struct vnt_private * ); #endif // __CARD_H__ diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c index d5b89b7aaf23..4ce964ba14b7 100644 --- a/drivers/staging/vt6655/channel.c +++ b/drivers/staging/vt6655/channel.c @@ -30,8 +30,6 @@ #define CARD_MAX_CHANNEL_TBL 56 -static int msglevel = MSG_LEVEL_INFO; - /*--------------------- Static Variables --------------------------*/ static SChannelTblElement sChannelTbl[CARD_MAX_CHANNEL_TBL + 1] = @@ -416,7 +414,7 @@ bool channel_get_list(unsigned int uCountryCodeIdx, unsigned char *pbyChannelTab void init_channel_table(void *pDeviceHandler) { - PSDevice pDevice = (PSDevice) pDeviceHandler; + struct vnt_private *pDevice = pDeviceHandler; bool bMultiBand = false; unsigned int ii; @@ -480,7 +478,10 @@ void init_channel_table(void *pDeviceHandler) } } - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Zone=[%d][%c][%c]!!\n", pDevice->byZoneType, ChannelRuleTab[pDevice->byZoneType].chCountryCode[0], ChannelRuleTab[pDevice->byZoneType].chCountryCode[1]); + pr_info("Zone=[%d][%c][%c]!!\n", + pDevice->byZoneType, + ChannelRuleTab[pDevice->byZoneType].chCountryCode[0], + ChannelRuleTab[pDevice->byZoneType].chCountryCode[1]); for (ii = 0; ii < CARD_MAX_CHANNEL_TBL; ii++) { if (pDevice->abyRegPwr[ii + 1] == 0) @@ -521,7 +522,7 @@ unsigned char get_channel_number(void *pDeviceHandler, unsigned char byChannelIn */ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel) { - PSDevice pDevice = (PSDevice) pDeviceHandler; + struct vnt_private *pDevice = pDeviceHandler; bool bResult = true; if (pDevice->byCurrentCh == uConnectionChannel) @@ -583,7 +584,7 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel) void set_country_info(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, void *pIE) { - PSDevice pDevice = (PSDevice) pDeviceHandler; + struct vnt_private *pDevice = pDeviceHandler; unsigned int ii = 0; unsigned int uu = 0; unsigned int step = 0; @@ -632,7 +633,7 @@ void set_country_info(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, void *pIE) unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs) { - PSDevice pDevice = (PSDevice) pDeviceHandler; + struct vnt_private *pDevice = pDeviceHandler; unsigned int ii; unsigned char byCount; PWLAN_IE_SUPP_CH pIE = (PWLAN_IE_SUPP_CH) pbyIEs; @@ -703,7 +704,7 @@ unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs) void set_country_IE(void *pDeviceHandler, void *pIE) { - PSDevice pDevice = (PSDevice) pDeviceHandler; + struct vnt_private *pDevice = pDeviceHandler; unsigned int ii; PWLAN_IE_COUNTRY pIECountry = (PWLAN_IE_COUNTRY) pIE; diff --git a/drivers/staging/vt6655/datarate.c b/drivers/staging/vt6655/datarate.c index 565028c4ab03..52907a4fae9d 100644 --- a/drivers/staging/vt6655/datarate.c +++ b/drivers/staging/vt6655/datarate.c @@ -49,7 +49,6 @@ extern unsigned short TxRate_iwconfig; /* 2008-5-8 <add> by chester */ /*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; static const unsigned char acbyIERate[MAX_RATE] = { 0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C }; @@ -195,7 +194,7 @@ RATEvParseMaxRate( unsigned char *pbyTopOFDMRate ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; + struct vnt_private *pDevice = pDeviceHandler; unsigned int ii; unsigned char byHighSuppRate = 0; unsigned char byRate = 0; @@ -208,7 +207,7 @@ RATEvParseMaxRate( *pwSuppRate = 0; uRateLen = pItemRates->len; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate Len: %d\n", uRateLen); + pr_debug("ParseMaxRate Len: %d\n", uRateLen); if (pDevice->eCurrentPHYType != PHY_TYPE_11B) { if (uRateLen > WLAN_RATES_MAXLEN) uRateLen = WLAN_RATES_MAXLEN; @@ -222,7 +221,8 @@ RATEvParseMaxRate( if (WLAN_MGMT_IS_BASICRATE(byRate) && bUpdateBasicRate) { /* Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate */ CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate)); + pr_debug("ParseMaxRate AddBasicRate: %d\n", + wGetRateIdx(byRate)); } byRate = (unsigned char)(pItemRates->abyRates[ii]&0x7F); if (byHighSuppRate == 0) @@ -244,7 +244,8 @@ RATEvParseMaxRate( if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) { /* Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate */ CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate)); + pr_debug("ParseMaxRate AddBasicRate: %d\n", + wGetRateIdx(byRate)); } byRate = (unsigned char)(pItemExtRates->abyRates[ii]&0x7F); if (byHighSuppRate == 0) @@ -268,7 +269,7 @@ RATEvParseMaxRate( if (wOldBasicRate != pDevice->wBasicRate) CARDvSetRSPINF((void *)pDevice, pDevice->eCurrentPHYType); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Exit ParseMaxRate\n"); + pr_debug("Exit ParseMaxRate\n"); } /*+ @@ -295,7 +296,7 @@ RATEvTxRateFallBack( PKnownNodeDB psNodeDBTable ) { - PSDevice pDevice = (PSDevice) pDeviceHandler; + struct vnt_private *pDevice = pDeviceHandler; unsigned short wIdxDownRate = 0; unsigned int ii; bool bAutoRate[MAX_RATE] = {true, true, true, true, false, false, true, true, true, true, true, true}; diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 05efa4e1b682..5a2bbd2047d8 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -33,6 +33,7 @@ #include <linux/types.h> #include <linux/mm.h> +#include "linux/ieee80211.h" #include "ttype.h" #include "tether.h" @@ -331,33 +332,6 @@ typedef const STxSyncDesc *PCSTxSyncDesc; // // RsvTime buffer header // -typedef struct tagSRrvTime_gRTS { - unsigned short wRTSTxRrvTime_ba; - unsigned short wRTSTxRrvTime_aa; - unsigned short wRTSTxRrvTime_bb; - unsigned short wReserved; - unsigned short wTxRrvTime_b; - unsigned short wTxRrvTime_a; -} __attribute__ ((__packed__)) -SRrvTime_gRTS, *PSRrvTime_gRTS; -typedef const SRrvTime_gRTS *PCSRrvTime_gRTS; - -typedef struct tagSRrvTime_gCTS { - unsigned short wCTSTxRrvTime_ba; - unsigned short wReserved; - unsigned short wTxRrvTime_b; - unsigned short wTxRrvTime_a; -} __attribute__ ((__packed__)) -SRrvTime_gCTS, *PSRrvTime_gCTS; -typedef const SRrvTime_gCTS *PCSRrvTime_gCTS; - -typedef struct tagSRrvTime_ab { - unsigned short wRTSTxRrvTime; - unsigned short wTxRrvTime; -} __attribute__ ((__packed__)) -SRrvTime_ab, *PSRrvTime_ab; -typedef const SRrvTime_ab *PCSRrvTime_ab; - typedef struct tagSRrvTime_atim { unsigned short wCTSTxRrvTime_ba; unsigned short wTxRrvTime_a; @@ -365,112 +339,18 @@ typedef struct tagSRrvTime_atim { SRrvTime_atim, *PSRrvTime_atim; typedef const SRrvTime_atim *PCSRrvTime_atim; -// -// RTS buffer header -// -typedef struct tagSRTSData { - unsigned short wFrameControl; - unsigned short wDurationID; - unsigned char abyRA[ETH_ALEN]; - unsigned char abyTA[ETH_ALEN]; -} __attribute__ ((__packed__)) -SRTSData, *PSRTSData; -typedef const SRTSData *PCSRTSData; - -typedef struct tagSRTS_g { - unsigned char bySignalField_b; - unsigned char byServiceField_b; - unsigned short wTransmitLength_b; - unsigned char bySignalField_a; - unsigned char byServiceField_a; - unsigned short wTransmitLength_a; - unsigned short wDuration_ba; - unsigned short wDuration_aa; - unsigned short wDuration_bb; - unsigned short wReserved; - SRTSData Data; -} __attribute__ ((__packed__)) -SRTS_g, *PSRTS_g; -typedef const SRTS_g *PCSRTS_g; - -typedef struct tagSRTS_g_FB { - unsigned char bySignalField_b; - unsigned char byServiceField_b; - unsigned short wTransmitLength_b; - unsigned char bySignalField_a; - unsigned char byServiceField_a; - unsigned short wTransmitLength_a; - unsigned short wDuration_ba; - unsigned short wDuration_aa; - unsigned short wDuration_bb; - unsigned short wReserved; - unsigned short wRTSDuration_ba_f0; - unsigned short wRTSDuration_aa_f0; - unsigned short wRTSDuration_ba_f1; - unsigned short wRTSDuration_aa_f1; - SRTSData Data; -} __attribute__ ((__packed__)) -SRTS_g_FB, *PSRTS_g_FB; -typedef const SRTS_g_FB *PCSRTS_g_FB; - -typedef struct tagSRTS_ab { - unsigned char bySignalField; - unsigned char byServiceField; - unsigned short wTransmitLength; - unsigned short wDuration; - unsigned short wReserved; - SRTSData Data; -} __attribute__ ((__packed__)) -SRTS_ab, *PSRTS_ab; -typedef const SRTS_ab *PCSRTS_ab; - -typedef struct tagSRTS_a_FB { - unsigned char bySignalField; - unsigned char byServiceField; - unsigned short wTransmitLength; - unsigned short wDuration; - unsigned short wReserved; - unsigned short wRTSDuration_f0; - unsigned short wRTSDuration_f1; - SRTSData Data; -} __attribute__ ((__packed__)) -SRTS_a_FB, *PSRTS_a_FB; -typedef const SRTS_a_FB *PCSRTS_a_FB; - -// -// CTS buffer header -// -typedef struct tagSCTSData { - unsigned short wFrameControl; - unsigned short wDurationID; - unsigned char abyRA[ETH_ALEN]; - unsigned short wReserved; -} __attribute__ ((__packed__)) -SCTSData, *PSCTSData; +/* Length, Service, and Signal fields of Phy for Tx */ +struct vnt_phy_field { + u8 signal; + u8 service; + __le16 len; +} __packed; -typedef struct tagSCTS { - unsigned char bySignalField_b; - unsigned char byServiceField_b; - unsigned short wTransmitLength_b; - unsigned short wDuration_ba; - unsigned short wReserved; - SCTSData Data; -} __attribute__ ((__packed__)) -SCTS, *PSCTS; -typedef const SCTS *PCSCTS; - -typedef struct tagSCTS_FB { - unsigned char bySignalField_b; - unsigned char byServiceField_b; - unsigned short wTransmitLength_b; - unsigned short wDuration_ba; - unsigned short wReserved; - unsigned short wCTSDuration_ba_f0; - unsigned short wCTSDuration_ba_f1; - SCTSData Data; -} __attribute__ ((__packed__)) -SCTS_FB, *PSCTS_FB; -typedef const SCTS_FB *PCSCTS_FB; +union vnt_phy_field_swap { + struct vnt_phy_field field_read; + u16 swap[2]; + u32 field_write; +}; // // Tx FIFO header @@ -486,81 +366,6 @@ typedef struct tagSTxBufHead { STxBufHead, *PSTxBufHead; typedef const STxBufHead *PCSTxBufHead; -typedef struct tagSTxShortBufHead { - unsigned short wFIFOCtl; - unsigned short wTimeStamp; -} __attribute__ ((__packed__)) -STxShortBufHead, *PSTxShortBufHead; -typedef const STxShortBufHead *PCSTxShortBufHead; - -// -// Tx data header -// -typedef struct tagSTxDataHead_g { - unsigned char bySignalField_b; - unsigned char byServiceField_b; - unsigned short wTransmitLength_b; - unsigned char bySignalField_a; - unsigned char byServiceField_a; - unsigned short wTransmitLength_a; - unsigned short wDuration_b; - unsigned short wDuration_a; - unsigned short wTimeStampOff_b; - unsigned short wTimeStampOff_a; -} __attribute__ ((__packed__)) -STxDataHead_g, *PSTxDataHead_g; -typedef const STxDataHead_g *PCSTxDataHead_g; - -typedef struct tagSTxDataHead_g_FB { - unsigned char bySignalField_b; - unsigned char byServiceField_b; - unsigned short wTransmitLength_b; - unsigned char bySignalField_a; - unsigned char byServiceField_a; - unsigned short wTransmitLength_a; - unsigned short wDuration_b; - unsigned short wDuration_a; - unsigned short wDuration_a_f0; - unsigned short wDuration_a_f1; - unsigned short wTimeStampOff_b; - unsigned short wTimeStampOff_a; -} __attribute__ ((__packed__)) -STxDataHead_g_FB, *PSTxDataHead_g_FB; -typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB; - -typedef struct tagSTxDataHead_ab { - unsigned char bySignalField; - unsigned char byServiceField; - unsigned short wTransmitLength; - unsigned short wDuration; - unsigned short wTimeStampOff; -} __attribute__ ((__packed__)) -STxDataHead_ab, *PSTxDataHead_ab; -typedef const STxDataHead_ab *PCSTxDataHead_ab; - -typedef struct tagSTxDataHead_a_FB { - unsigned char bySignalField; - unsigned char byServiceField; - unsigned short wTransmitLength; - unsigned short wDuration; - unsigned short wTimeStampOff; - unsigned short wDuration_f0; - unsigned short wDuration_f1; -} __attribute__ ((__packed__)) -STxDataHead_a_FB, *PSTxDataHead_a_FB; -typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB; - -// -// MICHDR data header -// -typedef struct tagSMICHDRHead { - u32 adwHDR0[4]; - u32 adwHDR1[4]; - u32 adwHDR2[4]; -} __attribute__ ((__packed__)) -SMICHDRHead, *PSMICHDRHead; -typedef const SMICHDRHead *PCSMICHDRHead; - typedef struct tagSBEACONCtl { u32 BufReady:1; u32 TSF:15; diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index 9bf0ea9af66e..ddd356aa7eaf 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -49,17 +49,13 @@ #include <linux/sched.h> #include <linux/io.h> #include <linux/if.h> +#include <linux/crc32.h> //#include <linux/config.h> #include <linux/uaccess.h> #include <linux/proc_fs.h> #include <linux/inetdevice.h> #include <linux/reboot.h> -#ifdef SIOCETHTOOL -#define DEVICE_ETHTOOL_IOCTL_SUPPORT #include <linux/ethtool.h> -#else -#undef DEVICE_ETHTOOL_IOCTL_SUPPORT -#endif /* Include Wireless Extension definition and check version - Jean II */ #include <linux/wireless.h> #include <net/iw_handler.h> // New driver API @@ -140,20 +136,12 @@ #define AVAIL_TD(p, q) ((p)->sOpts.nTxDescs[(q)] - ((p)->iTDUsed[(q)])) -//PLICE_DEBUG -> #define NUM 64 -//PLICE_DEUBG <- #define PRIVATE_Message 0 /*--------------------- Export Types ------------------------------*/ -#define DBG_PRT(l, p, args...) \ -do { \ - if (l <= msglevel) \ - printk(p, ##args); \ -} while (0) - #define PRINT_K(p, args...) \ do { \ if (PRIVATE_Message) \ @@ -337,20 +325,11 @@ typedef struct __device_opt { u32 flags; } OPTIONS, *POPTIONS; -typedef struct __device_info { - struct __device_info *next; - struct __device_info *prev; - +struct vnt_private { struct pci_dev *pcid; -#ifdef CONFIG_PM - u32 pci_state[16]; -#endif - // netdev struct net_device *dev; - struct net_device *next_module; - struct net_device_stats stats; //dma addr, rx/tx pool dma_addr_t pool_dma; @@ -409,11 +388,9 @@ typedef struct __device_info { spinlock_t lock; -//PLICE_DEBUG -> pid_t MLMEThr_pid; struct completion notify; struct semaphore mlme_semaphore; -//PLICE_DEBUG <- u32 rx_bytes; @@ -483,13 +460,12 @@ typedef struct __device_info { unsigned short wFragmentationThreshold; unsigned char byShortRetryLimit; unsigned char byLongRetryLimit; - CARD_OP_MODE eOPMode; + enum nl80211_iftype op_mode; unsigned char byOpMode; bool bBSSIDFilter; unsigned short wMaxTransmitMSDULifetime; unsigned char abyBSSID[ETH_ALEN]; unsigned char abyDesireBSSID[ETH_ALEN]; - unsigned short wCTSDuration; // update while speed change unsigned short wACKDuration; // update while speed change unsigned short wRTSTransmitLen; // update while speed change unsigned char byRTSServiceField; // update while speed change @@ -497,7 +473,6 @@ typedef struct __device_info { unsigned long dwMaxReceiveLifetime; // dot11MaxReceiveLifetime - bool bCCK; bool bEncryptionEnable; bool bLongHeader; bool bShortSlotTime; @@ -566,7 +541,7 @@ typedef struct __device_info { 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; @@ -643,12 +618,10 @@ typedef struct __device_info { // command timer struct timer_list sTimerCommand; -#ifdef TxInSleep struct timer_list sTimerTxData; unsigned long nTxDataTimeCout; bool fTxDataInSleep; bool IsTxDataTrigger; -#endif #ifdef WPA_SM_Transtatus bool fWPA_Authened; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? @@ -744,9 +717,10 @@ typedef struct __device_info { struct iw_statistics wstats; // wireless stats bool bCommit; -} DEVICE_INFO, *PSDevice; +}; -static inline bool device_get_ip(PSDevice pInfo) { +static inline bool device_get_ip(struct vnt_private *pInfo) +{ struct in_device *in_dev = (struct in_device *)pInfo->dev->ip_ptr; struct in_ifaddr *ifa; @@ -772,7 +746,10 @@ static inline PDEVICE_TD_INFO alloc_td_info(void) /*--------------------- Export Functions --------------------------*/ -bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeIndex); -bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF); -int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter); +bool device_dma0_xmit(struct vnt_private *pDevice, + struct sk_buff *skb, unsigned int uNodeIndex); +bool device_alloc_frag_buf(struct vnt_private *pDevice, + PSDeFragControlBlock pDeF); +int Config_FileOperation(struct vnt_private *pDevice, + bool fwrite, unsigned char *Parameter); #endif diff --git a/drivers/staging/vt6655/device_cfg.h b/drivers/staging/vt6655/device_cfg.h index 8e50e538076f..7221824e4f23 100644 --- a/drivers/staging/vt6655/device_cfg.h +++ b/drivers/staging/vt6655/device_cfg.h @@ -67,9 +67,6 @@ struct _version { #define PKT_BUF_SZ 2390 -#define MAX_UINTS 8 -#define OPTION_DEFAULT { [0 ... MAX_UINTS-1] = -1} - typedef enum _chip_type { VT3253 = 1 } CHIP_TYPE, *PCHIP_TYPE; diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index c78d06eff7ea..54e16f40d8ed 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -89,8 +89,6 @@ #include <linux/slab.h> /*--------------------- Static Definitions -------------------------*/ -static int msglevel = MSG_LEVEL_INFO; - // // Define module options // @@ -247,11 +245,6 @@ DEVICE_PARAM(bDiversityANTEnable, "ANT diversity mode"); // // Static vars definitions // - -static int device_nics = 0; -static PSDevice pDevice_Infos = NULL; -static struct net_device *root_device_dev = NULL; - static CHIP_INFO chip_info_table[] = { { VT3253, "VIA Networking Solomon-A/B/G Wireless LAN Adapter ", 256, 1, DEVICE_FLAGS_IP_ALIGN|DEVICE_FLAGS_TX_ALIGN }, @@ -266,12 +259,12 @@ static const struct pci_device_id vt6655_pci_id_table[] = { /*--------------------- Static Functions --------------------------*/ static int vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent); -static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice, PCHIP_INFO); -static void device_free_info(PSDevice pDevice); -static bool device_get_pci_info(PSDevice, struct pci_dev *pcid); -static void device_print_info(PSDevice pDevice); -static struct net_device_stats *device_get_stats(struct net_device *dev); -static void device_init_diversity_timer(PSDevice pDevice); +static void vt6655_init_info(struct pci_dev *pcid, + struct vnt_private **ppDevice, PCHIP_INFO); +static void device_free_info(struct vnt_private *pDevice); +static bool device_get_pci_info(struct vnt_private *, struct pci_dev *pcid); +static void device_print_info(struct vnt_private *pDevice); +static void device_init_diversity_timer(struct vnt_private *pDevice); static int device_open(struct net_device *dev); static int device_xmit(struct sk_buff *skb, struct net_device *dev); static irqreturn_t device_intr(int irq, void *dev_instance); @@ -290,28 +283,28 @@ static struct notifier_block device_notifier = { }; #endif -static void device_init_rd0_ring(PSDevice pDevice); -static void device_init_rd1_ring(PSDevice pDevice); -static void device_init_defrag_cb(PSDevice pDevice); -static void device_init_td0_ring(PSDevice pDevice); -static void device_init_td1_ring(PSDevice pDevice); +static void device_init_rd0_ring(struct vnt_private *pDevice); +static void device_init_rd1_ring(struct vnt_private *pDevice); +static void device_init_defrag_cb(struct vnt_private *pDevice); +static void device_init_td0_ring(struct vnt_private *pDevice); +static void device_init_td1_ring(struct vnt_private *pDevice); static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev); //2008-0714<Add>by Mike Liu -static bool device_release_WPADEV(PSDevice pDevice); +static bool device_release_WPADEV(struct vnt_private *pDevice); static int ethtool_ioctl(struct net_device *dev, void __user *useraddr); -static int device_rx_srv(PSDevice pDevice, unsigned int uIdx); -static int device_tx_srv(PSDevice pDevice, unsigned int uIdx); -static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pDesc); -static void device_init_registers(PSDevice pDevice); -static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc); -static void device_free_td0_ring(PSDevice pDevice); -static void device_free_td1_ring(PSDevice pDevice); -static void device_free_rd0_ring(PSDevice pDevice); -static void device_free_rd1_ring(PSDevice pDevice); -static void device_free_rings(PSDevice pDevice); -static void device_free_frag_buf(PSDevice pDevice); +static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx); +static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx); +static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pDesc); +static void device_init_registers(struct vnt_private *pDevice); +static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc); +static void device_free_td0_ring(struct vnt_private *pDevice); +static void device_free_td1_ring(struct vnt_private *pDevice); +static void device_free_rd0_ring(struct vnt_private *pDevice); +static void device_free_rd1_ring(struct vnt_private *pDevice); +static void device_free_rings(struct vnt_private *pDevice); +static void device_free_frag_buf(struct vnt_private *pDevice); static int Config_FileGetParameter(unsigned char *string, unsigned char *dest, unsigned char *source); @@ -331,14 +324,14 @@ static char *get_chip_name(int chip_id) static void vt6655_remove(struct pci_dev *pcid) { - PSDevice pDevice = pci_get_drvdata(pcid); + struct vnt_private *pDevice = pci_get_drvdata(pcid); if (pDevice == NULL) return; device_free_info(pDevice); } -static void device_get_options(PSDevice pDevice, int index, char *devname) +static void device_get_options(struct vnt_private *pDevice) { POPTIONS pOpts = &(pDevice->sOpts); @@ -363,7 +356,8 @@ static void device_get_options(PSDevice pDevice, int index, char *devname) } static void -device_set_options(PSDevice pDevice) { +device_set_options(struct vnt_private *pDevice) +{ unsigned char abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; unsigned char abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; unsigned char abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; @@ -387,31 +381,29 @@ device_set_options(PSDevice pDevice) { if (pDevice->uConnectionRate < RATE_AUTO) pDevice->bFixRate = true; pDevice->byBBType = pDevice->sOpts.bbp_type; - pDevice->byPacketType = pDevice->byBBType; - -//PLICE_DEBUG-> + pDevice->byPacketType = (VIA_PKT_TYPE)pDevice->byBBType; pDevice->byAutoFBCtrl = AUTO_FB_0; -//PLICE_DEBUG<- pDevice->bUpdateBBVGA = true; pDevice->byFOETuning = 0; - pDevice->wCTSDuration = 0; pDevice->byPreambleType = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " uChannel= %d\n", (int)pDevice->uChannel); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byOpMode= %d\n", (int)pDevice->byOpMode); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ePSMode= %d\n", (int)pDevice->ePSMode); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " wRTSThreshold= %d\n", (int)pDevice->wRTSThreshold); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byShortRetryLimit= %d\n", (int)pDevice->byShortRetryLimit); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byLongRetryLimit= %d\n", (int)pDevice->byLongRetryLimit); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byPreambleType= %d\n", (int)pDevice->byPreambleType); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byShortPreamble= %d\n", (int)pDevice->byShortPreamble); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " uConnectionRate= %d\n", (int)pDevice->uConnectionRate); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byBBType= %d\n", (int)pDevice->byBBType); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pDevice->b11hEnable= %d\n", (int)pDevice->b11hEnable); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pDevice->bDiversityRegCtlON= %d\n", (int)pDevice->bDiversityRegCtlON); + pr_debug(" uChannel= %d\n", (int)pDevice->uChannel); + pr_debug(" byOpMode= %d\n", (int)pDevice->byOpMode); + pr_debug(" ePSMode= %d\n", (int)pDevice->ePSMode); + pr_debug(" wRTSThreshold= %d\n", (int)pDevice->wRTSThreshold); + pr_debug(" byShortRetryLimit= %d\n", (int)pDevice->byShortRetryLimit); + pr_debug(" byLongRetryLimit= %d\n", (int)pDevice->byLongRetryLimit); + pr_debug(" byPreambleType= %d\n", (int)pDevice->byPreambleType); + pr_debug(" byShortPreamble= %d\n", (int)pDevice->byShortPreamble); + pr_debug(" uConnectionRate= %d\n", (int)pDevice->uConnectionRate); + pr_debug(" byBBType= %d\n", (int)pDevice->byBBType); + pr_debug(" pDevice->b11hEnable= %d\n", (int)pDevice->b11hEnable); + pr_debug(" pDevice->bDiversityRegCtlON= %d\n", + (int)pDevice->bDiversityRegCtlON); } -static void s_vCompleteCurrentMeasure(PSDevice pDevice, unsigned char byResult) +static void s_vCompleteCurrentMeasure(struct vnt_private *pDevice, + unsigned char byResult) { unsigned int ii; unsigned long dwDuration = 0; @@ -453,7 +445,7 @@ static void s_vCompleteCurrentMeasure(PSDevice pDevice, unsigned char byResult) // Initialisation of MAC & BBP registers // -static void device_init_registers(PSDevice pDevice) +static void device_init_registers(struct vnt_private *pDevice) { unsigned int ii; unsigned char byValue; @@ -469,8 +461,6 @@ static void device_init_registers(PSDevice pDevice) /* Do MACbSoftwareReset in MACvInitialize */ MACbSoftwareReset(pDevice->PortOffset); - /* force CCK */ - pDevice->bCCK = true; pDevice->bAES = false; /* Only used in 11g type, sync with ERP IE */ @@ -561,10 +551,10 @@ static void device_init_registers(PSDevice pDevice) } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n", - pDevice->bDiversityEnable, (int)pDevice->ulDiversityNValue, - (int)pDevice->ulDiversityMValue, pDevice->byTMax, pDevice->byTMax2); + pr_debug("bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n", + pDevice->bDiversityEnable, (int)pDevice->ulDiversityNValue, + (int)pDevice->ulDiversityMValue, pDevice->byTMax, + pDevice->byTMax2); /* zonetype initial */ pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; @@ -577,7 +567,7 @@ static void device_init_registers(PSDevice pDevice) pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0; pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :USA\n"); + pr_debug("Init Zone Type :USA\n"); } else if ((zonetype == 1) && (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) { /* for Japan */ @@ -589,7 +579,7 @@ static void device_init_registers(PSDevice pDevice) pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02; pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :Europe\n"); + pr_debug("Init Zone Type :Europe\n"); } else { if (zonetype != pDevice->abyEEPROM[EEP_OFS_ZONETYPE]) pr_debug("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n", @@ -612,12 +602,12 @@ static void device_init_registers(PSDevice pDevice) pDevice->byRevId = 0x80; pDevice->byRFType &= RF_MASK; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType); + pr_debug("pDevice->byRFType = %x\n", pDevice->byRFType); if (!pDevice->bZoneRegExist) pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType); + pr_debug("pDevice->byZoneType = %x\n", pDevice->byZoneType); /* Init RF module */ RFbInit(pDevice); @@ -740,8 +730,7 @@ static void device_init_registers(PSDevice pDevice) /* get Permanent network address */ SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Network address = %pM\n", - pDevice->abyCurrentNetAddr); + pr_debug("Network address = %pM\n", pDevice->abyCurrentNetAddr); /* reset Tx pointer */ CARDvSafeResetRx(pDevice); @@ -763,7 +752,7 @@ static void device_init_registers(PSDevice pDevice) netif_stop_queue(pDevice->dev); } -static void device_init_diversity_timer(PSDevice pDevice) +static void device_init_diversity_timer(struct vnt_private *pDevice) { init_timer(&pDevice->TimerSQ3Tmax1); pDevice->TimerSQ3Tmax1.data = (unsigned long) pDevice; @@ -781,7 +770,7 @@ static void device_init_diversity_timer(PSDevice pDevice) pDevice->TimerSQ3Tmax3.expires = RUN_AT(HZ); } -static bool device_release_WPADEV(PSDevice pDevice) +static bool device_release_WPADEV(struct vnt_private *pDevice) { viawget_wpa_header *wpahdr; int ii = 0; @@ -816,7 +805,6 @@ static const struct net_device_ops device_netdev_ops = { .ndo_open = device_open, .ndo_stop = device_close, .ndo_do_ioctl = device_ioctl, - .ndo_get_stats = device_get_stats, .ndo_start_xmit = device_xmit, .ndo_set_rx_mode = device_set_multi, }; @@ -827,17 +815,12 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) static bool bFirst = true; struct net_device *dev = NULL; PCHIP_INFO pChip_info = (PCHIP_INFO)ent->driver_data; - PSDevice pDevice; + struct vnt_private *pDevice; int rc; - if (device_nics++ >= MAX_UINTS) { - pr_notice(DEVICE_NAME ": already found %d NICs\n", device_nics); - return -ENODEV; - } + dev = alloc_etherdev(sizeof(*pDevice)); - dev = alloc_etherdev(sizeof(DEVICE_INFO)); - - pDevice = (PSDevice) netdev_priv(dev); + pDevice = netdev_priv(dev); if (dev == NULL) { pr_err(DEVICE_NAME ": allocate net device failed\n"); @@ -855,8 +838,6 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) vt6655_init_info(pcid, &pDevice, pChip_info); pDevice->dev = dev; - pDevice->next_module = root_device_dev; - root_device_dev = dev; if (pci_enable_device(pcid)) { device_free_info(pDevice); @@ -931,15 +912,6 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) } dev->base_addr = pDevice->ioaddr; -#ifdef PLICE_DEBUG - unsigned char value; - - VNSvInPortB(pDevice->PortOffset+0x4F, &value); - pr_debug("Before write: value is %x\n", value); - VNSvOutPortB(pDevice->PortOffset, value); - VNSvInPortB(pDevice->PortOffset+0x4F, &value); - pr_debug("After write: value is %x\n", value); -#endif // do reset if (!MACbSoftwareReset(pDevice->PortOffset)) { pr_err(DEVICE_NAME ": Failed to access MAC hardware..\n"); @@ -950,7 +922,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) MACvInitialize(pDevice->PortOffset); MACvReadEtherAddress(pDevice->PortOffset, dev->dev_addr); - device_get_options(pDevice, device_nics-1, dev->name); + device_get_options(pDevice); device_set_options(pDevice); //Mask out the options cannot be set to the chip pDevice->sOpts.flags &= pChip_info->flags; @@ -977,32 +949,21 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) return 0; } -static void device_print_info(PSDevice pDevice) +static void device_print_info(struct vnt_private *pDevice) { struct net_device *dev = pDevice->dev; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: %s\n", dev->name, get_chip_name(pDevice->chip_id)); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: MAC=%pM", dev->name, dev->dev_addr); - - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IO=0x%lx Mem=0x%lx ", - (unsigned long)pDevice->ioaddr, (unsigned long)pDevice->PortOffset); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d\n", pDevice->dev->irq); + pr_info("%s: %s\n", dev->name, get_chip_name(pDevice->chip_id)); + pr_info("%s: MAC=%pM IO=0x%lx Mem=0x%lx IRQ=%d\n", + dev->name, dev->dev_addr, (unsigned long)pDevice->ioaddr, + (unsigned long)pDevice->PortOffset, pDevice->dev->irq); } -static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice, - PCHIP_INFO pChip_info) { - PSDevice p; - - memset(*ppDevice, 0, sizeof(DEVICE_INFO)); - - if (pDevice_Infos == NULL) { - pDevice_Infos = *ppDevice; - } else { - for (p = pDevice_Infos; p->next != NULL; p = p->next) - do {} while (0); - p->next = *ppDevice; - (*ppDevice)->prev = p; - } +static void vt6655_init_info(struct pci_dev *pcid, + struct vnt_private **ppDevice, + PCHIP_INFO pChip_info) +{ + memset(*ppDevice, 0, sizeof(**ppDevice)); (*ppDevice)->pcid = pcid; (*ppDevice)->chip_id = pChip_info->chip_id; @@ -1013,19 +974,12 @@ static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice, spin_lock_init(&((*ppDevice)->lock)); } -static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid) +static bool device_get_pci_info(struct vnt_private *pDevice, + struct pci_dev *pcid) { u16 pci_cmd; u8 b; unsigned int cis_addr; -#ifdef PLICE_DEBUG - unsigned char pci_config[256]; - unsigned char value = 0x00; - int ii, j; - u16 max_lat = 0x0000; - - memset(pci_config, 0x00, 256); -#endif pci_read_config_byte(pcid, PCI_REVISION_ID, &pDevice->byRevId); pci_read_config_word(pcid, PCI_SUBSYSTEM_ID, &pDevice->SubSystemID); @@ -1044,26 +998,11 @@ static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid) pci_read_config_byte(pcid, PCI_COMMAND, &b); pci_write_config_byte(pcid, PCI_COMMAND, (b|PCI_COMMAND_MASTER)); -#ifdef PLICE_DEBUG - for (ii = 0; ii < 0xFF; ii++) { - pci_read_config_byte(pcid, ii, &value); - pci_config[ii] = value; - } - for (ii = 0, j = 1; ii < 0x100; ii++, j++) { - if (j % 16 == 0) { - pr_debug("%x:", pci_config[ii]); - pr_debug("\n"); - } else { - pr_debug("%x:", pci_config[ii]); - } - } -#endif return true; } -static void device_free_info(PSDevice pDevice) +static void device_free_info(struct vnt_private *pDevice) { - PSDevice ptr; struct net_device *dev = pDevice->dev; ASSERT(pDevice); @@ -1075,21 +1014,6 @@ static void device_free_info(PSDevice pDevice) if (wpa_set_wpadev(pDevice, 0) != 0) pr_err("unregister wpadev fail?\n"); - if (pDevice_Infos == NULL) - return; - - for (ptr = pDevice_Infos; ptr && (ptr != pDevice); ptr = ptr->next) - do {} while (0); - - if (ptr == pDevice) { - if (ptr == pDevice_Infos) - pDevice_Infos = ptr->next; - else - ptr->prev->next = ptr->next; - } else { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "info struct not found\n"); - return; - } #ifdef HOSTAP if (dev) vt6655_hostap_set_hostapd(pDevice, 0, 0); @@ -1106,30 +1030,22 @@ static void device_free_info(PSDevice pDevice) free_netdev(dev); } -static bool device_init_rings(PSDevice pDevice) +static bool device_init_rings(struct vnt_private *pDevice) { void *vir_pool; /*allocate all RD/TD rings a single pool*/ - vir_pool = pci_alloc_consistent(pDevice->pcid, - pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + - pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + - pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) + - pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc), - &pDevice->pool_dma); - + vir_pool = pci_zalloc_consistent(pDevice->pcid, + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + + pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) + + pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc), + &pDevice->pool_dma); if (vir_pool == NULL) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s : allocate desc dma memory failed\n", pDevice->dev->name); + dev_err(&pDevice->pcid->dev, "allocate desc dma memory failed\n"); return false; } - memset(vir_pool, 0, - pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + - pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + - pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) + - pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc) - ); - pDevice->aRD0Ring = vir_pool; pDevice->aRD1Ring = vir_pool + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc); @@ -1138,15 +1054,15 @@ static bool device_init_rings(PSDevice pDevice) pDevice->rd1_pool_dma = pDevice->rd0_pool_dma + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc); - pDevice->tx0_bufs = pci_alloc_consistent(pDevice->pcid, - pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ + - pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ + - CB_BEACON_BUF_SIZE + - CB_MAX_BUF_SIZE, - &pDevice->tx_bufs_dma0); - + pDevice->tx0_bufs = pci_zalloc_consistent(pDevice->pcid, + pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ + + pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ + + CB_BEACON_BUF_SIZE + + CB_MAX_BUF_SIZE, + &pDevice->tx_bufs_dma0); if (pDevice->tx0_bufs == NULL) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: allocate buf dma memory failed\n", pDevice->dev->name); + dev_err(&pDevice->pcid->dev, "allocate buf dma memory failed\n"); + pci_free_consistent(pDevice->pcid, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + @@ -1157,13 +1073,6 @@ static bool device_init_rings(PSDevice pDevice) return false; } - memset(pDevice->tx0_bufs, 0, - pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ + - pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ + - CB_BEACON_BUF_SIZE + - CB_MAX_BUF_SIZE - ); - pDevice->td0_pool_dma = pDevice->rd1_pool_dma + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc); @@ -1198,7 +1107,7 @@ static bool device_init_rings(PSDevice pDevice) return true; } -static void device_free_rings(PSDevice pDevice) +static void device_free_rings(struct vnt_private *pDevice) { pci_free_consistent(pDevice->pcid, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + @@ -1219,7 +1128,7 @@ static void device_free_rings(PSDevice pDevice) ); } -static void device_init_rd0_ring(PSDevice pDevice) +static void device_init_rd0_ring(struct vnt_private *pDevice) { int i; dma_addr_t curr = pDevice->rd0_pool_dma; @@ -1230,10 +1139,9 @@ static void device_init_rd0_ring(PSDevice pDevice) pDesc = &(pDevice->aRD0Ring[i]); pDesc->pRDInfo = alloc_rd_info(); ASSERT(pDesc->pRDInfo); - if (!device_alloc_rx_buf(pDevice, pDesc)) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc rx bufs\n", - pDevice->dev->name); - } + if (!device_alloc_rx_buf(pDevice, pDesc)) + dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n"); + pDesc->next = &(pDevice->aRD0Ring[(i+1) % pDevice->sOpts.nRxDescs0]); pDesc->pRDInfo->curr_desc = cpu_to_le32(curr); pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc)); @@ -1244,7 +1152,7 @@ static void device_init_rd0_ring(PSDevice pDevice) pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]); } -static void device_init_rd1_ring(PSDevice pDevice) +static void device_init_rd1_ring(struct vnt_private *pDevice) { int i; dma_addr_t curr = pDevice->rd1_pool_dma; @@ -1255,10 +1163,9 @@ static void device_init_rd1_ring(PSDevice pDevice) pDesc = &(pDevice->aRD1Ring[i]); pDesc->pRDInfo = alloc_rd_info(); ASSERT(pDesc->pRDInfo); - if (!device_alloc_rx_buf(pDevice, pDesc)) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc rx bufs\n", - pDevice->dev->name); - } + if (!device_alloc_rx_buf(pDevice, pDesc)) + dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n"); + pDesc->next = &(pDevice->aRD1Ring[(i+1) % pDevice->sOpts.nRxDescs1]); pDesc->pRDInfo->curr_desc = cpu_to_le32(curr); pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc)); @@ -1269,7 +1176,7 @@ static void device_init_rd1_ring(PSDevice pDevice) pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]); } -static void device_init_defrag_cb(PSDevice pDevice) +static void device_init_defrag_cb(struct vnt_private *pDevice) { int i; PSDeFragControlBlock pDeF; @@ -1277,16 +1184,14 @@ static void device_init_defrag_cb(PSDevice pDevice) /* Init the fragment ctl entries */ for (i = 0; i < CB_MAX_RX_FRAG; i++) { pDeF = &(pDevice->sRxDFCB[i]); - if (!device_alloc_frag_buf(pDevice, pDeF)) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc frag bufs\n", - pDevice->dev->name); - } + if (!device_alloc_frag_buf(pDevice, pDeF)) + dev_err(&pDevice->pcid->dev, "can not alloc frag bufs\n"); } pDevice->cbDFCB = CB_MAX_RX_FRAG; pDevice->cbFreeDFCB = pDevice->cbDFCB; } -static void device_free_rd0_ring(PSDevice pDevice) +static void device_free_rd0_ring(struct vnt_private *pDevice) { int i; @@ -1303,7 +1208,7 @@ static void device_free_rd0_ring(PSDevice pDevice) } } -static void device_free_rd1_ring(PSDevice pDevice) +static void device_free_rd1_ring(struct vnt_private *pDevice) { int i; @@ -1320,7 +1225,7 @@ static void device_free_rd1_ring(PSDevice pDevice) } } -static void device_free_frag_buf(PSDevice pDevice) +static void device_free_frag_buf(struct vnt_private *pDevice) { PSDeFragControlBlock pDeF; int i; @@ -1334,7 +1239,7 @@ static void device_free_frag_buf(PSDevice pDevice) } } -static void device_init_td0_ring(PSDevice pDevice) +static void device_init_td0_ring(struct vnt_private *pDevice) { int i; dma_addr_t curr; @@ -1359,7 +1264,7 @@ static void device_init_td0_ring(PSDevice pDevice) pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]); } -static void device_init_td1_ring(PSDevice pDevice) +static void device_init_td1_ring(struct vnt_private *pDevice) { int i; dma_addr_t curr; @@ -1385,7 +1290,7 @@ static void device_init_td1_ring(PSDevice pDevice) pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]); } -static void device_free_td0_ring(PSDevice pDevice) +static void device_free_td0_ring(struct vnt_private *pDevice) { int i; @@ -1404,7 +1309,7 @@ static void device_free_td0_ring(PSDevice pDevice) } } -static void device_free_td1_ring(PSDevice pDevice) +static void device_free_td1_ring(struct vnt_private *pDevice) { int i; @@ -1425,7 +1330,7 @@ static void device_free_td1_ring(PSDevice pDevice) /*-----------------------------------------------------------------*/ -static int device_rx_srv(PSDevice pDevice, unsigned int uIdx) +static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx) { PSRxDesc pRD; int works = 0; @@ -1437,8 +1342,8 @@ static int device_rx_srv(PSDevice pDevice, unsigned int uIdx) break; if (device_receive_frame(pDevice, pRD)) { if (!device_alloc_rx_buf(pDevice, pRD)) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR - "%s: can not allocate rx buf\n", pDevice->dev->name); + dev_err(&pDevice->pcid->dev, + "can not allocate rx buf\n"); break; } } @@ -1451,7 +1356,7 @@ static int device_rx_srv(PSDevice pDevice, unsigned int uIdx) return works; } -static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) +static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pRD) { PDEVICE_RD_INFO pRDInfo = pRD->pRDInfo; @@ -1472,7 +1377,8 @@ static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) return true; } -bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) +bool device_alloc_frag_buf(struct vnt_private *pDevice, + PSDeFragControlBlock pDeF) { pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); if (pDeF->skb == NULL) @@ -1483,7 +1389,7 @@ bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) return true; } -static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) +static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) { PSTxDesc pTD; bool bFull = false; @@ -1492,7 +1398,7 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) unsigned char byTsr1; unsigned int uFrameSize, uFIFOHeaderSize; PSTxBufHead pTxBufHead; - struct net_device_stats *pStats = &pDevice->stats; + struct net_device_stats *pStats = &pDevice->dev->stats; struct sk_buff *skb; unsigned int uNodeIndex; PSMgmtObject pMgmt = pDevice->pMgmt; @@ -1528,8 +1434,9 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) if (!(byTsr1 & TSR1_TERR)) { if (byTsr0 != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X].\n", - (int)uIdx, byTsr1, byTsr0); + pr_debug(" Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X]\n", + (int)uIdx, byTsr1, + byTsr0); } if ((pTxBufHead->wFragCtl & FRAGCTL_ENDFRAG) != FRAGCTL_NONFRAG) pDevice->s802_11Counter.TransmittedFragmentCount++; @@ -1537,8 +1444,8 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) pStats->tx_packets++; pStats->tx_bytes += pTD->pTDInfo->skb->len; } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] dropped & tsr1[%02X] tsr0[%02X].\n", - (int)uIdx, byTsr1, byTsr0); + pr_debug(" Tx[%d] dropped & tsr1[%02X] tsr0[%02X]\n", + (int)uIdx, byTsr1, byTsr0); pStats->tx_errors++; pStats->tx_dropped++; } @@ -1546,7 +1453,7 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) { if (pDevice->bEnableHostapd) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx call back netif..\n"); + pr_debug("tx call back netif..\n"); skb = pTD->pTDInfo->skb; skb->dev = pDevice->apdev; skb_reset_mac_header(skb); @@ -1558,8 +1465,8 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) if (byTsr1 & TSR1_TERR) { if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n", - (int)uIdx, byTsr1, byTsr0); + pr_debug(" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X]\n", + (int)uIdx, byTsr1, byTsr0); } @@ -1577,8 +1484,9 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID; pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; pTD->pTDInfo->byFlags &= ~(TD_FLAGS_NETIF_SKB); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx_srv:tx fail re-queue sta index= %d, QueCnt= %d\n" - , (int)uNodeIndex, pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt); + pr_debug("tx_srv:tx fail re-queue sta index= %d, QueCnt= %d\n", + (int)uNodeIndex, + pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt); pStats->tx_errors--; pStats->tx_dropped--; } @@ -1595,7 +1503,8 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) if (AVAIL_TD(pDevice, uIdx) < RESERV_AC0DMA) { bFull = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " AC0DMA is Full = %d\n", pDevice->iTDUsed[uIdx]); + pr_debug(" AC0DMA is Full = %d\n", + pDevice->iTDUsed[uIdx]); } if (netif_queue_stopped(pDevice->dev) && !bFull) netif_wake_queue(pDevice->dev); @@ -1607,12 +1516,11 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) return works; } -static void device_error(PSDevice pDevice, unsigned short status) +static void device_error(struct vnt_private *pDevice, unsigned short status) { if (status & ISR_FETALERR) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR - "%s: Hardware fatal error.\n", - pDevice->dev->name); + dev_err(&pDevice->pcid->dev, "Hardware fatal error\n"); + netif_stop_queue(pDevice->dev); del_timer(&pDevice->sTimerCommand); del_timer(&(pDevice->pMgmt->sTimerSecondCallback)); @@ -1622,7 +1530,7 @@ static void device_error(PSDevice pDevice, unsigned short status) } } -static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc) +static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) { PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; struct sk_buff *skb = pTDInfo->skb; @@ -1643,7 +1551,7 @@ static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc) static int device_open(struct net_device *dev) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); int i; #ifdef WPA_SM_Transtatus extern SWPAResult wpa_Result; @@ -1666,7 +1574,7 @@ static int device_open(struct net_device *dev) wpa_Result.authenticated = false; pDevice->fWPA_Authened = false; #endif - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device init rd0 ring\n"); + pr_debug("call device init rd0 ring\n"); device_init_rd0_ring(pDevice); device_init_rd1_ring(pDevice); device_init_defrag_cb(pDevice); @@ -1679,7 +1587,7 @@ static int device_open(struct net_device *dev) vMgrObjectInit(pDevice); vMgrTimerInit(pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n"); + pr_debug("call device_init_registers\n"); device_init_registers(pDevice); MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr); @@ -1710,7 +1618,7 @@ static int device_open(struct net_device *dev) pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call MACvIntEnable\n"); + pr_debug("call MACvIntEnable\n"); MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); if (pDevice->pMgmt->eConfigMode == WMAC_CONFIG_AP) { @@ -1721,24 +1629,21 @@ static int device_open(struct net_device *dev) } pDevice->flags |= DEVICE_FLAGS_OPENED; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success..\n"); + pr_debug("device_open success..\n"); return 0; } static int device_close(struct net_device *dev) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = pDevice->pMgmt; - //PLICE_DEBUG-> -//PLICE_DEBUG<- //2007-1121-02<Add>by EinsnLiu if (pDevice->bLinkPass) { bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL); mdelay(30); } -#ifdef TxInSleep + del_timer(&pDevice->sTimerTxData); -#endif del_timer(&pDevice->sTimerCommand); del_timer(&pMgmt->sTimerSecondCallback); if (pDevice->bDiversityRegCtlON) { @@ -1768,21 +1673,21 @@ static int device_close(struct net_device *dev) //2008-0714-01<Add>by chester device_release_WPADEV(pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close..\n"); + pr_debug("device_close..\n"); return 0; } static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); unsigned char *pbMPDU; unsigned int cbMPDULen = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211\n"); + pr_debug("device_dma0_tx_80211\n"); spin_lock_irq(&pDevice->lock); if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211, td0 <=0\n"); + pr_debug("device_dma0_tx_80211, td0 <=0\n"); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -1804,7 +1709,8 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) return 0; } -bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeIndex) +bool device_dma0_xmit(struct vnt_private *pDevice, + struct sk_buff *skb, unsigned int uNodeIndex) { PSMgmtObject pMgmt = pDevice->pMgmt; PSTxDesc pHeadTD, pLastTD; @@ -1824,14 +1730,14 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) { dev_kfree_skb_irq(skb); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, td0 <=0\n"); + pr_debug("device_dma0_xmit, td0 <=0\n"); return false; } if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (pDevice->uAssocCount == 0) { dev_kfree_skb_irq(skb); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, assocCount = 0\n"); + pr_debug("device_dma0_xmit, assocCount = 0\n"); return false; } } @@ -1877,7 +1783,7 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI else pDevice->byPreambleType = PREAMBLE_LONG; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = %d\n", pDevice->wCurrentRate); + pr_debug("dma0: pDevice->wCurrentRate = %d\n", pDevice->wCurrentRate); if (pDevice->wCurrentRate <= RATE_11M) { byPktType = PK_TYPE_11B; @@ -1944,10 +1850,8 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI } //TYPE_AC0DMA data tx -static int device_xmit(struct sk_buff *skb, struct net_device *dev) -{ - PSDevice pDevice = netdev_priv(dev); - +static int device_xmit(struct sk_buff *skb, struct net_device *dev) { + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = pDevice->pMgmt; PSTxDesc pHeadTD, pLastTD; unsigned int uNodeIndex = 0; @@ -2004,8 +1908,9 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) // set tx map wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID; pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set:pMgmt->abyPSTxMap[%d]= %d\n", - (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); + pr_debug("Set:pMgmt->abyPSTxMap[%d]= %d\n", + (wAID >> 3), + pMgmt->abyPSTxMap[wAID >> 3]); spin_unlock_irq(&pDevice->lock); return 0; } @@ -2021,7 +1926,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) } if (!bNodeExist) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Unknown STA not found in node DB\n"); + pr_debug("Unknown STA not found in node DB\n"); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2050,19 +1955,19 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) // get group key if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) { bTKIP_UseGTK = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get GTK.\n"); + pr_debug("Get GTK\n"); break; } } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get PTK.\n"); + pr_debug("Get PTK\n"); break; } } else if (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { pbyBSSID = pDevice->sTxEthHeader.abyDstAddr; //TO_DS = 0 and FROM_DS = 0 --> 802.11 MAC Address1 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "IBSS Serach Key:\n"); + pr_debug("IBSS Serach Key:\n"); for (ii = 0; ii < 6; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "%x\n", *(pbyBSSID+ii)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "\n"); + pr_debug("%x\n", *(pbyBSSID+ii)); + pr_debug("\n"); // get pairwise key if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) @@ -2073,18 +1978,20 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { pTransmitKey = NULL; if (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode); + pr_debug("IBSS and KEY is NULL. [%d]\n", + pDevice->pMgmt->eCurrMode); else - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "NOT IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode); + pr_debug("NOT IBSS and KEY is NULL. [%d]\n", + pDevice->pMgmt->eCurrMode); } else { bTKIP_UseGTK = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get GTK.\n"); + pr_debug("Get GTK\n"); } } while (false); } if (pDevice->bEnableHostWEP) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "acdma0: STA index %d\n", uNodeIndex); + pr_debug("acdma0: STA index %d\n", uNodeIndex); if (pDevice->bEncryptionEnable) { pTransmitKey = &STempKey; pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; @@ -2102,7 +2009,8 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader); if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA)) { - DBG_PRT(MSG_LEVEL_ERR, KERN_DEBUG "uMACfragNum > AVAIL_TD(TYPE_AC0DMA) = %d\n", uMACfragNum); + pr_debug("uMACfragNum > AVAIL_TD(TYPE_AC0DMA) = %d\n", + uMACfragNum); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2118,10 +2026,6 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) byPktType = (unsigned char)pDevice->byPacketType; if (pDevice->bFixRate) { -#ifdef PLICE_DEBUG - pr_debug("Fix Rate: PhyType is %d,ConnectionRate is %d\n", pDevice->eCurrentPHYType, pDevice->uConnectionRate); -#endif - if (pDevice->eCurrentPHYType == PHY_TYPE_11B) { if (pDevice->uConnectionRate >= RATE_11M) pDevice->wCurrentRate = RATE_11M; @@ -2180,18 +2084,21 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) } if (bNeedEncryption) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType)); + pr_debug("ntohs Pkt Type=%04x\n", + ntohs(pDevice->sTxEthHeader.wType)); if ((pDevice->sTxEthHeader.wType) == TYPE_PKT_802_1x) { bNeedEncryption = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pkt Type=%04x\n", (pDevice->sTxEthHeader.wType)); + pr_debug("Pkt Type=%04x\n", + (pDevice->sTxEthHeader.wType)); if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pDevice->pMgmt->eCurrState == WMAC_STATE_ASSOC)) { if (pTransmitKey == NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Don't Find TX KEY\n"); + pr_debug("Don't Find TX KEY\n"); } else { if (bTKIP_UseGTK) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "error: KEY is GTK!!~~\n"); + pr_debug("error: KEY is GTK!!~~\n"); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); + pr_debug("Find PTK [%lX]\n", + pTransmitKey->dwKeyIndex); bNeedEncryption = true; } } @@ -2205,13 +2112,14 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) if (pDevice->bEnableHostWEP) { if ((uNodeIndex != 0) && (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); + pr_debug("Find PTK [%lX]\n", + pTransmitKey->dwKeyIndex); bNeedEncryption = true; } } } else { if (pTransmitKey == NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return no tx key\n"); + pr_debug("return no tx key\n"); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2248,9 +2156,8 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) pLastTD->pTDInfo->skb = skb; pLastTD->pTDInfo->byFlags = 0; pLastTD->pTDInfo->byFlags |= TD_FLAGS_NETIF_SKB; -#ifdef TxInSleep pDevice->nTxDataTimeCout = 0; //2008-8-21 chester <add> for send null packet -#endif + if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 1) netif_stop_queue(dev); @@ -2300,8 +2207,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) static irqreturn_t device_intr(int irq, void *dev_instance) { struct net_device *dev = dev_instance; - PSDevice pDevice = (PSDevice)netdev_priv(dev); - + struct vnt_private *pDevice = netdev_priv(dev); int max_count = 0; unsigned long dwMIBCounter = 0; PSMgmtObject pMgmt = pDevice->pMgmt; @@ -2317,7 +2223,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) return IRQ_RETVAL(handled); if (pDevice->dwIsr == 0xffffffff) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwIsr = 0xffff\n"); + pr_debug("dwIsr = 0xffff\n"); return IRQ_RETVAL(handled); } @@ -2344,7 +2250,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr); if (pDevice->dwIsr & ISR_FETALERR) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ISR_FETALERR\n"); + pr_debug(" ISR_FETALERR\n"); VNSvOutPortB(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, 0); VNSvOutPortW(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI); device_error(pDevice, pDevice->dwIsr); @@ -2425,7 +2331,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) } } if (pDevice->bChannelSwitch && - (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE)) { + (pDevice->op_mode == NL80211_IFTYPE_STATION)) { pDevice->byChannelSwitchCount--; if (pDevice->byChannelSwitchCount == 0) { pDevice->bChannelSwitch = false; @@ -2438,7 +2344,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) } } - if (pDevice->eOPMode != OP_MODE_ADHOC) { + if (pDevice->op_mode != NL80211_IFTYPE_ADHOC) { if ((pDevice->bUpdateBBVGA) && pDevice->bLinkPass && (pDevice->uCurrRSSI != 0)) { long ldBm; @@ -2454,12 +2360,18 @@ static irqreturn_t device_intr(int irq, void *dev_instance) if (pDevice->uBBVGADiffCount == 1) { // first VGA diff gain BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "First RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n", - (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount); + pr_debug("First RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n", + (int)ldBm, + pDevice->byBBVGANew, + pDevice->byBBVGACurrent, + (int)pDevice->uBBVGADiffCount); } if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n", - (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount); + pr_debug("RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n", + (int)ldBm, + pDevice->byBBVGANew, + pDevice->byBBVGACurrent, + (int)pDevice->uBBVGADiffCount); BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew); } } else { @@ -2472,8 +2384,8 @@ static irqreturn_t device_intr(int irq, void *dev_instance) if (pDevice->bEnablePSMode) PSbIsNextTBTTWakeUp((void *)pDevice); - if ((pDevice->eOPMode == OP_MODE_AP) || - (pDevice->eOPMode == OP_MODE_ADHOC)) { + if ((pDevice->op_mode == NL80211_IFTYPE_AP) || + (pDevice->op_mode == NL80211_IFTYPE_ADHOC)) { MACvOneShotTimer1MicroSec(pDevice->PortOffset, (pMgmt->wIBSSBeaconPeriod - MAKE_BEACON_RESERVED) << 10); } @@ -2483,12 +2395,12 @@ static irqreturn_t device_intr(int irq, void *dev_instance) } if (pDevice->dwIsr & ISR_BNTX) { - if (pDevice->eOPMode == OP_MODE_ADHOC) { + if (pDevice->op_mode == NL80211_IFTYPE_ADHOC) { pDevice->bIsBeaconBufReadySet = false; pDevice->cbBeaconBufReadySetCnt = 0; } - if (pDevice->eOPMode == OP_MODE_AP) { + if (pDevice->op_mode == NL80211_IFTYPE_AP) { if (pMgmt->byDTIMCount > 0) { pMgmt->byDTIMCount--; pMgmt->sNodeDBTable[0].bRxPSPoll = false; @@ -2531,7 +2443,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) max_count += device_tx_srv(pDevice, TYPE_AC0DMA); if (pDevice->dwIsr & ISR_SOFTTIMER1) { - if (pDevice->eOPMode == OP_MODE_AP) { + if (pDevice->op_mode == NL80211_IFTYPE_AP) { if (pDevice->bShortSlotTime) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); else @@ -2560,23 +2472,6 @@ static irqreturn_t device_intr(int irq, void *dev_instance) return IRQ_RETVAL(handled); } -static unsigned const ethernet_polynomial = 0x04c11db7U; -static inline u32 ether_crc(int length, unsigned char *data) -{ - int crc = -1; - - while (--length >= 0) { - unsigned char current_octet = *data++; - int bit; - - for (bit = 0; bit < 8; bit++, current_octet >>= 1) { - crc = (crc << 1) ^ - ((crc < 0) ^ (current_octet & 1) ? ethernet_polynomial : 0); - } - } - return crc; -} - //2008-8-4 <add> by chester static int Config_FileGetParameter(unsigned char *string, unsigned char *dest, unsigned char *source) @@ -2593,7 +2488,8 @@ static int Config_FileGetParameter(unsigned char *string, return true; } -int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter) +int Config_FileOperation(struct vnt_private *pDevice, + bool fwrite, unsigned char *Parameter) { unsigned char *buffer = kmalloc(1024, GFP_KERNEL); unsigned char tmpbuffer[20]; @@ -2617,7 +2513,7 @@ int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter goto error1; } - if (Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer)!=true) { + if (Config_FileGetParameter("ZONETYPE", tmpbuffer, buffer) != true) { pr_err("get parameter error?\n"); result = -1; goto error1; @@ -2625,9 +2521,9 @@ int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter if (memcmp(tmpbuffer, "USA", 3) == 0) { result = ZoneType_USA; - } else if(memcmp(tmpbuffer, "JAPAN", 5) == 0) { + } else if (memcmp(tmpbuffer, "JAPAN", 5) == 0) { result = ZoneType_Japan; - } else if(memcmp(tmpbuffer, "EUROPE", 5) == 0) { + } else if (memcmp(tmpbuffer, "EUROPE", 5) == 0) { result = ZoneType_Europe; } else { result = -1; @@ -2640,10 +2536,8 @@ error1: return result; } -static void device_set_multi(struct net_device *dev) -{ - PSDevice pDevice = (PSDevice)netdev_priv(dev); - +static void device_set_multi(struct net_device *dev) { + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = pDevice->pMgmt; u32 mc_filter[2]; struct netdev_hw_addr *ha; @@ -2651,7 +2545,7 @@ static void device_set_multi(struct net_device *dev) VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode)); if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ - DBG_PRT(MSG_LEVEL_ERR, KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name); + pr_notice("%s: Promiscuous mode enabled\n", dev->name); /* Unconditionally log net taps. */ pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST); } else if ((netdev_mc_count(dev) > pDevice->multicast_limit) @@ -2683,20 +2577,12 @@ static void device_set_multi(struct net_device *dev) } VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byRxMode); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode = %x\n", pDevice->byRxMode); -} - -static struct net_device_stats *device_get_stats(struct net_device *dev) -{ - PSDevice pDevice = (PSDevice)netdev_priv(dev); - - return &pDevice->stats; + pr_debug("pDevice->byRxMode = %x\n", pDevice->byRxMode); } static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - + struct vnt_private *pDevice = netdev_priv(dev); struct iwreq *wrq = (struct iwreq *)rq; int rc = 0; PSMgmtObject pMgmt = pDevice->pMgmt; @@ -2774,13 +2660,13 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) // Set desired station name case SIOCSIWNICKN: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN\n"); + pr_debug(" SIOCSIWNICKN\n"); rc = -EOPNOTSUPP; break; // Get current station name case SIOCGIWNICKN: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN\n"); + pr_debug(" SIOCGIWNICKN\n"); rc = -EOPNOTSUPP; break; @@ -2877,12 +2763,12 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) // Get the current Tx-Power case SIOCGIWTXPOW: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW\n"); + pr_debug(" SIOCGIWTXPOW\n"); rc = -EOPNOTSUPP; break; case SIOCSIWTXPOW: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWTXPOW\n"); + pr_debug(" SIOCSIWTXPOW\n"); rc = -EOPNOTSUPP; break; @@ -2925,7 +2811,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) break; case SIOCSIWSENS: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSENS\n"); + pr_debug(" SIOCSIWSENS\n"); rc = -EOPNOTSUPP; break; @@ -2949,50 +2835,50 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) // Set the spy list case SIOCSIWSPY: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY\n"); + pr_debug(" SIOCSIWSPY\n"); rc = -EOPNOTSUPP; break; // Get the spy list case SIOCGIWSPY: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSPY\n"); + pr_debug(" SIOCGIWSPY\n"); rc = -EOPNOTSUPP; break; #endif // WIRELESS_SPY case SIOCGIWPRIV: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPRIV\n"); + pr_debug(" SIOCGIWPRIV\n"); rc = -EOPNOTSUPP; break; //2008-0409-07, <Add> by Einsn Liu #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT case SIOCSIWAUTH: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n"); + pr_debug(" SIOCSIWAUTH\n"); rc = iwctl_siwauth(dev, NULL, &(wrq->u.param), NULL); break; case SIOCGIWAUTH: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAUTH\n"); + pr_debug(" SIOCGIWAUTH\n"); rc = iwctl_giwauth(dev, NULL, &(wrq->u.param), NULL); break; case SIOCSIWGENIE: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWGENIE\n"); + pr_debug(" SIOCSIWGENIE\n"); rc = iwctl_siwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer); break; case SIOCGIWGENIE: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWGENIE\n"); + pr_debug(" SIOCGIWGENIE\n"); rc = iwctl_giwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer); break; case SIOCSIWENCODEEXT: { char extra[sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODEEXT\n"); + pr_debug(" SIOCSIWENCODEEXT\n"); if (wrq->u.encoding.pointer) { memset(extra, 0, sizeof(struct iw_encode_ext)+MAX_KEY_LEN + 1); if (wrq->u.encoding.length > (sizeof(struct iw_encode_ext) + MAX_KEY_LEN)) { @@ -3012,12 +2898,12 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) break; case SIOCGIWENCODEEXT: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODEEXT\n"); + pr_debug(" SIOCGIWENCODEEXT\n"); rc = iwctl_giwencodeext(dev, NULL, &(wrq->u.encoding), NULL); break; case SIOCSIWMLME: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME\n"); + pr_debug(" SIOCSIWMLME\n"); rc = iwctl_siwmlme(dev, NULL, &(wrq->u.data), wrq->u.data.pointer); break; @@ -3075,7 +2961,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) default: rc = -EOPNOTSUPP; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Ioctl command not support..%x\n", cmd); + pr_debug("Ioctl command not support..%x\n", cmd); } @@ -3086,7 +2972,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL); spin_unlock_irq(&pDevice->lock); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n"); + pr_debug("Commit the settings\n"); spin_lock_irq(&pDevice->lock); pDevice->bLinkPass = false; memset(pMgmt->abyCurrBSSID, 0, 6); @@ -3193,7 +3079,7 @@ viawget_suspend(struct pci_dev *pcid, pm_message_t state) { int power_status; // to silence the compiler - PSDevice pDevice = pci_get_drvdata(pcid); + struct vnt_private *pDevice = pci_get_drvdata(pcid); PSMgmtObject pMgmt = pDevice->pMgmt; netif_stop_queue(pDevice->dev); @@ -3219,7 +3105,7 @@ viawget_suspend(struct pci_dev *pcid, pm_message_t state) static int viawget_resume(struct pci_dev *pcid) { - PSDevice pDevice = pci_get_drvdata(pcid); + struct vnt_private *pDevice = pci_get_drvdata(pcid); PSMgmtObject pMgmt = pDevice->pMgmt; int power_status; // to silence the compiler diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index 0bcf6c7472fe..8515b8c80801 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -61,8 +61,6 @@ /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; - static const unsigned char acbyRxRate[MAX_RATE] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; @@ -79,18 +77,18 @@ s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize, PSEthernetHeader psEthHeader); static void -s_vProcessRxMACHeader(PSDevice pDevice, unsigned char *pbyRxBufferAddr, +s_vProcessRxMACHeader(struct vnt_private *pDevice, unsigned char *pbyRxBufferAddr, unsigned int cbPacketSize, bool bIsWEP, bool bExtIV, unsigned int *pcbHeadSize); static bool s_bAPModeRxCtl( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyFrame, int iSANodeIndex ); static bool s_bAPModeRxData( - PSDevice pDevice, + struct vnt_private *pDevice, struct sk_buff *skb, unsigned int FrameSize, unsigned int cbHeaderOffset, @@ -99,7 +97,7 @@ static bool s_bAPModeRxData( ); static bool s_bHandleRxEncryption( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyFrame, unsigned int FrameSize, unsigned char *pbyRsr, @@ -112,7 +110,7 @@ static bool s_bHandleRxEncryption( static bool s_bHostWepRxEncryption( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyFrame, unsigned int FrameSize, unsigned char *pbyRsr, @@ -145,7 +143,8 @@ static bool s_bHostWepRxEncryption( * -*/ static void -s_vProcessRxMACHeader(PSDevice pDevice, unsigned char *pbyRxBufferAddr, +s_vProcessRxMACHeader(struct vnt_private *pDevice, + unsigned char *pbyRxBufferAddr, unsigned int cbPacketSize, bool bIsWEP, bool bExtIV, unsigned int *pcbHeadSize) { @@ -270,12 +269,12 @@ s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize, bool device_receive_frame( - PSDevice pDevice, + struct vnt_private *pDevice, PSRxDesc pCurrRD ) { PDEVICE_RD_INFO pRDInfo = pCurrRD->pRDInfo; - struct net_device_stats *pStats = &pDevice->stats; + struct net_device_stats *pStats = &pDevice->dev->stats; struct sk_buff *skb; PSMgmtObject pMgmt = pDevice->pMgmt; PSRxMgmtPacket pRxPacket = &(pDevice->pMgmt->sRxPacket); @@ -283,7 +282,7 @@ device_receive_frame( unsigned char *pbyRsr; unsigned char *pbyNewRsr; unsigned char *pbyRSSI; - PQWORD pqwTSFTime; + __le64 *pqwTSFTime; unsigned short *pwFrameSize; unsigned char *pbyFrame; bool bDeFragRx = false; @@ -313,10 +312,9 @@ device_receive_frame( skb = pRDInfo->skb; -//PLICE_DEBUG-> pci_unmap_single(pDevice->pcid, pRDInfo->skb_dma, pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE); -//PLICE_DEBUG<- + pwFrameSize = (unsigned short *)(skb->data + 2); FrameSize = cpu_to_le16(pCurrRD->m_rd1RD1.wReqCount) - cpu_to_le16(pCurrRD->m_rd0RD0.wResCount); @@ -324,7 +322,7 @@ device_receive_frame( // Min (ACK): 10HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR if ((FrameSize > 2364) || (FrameSize <= 32)) { // Frame Size error drop this packet. - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 1\n"); + pr_debug("---------- WRONG Length 1\n"); return false; } @@ -334,7 +332,7 @@ device_receive_frame( 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 @@ -342,10 +340,10 @@ device_receive_frame( if ((FrameSize > 2346)|(FrameSize < 14)) { // Max: 2312Payload + 30HD +4CRC // Min: 14 bytes ACK - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 2\n"); + pr_debug("---------- WRONG Length 2\n"); return false; } -//PLICE_DEBUG-> + // update receive statistic counter STAvUpdateRDStatCounter(&pDevice->scStatistic, *pbyRsr, @@ -355,7 +353,7 @@ device_receive_frame( FrameSize); pMACHeader = (PS802_11Header)((unsigned char *)(skb->data) + 8); -//PLICE_DEBUG<- + if (pDevice->bMeasureInProgress) { if ((*pbyRsr & RSR_CRCOK) != 0) pDevice->byBasicMap |= 0x01; @@ -420,7 +418,7 @@ device_receive_frame( if (IS_FC_WEP(pbyFrame)) { bool bRxDecryOK = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx WEP pkt\n"); + pr_debug("rx WEP pkt\n"); bIsWEP = true; if ((pDevice->bEnableHostWEP) && (iSANodeIndex >= 0)) { pKey = &STempKey; @@ -458,7 +456,7 @@ device_receive_frame( if (bRxDecryOK) { if ((*pbyNewRsr & NEWRSR_DECRYPTOK) == 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV Fail\n"); + pr_debug("ICV Fail\n"); if ((pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) || @@ -472,7 +470,7 @@ device_receive_frame( return false; } } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP Func Fail\n"); + pr_debug("WEP Func Fail\n"); return false; } if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP)) @@ -515,8 +513,7 @@ device_receive_frame( 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); @@ -554,8 +551,8 @@ device_receive_frame( if (!(*pbyRsr & RSR_BSSIDOK)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); + pr_err("%s: can not alloc more frag bufs\n", + pDevice->dev->name); } } return false; @@ -565,8 +562,8 @@ device_receive_frame( if (!pDevice->bLinkPass || !(*pbyRsr & RSR_BSSIDOK)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); + pr_err("%s: can not alloc more frag bufs\n", + pDevice->dev->name); } } return false; @@ -606,7 +603,7 @@ device_receive_frame( // Now it only supports 802.11g Infrastructure Mode, and support rate must up to 54 Mbps if (pDevice->bDiversityEnable && (FrameSize > 50) && - (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) && + (pDevice->op_mode == NL80211_IFTYPE_STATION) && pDevice->bLinkPass) { BBvAntennaDiversity(pDevice, s_byGetRateIdx(*pbyRxRate), 0); } @@ -642,7 +639,7 @@ device_receive_frame( wEtherType = (skb->data[cbIVOffset + 4 + 24 + 6] << 8) | skb->data[cbIVOffset + 4 + 24 + 6 + 1]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wEtherType = %04x\n", wEtherType); + pr_debug("wEtherType = %04x\n", wEtherType); if (wEtherType == ETH_P_PAE) { skb->dev = pDevice->apdev; @@ -717,13 +714,13 @@ device_receive_frame( if ((le32_to_cpu(*pdwMIC_L) != dwLocalMIC_L) || (le32_to_cpu(*pdwMIC_R) != dwLocalMIC_R) || pDevice->bRxMICFail) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC comparison is fail!\n"); + pr_debug("MIC comparison is fail!\n"); pDevice->bRxMICFail = false; pDevice->s802_11Counter.TKIPLocalMICFailures++; if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); + pr_err("%s: can not alloc more frag bufs\n", + pDevice->dev->name); } } //2008-0409-07, <Add> by Einsn Liu @@ -796,7 +793,7 @@ device_receive_frame( 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)) { @@ -804,7 +801,7 @@ device_receive_frame( if ((wRxTSC15_0 < wLocalTSC15_0) && (dwRxTSC47_16 <= dwLocalTSC47_16) && !((dwRxTSC47_16 == 0) && (dwLocalTSC47_16 == 0xFFFFFFFF))) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TSC is illegal~~!\n "); + pr_debug("TSC is illegal~~!\n "); if (pKey->byCipherSuite == KEY_CTL_TKIP) pDevice->s802_11Counter.TKIPReplays++; else @@ -812,8 +809,8 @@ device_receive_frame( if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); + pr_err("%s: can not alloc more frag bufs\n", + pDevice->dev->name); } } return false; @@ -840,8 +837,8 @@ device_receive_frame( )) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); + pr_err("%s: can not alloc more frag bufs\n", + pDevice->dev->name); } } return false; @@ -862,8 +859,8 @@ device_receive_frame( if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); + pr_err("%s: can not alloc more frag bufs\n", + pDevice->dev->name); } return false; } @@ -872,7 +869,7 @@ device_receive_frame( } static bool s_bAPModeRxCtl( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyFrame, int iSANodeIndex ) @@ -897,7 +894,7 @@ static bool s_bAPModeRxCtl( (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 1\n"); + pr_debug("dpc: send vMgrDeAuthenBeginSta 1\n"); return true; } if (pMgmt->sNodeDBTable[iSANodeIndex].eNodeState < NODE_ASSOC) { @@ -909,7 +906,7 @@ static bool s_bAPModeRxCtl( (WLAN_MGMT_REASON_CLASS3_NONASSOC), &Status ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDisassocBeginSta 2\n"); + pr_debug("dpc: send vMgrDisassocBeginSta 2\n"); return true; } @@ -918,7 +915,7 @@ static bool s_bAPModeRxCtl( if (IS_CTL_PSPOLL(pbyFrame)) { pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; bScheduleCommand((void *)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n"); + pr_debug("dpc: WLAN_CMD_RX_PSPOLL 1\n"); } else { // check Data PS state // if PW bit off, send out all PS bufferring packets. @@ -926,7 +923,7 @@ static bool s_bAPModeRxCtl( pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false; pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; bScheduleCommand((void *)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n"); + pr_debug("dpc: WLAN_CMD_RX_PSPOLL 2\n"); } } } else { @@ -940,7 +937,7 @@ static bool s_bAPModeRxCtl( pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false; pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; bScheduleCommand((void *)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 3\n"); + pr_debug("dpc: WLAN_CMD_RX_PSPOLL 3\n"); } } @@ -952,16 +949,18 @@ static bool s_bAPModeRxCtl( (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%pM\n", - p802_11Header->abyAddr3); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%pM\n", - p802_11Header->abyAddr2); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n", - p802_11Header->abyAddr1); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl); + pr_debug("dpc: send vMgrDeAuthenBeginSta 3\n"); + pr_debug("BSSID:%pM\n", + p802_11Header->abyAddr3); + pr_debug("ADDR2:%pM\n", + p802_11Header->abyAddr2); + pr_debug("ADDR1:%pM\n", + p802_11Header->abyAddr1); + pr_debug("dpc: wFrameCtl= %x\n", + p802_11Header->wFrameCtl); VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc:pDevice->byRxMode = %x\n", pDevice->byRxMode); + pr_debug("dpc:pDevice->byRxMode = %x\n", + pDevice->byRxMode); return true; } } @@ -970,7 +969,7 @@ static bool s_bAPModeRxCtl( } static bool s_bHandleRxEncryption( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyFrame, unsigned int FrameSize, unsigned char *pbyRsr, @@ -999,7 +998,7 @@ static bool s_bHandleRxEncryption( } byKeyIdx = (*(pbyIV+3) & 0xc0); byKeyIdx >>= 6; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\nKeyIdx: %d\n", byKeyIdx); + pr_debug("\nKeyIdx: %d\n", byKeyIdx); if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || @@ -1009,14 +1008,14 @@ static bool s_bHandleRxEncryption( if (((*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) && (pDevice->pMgmt->byCSSPK != KEY_CTL_NONE)) { // unicast pkt use pairwise key - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "unicast pkt\n"); + pr_debug("unicast pkt\n"); if (KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, 0xFFFFFFFF, &pKey) == true) { if (pDevice->pMgmt->byCSSPK == KEY_CTL_TKIP) byDecMode = KEY_CTL_TKIP; else if (pDevice->pMgmt->byCSSPK == KEY_CTL_CCMP) byDecMode = KEY_CTL_CCMP; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "unicast pkt: %d, %p\n", byDecMode, pKey); + pr_debug("unicast pkt: %d, %p\n", byDecMode, pKey); } else { // use group key KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, byKeyIdx, &pKey); @@ -1024,7 +1023,8 @@ static bool s_bHandleRxEncryption( byDecMode = KEY_CTL_TKIP; else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP) byDecMode = KEY_CTL_CCMP; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group pkt: %d, %d, %p\n", byKeyIdx, byDecMode, pKey); + pr_debug("group pkt: %d, %d, %p\n", + byKeyIdx, byDecMode, pKey); } } // our WEP only support Default Key @@ -1038,10 +1038,11 @@ static bool s_bHandleRxEncryption( } *pKeyOut = pKey; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); + pr_debug("AES:%d %d %d\n", + pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); if (pKey == NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey == NULL\n"); + pr_debug("pKey == NULL\n"); return false; } @@ -1074,13 +1075,13 @@ static bool s_bHandleRxEncryption( PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc *pdwRxTSC47_16 = cpu_to_le32(*(unsigned long *)(pbyIV + 4)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ExtIV: %lx\n", *pdwRxTSC47_16); + pr_debug("ExtIV: %lx\n", *pdwRxTSC47_16); if (byDecMode == KEY_CTL_TKIP) *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV + 2), *pbyIV)); else *pwRxTSC15_0 = cpu_to_le16(*(unsigned short *)pbyIV); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TSC0_15: %x\n", *pwRxTSC15_0); + pr_debug("TSC0_15: %x\n", *pwRxTSC15_0); if ((byDecMode == KEY_CTL_TKIP) && (pDevice->byLocalID <= REV_ID_VT3253_A1)) { @@ -1093,10 +1094,10 @@ static bool s_bHandleRxEncryption( rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { *pbyNewRsr |= NEWRSR_DECRYPTOK; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV OK!\n"); + pr_debug("ICV OK!\n"); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV FAIL!!!\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PayloadLen = %d\n", PayloadLen); + pr_debug("ICV FAIL!!!\n"); + pr_debug("PayloadLen = %d\n", PayloadLen); } } }// end of TKIP/AES @@ -1107,7 +1108,7 @@ static bool s_bHandleRxEncryption( } static bool s_bHostWepRxEncryption( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyFrame, unsigned int FrameSize, unsigned char *pbyRsr, @@ -1136,21 +1137,22 @@ static bool s_bHostWepRxEncryption( } byKeyIdx = (*(pbyIV+3) & 0xc0); byKeyIdx >>= 6; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\nKeyIdx: %d\n", byKeyIdx); + pr_debug("\nKeyIdx: %d\n", byKeyIdx); if (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP) byDecMode = KEY_CTL_TKIP; else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP) byDecMode = KEY_CTL_CCMP; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); + pr_debug("AES:%d %d %d\n", + pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); if (byDecMode != pKey->byCipherSuite) return false; if (byDecMode == KEY_CTL_WEP) { // handle WEP - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byDecMode == KEY_CTL_WEP\n"); + pr_debug("byDecMode == KEY_CTL_WEP\n"); if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true) || @@ -1176,31 +1178,32 @@ static bool s_bHostWepRxEncryption( PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc *pdwRxTSC47_16 = cpu_to_le32(*(unsigned long *)(pbyIV + 4)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ExtIV: %lx\n", *pdwRxTSC47_16); + pr_debug("ExtIV: %lx\n", *pdwRxTSC47_16); if (byDecMode == KEY_CTL_TKIP) *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); else *pwRxTSC15_0 = cpu_to_le16(*(unsigned short *)pbyIV); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TSC0_15: %x\n", *pwRxTSC15_0); + pr_debug("TSC0_15: %x\n", *pwRxTSC15_0); if (byDecMode == KEY_CTL_TKIP) { if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || !bOnFly) { // Software TKIP // 1. 3253 A // 2. NotOnFly - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "soft KEY_CTL_TKIP\n"); + pr_debug("soft KEY_CTL_TKIP\n"); pMACHeader = (PS802_11Header)(pbyFrame); TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { *pbyNewRsr |= NEWRSR_DECRYPTOK; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV OK!\n"); + pr_debug("ICV OK!\n"); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV FAIL!!!\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PayloadLen = %d\n", PayloadLen); + pr_debug("ICV FAIL!!!\n"); + pr_debug("PayloadLen = %d\n", + PayloadLen); } } } @@ -1209,12 +1212,12 @@ static bool s_bHostWepRxEncryption( if (!bOnFly) { // Software CCMP // NotOnFly - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "soft KEY_CTL_CCMP\n"); + pr_debug("soft KEY_CTL_CCMP\n"); if (AESbGenCCMP(pKey->abyKey, pbyFrame, FrameSize)) { *pbyNewRsr |= NEWRSR_DECRYPTOK; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CCMP MIC compare OK!\n"); + pr_debug("CCMP MIC compare OK!\n"); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CCMP MIC fail!\n"); + pr_debug("CCMP MIC fail!\n"); } } } @@ -1227,7 +1230,7 @@ static bool s_bHostWepRxEncryption( } static bool s_bAPModeRxData( - PSDevice pDevice, + struct vnt_private *pDevice, struct sk_buff *skb, unsigned int FrameSize, unsigned int cbHeaderOffset, @@ -1252,7 +1255,7 @@ static bool s_bAPModeRxData( // if any node in PS mode, buffer packet until DTIM. if (skbcpy == NULL) { - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available\n"); + pr_info("relay multicast no skb available\n"); } else { skbcpy->dev = pDevice->dev; skbcpy->len = FrameSize; @@ -1280,8 +1283,9 @@ static bool s_bAPModeRxData( pMgmt->sNodeDBTable[iDANodeIndex].wEnQueueCnt++; wAID = pMgmt->sNodeDBTable[iDANodeIndex].wAID; pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n", - iDANodeIndex, (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); + pr_debug("relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n", + iDANodeIndex, (wAID >> 3), + pMgmt->abyPSTxMap[wAID >> 3]); return true; } else { bRelayOnly = true; diff --git a/drivers/staging/vt6655/dpc.h b/drivers/staging/vt6655/dpc.h index 4914890115e4..a068b846b1be 100644 --- a/drivers/staging/vt6655/dpc.h +++ b/drivers/staging/vt6655/dpc.h @@ -35,7 +35,7 @@ bool device_receive_frame( - PSDevice pDevice, + struct vnt_private *, PSRxDesc pCurrRD ); diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index f105c2ac091b..ae0dade229d8 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c @@ -47,9 +47,6 @@ /*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; - /*--------------------- Static Functions --------------------------*/ /*--------------------- Export Variables --------------------------*/ @@ -68,16 +65,16 @@ static int msglevel = MSG_LEVEL_INFO; * */ -static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) +static int hostap_enable_hostapd(struct vnt_private *pDevice, int rtnl_locked) { - PSDevice apdev_priv; + struct vnt_private *apdev_priv; struct net_device *dev = pDevice->dev; int ret; const struct net_device_ops apdev_netdev_ops = { .ndo_start_xmit = pDevice->tx_80211, }; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name); + pr_debug("%s: Enabling hostapd mode\n", dev->name); pDevice->apdev = alloc_etherdev(sizeof(*apdev_priv)); if (pDevice->apdev == NULL) @@ -101,15 +98,15 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) else ret = register_netdev(pDevice->apdev); if (ret) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdevice(AP) failed!\n", - dev->name); + pr_debug("%s: register_netdevice(AP) failed!\n", + dev->name); free_netdev(pDevice->apdev); pDevice->apdev = NULL; return -1; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n", - dev->name, pDevice->apdev->name); + pr_debug("%s: Registered netdevice %s for AP management\n", + dev->name, pDevice->apdev->name); KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); @@ -130,17 +127,17 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) * */ -static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked) +static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name); + pr_debug("%s: disabling hostapd mode\n", pDevice->dev->name); if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) { if (rtnl_locked) unregister_netdevice(pDevice->apdev); else unregister_netdev(pDevice->apdev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", - pDevice->dev->name, pDevice->apdev->name); + pr_debug("%s: Netdevice %s unregistered\n", + pDevice->dev->name, pDevice->apdev->name); } if (pDevice->apdev) free_netdev(pDevice->apdev); @@ -149,8 +146,8 @@ static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked) pDevice->bEnableHostWEP = false; pDevice->bEncryptionEnable = false; -//4.2007-0118-03,<Add> by EinsnLiu -//execute some clear work +/* 4.2007-0118-03,<Add> by EinsnLiu */ +/* execute some clear work */ pDevice->pMgmt->byCSSPK = KEY_CTL_NONE; pDevice->pMgmt->byCSSGK = KEY_CTL_NONE; KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); @@ -172,7 +169,8 @@ static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked) * */ -int vt6655_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked) +int vt6655_hostap_set_hostapd(struct vnt_private *pDevice, + int val, int rtnl_locked) { if (val < 0 || val > 1) return -EINVAL; @@ -201,7 +199,7 @@ int vt6655_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked) * Return Value: * */ -static int hostap_remove_sta(PSDevice pDevice, +static int hostap_remove_sta(struct vnt_private *pDevice, struct viawget_hostapd_param *param) { unsigned int uNodeIndex; @@ -227,28 +225,28 @@ static int hostap_remove_sta(PSDevice pDevice, * Return Value: * */ -static int hostap_add_sta(PSDevice pDevice, +static int hostap_add_sta(struct vnt_private *pDevice, struct viawget_hostapd_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int uNodeIndex; if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) - BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); + BSSvCreateOneNode(pDevice, &uNodeIndex); memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN); pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability; -// TODO listenInterval +/* TODO listenInterval */ pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = false; pMgmt->sNodeDBTable[uNodeIndex].bySuppRate = param->u.add_sta.tx_supp_rates; - // set max tx rate + /* set max tx rate */ pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; - // set max basic rate + /* set max basic rate */ pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate = RATE_2M; - // Todo: check sta preamble, if ap can't support, set status code + /* Todo: check sta preamble, if ap can't support, set status code */ pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(pMgmt->sNodeDBTable[uNodeIndex].wCapInfo); @@ -256,17 +254,10 @@ static int hostap_add_sta(PSDevice pDevice, pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d\n", pMgmt->sNodeDBTable[uNodeIndex].wAID); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", - param->sta_addr[0], - param->sta_addr[1], - param->sta_addr[2], - param->sta_addr[3], - param->sta_addr[4], - param->sta_addr[5] - ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d\n", - pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); + pr_debug("Add STA AID= %d\n", pMgmt->sNodeDBTable[uNodeIndex].wAID); + pr_debug("MAC=%pM\n", param->sta_addr); + pr_debug("Max Support rate = %d\n", + pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); return 0; } @@ -285,7 +276,7 @@ static int hostap_add_sta(PSDevice pDevice, * */ -static int hostap_get_info_sta(PSDevice pDevice, +static int hostap_get_info_sta(struct vnt_private *pDevice, struct viawget_hostapd_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; @@ -314,7 +305,7 @@ static int hostap_get_info_sta(PSDevice pDevice, * Return Value: * */ -static int hostap_set_flags_sta(PSDevice pDevice, +static int hostap_set_flags_sta(struct vnt_private *pDevice, struct viawget_hostapd_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; @@ -323,8 +314,8 @@ static int hostap_set_flags_sta(PSDevice pDevice, if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { pMgmt->sNodeDBTable[uNodeIndex].dwFlags |= param->u.set_flags_sta.flags_or; pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x\n", - (unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags); + pr_debug(" dwFlags = %x\n", + (unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags); } else { return -ENOENT; } @@ -345,11 +336,14 @@ static int hostap_set_flags_sta(PSDevice pDevice, * Return Value: * */ -static int hostap_set_generic_element(PSDevice pDevice, +static int hostap_set_generic_element(struct vnt_private *pDevice, struct viawget_hostapd_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; + if (param->u.generic_elem.len > sizeof(pMgmt->abyWPAIE)) + return -EINVAL; + memcpy(pMgmt->abyWPAIE, param->u.generic_elem.data, param->u.generic_elem.len @@ -357,18 +351,18 @@ static int hostap_set_generic_element(PSDevice pDevice, pMgmt->wWPAIELen = param->u.generic_elem.len; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen); + pr_debug("pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen); - // disable wpa + /* disable wpa */ if (pMgmt->wWPAIELen == 0) { pMgmt->eAuthenMode = WMAC_AUTH_OPEN; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA\n"); + pr_debug(" No WPAIE, Disable WPA\n"); } else { - // enable wpa + /* enable wpa */ if ((pMgmt->abyWPAIE[0] == WLAN_EID_RSN_WPA) || (pMgmt->abyWPAIE[0] == WLAN_EID_RSN)) { pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set WPAIE enable WPA\n"); + pr_debug("Set WPAIE enable WPA\n"); } else return -EINVAL; } @@ -389,9 +383,9 @@ static int hostap_set_generic_element(PSDevice pDevice, * */ -static void hostap_flush_sta(PSDevice pDevice) +static void hostap_flush_sta(struct vnt_private *pDevice) { - // reserved node index =0 for multicast node. + /* reserved node index =0 for multicast node. */ BSSvClearNodeDBTable(pDevice, 1); pDevice->uAssocCount = 0; } @@ -409,7 +403,7 @@ static void hostap_flush_sta(PSDevice pDevice) * Return Value: * */ -static int hostap_set_encryption(PSDevice pDevice, +static int hostap_set_encryption(struct vnt_private *pDevice, struct viawget_hostapd_param *param, int param_len) { @@ -417,7 +411,7 @@ static int hostap_set_encryption(PSDevice pDevice, 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; @@ -431,7 +425,7 @@ static int hostap_set_encryption(PSDevice pDevice, if ((param->u.crypt.idx > 3) || (param->u.crypt.key_len > MAX_KEY_LEN)) { param->u.crypt.err = HOSTAP_CRYPT_ERR_KEY_SET_FAILED; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n"); + pr_debug(" HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n"); return -EINVAL; } @@ -443,12 +437,12 @@ static int hostap_set_encryption(PSDevice pDevice, } else { if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) { param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); + pr_debug(" HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); return -EINVAL; } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: sta_index %d\n", iNodeIndex); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d\n", param->u.crypt.alg); + pr_debug(" hostap_set_encryption: sta_index %d\n", iNodeIndex); + pr_debug(" hostap_set_encryption: alg %d\n", param->u.crypt.alg); if (param->u.crypt.alg == WPA_ALG_NONE) { if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly) { @@ -456,7 +450,7 @@ static int hostap_set_encryption(PSDevice pDevice, param->sta_addr, pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex, pDevice->PortOffset)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail\n"); + pr_debug("KeybRemoveKey fail\n"); } pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; } @@ -476,7 +470,7 @@ static int hostap_set_encryption(PSDevice pDevice, } memcpy(abyKey, param->u.crypt.key, param->u.crypt.key_len); - // copy to node key tbl + /* copy to node key tbl */ pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = param->u.crypt.idx; pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = param->u.crypt.key_len; memcpy(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], @@ -503,13 +497,13 @@ static int hostap_set_encryption(PSDevice pDevice, pDevice->byLocalID); } else { - // 8021x enable, individual key - dwKeyIndex |= (1 << 30); // set pairwise key + /* 8021x enable, individual key */ + dwKeyIndex |= (1 << 30); /* set pairwise key */ if (KeybSetKey(&(pDevice->sKey), ¶m->sta_addr[0], dwKeyIndex & ~(USE_KEYRSC), param->u.crypt.key_len, - (PQWORD) &(KeyRSC), + (u64 *) &KeyRSC, (unsigned char *)abyKey, KEY_CTL_WEP, pDevice->PortOffset, @@ -517,7 +511,7 @@ static int hostap_set_encryption(PSDevice pDevice, pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { - // Key Table Full + /* Key Table Full */ pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; bKeyTableFull = true; } @@ -534,7 +528,7 @@ static int hostap_set_encryption(PSDevice pDevice, 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; @@ -563,7 +557,7 @@ static int hostap_set_encryption(PSDevice pDevice, KeybSetDefaultKey(&(pDevice->sKey), dwKeyIndex, param->u.crypt.key_len, - (PQWORD) &(KeyRSC), + (u64 *) &KeyRSC, abyKey, byKeyDecMode, pDevice->PortOffset, @@ -571,12 +565,12 @@ static int hostap_set_encryption(PSDevice pDevice, pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { - dwKeyIndex |= (1 << 30); // set pairwise key + dwKeyIndex |= (1 << 30); /* set pairwise key */ if (KeybSetKey(&(pDevice->sKey), ¶m->sta_addr[0], dwKeyIndex, param->u.crypt.key_len, - (PQWORD) &(KeyRSC), + (u64 *) &KeyRSC, (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, @@ -584,35 +578,34 @@ static int hostap_set_encryption(PSDevice pDevice, pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { - // Key Table Full + /* Key Table Full */ pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; bKeyTableFull = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n"); + pr_debug(" Key Table Full\n"); } } if (bKeyTableFull) { - wKeyCtl &= 0x7F00; // clear all key control filed + wKeyCtl &= 0x7F00; /* clear all key control filed */ wKeyCtl |= (byKeyDecMode << 4); wKeyCtl |= (byKeyDecMode); - wKeyCtl |= 0x0044; // use group key for all address - wKeyCtl |= 0x4000; // disable KeyTable[MAX_KEY_TABLE-1] on-fly to genernate rx int + wKeyCtl |= 0x0044; /* use group key for all address */ + wKeyCtl |= 0x4000; /* disable KeyTable[MAX_KEY_TABLE-1] on-fly to genernate rx int */ MACvSetDefaultKeyCtl(pDevice->PortOffset, wKeyCtl, MAX_KEY_TABLE-1, pDevice->byLocalID); } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set key sta_index= %d\n", iNodeIndex); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " tx_index=%d len=%d\n", param->u.crypt.idx, - param->u.crypt.key_len); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx\n", - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1], - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2], - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3], - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4] -); - - // set wep key + pr_debug(" Set key sta_index= %d\n", iNodeIndex); + pr_debug(" tx_index=%d len=%d\n", + param->u.crypt.idx, param->u.crypt.key_len); + pr_debug(" key=%x-%x-%x-%x-%x-xxxxx\n", + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1], + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2], + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3], + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4]); + + /* set wep key */ pDevice->bEncryptionEnable = true; pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = byKeyDecMode; pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; @@ -635,7 +628,7 @@ static int hostap_set_encryption(PSDevice pDevice, * Return Value: * */ -static int hostap_get_encryption(PSDevice pDevice, +static int hostap_get_encryption(struct vnt_private *pDevice, struct viawget_hostapd_param *param, int param_len) { @@ -650,11 +643,11 @@ static int hostap_get_encryption(PSDevice pDevice, } else { if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) { param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); + pr_debug("hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); return -EINVAL; } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: %d\n", iNodeIndex); + pr_debug("hostap_get_encryption: %d\n", iNodeIndex); memset(param->u.crypt.seq, 0, 8); for (ii = 0; ii < 8; ii++) param->u.crypt.seq[ii] = (unsigned char)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8); @@ -675,7 +668,7 @@ static int hostap_get_encryption(PSDevice pDevice, * Return Value: * */ -int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p) +int vt6655_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) { struct viawget_hostapd_param *param; int ret = 0; @@ -696,67 +689,67 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p) switch (param->cmd) { case VIAWGET_HOSTAPD_SET_ENCRYPTION: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ENCRYPTION\n"); + pr_debug("VIAWGET_HOSTAPD_SET_ENCRYPTION\n"); spin_lock_irq(&pDevice->lock); ret = hostap_set_encryption(pDevice, param, p->length); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_GET_ENCRYPTION: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_ENCRYPTION\n"); + pr_debug("VIAWGET_HOSTAPD_GET_ENCRYPTION\n"); spin_lock_irq(&pDevice->lock); ret = hostap_get_encryption(pDevice, param, p->length); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR\n"); + pr_debug("VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR\n"); ret = -EOPNOTSUPP; goto out; case VIAWGET_HOSTAPD_FLUSH: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH\n"); + pr_debug("VIAWGET_HOSTAPD_FLUSH\n"); spin_lock_irq(&pDevice->lock); hostap_flush_sta(pDevice); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_ADD_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_ADD_STA\n"); + pr_debug("VIAWGET_HOSTAPD_ADD_STA\n"); spin_lock_irq(&pDevice->lock); ret = hostap_add_sta(pDevice, param); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_REMOVE_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_REMOVE_STA\n"); + pr_debug("VIAWGET_HOSTAPD_REMOVE_STA\n"); spin_lock_irq(&pDevice->lock); ret = hostap_remove_sta(pDevice, param); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_GET_INFO_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_INFO_STA\n"); + pr_debug("VIAWGET_HOSTAPD_GET_INFO_STA\n"); ret = hostap_get_info_sta(pDevice, param); ap_ioctl = 1; break; case VIAWGET_HOSTAPD_SET_FLAGS_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA\n"); + pr_debug("VIAWGET_HOSTAPD_SET_FLAGS_STA\n"); ret = hostap_set_flags_sta(pDevice, param); break; case VIAWGET_HOSTAPD_MLME: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME\n"); + pr_debug("VIAWGET_HOSTAPD_MLME\n"); ret = -EOPNOTSUPP; goto out; case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT\n"); + pr_debug("VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT\n"); ret = hostap_set_generic_element(pDevice, param); break; case VIAWGET_HOSTAPD_SCAN_REQ: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ\n"); + pr_debug("VIAWGET_HOSTAPD_SCAN_REQ\n"); ret = -EOPNOTSUPP; goto out; case VIAWGET_HOSTAPD_STA_CLEAR_STATS: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS\n"); + pr_debug("VIAWGET_HOSTAPD_STA_CLEAR_STATS\n"); ret = -EOPNOTSUPP; goto out; default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6655_hostap_ioctl: unknown cmd=%d\n", - (int)param->cmd); + pr_debug("vt6655_hostap_ioctl: unknown cmd=%d\n", + (int)param->cmd); ret = -EOPNOTSUPP; goto out; } diff --git a/drivers/staging/vt6655/hostap.h b/drivers/staging/vt6655/hostap.h index 6e801a428183..17df4e403fcf 100644 --- a/drivers/staging/vt6655/hostap.h +++ b/drivers/staging/vt6655/hostap.h @@ -52,7 +52,7 @@ #define ARPHRD_IEEE80211 801 #endif -int vt6655_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked); -int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p); +int vt6655_hostap_set_hostapd(struct vnt_private *, int val, int rtnl_locked); +int vt6655_hostap_ioctl(struct vnt_private *, struct iw_point *p); #endif // __HOSTAP_H__ diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c index 65e59336f03b..970e80d92fb9 100644 --- a/drivers/staging/vt6655/ioctl.c +++ b/drivers/staging/vt6655/ioctl.c @@ -38,13 +38,11 @@ #include "wpactl.h" #include "rf.h" -static int msglevel = MSG_LEVEL_INFO; - #ifdef WPA_SM_Transtatus SWPAResult wpa_Result; #endif -int private_ioctl(PSDevice pDevice, struct ifreq *rq) +int private_ioctl(struct vnt_private *pDevice, struct ifreq *rq) { PSCmdRequest pReq = (PSCmdRequest)rq; PSMgmtObject pMgmt = pDevice->pMgmt; @@ -74,7 +72,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) switch (pReq->wCmdCode) { case WLAN_CMD_BSS_SCAN: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin\n"); + pr_debug("WLAN_CMD_BSS_SCAN..begin\n"); if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) { result = -EFAULT; break; @@ -175,27 +173,27 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); if (sJoinCmd.wBSSType == ADHOC) { pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n"); + pr_debug("ioct set to adhoc mode\n"); } else { pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n"); + pr_debug("ioct set to STA mode\n"); } if (sJoinCmd.bPSEnable == true) { pDevice->ePSMode = WMAC_POWER_FAST; pMgmt->wListenInterval = 2; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n"); + pr_debug("Power Saving On\n"); } else { pDevice->ePSMode = WMAC_POWER_CAM; pMgmt->wListenInterval = 1; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off\n"); + pr_debug("Power Saving Off\n"); } if (sJoinCmd.bShareKeyAuth == true) { pMgmt->bShareKeyAlgorithm = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n"); + pr_debug("Share Key\n"); } else { pMgmt->bShareKeyAlgorithm = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n"); + pr_debug("Open System\n"); } pDevice->uChannel = sJoinCmd.uChannel; netif_stop_queue(pDevice->dev); @@ -207,7 +205,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) break; case WLAN_CMD_SET_WEP: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key.\n"); + pr_debug("WLAN_CMD_SET_WEP Key\n"); memset(&sWEPCmd, 0, sizeof(SCmdSetWEP)); if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) { result = -EFAULT; @@ -217,7 +215,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) pDevice->bEncryptionEnable = false; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; MACvDisableDefaultKey(pDevice->PortOffset); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable.\n"); + pr_debug("WEP function disable\n"); break; } @@ -247,7 +245,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) case WLAN_CMD_GET_LINK: { SCmdLinkStatus sLinkStatus; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status.\n"); + pr_debug("WLAN_CMD_GET_LINK status\n"); memset(&sLinkStatus, 0, sizeof(sLinkStatus)); @@ -268,7 +266,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len); memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Link Success!\n"); + pr_debug(" Link Success!\n"); } else { sLinkStatus.bLink = false; sLinkStatus.uLinkRate = 0; @@ -364,7 +362,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) break; case WLAN_CMD_STOP_MAC: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_STOP_MAC\n"); + pr_debug("WLAN_CMD_STOP_MAC\n"); netif_stop_queue(pDevice->dev); spin_lock_irq(&pDevice->lock); @@ -383,7 +381,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) break; case WLAN_CMD_START_MAC: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n"); + pr_debug("WLAN_CMD_START_MAC\n"); if (pDevice->bMACSuspend == true) { if (pDevice->bRadioOff == true) @@ -396,7 +394,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) break; case WLAN_CMD_SET_HOSTAPD: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n"); + pr_debug("WLAN_CMD_SET_HOSTAPD\n"); if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; @@ -404,23 +402,23 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) } if (sValue.dwValue == 1) { if (vt6655_hostap_set_hostapd(pDevice, 1, 1) == 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n"); + pr_debug("Enable HOSTAP\n"); } else { result = -EFAULT; break; } } else { vt6655_hostap_set_hostapd(pDevice, 0, 1); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n"); + pr_debug("Disable HOSTAP\n"); } break; case WLAN_CMD_SET_HOSTAPD_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n"); + pr_debug("WLAN_CMD_SET_HOSTAPD_STA\n"); break; case WLAN_CMD_SET_802_1X: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n"); + pr_debug("WLAN_CMD_SET_802_1X\n"); if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; @@ -428,15 +426,15 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) if (sValue.dwValue == 1) { pDevice->bEnable8021x = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable 802.1x\n"); + pr_debug("Enable 802.1x\n"); } else { pDevice->bEnable8021x = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable 802.1x\n"); + pr_debug("Disable 802.1x\n"); } break; case WLAN_CMD_SET_HOST_WEP: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n"); + pr_debug("WLAN_CMD_SET_HOST_WEP\n"); if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; @@ -444,32 +442,32 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) if (sValue.dwValue == 1) { pDevice->bEnableHostWEP = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HostWEP\n"); + pr_debug("Enable HostWEP\n"); } else { pDevice->bEnableHostWEP = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HostWEP\n"); + pr_debug("Disable HostWEP\n"); } break; case WLAN_CMD_SET_WPA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WPA\n"); + pr_debug("WLAN_CMD_SET_WPA\n"); if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; } if (sValue.dwValue == 1) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); + pr_debug("up wpadev\n"); eth_hw_addr_inherit(pDevice->wpadev, pDevice->dev); pDevice->bWPADEVUp = true; } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n"); + pr_debug("close wpadev\n"); pDevice->bWPADEVUp = false; } break; case WLAN_CMD_AP_START: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n"); + pr_debug("WLAN_CMD_AP_START\n"); if (pDevice->bRadioOff == true) { CARDbRadioPowerOn(pDevice); vMgrTimerInit(pDevice); @@ -483,9 +481,9 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) if (sStartAPCmd.wBSSType == AP) { pMgmt->eConfigMode = WMAC_CONFIG_AP; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to AP mode\n"); + pr_debug("ioct set to AP mode\n"); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct BSS type not set to AP mode\n"); + pr_debug("ioct BSS type not set to AP mode\n"); result = -EFAULT; break; } @@ -513,10 +511,10 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) if (sStartAPCmd.bShareKeyAuth == true) { pMgmt->bShareKeyAlgorithm = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n"); + pr_debug("Share Key\n"); } else { pMgmt->bShareKeyAlgorithm = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n"); + pr_debug("Open System\n"); } memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6); @@ -540,8 +538,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) pMgmt->abyIBSSSuppRates[3] |= BIT7; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %*ph\n", - 4, pMgmt->abyIBSSSuppRates + 2); + pr_debug("Support Rate= %*ph\n", + 4, pMgmt->abyIBSSSuppRates + 2); netif_stop_queue(pDevice->dev); spin_lock_irq(&pDevice->lock); @@ -597,12 +595,12 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex; pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength; memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", - pNodeList->sNodeList[jj].abyWepKey[0], - pNodeList->sNodeList[jj].abyWepKey[1], - pNodeList->sNodeList[jj].abyWepKey[2], - pNodeList->sNodeList[jj].abyWepKey[3], - pNodeList->sNodeList[jj].abyWepKey[4]); + pr_debug("key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", + pNodeList->sNodeList[jj].abyWepKey[0], + pNodeList->sNodeList[jj].abyWepKey[1], + pNodeList->sNodeList[jj].abyWepKey[2], + pNodeList->sNodeList[jj].abyWepKey[3], + pNodeList->sNodeList[jj].abyWepKey[4]); pNodeList->sNodeList[jj].bIsInFallback = pNode->bIsInFallback; pNodeList->sNodeList[jj].uTxFailures = pNode->uTxFailures; pNodeList->sNodeList[jj].uTxAttempts = pNode->uTxAttempts; @@ -653,7 +651,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) #endif default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Private command not support..\n"); + pr_debug("Private command not support..\n"); } return result; diff --git a/drivers/staging/vt6655/ioctl.h b/drivers/staging/vt6655/ioctl.h index 187fc915fd12..2dc5a5743e8d 100644 --- a/drivers/staging/vt6655/ioctl.h +++ b/drivers/staging/vt6655/ioctl.h @@ -31,6 +31,6 @@ #include "device.h" -int private_ioctl(PSDevice pDevice, struct ifreq *rq); +int private_ioctl(struct vnt_private *, struct ifreq *rq); #endif // __IOCTL_H__ diff --git a/drivers/staging/vt6655/iowpa.h b/drivers/staging/vt6655/iowpa.h index 772bc4c2a7b9..fe4b22ed49f4 100644 --- a/drivers/staging/vt6655/iowpa.h +++ b/drivers/staging/vt6655/iowpa.h @@ -75,7 +75,7 @@ struct viawget_wpa_param { u8 bssid[6]; u8 ssid[32]; u8 ssid_len; - u8 *wpa_ie; + u8 __user *wpa_ie; u16 wpa_ie_len; int pairwise_suite; int group_suite; @@ -102,7 +102,7 @@ struct viawget_wpa_param { struct { u16 scan_count; - u8 *buf; + u8 __user *buf; } scan_results; } u; diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index 7ce23b57e78d..14a62bdae278 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -66,9 +66,6 @@ static const long frequency_list[] = { }; /*--------------------- Static Classes ----------------------------*/ - -static int msglevel = MSG_LEVEL_INFO; - /*--------------------- Static Variables --------------------------*/ /*--------------------- Static Functions --------------------------*/ @@ -76,10 +73,10 @@ static int msglevel = MSG_LEVEL_INFO; struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); long ldBm; - pDevice->wstats.status = pDevice->eOPMode; + pDevice->wstats.status = pDevice->op_mode; #ifdef Calcu_LinkQual if (pDevice->scStatistic.LinkQuality > 100) pDevice->scStatistic.LinkQuality = 100; @@ -108,7 +105,7 @@ static int iwctl_commit(struct net_device *dev, void *wrq, char *extra) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT\n"); + pr_debug(" SIOCSIWCOMMIT\n"); return 0; } @@ -134,13 +131,13 @@ static int iwctl_siwscan(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_scan_req *req = (struct iw_scan_req *)extra; unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; PWLAN_IE_SSID pItemSSID = NULL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN\n"); + pr_debug(" SIOCSIWSCAN\n"); if (pDevice->byReAssocCount > 0) { //reject scan when re-associating! //send scan event to wpa_Supplicant @@ -198,7 +195,7 @@ static int iwctl_giwscan(struct net_device *dev, char *extra) { int ii, jj, kk; - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PKnownBSS pBSS; PWLAN_IE_SSID pItemSSID; @@ -210,7 +207,7 @@ static int iwctl_giwscan(struct net_device *dev, long ldBm; char buf[MAX_WPA_IE_LEN * 2 + 30]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n"); + pr_debug(" SIOCGIWSCAN\n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. @@ -350,10 +347,10 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_freq *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ\n"); + pr_debug(" SIOCSIWFREQ\n"); // If setting by frequency, convert to a channel if ((wrq->e == 1) && @@ -374,11 +371,12 @@ int iwctl_siwfreq(struct net_device *dev, int channel = wrq->m; if ((channel < 1) || (channel > 14)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m); + pr_debug("%s: New channel value of %d is invalid!\n", + dev->name, wrq->m); rc = -EINVAL; } else { // Yes ! We can set it !!! - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel); + pr_debug(" Set to channel = %d\n", channel); pDevice->uChannel = channel; //2007-0207-04,<Add> by EinsnLiu //Make change effect at once @@ -398,10 +396,10 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_freq *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ\n"); + pr_debug(" SIOCGIWFREQ\n"); #ifdef WEXT_USECHANNELS wrq->m = (int)pMgmt->uCurrChannel; @@ -429,14 +427,14 @@ int iwctl_siwmode(struct net_device *dev, __u32 *wmode, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE\n"); + pr_debug(" SIOCSIWMODE\n"); if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Can't set operation mode, hostapd is running\n"); + pr_debug("Can't set operation mode, hostapd is running\n"); return rc; } @@ -448,7 +446,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc\n"); + pr_debug("set mode to ad-hoc\n"); break; case IW_MODE_AUTO: case IW_MODE_INFRA: @@ -458,7 +456,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure\n"); + pr_debug("set mode to infrastructure\n"); break; case IW_MODE_MASTER: @@ -472,7 +470,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point\n"); + pr_debug("set mode to Access Point\n"); break; case IW_MODE_REPEAT: @@ -495,10 +493,10 @@ int iwctl_giwmode(struct net_device *dev, __u32 *wmode, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE\n"); + pr_debug(" SIOCGIWMODE\n"); // If not managed, assume it's ad-hoc switch (pMgmt->eConfigMode) { case WMAC_CONFIG_ESS_STA: @@ -533,7 +531,7 @@ int iwctl_giwrange(struct net_device *dev, int i, k; unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n"); + pr_debug(" SIOCGIWRANGE\n"); if (wrq->pointer) { wrq->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); @@ -635,12 +633,12 @@ int iwctl_siwap(struct net_device *dev, struct sockaddr *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; unsigned char ZeroBSSID[WLAN_BSSID_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP\n"); + pr_debug(" SIOCSIWAP\n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. pr_debug("SIOCSIWAP(??)-->In scanning..\n"); @@ -694,10 +692,10 @@ int iwctl_giwap(struct net_device *dev, struct sockaddr *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP\n"); + pr_debug(" SIOCGIWAP\n"); memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); //2008-0410,<Modify> by Einsn Liu @@ -728,10 +726,10 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_quality *q = NULL; PKnownBSS pBSS = NULL; - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST\n"); + pr_debug(" SIOCGIWAPLIST\n"); if (!capable(CAP_NET_ADMIN)) { rc = -EPERM; @@ -794,13 +792,13 @@ int iwctl_siwessid(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; //2008-0409-05, <Add> by Einsn Liu unsigned char len; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID\n"); + pr_debug(" SIOCSIWESSID\n"); pDevice->fWPA_Authened = false; if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. @@ -885,7 +883,7 @@ int iwctl_siwessid(struct net_device *dev, } #endif - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s\n", pItemSSID->abySSID); + pr_debug("set essid = %s\n", pItemSSID->abySSID); } if (pDevice->flags & DEVICE_FLAGS_OPENED) @@ -903,11 +901,11 @@ int iwctl_giwessid(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID\n"); + pr_debug(" SIOCGIWESSID\n"); // Note : if wrq->u.data.flags != 0, we should // get the relevant SSID from the SSID list... @@ -933,13 +931,13 @@ int iwctl_siwrate(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); int rc = 0; u8 brate = 0; int i; unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE\n"); + pr_debug(" SIOCSIWRATE\n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; return rc; @@ -993,7 +991,8 @@ int iwctl_siwrate(struct net_device *dev, pDevice->uConnectionRate = 3; } else { pDevice->uConnectionRate = brate; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d\n", pDevice->uConnectionRate); + pr_debug("Fixed to Rate %d\n", + pDevice->uConnectionRate); } } else { @@ -1014,12 +1013,12 @@ int iwctl_giwrate(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); //2007-0118-05,<Mark> by EinsnLiu //Mark the unnecessary sentences. // PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE\n"); + pr_debug(" SIOCGIWRATE\n"); { unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; int brate = 0; @@ -1059,10 +1058,10 @@ int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS\n"); + pr_debug(" SIOCSIWRTS\n"); { int rthr = wrq->value; @@ -1088,9 +1087,9 @@ int iwctl_giwrts(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS\n"); + pr_debug(" SIOCGIWRTS\n"); wrq->value = pDevice->wRTSThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -1107,11 +1106,11 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); int rc = 0; int fthr = wrq->value; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG\n"); + pr_debug(" SIOCSIWFRAG\n"); if (wrq->disabled) fthr = 2312; @@ -1134,9 +1133,9 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG\n"); + pr_debug(" SIOCGIWFRAG\n"); wrq->value = pDevice->wFragmentationThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -1152,10 +1151,10 @@ int iwctl_siwretry(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY\n"); + pr_debug(" SIOCSIWRETRY\n"); if (wrq->disabled) { rc = -EINVAL; @@ -1187,9 +1186,9 @@ int iwctl_giwretry(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY\n"); + pr_debug(" SIOCGIWRETRY\n"); wrq->disabled = 0; // Can't be disabled // Note : by default, display the min retry number @@ -1217,7 +1216,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); unsigned long dwKeyIndex = (unsigned long)(wrq->flags & IW_ENCODE_INDEX); int ii, uu, rc = 0; @@ -1234,7 +1233,7 @@ int iwctl_siwencode(struct net_device *dev, PSKeyTable pkeytab; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE\n"); + pr_debug(" SIOCSIWENCODE\n"); if ((wrq->flags & IW_ENCODE_DISABLED) == 0) { //Not disable encryption @@ -1262,11 +1261,12 @@ int iwctl_siwencode(struct net_device *dev, if (wrq->length > 0) {//have key if (wrq->length == WLAN_WEP232_KEYLEN) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); + pr_debug("Set 232 bit wep key\n"); } else if (wrq->length == WLAN_WEP104_KEYLEN) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); + pr_debug("Set 104 bit wep key\n"); } else if (wrq->length == WLAN_WEP40_KEYLEN) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); + pr_debug("Set 40 bit wep key, index= %d\n", + (int)dwKeyIndex); } else {//no support length rc = -EINVAL; return rc; @@ -1274,9 +1274,9 @@ int iwctl_siwencode(struct net_device *dev, memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN); memcpy(pDevice->abyKey, extra, wrq->length); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyKey: "); + pr_debug("abyKey: "); for (ii = 0; ii < wrq->length; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); + pr_debug("%02x ", pDevice->abyKey[ii]); if (pDevice->flags & DEVICE_FLAGS_OPENED) { spin_lock_irq(&pDevice->lock); @@ -1304,10 +1304,10 @@ int iwctl_siwencode(struct net_device *dev, rc = -EINVAL; return rc; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n"); + pr_debug("Just set Default key Index:\n"); pkeytab = &(pDevice->sKey.KeyTable[MAX_KEY_TABLE - 1]); if (pkeytab->GroupKey[(unsigned char)dwKeyIndex].uKeyLength == 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n"); + pr_debug("Default key len is 0\n"); rc = -EINVAL; return rc; } @@ -1317,7 +1317,7 @@ int iwctl_siwencode(struct net_device *dev, } } else {//disable the key - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); + pr_debug("Disable WEP function\n"); if (pDevice->bEncryptionEnable == false) return 0; pMgmt->bShareKeyAlgorithm = false; @@ -1333,11 +1333,11 @@ int iwctl_siwencode(struct net_device *dev, //End Modify,Einsn if (wrq->flags & IW_ENCODE_RESTRICTED) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n"); + pr_debug("Enable WEP & ShareKey System\n"); pMgmt->bShareKeyAlgorithm = true; } if (wrq->flags & IW_ENCODE_OPEN) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n"); + pr_debug("Enable WEP & Open System\n"); pMgmt->bShareKeyAlgorithm = false; } return rc; @@ -1348,14 +1348,14 @@ int iwctl_giwencode(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); char abyKey[WLAN_WEP232_KEYLEN]; unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX); PSKeyItem pKey = NULL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); + pr_debug(" SIOCGIWENCODE\n"); if (index > WLAN_WEP_NKEYS) return -EINVAL; @@ -1410,11 +1410,11 @@ int iwctl_siwpower(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER\n"); + pr_debug(" SIOCSIWPOWER\n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; @@ -1436,14 +1436,14 @@ int iwctl_siwpower(struct net_device *dev, } switch (wrq->flags & IW_POWER_MODE) { case IW_POWER_UNICAST_R: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R\n"); + pr_debug(" 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"); + pr_debug(" SIOCSIWPOWER: IW_POWER_ALL_R\n"); rc = -EINVAL; case IW_POWER_ON: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON\n"); + pr_debug(" SIOCSIWPOWER: IW_POWER_ON\n"); break; default: rc = -EINVAL; @@ -1460,11 +1460,11 @@ int iwctl_giwpower(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int mode = pDevice->ePSMode; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER\n"); + pr_debug(" SIOCGIWPOWER\n"); wrq->disabled = (mode == WMAC_POWER_CAM); if (wrq->disabled) @@ -1490,10 +1490,10 @@ int iwctl_giwsens(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); long ldBm; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS\n"); + pr_debug(" SIOCGIWSENS\n"); if (pDevice->bLinkPass == true) { RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm); wrq->value = ldBm; @@ -1514,13 +1514,13 @@ int iwctl_siwauth(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; static int wpa_version = 0; //must be static to save the last value,einsn liu static int pairwise = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n"); + pr_debug(" SIOCSIWAUTH\n"); switch (wrq->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: wpa_version = wrq->value; @@ -1623,7 +1623,7 @@ int iwctl_siwgenie(struct net_device *dev, struct iw_point *wrq, char __user *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; char length; @@ -1663,7 +1663,7 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_point *wrq, char __user *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; int space = wrq->length; @@ -1688,7 +1688,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct viawget_wpa_param *param = NULL; //original member @@ -1810,7 +1810,7 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_point *wrq, char __user *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_mlme mime; diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c index 9339e2a4073a..211afae306c7 100644 --- a/drivers/staging/vt6655/key.c +++ b/drivers/staging/vt6655/key.c @@ -44,8 +44,6 @@ /*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ /*--------------------- Export Variables --------------------------*/ @@ -134,7 +132,7 @@ bool KeybGetKey( { int i; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetKey()\n"); + pr_debug("KeybGetKey()\n"); *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { @@ -184,7 +182,7 @@ bool KeybSetKey( unsigned char *pbyBSSID, unsigned long dwKeyIndex, unsigned long uKeyLength, - PQWORD pKeyRSC, + u64 *pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, void __iomem *dwIoBase, @@ -196,7 +194,7 @@ bool KeybSetKey( PSKeyItem pKey; unsigned int uKeyIdx; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetKey: %lX\n", dwKeyIndex); + pr_debug("Enter KeybSetKey: %lX\n", dwKeyIndex); j = (MAX_KEY_TABLE-1); for (i = 0; i < (MAX_KEY_TABLE - 1); i++) { @@ -221,7 +219,8 @@ bool KeybSetKey( if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); + pr_debug("Group transmit key(R)[%lX]: %d\n", + pTable->KeyTable[i].dwGTKeyIndex, i); } pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4); @@ -245,24 +244,24 @@ bool KeybSetKey( 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; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybSetKey(R):\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->bKeyValid: %d\n ", pKey->bKeyValid); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->abyKey: "); + pr_debug("KeybSetKey(R):\n"); + pr_debug("pKey->bKeyValid: %d\n ", pKey->bKeyValid); + pr_debug("pKey->abyKey: "); for (ii = 0; ii < pKey->uKeyLength; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); + pr_debug("%02x ", pKey->abyKey[ii]); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n"); + pr_debug("\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); + pr_debug("pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); + pr_debug("pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); + pr_debug("pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); return true; } @@ -284,7 +283,8 @@ bool KeybSetKey( if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key pTable->KeyTable[j].dwGTKeyIndex = dwKeyIndex; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Group transmit key(N)[%lX]: %d\n", pTable->KeyTable[j].dwGTKeyIndex, j); + pr_debug("Group transmit key(N)[%lX]: %d\n", + pTable->KeyTable[j].dwGTKeyIndex, j); } pTable->KeyTable[j].wKeyCtl &= 0xFF0F; // clear group key control filed pTable->KeyTable[j].wKeyCtl |= (byKeyDecMode << 4); @@ -308,25 +308,25 @@ bool KeybSetKey( 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; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybSetKey(N):\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->bKeyValid: %d\n ", pKey->bKeyValid); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->abyKey: "); + pr_debug("KeybSetKey(N):\n"); + pr_debug("pKey->bKeyValid: %d\n ", pKey->bKeyValid); + pr_debug("pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength); + pr_debug("pKey->abyKey: "); for (ii = 0; ii < pKey->uKeyLength; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); + pr_debug("%02x ", pKey->abyKey[ii]); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n"); + pr_debug("\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); + pr_debug("pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); + pr_debug("pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); + pr_debug("pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); return true; } @@ -511,48 +511,51 @@ bool KeybGetTransmitKey( if (pTable->KeyTable[i].PairwiseKey.bKeyValid) { *pKey = &(pTable->KeyTable[i].PairwiseKey); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetTransmitKey:"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PAIRWISE_KEY: KeyTable.abyBSSID: "); + pr_debug("KeybGetTransmitKey:"); + pr_debug("PAIRWISE_KEY: KeyTable.abyBSSID: "); for (ii = 0; ii < 6; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%x ", pTable->KeyTable[i].abyBSSID[ii]); + pr_debug("%x ", + pTable->KeyTable[i].abyBSSID[ii]); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n"); + pr_debug("\n"); return true; } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PairwiseKey.bKeyValid == false\n"); + pr_debug("PairwiseKey.bKeyValid == false\n"); return false; } } // End of Type == PAIRWISE else { if (pTable->KeyTable[i].dwGTKeyIndex == 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ERROR: dwGTKeyIndex == 0 !!!\n"); + pr_debug("ERROR: dwGTKeyIndex == 0 !!!\n"); return false; } if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid) { *pKey = &(pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)]); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetTransmitKey:"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP_KEY: KeyTable.abyBSSID\n"); + pr_debug("KeybGetTransmitKey:"); + pr_debug("GROUP_KEY: KeyTable.abyBSSID\n"); for (ii = 0; ii < 6; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%x ", pTable->KeyTable[i].abyBSSID[ii]); + pr_debug("%x ", + pTable->KeyTable[i].abyBSSID[ii]); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwGTKeyIndex: %lX\n", pTable->KeyTable[i].dwGTKeyIndex); + pr_debug("\n"); + pr_debug("dwGTKeyIndex: %lX\n", + pTable->KeyTable[i].dwGTKeyIndex); return true; } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GroupKey.bKeyValid == false\n"); + pr_debug("GroupKey.bKeyValid == false\n"); return false; } } // End of Type = GROUP } // BSSID match } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ERROR: NO Match BSSID !!! "); + pr_debug("ERROR: NO Match BSSID !!! "); for (ii = 0; ii < 6; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", *(pbyBSSID+ii)); + pr_debug("%02x ", *(pbyBSSID+ii)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n"); + pr_debug("\n"); return false; } @@ -606,7 +609,7 @@ bool KeybSetDefaultKey( PSKeyManagement pTable, unsigned long dwKeyIndex, unsigned long uKeyLength, - PQWORD pKeyRSC, + u64 *pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, void __iomem *dwIoBase, @@ -617,7 +620,8 @@ bool KeybSetDefaultKey( PSKeyItem pKey; unsigned int uKeyIdx; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetDefaultKey: %1x, %d\n", (int)dwKeyIndex, (int)uKeyLength); + pr_debug("Enter KeybSetDefaultKey: %1x, %d\n", + (int)dwKeyIndex, (int)uKeyLength); if ((dwKeyIndex & PAIRWISE_KEY) != 0) // Pairwise key return false; @@ -636,7 +640,9 @@ bool KeybSetDefaultKey( if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = dwKeyIndex; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, MAX_KEY_TABLE-1); + pr_debug("Group transmit key(R)[%lX]: %d\n", + pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, + MAX_KEY_TABLE-1); } pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl &= 0x7F00; // clear all key control filed @@ -669,25 +675,25 @@ bool KeybSetDefaultKey( 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; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybSetKey(R):\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->bKeyValid: %d\n", pKey->bKeyValid); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->uKeyLength: %d\n", (int)pKey->uKeyLength); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->abyKey:\n"); + pr_debug("KeybSetKey(R):\n"); + pr_debug("pKey->bKeyValid: %d\n", pKey->bKeyValid); + pr_debug("pKey->uKeyLength: %d\n", (int)pKey->uKeyLength); + pr_debug("pKey->abyKey:\n"); for (ii = 0; ii < pKey->uKeyLength; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%x", pKey->abyKey[ii]); + pr_debug("%x", pKey->abyKey[ii]); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n"); + pr_debug("\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwTSC47_16: %lx\n", pKey->dwTSC47_16); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->wTSC15_0: %x\n", pKey->wTSC15_0); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwKeyIndex: %lx\n", pKey->dwKeyIndex); + pr_debug("pKey->dwTSC47_16: %lx\n", pKey->dwTSC47_16); + pr_debug("pKey->wTSC15_0: %x\n", pKey->wTSC15_0); + pr_debug("pKey->dwKeyIndex: %lx\n", pKey->dwKeyIndex); return true; } @@ -712,7 +718,7 @@ bool KeybSetAllGroupKey( PSKeyManagement pTable, unsigned long dwKeyIndex, unsigned long uKeyLength, - PQWORD pKeyRSC, + u64 *pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, void __iomem *dwIoBase, @@ -724,7 +730,7 @@ bool KeybSetAllGroupKey( PSKeyItem pKey; unsigned int uKeyIdx; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex); + pr_debug("Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex); if ((dwKeyIndex & PAIRWISE_KEY) != 0) // Pairwise key return false; @@ -739,7 +745,8 @@ bool KeybSetAllGroupKey( if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); + pr_debug("Group transmit key(R)[%lX]: %d\n", + pTable->KeyTable[i].dwGTKeyIndex, i); } pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed @@ -764,21 +771,22 @@ bool KeybSetAllGroupKey( 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; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybSetKey(R):\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->bKeyValid: %d\n ", pKey->bKeyValid); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->abyKey: "); + pr_debug("KeybSetKey(R):\n"); + pr_debug("pKey->bKeyValid: %d\n ", pKey->bKeyValid); + pr_debug("pKey->uKeyLength: %d\n ", + (int)pKey->uKeyLength); + pr_debug("pKey->abyKey: "); for (ii = 0; ii < pKey->uKeyLength; ii++) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); + pr_debug("%02x ", pKey->abyKey[ii]); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n"); + pr_debug("\n"); } // (pTable->KeyTable[i].bInUse == true) } diff --git a/drivers/staging/vt6655/key.h b/drivers/staging/vt6655/key.h index 3eb881b69a55..44efe18315af 100644 --- a/drivers/staging/vt6655/key.h +++ b/drivers/staging/vt6655/key.h @@ -57,7 +57,7 @@ typedef struct tagSKeyItem { 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; @@ -108,7 +108,7 @@ bool KeybSetKey( unsigned char *pbyBSSID, unsigned long dwKeyIndex, unsigned long uKeyLength, - PQWORD pKeyRSC, + u64 *pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, void __iomem *dwIoBase, @@ -119,7 +119,7 @@ bool KeybSetDefaultKey( PSKeyManagement pTable, unsigned long dwKeyIndex, unsigned long uKeyLength, - PQWORD pKeyRSC, + u64 *pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, void __iomem *dwIoBase, @@ -166,7 +166,7 @@ bool KeybSetAllGroupKey( PSKeyManagement pTable, unsigned long dwKeyIndex, unsigned long uKeyLength, - PQWORD pKeyRSC, + u64 *pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, void __iomem *dwIoBase, diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c index 9bbc873de702..e3b0b7f7ca85 100644 --- a/drivers/staging/vt6655/mac.c +++ b/drivers/staging/vt6655/mac.c @@ -73,8 +73,6 @@ #include "mac.h" unsigned short TxRate_iwconfig;//2008-5-8 <add> by chester -/*--------------------- Static Definitions -------------------------*/ -static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ @@ -837,7 +835,7 @@ bool MACbSafeRxOff(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x10); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x10)\n"); + pr_debug(" DBG_PORT80(0x10)\n"); return false; } for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { @@ -847,7 +845,7 @@ bool MACbSafeRxOff(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x11); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x11)\n"); + pr_debug(" DBG_PORT80(0x11)\n"); return false; } @@ -861,7 +859,7 @@ bool MACbSafeRxOff(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x12); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x12)\n"); + pr_debug(" DBG_PORT80(0x12)\n"); return false; } return true; @@ -899,7 +897,7 @@ bool MACbSafeTxOff(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x20); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x20)\n"); + pr_debug(" DBG_PORT80(0x20)\n"); return false; } for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { @@ -909,7 +907,7 @@ bool MACbSafeTxOff(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x21); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x21)\n"); + pr_debug(" DBG_PORT80(0x21)\n"); return false; } @@ -924,7 +922,7 @@ bool MACbSafeTxOff(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x24); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x24)\n"); + pr_debug(" DBG_PORT80(0x24)\n"); return false; } return true; @@ -949,13 +947,13 @@ bool MACbSafeStop(void __iomem *dwIoBase) if (!MACbSafeRxOff(dwIoBase)) { DBG_PORT80(0xA1); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeRxOff == false)\n"); + pr_debug(" MACbSafeRxOff == false)\n"); MACbSafeSoftwareReset(dwIoBase); return false; } if (!MACbSafeTxOff(dwIoBase)) { DBG_PORT80(0xA2); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeTxOff == false)\n"); + pr_debug(" MACbSafeTxOff == false)\n"); MACbSafeSoftwareReset(dwIoBase); return false; } @@ -1172,7 +1170,7 @@ void MACvSetCurrAC0DescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAd } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x26); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x26)\n"); + pr_debug(" DBG_PORT80(0x26)\n"); } VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, dwCurrDescAddr); if (byOrgDMACtl & DMACTL_RUN) @@ -1295,7 +1293,7 @@ bool MACbTxDMAOff(void __iomem *dwIoBase, unsigned int idx) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x29); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x29)\n"); + pr_debug(" DBG_PORT80(0x29)\n"); return false; } return true; @@ -1319,7 +1317,7 @@ void MACvClearBusSusInd(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x33); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n"); + pr_debug(" DBG_PORT80(0x33)\n"); } } @@ -1341,7 +1339,7 @@ void MACvEnableBusSusEn(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x34); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x34)\n"); + pr_debug(" DBG_PORT80(0x34)\n"); } } @@ -1364,7 +1362,7 @@ bool MACbFlushSYNCFifo(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x35); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n"); + pr_debug(" DBG_PORT80(0x33)\n"); } return true; } @@ -1388,7 +1386,7 @@ bool MACbPSWakeup(void __iomem *dwIoBase) } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x36); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n"); + pr_debug(" DBG_PORT80(0x33)\n"); return false; } return true; @@ -1419,7 +1417,7 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned in if (byLocalID <= 1) return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n"); + pr_debug("MACvSetKeyEntry\n"); wOffset = MISCFIFO_KEYETRY0; wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); @@ -1427,7 +1425,8 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned in dwData |= wKeyCtl; dwData <<= 16; dwData |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %X, KeyCtl:%X\n", wOffset, dwData, wKeyCtl); + pr_debug("1. wOffset: %d, Data: %X, KeyCtl:%X\n", + wOffset, dwData, wKeyCtl); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); @@ -1442,7 +1441,7 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned in dwData |= *(pbyAddr+1); dwData <<= 8; dwData |= *(pbyAddr+0); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2. wOffset: %d, Data: %X\n", wOffset, dwData); + pr_debug("2. wOffset: %d, Data: %X\n", wOffset, dwData); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); @@ -1452,7 +1451,8 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned in wOffset += (uKeyIdx * 4); for (ii = 0; ii < 4; ii++) { // always push 128 bits - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "3.(%d) wOffset: %d, Data: %X\n", ii, wOffset+ii, *pdwKey); + pr_debug("3.(%d) wOffset: %d, Data: %X\n", + ii, wOffset+ii, *pdwKey); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); @@ -1510,7 +1510,7 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, if (byLocalID <= 1) return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetDefaultKeyEntry\n"); + pr_debug("MACvSetDefaultKeyEntry\n"); wOffset = MISCFIFO_KEYETRY0; wOffset += (10 * MISCFIFO_KEYENTRYSIZE); @@ -1519,7 +1519,8 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, wOffset += (uKeyIdx * 4); // always push 128 bits for (ii = 0; ii < 3; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); + pr_debug("(%d) wOffset: %d, Data: %lX\n", + ii, wOffset+ii, *pdwKey); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); @@ -1531,7 +1532,7 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+3); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End. wOffset: %d, Data: %lX\n", wOffset+3, dwData); + pr_debug("End. wOffset: %d, Data: %lX\n", wOffset+3, dwData); } /* @@ -1564,7 +1565,7 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData); + pr_debug("MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData); } */ @@ -1595,7 +1596,8 @@ void MACvDisableDefaultKey(void __iomem *dwIoBase) VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvDisableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData); + pr_debug("MACvDisableDefaultKey: wOffset: %d, Data: %lX\n", + wOffset, dwData); } /* @@ -1622,7 +1624,7 @@ void MACvSetDefaultTKIPKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, if (byLocalID <= 1) return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetDefaultTKIPKeyEntry\n"); + pr_debug("MACvSetDefaultTKIPKeyEntry\n"); wOffset = MISCFIFO_KEYETRY0; // Kyle test : change offset from 10 -> 0 wOffset += (10 * MISCFIFO_KEYENTRYSIZE); @@ -1640,10 +1642,12 @@ void MACvSetDefaultTKIPKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, wOffset++; wOffset += (uKeyIdx * 4); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, idx:%d\n", wOffset, *pdwKey, uKeyIdx); + pr_debug("1. wOffset: %d, Data: %lX, idx:%d\n", + wOffset, *pdwKey, uKeyIdx); // always push 128 bits for (ii = 0; ii < 4; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); + pr_debug("2.(%d) wOffset: %d, Data: %lX\n", + ii, wOffset+ii, *pdwKey); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); @@ -1673,7 +1677,7 @@ void MACvSetDefaultKeyCtl(void __iomem *dwIoBase, unsigned short wKeyCtl, unsign if (byLocalID <= 1) return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n"); + pr_debug("MACvSetKeyEntry\n"); wOffset = MISCFIFO_KEYETRY0; wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); @@ -1681,7 +1685,8 @@ void MACvSetDefaultKeyCtl(void __iomem *dwIoBase, unsigned short wKeyCtl, unsign dwData |= wKeyCtl; dwData <<= 16; dwData |= 0xffff; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl); + pr_debug("1. wOffset: %d, Data: %lX, KeyCtl:%X\n", + wOffset, dwData, wKeyCtl); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); diff --git a/drivers/staging/vt6655/mib.c b/drivers/staging/vt6655/mib.c index 36895970a892..111c01877086 100644 --- a/drivers/staging/vt6655/mib.c +++ b/drivers/staging/vt6655/mib.c @@ -44,8 +44,6 @@ #include "wctl.h" #include "baseband.h" -/*--------------------- Static Definitions -------------------------*/ -static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ @@ -190,75 +188,101 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr11MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "11M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr11M, (int)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR); + pr_debug("11M: ALL[%d], OK[%d]:[%02x]\n", + (int)pStatistic->CustomStat.ullRsr11M, + (int)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR); } else if (byRxRate == 11) { pStatistic->CustomStat.ullRsr5M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr5MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 5M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr5M, (int)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR); + pr_debug(" 5M: ALL[%d], OK[%d]:[%02x]\n", + (int)pStatistic->CustomStat.ullRsr5M, + (int)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR); } else if (byRxRate == 4) { pStatistic->CustomStat.ullRsr2M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr2MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 2M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr2M, (int)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR); + pr_debug(" 2M: ALL[%d], OK[%d]:[%02x]\n", + (int)pStatistic->CustomStat.ullRsr2M, + (int)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR); } else if (byRxRate == 2) { pStatistic->CustomStat.ullRsr1M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr1MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 1M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr1M, (int)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR); + pr_debug(" 1M: ALL[%d], OK[%d]:[%02x]\n", + (int)pStatistic->CustomStat.ullRsr1M, + (int)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR); } else if (byRxRate == 12) { pStatistic->CustomStat.ullRsr6M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr6MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 6M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr6M, (int)pStatistic->CustomStat.ullRsr6MCRCOk); + pr_debug(" 6M: ALL[%d], OK[%d]\n", + (int)pStatistic->CustomStat.ullRsr6M, + (int)pStatistic->CustomStat.ullRsr6MCRCOk); } else if (byRxRate == 18) { pStatistic->CustomStat.ullRsr9M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr9MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 9M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr9M, (int)pStatistic->CustomStat.ullRsr9MCRCOk); + pr_debug(" 9M: ALL[%d], OK[%d]\n", + (int)pStatistic->CustomStat.ullRsr9M, + (int)pStatistic->CustomStat.ullRsr9MCRCOk); } else if (byRxRate == 24) { pStatistic->CustomStat.ullRsr12M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr12MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "12M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr12M, (int)pStatistic->CustomStat.ullRsr12MCRCOk); + pr_debug("12M: ALL[%d], OK[%d]\n", + (int)pStatistic->CustomStat.ullRsr12M, + (int)pStatistic->CustomStat.ullRsr12MCRCOk); } else if (byRxRate == 36) { pStatistic->CustomStat.ullRsr18M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr18MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "18M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr18M, (int)pStatistic->CustomStat.ullRsr18MCRCOk); + pr_debug("18M: ALL[%d], OK[%d]\n", + (int)pStatistic->CustomStat.ullRsr18M, + (int)pStatistic->CustomStat.ullRsr18MCRCOk); } else if (byRxRate == 48) { pStatistic->CustomStat.ullRsr24M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr24MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "24M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr24M, (int)pStatistic->CustomStat.ullRsr24MCRCOk); + pr_debug("24M: ALL[%d], OK[%d]\n", + (int)pStatistic->CustomStat.ullRsr24M, + (int)pStatistic->CustomStat.ullRsr24MCRCOk); } else if (byRxRate == 72) { pStatistic->CustomStat.ullRsr36M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr36MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "36M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr36M, (int)pStatistic->CustomStat.ullRsr36MCRCOk); + pr_debug("36M: ALL[%d], OK[%d]\n", + (int)pStatistic->CustomStat.ullRsr36M, + (int)pStatistic->CustomStat.ullRsr36MCRCOk); } else if (byRxRate == 96) { pStatistic->CustomStat.ullRsr48M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr48MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "48M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr48M, (int)pStatistic->CustomStat.ullRsr48MCRCOk); + pr_debug("48M: ALL[%d], OK[%d]\n", + (int)pStatistic->CustomStat.ullRsr48M, + (int)pStatistic->CustomStat.ullRsr48MCRCOk); } else if (byRxRate == 108) { pStatistic->CustomStat.ullRsr54M++; if (byRSR & RSR_CRCOK) pStatistic->CustomStat.ullRsr54MCRCOk++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "54M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr54M, (int)pStatistic->CustomStat.ullRsr54MCRCOk); + pr_debug("54M: ALL[%d], OK[%d]\n", + (int)pStatistic->CustomStat.ullRsr54M, + (int)pStatistic->CustomStat.ullRsr54MCRCOk); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unknown: Total[%d], CRCOK[%d]\n", (int)pStatistic->dwRsrRxPacket+1, (int)pStatistic->dwRsrCRCOk); + pr_debug("Unknown: Total[%d], CRCOK[%d]\n", + (int)pStatistic->dwRsrRxPacket+1, + (int)pStatistic->dwRsrCRCOk); } if (byRSR & RSR_BSSIDOK) diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c index 2a21cbd1c6ac..08241b917777 100644 --- a/drivers/staging/vt6655/power.c +++ b/drivers/staging/vt6655/power.c @@ -50,8 +50,6 @@ /*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ /*--------------------- Export Variables --------------------------*/ @@ -74,13 +72,13 @@ PSvEnablePowerSaving( unsigned short wListenInterval ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned short wAID = pMgmt->wCurrAID | BIT14 | BIT15; // set period of power up before TBTT VNSvOutPortW(pDevice->PortOffset + MAC_REG_PWBT, C_PWBT); - if (pDevice->eOPMode != OP_MODE_ADHOC) { + if (pDevice->op_mode != NL80211_IFTYPE_ADHOC) { // set AID VNSvOutPortW(pDevice->PortOffset + MAC_REG_AIDATIM, wAID); } else { @@ -109,11 +107,12 @@ PSvEnablePowerSaving( pDevice->bEnablePSMode = true; /* We don't send null pkt in ad hoc mode since beacon will handle this. */ - if (pDevice->eOPMode != OP_MODE_ADHOC && pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) + if (pDevice->op_mode != NL80211_IFTYPE_ADHOC && + pDevice->op_mode == NL80211_IFTYPE_STATION) PSbSendNullPacket(pDevice); pDevice->bPWBitOn = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable...\n"); + pr_debug("PS:Power Saving Mode Enable...\n"); } /*+ @@ -131,7 +130,7 @@ PSvDisablePowerSaving( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; // disable power saving hw function MACbPSWakeup(pDevice->PortOffset); @@ -144,7 +143,7 @@ PSvDisablePowerSaving( pDevice->bEnablePSMode = false; - if (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) + if (pDevice->op_mode == NL80211_IFTYPE_STATION) PSbSendNullPacket(pDevice); pDevice->bPWBitOn = false; @@ -167,7 +166,7 @@ PSbConsiderPowerDown( bool bCheckCountToWakeUp ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int uIdx; @@ -210,7 +209,7 @@ PSbConsiderPowerDown( // no Tx, no Rx isr, now go to Doze MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n"); + pr_debug("Go to Doze ZZZZZZZZZZZZZZZ\n"); return true; } @@ -229,7 +228,7 @@ PSvSendPSPOLL( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; PSTxMgmtPacket pTxPacket = NULL; @@ -249,7 +248,7 @@ PSvSendPSPOLL( pTxPacket->cbPayloadLen = 0; // send the frame if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n"); + pr_debug("Send PS-Poll packet failed..\n"); } /*+ @@ -266,7 +265,7 @@ PSbSendNullPacket( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSTxMgmtPacket pTxPacket = NULL; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int uIdx; @@ -274,13 +273,9 @@ PSbSendNullPacket( if (!pDevice->bLinkPass) return false; -#ifdef TxInSleep if (!pDevice->bEnablePSMode && !pDevice->fTxDataInSleep) return false; -#else - if (!pDevice->bEnablePSMode) - return false; -#endif + if (pDevice->bEnablePSMode) { for (uIdx = 0; uIdx < TYPE_MAXTD; uIdx++) { if (pDevice->iTDUsed[uIdx] != 0) @@ -318,7 +313,7 @@ PSbSendNullPacket( pTxPacket->cbPayloadLen = 0; // send the frame if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet failed !\n"); + pr_debug("Send Null Packet failed !\n"); return false; } @@ -340,7 +335,7 @@ PSbIsNextTBTTWakeUp( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; bool bWakeUp = false; diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index 42b257f916d3..e505af91bfd0 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -746,7 +746,7 @@ static bool RFbAL2230SelectChannel(void __iomem *dwIoBase, unsigned char byChann * */ bool RFbInit( - PSDevice pDevice + struct vnt_private *pDevice ) { bool bResult = true; @@ -897,7 +897,7 @@ bool RFvWriteWakeProgSyn(void __iomem *dwIoBase, unsigned char byRFType, unsigne * */ bool RFbSetPower( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned int uRATE, unsigned int uCH ) @@ -978,7 +978,7 @@ bool RFbSetPower( */ bool RFbRawSetPower( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byPwr, unsigned int uRATE ) @@ -1042,7 +1042,7 @@ bool RFbRawSetPower( -*/ void RFvRSSITodBm( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byCurrRSSI, long *pldBm ) diff --git a/drivers/staging/vt6655/rf.h b/drivers/staging/vt6655/rf.h index ba55561c45d2..be4ef88b7666 100644 --- a/drivers/staging/vt6655/rf.h +++ b/drivers/staging/vt6655/rf.h @@ -77,19 +77,19 @@ bool IFRFbWriteEmbedded(void __iomem *dwIoBase, unsigned long dwData); bool RFbSelectChannel(void __iomem *dwIoBase, unsigned char byRFType, unsigned char byChannel); bool RFbInit( - PSDevice pDevice + struct vnt_private * ); bool RFvWriteWakeProgSyn(void __iomem *dwIoBase, unsigned char byRFType, unsigned int uChannel); -bool RFbSetPower(PSDevice pDevice, unsigned int uRATE, unsigned int uCH); +bool RFbSetPower(struct vnt_private *, unsigned int uRATE, unsigned int uCH); bool RFbRawSetPower( - PSDevice pDevice, + struct vnt_private *, unsigned char byPwr, unsigned int uRATE ); void RFvRSSITodBm( - PSDevice pDevice, + struct vnt_private *, unsigned char byCurrRSSI, long *pldBm ); diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 0d45aa076fed..7a183f55e7eb 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -68,9 +68,6 @@ /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; - -#define PLICE_DEBUG /*--------------------- Static Functions --------------------------*/ @@ -112,7 +109,7 @@ static const unsigned short wFB_Opt1[2][5] = { static void s_vFillTxKey( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyBuf, unsigned char *pbyIVHead, PSKeyItem pTransmitKey, @@ -124,7 +121,7 @@ s_vFillTxKey( static void s_vFillRTSHead( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byPktType, void *pvRTS, unsigned int cbFrameLength, @@ -138,7 +135,7 @@ s_vFillRTSHead( static void s_vGenerateTxParameter( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byPktType, void *pTxBufHead, void *pvRrvTime, @@ -152,7 +149,7 @@ s_vGenerateTxParameter( ); static void s_vFillFragParameter( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyBuffer, unsigned int uTxType, void *pvtdCurr, @@ -161,15 +158,17 @@ static void s_vFillFragParameter( ); static unsigned int -s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr, - unsigned int cbFrameBodySize, unsigned int uDMAIdx, PSTxDesc pHeadTD, - PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt, - PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum); +s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, + unsigned char *pbyTxBufferAddr, unsigned int cbFrameBodySize, + unsigned int uDMAIdx, PSTxDesc pHeadTD, + PSEthernetHeader psEthHeader, unsigned char *pPacket, + bool bNeedEncrypt, PSKeyItem pTransmitKey, + unsigned int uNodeIndex, unsigned int *puMACfragNum); static -unsigned int +__le16 s_uFillDataHead( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byPktType, void *pTxDataHead, unsigned int cbFrameLength, @@ -187,7 +186,7 @@ s_uFillDataHead( static void s_vFillTxKey( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyBuf, unsigned char *pbyIVHead, PSKeyItem pTransmitKey, @@ -196,9 +195,9 @@ s_vFillTxKey( unsigned char *pMICHDR ) { + struct vnt_mic_hdr *mic_hdr = (struct vnt_mic_hdr *)pMICHDR; unsigned long *pdwIV = (unsigned long *)pbyIVHead; unsigned long *pdwExtIV = (unsigned long *)((unsigned char *)pbyIVHead+4); - unsigned short wValue; PS802_11Header pMACHeader = (PS802_11Header)pbyHdrBuf; unsigned long dwRevIVCounter; unsigned char byKeyIndex = 0; @@ -246,7 +245,7 @@ s_vFillTxKey( *(pbyIVHead+3) = (unsigned char)(((byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV // Append IV&ExtIV after Mac Header *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV); + pr_debug("vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV); } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { pTransmitKey->wTSC15_0++; @@ -262,47 +261,45 @@ s_vFillTxKey( //Append IV&ExtIV after Mac Header *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); - //Fill MICHDR0 - *pMICHDR = 0x59; - *((unsigned char *)(pMICHDR+1)) = 0; // TxPriority - memcpy(pMICHDR+2, &(pMACHeader->abyAddr2[0]), 6); - *((unsigned char *)(pMICHDR+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16)); - *((unsigned char *)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16)); - *((unsigned char *)(pMICHDR+10)) = HIBYTE(LOWORD(pTransmitKey->dwTSC47_16)); - *((unsigned char *)(pMICHDR+11)) = LOBYTE(LOWORD(pTransmitKey->dwTSC47_16)); - *((unsigned char *)(pMICHDR+12)) = HIBYTE(pTransmitKey->wTSC15_0); - *((unsigned char *)(pMICHDR+13)) = LOBYTE(pTransmitKey->wTSC15_0); - *((unsigned char *)(pMICHDR+14)) = HIBYTE(wPayloadLen); - *((unsigned char *)(pMICHDR+15)) = LOBYTE(wPayloadLen); - - //Fill MICHDR1 - *((unsigned char *)(pMICHDR+16)) = 0; // HLEN[15:8] + /* MICHDR0 */ + mic_hdr->id = 0x59; + mic_hdr->tx_priority = 0; + memcpy(mic_hdr->mic_addr2, pMACHeader->abyAddr2, ETH_ALEN); + + /* ccmp pn big endian order */ + mic_hdr->ccmp_pn[0] = (u8)(pTransmitKey->dwTSC47_16 >> 24); + mic_hdr->ccmp_pn[1] = (u8)(pTransmitKey->dwTSC47_16 >> 16); + mic_hdr->ccmp_pn[2] = (u8)(pTransmitKey->dwTSC47_16 >> 8); + mic_hdr->ccmp_pn[3] = (u8)pTransmitKey->dwTSC47_16; + mic_hdr->ccmp_pn[4] = (u8)(pTransmitKey->wTSC15_0 >> 8); + mic_hdr->ccmp_pn[5] = (u8)pTransmitKey->wTSC15_0; + + /* MICHDR1 */ + mic_hdr->payload_len = cpu_to_be16(wPayloadLen); + if (pDevice->bLongHeader) - *((unsigned char *)(pMICHDR+17)) = 28; // HLEN[7:0] + mic_hdr->hlen = cpu_to_be16(28); else - *((unsigned char *)(pMICHDR+17)) = 22; // HLEN[7:0] - - wValue = cpu_to_le16(pMACHeader->wFrameCtl & 0xC78F); - memcpy(pMICHDR+18, (unsigned char *)&wValue, 2); // MSKFRACTL - memcpy(pMICHDR+20, &(pMACHeader->abyAddr1[0]), 6); - memcpy(pMICHDR+26, &(pMACHeader->abyAddr2[0]), 6); - - //Fill MICHDR2 - memcpy(pMICHDR+32, &(pMACHeader->abyAddr3[0]), 6); - wValue = pMACHeader->wSeqCtl; - wValue &= 0x000F; - wValue = cpu_to_le16(wValue); - memcpy(pMICHDR+38, (unsigned char *)&wValue, 2); // MSKSEQCTL - if (pDevice->bLongHeader) - memcpy(pMICHDR+40, &(pMACHeader->abyAddr4[0]), 6); + mic_hdr->hlen = cpu_to_be16(22); + + memcpy(mic_hdr->addr1, pMACHeader->abyAddr1, ETH_ALEN); + memcpy(mic_hdr->addr2, pMACHeader->abyAddr2, ETH_ALEN); + /* MICHDR2 */ + memcpy(mic_hdr->addr3, pMACHeader->abyAddr3, ETH_ALEN); + mic_hdr->frame_control = + cpu_to_le16(pMACHeader->wFrameCtl & 0xc78f); + mic_hdr->seq_ctrl = cpu_to_le16(pMACHeader->wSeqCtl & 0xf); + + if (pDevice->bLongHeader) + memcpy(mic_hdr->addr4, pMACHeader->abyAddr4, ETH_ALEN); } } static void s_vSWencryption( - PSDevice pDevice, + struct vnt_private *pDevice, PSKeyItem pTransmitKey, unsigned char *pbyPayloadHead, unsigned short wPayloadSize @@ -340,6 +337,12 @@ s_vSWencryption( } } +static __le16 vnt_time_stamp_off(struct vnt_private *priv, u16 rate) +{ + return cpu_to_le16(wTimeStampOff[priv->byPreambleType % 2] + [rate % MAX_RATE]); +} + /*byPktType : PK_TYPE_11A 0 PK_TYPE_11B 1 PK_TYPE_11GB 2 @@ -348,7 +351,7 @@ s_vSWencryption( static unsigned int s_uGetTxRsvTime( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byPktType, unsigned int cbFrameLength, unsigned short wRate, @@ -369,11 +372,18 @@ s_uGetTxRsvTime( return uDataTime; } +static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type, + u32 frame_length, u16 rate, bool need_ack) +{ + return cpu_to_le16((u16)s_uGetTxRsvTime(priv, pkt_type, + frame_length, rate, need_ack)); +} + //byFreqType: 0=>5GHZ 1=>2.4GHZ static -unsigned int +__le16 s_uGetRTSCTSRsvTime( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byRTSRsvType, unsigned char byPktType, unsigned int cbFrameLength, @@ -399,19 +409,19 @@ s_uGetRTSCTSRsvTime( uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); uRrvTime = uCTSTime + uAckTime + uDataTime + 2*pDevice->uSIFS; - return uRrvTime; + return cpu_to_le16((u16)uRrvTime); } //RTSRrvTime uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3*pDevice->uSIFS; - return uRrvTime; + return cpu_to_le16((u16)uRrvTime); } //byFreqType 0: 5GHz, 1:2.4Ghz static unsigned int s_uGetDataDuration( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byDurType, unsigned int cbFrameLength, unsigned char byPktType, @@ -568,9 +578,9 @@ s_uGetDataDuration( //byFreqType: 0=>5GHZ 1=>2.4GHZ static -unsigned int +__le16 s_uGetRTSCTSDuration( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byDurType, unsigned int cbFrameLength, unsigned char byPktType, @@ -657,13 +667,13 @@ s_uGetRTSCTSDuration( break; } - return uDurTime; + return cpu_to_le16((u16)uDurTime); } static -unsigned int +__le16 s_uFillDataHead( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byPktType, void *pTxDataHead, unsigned int cbFrameLength, @@ -676,7 +686,6 @@ s_uFillDataHead( unsigned short wCurrentRate ) { - unsigned short wLen = 0x0000; if (pTxDataHead == NULL) return 0; @@ -684,107 +693,98 @@ s_uFillDataHead( if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (byFBOption == AUTO_FB_NONE) { - PSTxDataHead_g pBuf = (PSTxDataHead_g)pTxDataHead; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a) -); - pBuf->wTransmitLength_a = cpu_to_le16(wLen); - BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b) -); - pBuf->wTransmitLength_b = cpu_to_le16(wLen); - //Get Duration and TimeStamp - pBuf->wDuration_a = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, - byPktType, wCurrentRate, bNeedAck, uFragIdx, - cbLastFragmentSize, uMACfragNum, - byFBOption)); //1: 2.4GHz - pBuf->wDuration_b = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, - PK_TYPE_11B, pDevice->byTopCCKBasicRate, - bNeedAck, uFragIdx, cbLastFragmentSize, - uMACfragNum, byFBOption)); //1: 2.4 - - pBuf->wTimeStampOff_a = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]); - pBuf->wTimeStampOff_b = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]); - - return pBuf->wDuration_a; + struct vnt_tx_datahead_g *buf = pTxDataHead; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, + byPktType, &buf->a); + + vnt_get_phy_field(pDevice, cbFrameLength, + pDevice->byTopCCKBasicRate, + PK_TYPE_11B, &buf->b); + + /* Get Duration and TimeStamp */ + buf->duration_a = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, + byPktType, wCurrentRate, bNeedAck, uFragIdx, + cbLastFragmentSize, uMACfragNum, + byFBOption)); + buf->duration_b = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, + PK_TYPE_11B, pDevice->byTopCCKBasicRate, + bNeedAck, uFragIdx, cbLastFragmentSize, + uMACfragNum, byFBOption)); + + buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate); + buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate); + + return buf->duration_a; } else { - // Auto Fallback - PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a) -); - pBuf->wTransmitLength_a = cpu_to_le16(wLen); - BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b) -); - pBuf->wTransmitLength_b = cpu_to_le16(wLen); - //Get Duration and TimeStamp - pBuf->wDuration_a = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz - pBuf->wDuration_b = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B, - pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz - pBuf->wDuration_a_f0 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz - pBuf->wDuration_a_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz - - pBuf->wTimeStampOff_a = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]); - pBuf->wTimeStampOff_b = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]); - - return pBuf->wDuration_a; + /* Auto Fallback */ + struct vnt_tx_datahead_g_fb *buf = pTxDataHead; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, + byPktType, &buf->a); + + vnt_get_phy_field(pDevice, cbFrameLength, + pDevice->byTopCCKBasicRate, + PK_TYPE_11B, &buf->b); + /* Get Duration and TimeStamp */ + buf->duration_a = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); + buf->duration_b = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B, + pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); + buf->duration_a_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); + buf->duration_a_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); + + buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate); + buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate); + + return buf->duration_a; } //if (byFBOption == AUTO_FB_NONE) } else if (byPktType == PK_TYPE_11A) { if ((byFBOption != AUTO_FB_NONE)) { - // Auto Fallback - PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField) -); - pBuf->wTransmitLength = cpu_to_le16(wLen); - //Get Duration and TimeStampOff - - pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz - pBuf->wDuration_f0 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz - pBuf->wDuration_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz - pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]); - return pBuf->wDuration; + /* Auto Fallback */ + struct vnt_tx_datahead_a_fb *buf = pTxDataHead; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, + byPktType, &buf->a); + + /* Get Duration and TimeStampOff */ + buf->duration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); + buf->duration_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); + buf->duration_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); + buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); + return buf->duration; } else { - PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField) -); - pBuf->wTransmitLength = cpu_to_le16(wLen); - //Get Duration and TimeStampOff - - pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, uFragIdx, - cbLastFragmentSize, uMACfragNum, - byFBOption)); - - pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]); - return pBuf->wDuration; + struct vnt_tx_datahead_ab *buf = pTxDataHead; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, + byPktType, &buf->ab); + + /* Get Duration and TimeStampOff */ + buf->duration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, uFragIdx, + cbLastFragmentSize, uMACfragNum, + byFBOption)); + + buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); + return buf->duration; } } else { - PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField) -); - pBuf->wTransmitLength = cpu_to_le16(wLen); - //Get Duration and TimeStampOff - pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, uFragIdx, - cbLastFragmentSize, uMACfragNum, - byFBOption)); - pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]); - return pBuf->wDuration; + struct vnt_tx_datahead_ab *buf = pTxDataHead; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, + byPktType, &buf->ab); + /* Get Duration and TimeStampOff */ + buf->duration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, uFragIdx, + cbLastFragmentSize, uMACfragNum, + byFBOption)); + buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); + return buf->duration; } return 0; } @@ -792,7 +792,7 @@ s_uFillDataHead( static void s_vFillRTSHead( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byPktType, void *pvRTS, unsigned int cbFrameLength, @@ -804,7 +804,6 @@ s_vFillRTSHead( ) { unsigned int uRTSFrameLen = 20; - unsigned short wLen = 0x0000; if (pvRTS == NULL) return; @@ -819,155 +818,222 @@ s_vFillRTSHead( // Otherwise, we need to modify codes for them. if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (byFBOption == AUTO_FB_NONE) { - PSRTS_g pBuf = (PSRTS_g)pvRTS; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b) -); - pBuf->wTransmitLength_b = cpu_to_le16(wLen); - BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a) -); - pBuf->wTransmitLength_a = cpu_to_le16(wLen); - //Get Duration - pBuf->wDuration_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData - pBuf->wDuration_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData - pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data - - pBuf->Data.wDurationID = pBuf->wDuration_aa; - //Get RTS Frame body - pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN); + struct vnt_rts_g *buf = pvRTS; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, uRTSFrameLen, + pDevice->byTopCCKBasicRate, + PK_TYPE_11B, &buf->b); + + vnt_get_phy_field(pDevice, uRTSFrameLen, + pDevice->byTopOFDMBasicRate, + byPktType, &buf->a); + /* Get Duration */ + buf->duration_bb = + s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, + cbFrameLength, PK_TYPE_11B, + pDevice->byTopCCKBasicRate, + bNeedAck, byFBOption); + buf->duration_aa = + s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->duration_ba = + s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + + buf->data.duration = buf->duration_aa; + /* Get RTS Frame body */ + buf->data.frame_control = + cpu_to_le16(IEEE80211_FTYPE_CTL | + IEEE80211_STYPE_RTS); + + + if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) || + (pDevice->op_mode == NL80211_IFTYPE_AP)) { + memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN); } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN); } - if (pDevice->eOPMode == OP_MODE_AP) - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + if (pDevice->op_mode == NL80211_IFTYPE_AP) + memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN); else - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN); + memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN); } else { - PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b) -); - pBuf->wTransmitLength_b = cpu_to_le16(wLen); - BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a) -); - pBuf->wTransmitLength_a = cpu_to_le16(wLen); - - //Get Duration - pBuf->wDuration_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData - pBuf->wDuration_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData - pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData - pBuf->wRTSDuration_ba_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData - pBuf->wRTSDuration_aa_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData - pBuf->wRTSDuration_ba_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData - pBuf->wRTSDuration_aa_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData - pBuf->Data.wDurationID = pBuf->wDuration_aa; - //Get RTS Frame body - pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN); + struct vnt_rts_g_fb *buf = pvRTS; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, uRTSFrameLen, + pDevice->byTopCCKBasicRate, + PK_TYPE_11B, &buf->b); + + vnt_get_phy_field(pDevice, uRTSFrameLen, + pDevice->byTopOFDMBasicRate, + byPktType, &buf->a); + /* Get Duration */ + buf->duration_bb = + s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, + cbFrameLength, PK_TYPE_11B, + pDevice->byTopCCKBasicRate, + bNeedAck, byFBOption); + buf->duration_aa = + s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->duration_ba = + s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->rts_duration_ba_f0 = + s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->rts_duration_aa_f0 = + s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->rts_duration_ba_f1 = + s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->rts_duration_aa_f1 = + s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->data.duration = buf->duration_aa; + /* Get RTS Frame body */ + buf->data.frame_control = + cpu_to_le16(IEEE80211_FTYPE_CTL | + IEEE80211_STYPE_RTS); + + + if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) || + (pDevice->op_mode == NL80211_IFTYPE_AP)) { + memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN); } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN); } - if (pDevice->eOPMode == OP_MODE_AP) - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + if (pDevice->op_mode == NL80211_IFTYPE_AP) + memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN); else - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN); + memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN); } // if (byFBOption == AUTO_FB_NONE) } else if (byPktType == PK_TYPE_11A) { if (byFBOption == AUTO_FB_NONE) { - PSRTS_ab pBuf = (PSRTS_ab)pvRTS; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField) -); - pBuf->wTransmitLength = cpu_to_le16(wLen); - //Get Duration - pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData - pBuf->Data.wDurationID = pBuf->wDuration; - //Get RTS Frame body - pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN); + struct vnt_rts_ab *buf = pvRTS; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, uRTSFrameLen, + pDevice->byTopOFDMBasicRate, + byPktType, &buf->ab); + /* Get Duration */ + buf->duration = + s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->data.duration = buf->duration; + /* Get RTS Frame body */ + buf->data.frame_control = + cpu_to_le16(IEEE80211_FTYPE_CTL | + IEEE80211_STYPE_RTS); + + + if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) || + (pDevice->op_mode == NL80211_IFTYPE_AP)) { + memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN); } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN); } - if (pDevice->eOPMode == OP_MODE_AP) - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + if (pDevice->op_mode == NL80211_IFTYPE_AP) + memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN); else - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN); + memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN); } else { - PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField) -); - pBuf->wTransmitLength = cpu_to_le16(wLen); - //Get Duration - pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData - pBuf->wRTSDuration_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData - pBuf->wRTSDuration_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0: - pBuf->Data.wDurationID = pBuf->wDuration; - //Get RTS Frame body - pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN); + struct vnt_rts_a_fb *buf = pvRTS; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, uRTSFrameLen, + pDevice->byTopOFDMBasicRate, + byPktType, &buf->a); + /* Get Duration */ + buf->duration = + s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->rts_duration_f0 = + s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->rts_duration_f1 = + s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + buf->data.duration = buf->duration; + /* Get RTS Frame body */ + buf->data.frame_control = + cpu_to_le16(IEEE80211_FTYPE_CTL | + IEEE80211_STYPE_RTS); + + if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) || + (pDevice->op_mode == NL80211_IFTYPE_AP)) { + memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN); } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN); } - if (pDevice->eOPMode == OP_MODE_AP) - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + if (pDevice->op_mode == NL80211_IFTYPE_AP) + memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN); else - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN); + memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN); } } else if (byPktType == PK_TYPE_11B) { - PSRTS_ab pBuf = (PSRTS_ab)pvRTS; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField) -); - pBuf->wTransmitLength = cpu_to_le16(wLen); - //Get Duration - pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData - pBuf->Data.wDurationID = pBuf->wDuration; - //Get RTS Frame body - pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN); + struct vnt_rts_ab *buf = pvRTS; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, uRTSFrameLen, + pDevice->byTopCCKBasicRate, + PK_TYPE_11B, &buf->ab); + /* Get Duration */ + buf->duration = + s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, + byPktType, wCurrentRate, bNeedAck, + byFBOption); + + buf->data.duration = buf->duration; + /* Get RTS Frame body */ + buf->data.frame_control = + cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS); + + if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) || + (pDevice->op_mode == NL80211_IFTYPE_AP)) { + memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN); } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN); } - if (pDevice->eOPMode == OP_MODE_AP) - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + if (pDevice->op_mode == NL80211_IFTYPE_AP) + memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN); else - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN); + memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN); } } static void s_vFillCTSHead( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned int uDMAIdx, unsigned char byPktType, void *pvCTS, @@ -979,7 +1045,6 @@ s_vFillCTSHead( ) { unsigned int uCTSFrameLen = 14; - unsigned short wLen = 0x0000; if (pvCTS == NULL) return; @@ -993,48 +1058,65 @@ s_vFillCTSHead( if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) { // Auto Fall back - PSCTS_FB pBuf = (PSCTS_FB)pvCTS; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b) -); - - pBuf->wTransmitLength_b = cpu_to_le16(wLen); - - pBuf->wDuration_ba = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data - pBuf->wDuration_ba += pDevice->wCTSDuration; - pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba); - //Get CTSDuration_ba_f0 - pBuf->wCTSDuration_ba_f0 = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data - pBuf->wCTSDuration_ba_f0 += pDevice->wCTSDuration; - pBuf->wCTSDuration_ba_f0 = cpu_to_le16(pBuf->wCTSDuration_ba_f0); - //Get CTSDuration_ba_f1 - pBuf->wCTSDuration_ba_f1 = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data - pBuf->wCTSDuration_ba_f1 += pDevice->wCTSDuration; - pBuf->wCTSDuration_ba_f1 = cpu_to_le16(pBuf->wCTSDuration_ba_f1); - //Get CTS Frame body - pBuf->Data.wDurationID = pBuf->wDuration_ba; - pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4 - pBuf->Data.wReserved = 0x0000; - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), ETH_ALEN); - + struct vnt_cts_fb *buf = pvCTS; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, uCTSFrameLen, + pDevice->byTopCCKBasicRate, + PK_TYPE_11B, &buf->b); + + buf->duration_ba = + s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + + /* Get CTSDuration_ba_f0 */ + buf->cts_duration_ba_f0 = + s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + + /* Get CTSDuration_ba_f1 */ + buf->cts_duration_ba_f1 = + s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + + /* Get CTS Frame body */ + buf->data.duration = buf->duration_ba; + + buf->data.frame_control = + cpu_to_le16(IEEE80211_FTYPE_CTL | + IEEE80211_STYPE_CTS); + + buf->reserved2 = 0x0; + + memcpy(&buf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN); } else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) - PSCTS pBuf = (PSCTS)pvCTS; - //Get SignalField,ServiceField,Length - BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b) -); - pBuf->wTransmitLength_b = cpu_to_le16(wLen); - //Get CTSDuration_ba - pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data - pBuf->wDuration_ba += pDevice->wCTSDuration; - pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba); - - //Get CTS Frame body - pBuf->Data.wDurationID = pBuf->wDuration_ba; - pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4 - pBuf->Data.wReserved = 0x0000; - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), ETH_ALEN); + struct vnt_cts *buf = pvCTS; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, uCTSFrameLen, + pDevice->byTopCCKBasicRate, + PK_TYPE_11B, &buf->b); + + /* Get CTSDuration_ba */ + buf->duration_ba = + s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, + byFBOption); + + /* Get CTS Frame body */ + buf->data.duration = buf->duration_ba; + + buf->data.frame_control = + cpu_to_le16(IEEE80211_FTYPE_CTL | + IEEE80211_STYPE_CTS); + + buf->reserved2 = 0x0; + memcpy(&buf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN); } } } @@ -1065,7 +1147,7 @@ s_vFillCTSHead( static void s_vGenerateTxParameter( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byPktType, void *pTxBufHead, void *pvRrvTime, @@ -1099,71 +1181,58 @@ s_vGenerateTxParameter( if (pDevice->bLongHeader) cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6; + if (!pvRrvTime) + return; + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (pvRTS != NULL) { //RTS_need - //Fill RsvTime - if (pvRrvTime) { - PSRrvTime_gRTS pBuf = (PSRrvTime_gRTS)pvRrvTime; - - pBuf->wRTSTxRrvTime_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 1:2.4GHz - pBuf->wRTSTxRrvTime_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));//1:RTSTxRrvTime_ba, 1:2.4GHz - pBuf->wRTSTxRrvTime_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz - pBuf->wTxRrvTime_a = cpu_to_le16((unsigned short) s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM - pBuf->wTxRrvTime_b = cpu_to_le16((unsigned short) s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK - } - //Fill RTS + /* Fill RsvTime */ + struct vnt_rrv_time_rts *buf = pvRrvTime; + + buf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate); + buf->rts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate); + buf->rts_rrv_time_bb = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate); + buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK); + buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK); + s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); } else {//RTS_needless, PCF mode + struct vnt_rrv_time_cts *buf = pvRrvTime; - //Fill RsvTime - if (pvRrvTime) { - PSRrvTime_gCTS pBuf = (PSRrvTime_gCTS)pvRrvTime; - - pBuf->wTxRrvTime_a = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM - pBuf->wTxRrvTime_b = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK - pBuf->wCTSTxRrvTime_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));//3:CTSTxRrvTime_Ba, 1:2.4GHz - } + buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK); + buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK); + buf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate); //Fill CTS s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption); } } else if (byPktType == PK_TYPE_11A) { if (pvRTS != NULL) {//RTS_need, non PCF mode - //Fill RsvTime - if (pvRrvTime) { - PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; + struct vnt_rrv_time_ab *buf = pvRrvTime; + + buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate); + buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK); - pBuf->wRTSTxRrvTime = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 0:5GHz - pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//0:OFDM - } //Fill RTS s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); } else if (pvRTS == NULL) {//RTS_needless, non PCF mode - //Fill RsvTime - if (pvRrvTime) { - PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; + struct vnt_rrv_time_ab *buf = pvRrvTime; - pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK)); //0:OFDM - } + buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK); } } else if (byPktType == PK_TYPE_11B) { if ((pvRTS != NULL)) {//RTS_need, non PCF mode - //Fill RsvTime - if (pvRrvTime) { - PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; + struct vnt_rrv_time_ab *buf = pvRrvTime; + + buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate); + buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK); - pBuf->wRTSTxRrvTime = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz - pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));//1:CCK - } //Fill RTS s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); } else { //RTS_needless, non PCF mode - //Fill RsvTime - if (pvRrvTime) { - PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; + struct vnt_rrv_time_ab *buf = pvRrvTime; - pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK)); //1:CCK - } + buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK); } } } @@ -1171,7 +1240,7 @@ s_vGenerateTxParameter( static void s_vFillFragParameter( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyBuffer, unsigned int uTxType, void *pvtdCurr, @@ -1207,10 +1276,12 @@ s_vFillFragParameter( } static unsigned int -s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr, - unsigned int cbFrameBodySize, unsigned int uDMAIdx, PSTxDesc pHeadTD, - PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt, - PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum) +s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, + unsigned char *pbyTxBufferAddr, unsigned int cbFrameBodySize, + unsigned int uDMAIdx, PSTxDesc pHeadTD, + PSEthernetHeader psEthHeader, unsigned char *pPacket, + bool bNeedEncrypt, PSKeyItem pTransmitKey, + unsigned int uNodeIndex, unsigned int *puMACfragNum) { unsigned int cbMACHdLen; unsigned int cbFrameSize; @@ -1223,7 +1294,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT unsigned char *pbyIVHead; unsigned char *pbyMacHdr; unsigned short wFragType; //00:Non-Frag, 01:Start, 10:Mid, 11:Last - unsigned int uDuration; + __le16 uDuration; unsigned char *pbyBuffer; unsigned int cbIVlen = 0; unsigned int cbICVlen = 0; @@ -1252,7 +1323,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT PSTxBufHead psTxBufHd = (PSTxBufHead) pbyTxBufferAddr; unsigned int cbHeaderLength = 0; void *pvRrvTime; - PSMICHDRHead pMICHDR; + struct vnt_mic_hdr *pMICHDR; void *pvRTS; void *pvCTS; void *pvTxDataHd; @@ -1264,8 +1335,8 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL; - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { + if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) || + (pDevice->op_mode == NL80211_IFTYPE_AP)) { if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0]))) bNeedACK = false; else @@ -1297,7 +1368,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { cbIVlen = 8;//RSN Header cbICVlen = 8;//MIC - cbMICHDR = sizeof(SMICHDRHead); + cbMICHDR = sizeof(struct vnt_mic_hdr); } if (pDevice->byLocalID > REV_ID_VT3253_A1) { //MAC Header should be padding 0 to DW alignment. @@ -1332,72 +1403,87 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT if (byFBOption == AUTO_FB_NONE) { if (bRTS == true) {//RTS_need - pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS)); - pvRTS = (PSRTS_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts)); + pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR); pvCTS = NULL; - pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g)); - cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g); + pvTxDataHd = (void *)(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) + + sizeof(struct vnt_tx_datahead_g); } else { //RTS_needless - pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS)); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts)); pvRTS = NULL; - pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR); - pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS)); - cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g); + pvCTS = (void *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR); + pvTxDataHd = (void *)(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) + sizeof(struct vnt_tx_datahead_g); } } else { // Auto Fall Back if (bRTS == true) {//RTS_need - pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS)); - pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts)); + pvRTS = (void *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR); pvCTS = NULL; - pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB)); - cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB); + pvTxDataHd = (void *)(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) + sizeof(struct vnt_tx_datahead_g_fb); } else { //RTS_needless - pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS)); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts)); pvRTS = NULL; - pvCTS = (PSCTS_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR); - pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB)); - cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB) + sizeof(STxDataHead_g_FB); + pvCTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR); + pvTxDataHd = (void *)(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) + sizeof(struct vnt_tx_datahead_g_fb); } } // Auto Fall Back } else {//802.11a/b packet if (byFBOption == AUTO_FB_NONE) { if (bRTS == true) { - pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); - pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); + pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); pvCTS = NULL; - pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab)); - cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab); + pvTxDataHd = (void *)(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) + sizeof(struct vnt_tx_datahead_ab); } else { //RTS_needless, need MICHDR - pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); pvRTS = NULL; pvCTS = NULL; - pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR); - cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab); + pvTxDataHd = (void *)(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 = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); - pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); + pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); pvCTS = NULL; - pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB)); - cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB); + pvTxDataHd = (void *)(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) + sizeof(struct vnt_tx_datahead_a_fb); } else { //RTS_needless - pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); pvRTS = NULL; pvCTS = NULL; - pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR); - cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_a_FB); + pvTxDataHd = (void *)(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); } } // Auto Fall Back } @@ -1420,7 +1506,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT MIC_vAppend((unsigned char *)&(psEthHeader->abyDstAddr[0]), 12); dwMIC_Priority = 0; MIC_vAppend((unsigned char *)&dwMIC_Priority, 4); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC KEY: %X, %X\n", dwMICKey0, dwMICKey1); + pr_debug("MIC KEY: %X, %X\n", dwMICKey0, dwMICKey1); } /////////////////////////////////////////////////////////////////// @@ -1450,7 +1536,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT //========================= // Start Fragmentation //========================= - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Start Fragmentation...\n"); + pr_debug("Start Fragmentation...\n"); wFragType = FRAGCTL_STAFRAG; //Fill FIFO,RrvTime,RTS,and CTS @@ -1460,7 +1546,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate); // Generate TX MAC Header - vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt, + vGenerateMACHeader(pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt, wFragType, uDMAIdx, uFragIdx); if (bNeedEncrypt == true) { @@ -1503,7 +1589,8 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT uTotalCopyLength += cbFragPayloadSize - cb802_1_H_len; if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Start MIC: %d\n", cbFragPayloadSize); + pr_debug("Start MIC: %d\n", + cbFragPayloadSize); MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFragPayloadSize); } @@ -1538,7 +1625,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT //========================= // Last Fragmentation //========================= - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last Fragmentation...\n"); + pr_debug("Last Fragmentation...\n"); wFragType = FRAGCTL_ENDFRAG; @@ -1550,7 +1637,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate); // Generate TX MAC Header - vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt, + vGenerateMACHeader(pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt, wFragType, uDMAIdx, uFragIdx); if (bNeedEncrypt == true) { @@ -1588,8 +1675,10 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT } if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LAST: uMICFragLen:%d, cbLastFragPayloadSize:%d, uTmpLen:%d\n", - uMICFragLen, cbLastFragPayloadSize, uTmpLen); + pr_debug("LAST: uMICFragLen:%d, cbLastFragPayloadSize:%d, uTmpLen:%d\n", + uMICFragLen, + cbLastFragPayloadSize, + uTmpLen); if (bMIC2Frag == false) { if (uTmpLen != 0) @@ -1597,22 +1686,23 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT pdwMIC_L = (u32 *)(pbyBuffer + uLength + uTmpLen); pdwMIC_R = (u32 *)(pbyBuffer + uLength + uTmpLen + 4); MIC_vGetMIC(pdwMIC_L, pdwMIC_R); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last MIC:%X, %X\n", *pdwMIC_L, *pdwMIC_R); + pr_debug("Last MIC:%X, %X\n", + *pdwMIC_L, *pdwMIC_R); } else { if (uMICFragLen >= 4) { memcpy((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)), (cbMIClen - uMICFragLen)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LAST: uMICFragLen >= 4: %X, %d\n", - *(unsigned char *)((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)), - (cbMIClen - uMICFragLen)); + pr_debug("LAST: uMICFragLen >= 4: %X, %d\n", + *(unsigned char *)((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)), + (cbMIClen - uMICFragLen)); } else { memcpy((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_L + uMICFragLen), (4 - uMICFragLen)); memcpy((pbyBuffer + uLength + (4 - uMICFragLen)), &dwSafeMIC_R, 4); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LAST: uMICFragLen < 4: %X, %d\n", - *(unsigned char *)((unsigned char *)&dwSafeMIC_R + uMICFragLen - 4), - (cbMIClen - uMICFragLen)); + pr_debug("LAST: uMICFragLen < 4: %X, %d\n", + *(unsigned char *)((unsigned char *)&dwSafeMIC_R + uMICFragLen - 4), + (cbMIClen - uMICFragLen)); } } MIC_vUnInit(); @@ -1653,7 +1743,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT //========================= // Middle Fragmentation //========================= - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Middle Fragmentation...\n"); + pr_debug("Middle Fragmentation...\n"); wFragType = FRAGCTL_MIDFRAG; @@ -1665,7 +1755,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate); // Generate TX MAC Header - vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt, + vGenerateMACHeader(pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt, wFragType, uDMAIdx, uFragIdx); if (bNeedEncrypt == true) { @@ -1713,12 +1803,17 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT dwSafeMIC_L = *pdwMIC_L; dwSafeMIC_R = *pdwMIC_R; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIDDLE: uMICFragLen:%d, cbFragPayloadSize:%d, uTmpLen:%d\n", - uMICFragLen, cbFragPayloadSize, uTmpLen); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fill MIC in Middle frag [%d]\n", uMICFragLen); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get MIC:%X, %X\n", *pdwMIC_L, *pdwMIC_R); + pr_debug("MIDDLE: uMICFragLen:%d, cbFragPayloadSize:%d, uTmpLen:%d\n", + uMICFragLen, + cbFragPayloadSize, + uTmpLen); + pr_debug("Fill MIC in Middle frag [%d]\n", + uMICFragLen); + pr_debug("Get MIC:%X, %X\n", + *pdwMIC_L, *pdwMIC_R); } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Middle frag len: %d\n", uTmpLen); + pr_debug("Middle frag len: %d\n", + uTmpLen); } else { ASSERT(uTmpLen == (cbFragPayloadSize)); @@ -1768,7 +1863,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT 0, 0, uMACfragNum, byFBOption, pDevice->wCurrentRate); // Generate TX MAC Header - vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt, + vGenerateMACHeader(pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt, wFragType, uDMAIdx, 0); if (bNeedEncrypt == true) { @@ -1812,7 +1907,8 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT ); if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Length:%d, %d\n", cbFrameBodySize - cb802_1_H_len, uLength); + pr_debug("Length:%d, %d\n", + cbFrameBodySize - cb802_1_H_len, uLength); MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFrameBodySize); @@ -1828,9 +1924,10 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT pDevice->bTxMICFail = false; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "uLength: %d, %d\n", uLength, cbFrameBodySize); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderLength, uPadding, cbIVlen); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC:%x, %x\n", *pdwMIC_L, *pdwMIC_R); + pr_debug("uLength: %d, %d\n", uLength, cbFrameBodySize); + pr_debug("cbReqCount:%d, %d, %d, %d\n", + cbReqCount, cbHeaderLength, uPadding, cbIVlen); + pr_debug("MIC:%x, %x\n", *pdwMIC_L, *pdwMIC_R); } @@ -1861,8 +1958,9 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT } void -vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr, - bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx, +vGenerateFIFOHeader(struct vnt_private *pDevice, unsigned char byPktType, + unsigned char *pbyTxBufferAddr, bool bNeedEncrypt, + unsigned int cbPayloadSize, unsigned int uDMAIdx, PSTxDesc pHeadTD, PSEthernetHeader psEthHeader, unsigned char *pPacket, PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum, unsigned int *pcbHeaderSize) @@ -1878,8 +1976,8 @@ vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pb memset(pTxBufHead, 0, wTxBufSize); //Set FIFOCTL_NEEDACK - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { + if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) || + (pDevice->op_mode == NL80211_IFTYPE_AP)) { if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0]))) { bNeedACK = false; pTxBufHead->wFIFOCtl = pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK); @@ -1957,9 +2055,8 @@ vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pb } } -#ifdef PLICE_DEBUG RFbSetPower(pDevice, pDevice->wCurrentRate, pDevice->byCurrentCh); -#endif + pTxBufHead->byTxPower = pDevice->byCurPwr; *pcbHeaderSize = s_cbFillTxBufHead(pDevice, byPktType, pbyTxBufferAddr, cbPayloadSize, @@ -1988,9 +2085,9 @@ vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pb void vGenerateMACHeader( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char *pbyBufferAddr, - unsigned short wDuration, + __le16 wDuration, PSEthernetHeader psEthHeader, bool bNeedEncrypt, unsigned short wFragType, @@ -2007,13 +2104,13 @@ vGenerateMACHeader( else pMACHeader->wFrameCtl = TYPE_802_11_DATA; - if (pDevice->eOPMode == OP_MODE_AP) { + if (pDevice->op_mode == NL80211_IFTYPE_AP) { memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN); memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN); pMACHeader->wFrameCtl |= FC_FROMDS; } else { - if (pDevice->eOPMode == OP_MODE_ADHOC) { + if (pDevice->op_mode == NL80211_IFTYPE_ADHOC) { memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN); memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN); memcpy(&(pMACHeader->abyAddr3[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); @@ -2028,7 +2125,7 @@ vGenerateMACHeader( if (bNeedEncrypt) pMACHeader->wFrameCtl |= cpu_to_le16((unsigned short)WLAN_SET_FC_ISWEP(1)); - pMACHeader->wDurationID = cpu_to_le16(wDuration); + pMACHeader->wDurationID = le16_to_cpu(wDuration); if (pDevice->bLongHeader) { PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr; @@ -2051,13 +2148,13 @@ vGenerateMACHeader( pMACHeader->wFrameCtl |= FC_MOREFRAG; } -CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) +CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket) { PSTxDesc pFrstTD; unsigned char byPktType; unsigned char *pbyTxBufferAddr; void *pvRTS; - PSCTS pCTS; + struct vnt_cts *pCTS; void *pvTxDataHd; unsigned int uDuration; unsigned int cbReqCount; @@ -2192,20 +2289,24 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) //Set RrvTime/RTS/CTS Buffer if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet - - pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize); + pvRrvTime = (void *) (pbyTxBufferAddr + wTxBufSize); pMICHDR = NULL; pvRTS = NULL; - pCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS)); - pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS)); - cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS) + sizeof(STxDataHead_g); + pCTS = (struct vnt_cts *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts)); + pvTxDataHd = (void *)(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_tx_datahead_g); } else { // 802.11a/b packet - pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = NULL; pvRTS = NULL; pCTS = NULL; - pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); - cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + sizeof(STxDataHead_ab); + pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_ab)); + cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + + sizeof(struct vnt_tx_datahead_ab); } memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize)); @@ -2248,18 +2349,18 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) // S/W or H/W Encryption //--------------------------- do { - if ((pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) && + if ((pDevice->op_mode == NL80211_IFTYPE_STATION) && (pDevice->bLinkPass == true)) { pbyBSSID = pDevice->abyBSSID; // get pairwise key if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == false) { // get group key if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get GTK.\n"); + pr_debug("Get GTK\n"); break; } } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get PTK.\n"); + pr_debug("Get PTK\n"); break; } } @@ -2267,9 +2368,10 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) pbyBSSID = pDevice->abyBroadcastAddr; if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { pTransmitKey = NULL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KEY is NULL. OP Mode[%d]\n", pDevice->eOPMode); + pr_debug("KEY is NULL. OP Mode[%d]\n", + pDevice->op_mode); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get GTK.\n"); + pr_debug("Get GTK\n"); } } while (false); //Fill TXKEY @@ -2296,10 +2398,10 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) // 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) { - ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); - ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); + ((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_a = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); + ((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_b = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); } else { - ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); + ((struct vnt_tx_datahead_ab *)pvTxDataHd)->duration = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); } } @@ -2324,13 +2426,11 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) pDevice->iTDUsed[TYPE_TXDMA0]++; if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n"); + pr_debug(" available td0 <= 1\n"); pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next; -#ifdef TxInSleep pDevice->nTxDataTimeCout = 0; //2008-8-21 chester <add> for send null packet -#endif // Poll Transmit the adapter MACvTransmit0(pDevice->PortOffset); @@ -2338,20 +2438,18 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) return CMD_STATUS_PENDING; } -CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) +CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket) { unsigned char byPktType; unsigned char *pbyBuffer = (unsigned char *)pDevice->tx_beacon_bufs; unsigned int cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN; unsigned int cbHeaderSize = 0; - unsigned short wTxBufSize = sizeof(STxShortBufHead); - PSTxShortBufHead pTxBufHead = (PSTxShortBufHead) pbyBuffer; - PSTxDataHead_ab pTxDataHead = (PSTxDataHead_ab) (pbyBuffer + wTxBufSize); + struct vnt_tx_short_buf_head *short_head = + (struct vnt_tx_short_buf_head *)pbyBuffer; PS802_11Header pMACHeader; unsigned short wCurrentRate; - unsigned short wLen = 0x0000; - memset(pTxBufHead, 0, wTxBufSize); + memset(short_head, 0, sizeof(*short_head)); if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { wCurrentRate = RATE_6M; @@ -2364,27 +2462,30 @@ CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) //Set Preamble type always long pDevice->byPreambleType = PREAMBLE_LONG; - //Set FIFOCTL_GENINT - - pTxBufHead->wFIFOCtl |= FIFOCTL_GENINT; + /* Set FIFOCTL_GENINT */ + short_head->fifo_ctl |= cpu_to_le16(FIFOCTL_GENINT); - //Set packet type & Get Duration + /* Set packet type & Get Duration */ if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 - pTxDataHead->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, byPktType, - wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE)); + short_head->duration = + cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, + cbFrameSize, byPktType, wCurrentRate, false, + 0, 0, 1, AUTO_FB_NONE)); } else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_11B; - pTxDataHead->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, byPktType, - wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE)); + short_head->fifo_ctl |= cpu_to_le16(FIFOCTL_11B); + + short_head->duration = + cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, + cbFrameSize, byPktType, wCurrentRate, false, + 0, 0, 1, AUTO_FB_NONE)); } - BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, byPktType, - (unsigned short *)&(wLen), (unsigned char *)&(pTxDataHead->byServiceField), (unsigned char *)&(pTxDataHead->bySignalField) -); - pTxDataHead->wTransmitLength = cpu_to_le16(wLen); - //Get TimeStampOff - pTxDataHead->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]); - cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab); + vnt_get_phy_field(pDevice, cbFrameSize, + wCurrentRate, byPktType, &short_head->ab); + + /* Get TimeStampOff */ + short_head->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); + cbHeaderSize = sizeof(struct vnt_tx_short_buf_head); //Generate Beacon Header pMACHeader = (PS802_11Header)(pbyBuffer + cbHeaderSize); @@ -2412,7 +2513,7 @@ CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) unsigned int cbGetFragCount( - PSDevice pDevice, + struct vnt_private *pDevice, PSKeyItem pTransmitKey, unsigned int cbFrameBodySize, PSEthernetHeader psEthHeader @@ -2430,8 +2531,8 @@ cbGetFragCount( unsigned int uMACfragNum = 1; bool bNeedACK; - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { + if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) || + (pDevice->op_mode == NL80211_IFTYPE_AP)) { if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0]))) bNeedACK = false; else @@ -2489,8 +2590,9 @@ cbGetFragCount( return uMACfragNum; } -void -vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, unsigned int cbMPDULen) { +void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb, + unsigned char *pbMPDU, unsigned int cbMPDULen) +{ PSTxDesc pFrstTD; unsigned char byPktType; unsigned char *pbyTxBufferAddr; @@ -2577,7 +2679,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vDMA0_tx_80211: p80211Header->sA3.wFrameCtl = %x\n", p80211Header->sA3.wFrameCtl); + pr_debug("vDMA0_tx_80211: p80211Header->sA3.wFrameCtl = %x\n", + p80211Header->sA3.wFrameCtl); //Set packet type if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 @@ -2656,7 +2759,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { cbIVlen = 8;//RSN Header cbICVlen = 8;//MIC - cbMICHDR = sizeof(SMICHDRHead); + cbMICHDR = sizeof(struct vnt_mic_hdr); pTxBufHead->wFragCtl |= FRAGCTL_AES; pDevice->bAES = true; } @@ -2675,21 +2778,28 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet - pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS)); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts)); pvRTS = NULL; - pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR); - pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS)); - cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g); + pvCTS = (struct vnt_cts *)(pbyTxBufferAddr + wTxBufSize + + sizeof(struct vnt_rrv_time_cts) + cbMICHDR); + pvTxDataHd = (void *)(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_tx_datahead_g); } else {//802.11a/b packet - pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); - pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); + pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); + pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); pvRTS = NULL; pvCTS = NULL; - pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR); - cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab); + pvTxDataHd = (void *)(pbyTxBufferAddr + + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); + cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + + cbMICHDR + sizeof(struct vnt_tx_datahead_ab); } @@ -2764,7 +2874,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un MIC_vAppend((unsigned char *)&(sEthHeader.abyDstAddr[0]), 12); dwMIC_Priority = 0; MIC_vAppend((unsigned char *)&dwMIC_Priority, 4); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "DMA0_tx_8021:MIC KEY: %X, %X\n", dwMICKey0, dwMICKey1); + pr_debug("DMA0_tx_8021:MIC KEY: %X, %X\n", + dwMICKey0, dwMICKey1); uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen; @@ -2782,9 +2893,10 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un pDevice->bTxMICFail = false; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "uLength: %d, %d\n", uLength, cbFrameBodySize); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderSize, uPadding, cbIVlen); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC:%x, %x\n", *pdwMIC_L, *pdwMIC_R); + pr_debug("uLength: %d, %d\n", uLength, cbFrameBodySize); + pr_debug("cbReqCount:%d, %d, %d, %d\n", + cbReqCount, cbHeaderSize, uPadding, cbIVlen); + pr_debug("MIC:%x, %x\n", *pdwMIC_L, *pdwMIC_R); } @@ -2812,10 +2924,10 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un // 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) { - ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(p80211Header->sA2.wDurationID); - ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(p80211Header->sA2.wDurationID); + ((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_a = cpu_to_le16(p80211Header->sA2.wDurationID); + ((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_b = cpu_to_le16(p80211Header->sA2.wDurationID); } else { - ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(p80211Header->sA2.wDurationID); + ((struct vnt_tx_datahead_ab *)pvTxDataHd)->duration = cpu_to_le16(p80211Header->sA2.wDurationID); } } @@ -2842,7 +2954,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un pDevice->iTDUsed[TYPE_TXDMA0]++; if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n"); + pr_debug(" available td0 <= 1\n"); pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next; diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h index 601bedb211d6..8ee62887dee5 100644 --- a/drivers/staging/vt6655/rxtx.h +++ b/drivers/staging/vt6655/rxtx.h @@ -39,9 +39,151 @@ /*--------------------- Export Functions --------------------------*/ +/* MIC HDR data header */ +struct vnt_mic_hdr { + u8 id; + u8 tx_priority; + u8 mic_addr2[ETH_ALEN]; + u8 ccmp_pn[IEEE80211_CCMP_PN_LEN]; + __be16 payload_len; + __be16 hlen; + __le16 frame_control; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 addr3[ETH_ALEN]; + __le16 seq_ctrl; + u8 addr4[ETH_ALEN]; + u16 packing; /* packing to 48 bytes */ +} __packed; + +/* RsvTime buffer header */ +struct vnt_rrv_time_rts { + __le16 rts_rrv_time_ba; + __le16 rts_rrv_time_aa; + __le16 rts_rrv_time_bb; + u16 reserved; + __le16 rrv_time_b; + __le16 rrv_time_a; +} __packed; + +struct vnt_rrv_time_cts { + __le16 cts_rrv_time_ba; + u16 reserved; + __le16 rrv_time_b; + __le16 rrv_time_a; +} __packed; + +struct vnt_rrv_time_ab { + __le16 rts_rrv_time; + __le16 rrv_time; +} __packed; + +/* TX data header */ +struct vnt_tx_datahead_g { + struct vnt_phy_field b; + struct vnt_phy_field a; + __le16 duration_b; + __le16 duration_a; + __le16 time_stamp_off_b; + __le16 time_stamp_off_a; +} __packed; + +struct vnt_tx_datahead_g_fb { + struct vnt_phy_field b; + struct vnt_phy_field a; + __le16 duration_b; + __le16 duration_a; + __le16 duration_a_f0; + __le16 duration_a_f1; + __le16 time_stamp_off_b; + __le16 time_stamp_off_a; +} __packed; + +struct vnt_tx_datahead_ab { + struct vnt_phy_field ab; + __le16 duration; + __le16 time_stamp_off; +} __packed; + +struct vnt_tx_datahead_a_fb { + struct vnt_phy_field a; + __le16 duration; + __le16 time_stamp_off; + __le16 duration_f0; + __le16 duration_f1; +} __packed; + +/* RTS buffer header */ +struct vnt_rts_g { + struct vnt_phy_field b; + struct vnt_phy_field a; + __le16 duration_ba; + __le16 duration_aa; + __le16 duration_bb; + u16 reserved; + struct ieee80211_rts data; +} __packed; + +struct vnt_rts_g_fb { + struct vnt_phy_field b; + struct vnt_phy_field a; + __le16 duration_ba; + __le16 duration_aa; + __le16 duration_bb; + u16 wReserved; + __le16 rts_duration_ba_f0; + __le16 rts_duration_aa_f0; + __le16 rts_duration_ba_f1; + __le16 rts_duration_aa_f1; + struct ieee80211_rts data; +} __packed; + +struct vnt_rts_ab { + struct vnt_phy_field ab; + __le16 duration; + u16 reserved; + struct ieee80211_rts data; +} __packed; + +struct vnt_rts_a_fb { + struct vnt_phy_field a; + __le16 duration; + u16 reserved; + __le16 rts_duration_f0; + __le16 rts_duration_f1; + struct ieee80211_rts data; +} __packed; + +/* CTS buffer header */ +struct vnt_cts { + struct vnt_phy_field b; + __le16 duration_ba; + u16 reserved; + struct ieee80211_cts data; + u16 reserved2; +} __packed; + +struct vnt_cts_fb { + struct vnt_phy_field b; + __le16 duration_ba; + u16 reserved; + __le16 cts_duration_ba_f0; + __le16 cts_duration_ba_f1; + struct ieee80211_cts data; + u16 reserved2; +} __packed; + +struct vnt_tx_short_buf_head { + __le16 fifo_ctl; + u16 time_stamp; + struct vnt_phy_field ab; + __le16 duration; + __le16 time_stamp_off; +} __packed; + void vGenerateMACHeader( - PSDevice pDevice, + struct vnt_private *, unsigned char *pbyBufferAddr, unsigned short wDuration, PSEthernetHeader psEthHeader, @@ -53,20 +195,24 @@ vGenerateMACHeader( unsigned int cbGetFragCount( - PSDevice pDevice, + struct vnt_private *, PSKeyItem pTransmitKey, unsigned int cbFrameBodySize, PSEthernetHeader psEthHeader ); void -vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktTyp, unsigned char *pbyTxBufferAddr, - bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx, PSTxDesc pHeadTD, - PSEthernetHeader psEthHeader, unsigned char *pPacket, PSKeyItem pTransmitKey, - unsigned int uNodeIndex, unsigned int *puMACfragNum, unsigned int *pcbHeaderSize); - -void vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, unsigned int cbMPDULen); -CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket); -CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket); +vGenerateFIFOHeader(struct vnt_private *, unsigned char byPktTyp, + unsigned char *pbyTxBufferAddr, bool bNeedEncrypt, + unsigned int cbPayloadSize, unsigned int uDMAIdx, + PSTxDesc pHeadTD, PSEthernetHeader psEthHeader, + unsigned char *pPacket, PSKeyItem pTransmitKey, + unsigned int uNodeIndex, unsigned int *puMACfragNum, + unsigned int *pcbHeaderSize); + +void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb, + unsigned char *pbMPDU, unsigned int cbMPDULen); +CMD_STATUS csMgmt_xmit(struct vnt_private *, PSTxMgmtPacket pPacket); +CMD_STATUS csBeacon_xmit(struct vnt_private *, PSTxMgmtPacket pPacket); #endif // __RXTX_H__ diff --git a/drivers/staging/vt6655/ttype.h b/drivers/staging/vt6655/ttype.h index b1d8ae732774..747ef62ec9be 100644 --- a/drivers/staging/vt6655/ttype.h +++ b/drivers/staging/vt6655/ttype.h @@ -31,10 +31,6 @@ /******* Common definitions and typedefs ***********************************/ -#ifndef TxInSleep -#define TxInSleep -#endif - #ifndef WPA_SM_Transtatus #define WPA_SM_Transtatus #endif @@ -43,27 +39,4 @@ #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__ diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h index e262f1b00e66..c5c889cade25 100644 --- a/drivers/staging/vt6655/upc.h +++ b/drivers/staging/vt6655/upc.h @@ -40,61 +40,34 @@ #define VNSvInPortB(dwIOAddress, pbyData) \ do { \ - *(pbyData) = readb(dwIOAddress); \ + *(pbyData) = ioread8(dwIOAddress); \ } while (0) #define VNSvInPortW(dwIOAddress, pwData) \ do { \ - *(pwData) = readw(dwIOAddress); \ + *(pwData) = ioread16(dwIOAddress); \ } while (0) #define VNSvInPortD(dwIOAddress, pdwData) \ do { \ - *(pdwData) = readl(dwIOAddress); \ + *(pdwData) = ioread32(dwIOAddress); \ } while (0) #define VNSvOutPortB(dwIOAddress, byData) \ do { \ - writeb((unsigned char)byData, dwIOAddress); \ + iowrite8((u8)byData, dwIOAddress); \ } while (0) #define VNSvOutPortW(dwIOAddress, wData) \ do { \ - writew((unsigned short)wData, dwIOAddress); \ + iowrite16((u16)wData, dwIOAddress); \ } while (0) #define VNSvOutPortD(dwIOAddress, dwData) \ do { \ - writel((unsigned long)dwData, dwIOAddress); \ + iowrite32((u32)dwData, dwIOAddress); \ } while (0) -// -// ALWAYS IO-Mapped IO when in 16-bit/32-bit environment -// -#define PCBvInPortB(dwIOAddress, pbyData) \ -do { \ - *(pbyData) = inb(dwIOAddress); \ -} while (0) - -#define PCBvInPortW(dwIOAddress, pwData) \ -do { \ - *(pwData) = inw(dwIOAddress); \ -} while (0) - -#define PCBvInPortD(dwIOAddress, pdwData) \ -do { \ - *(pdwData) = inl(dwIOAddress); \ -} while (0) - -#define PCBvOutPortB(dwIOAddress, byData) \ - outb(byData, dwIOAddress) - -#define PCBvOutPortW(dwIOAddress, wData) \ - outw(wData, dwIOAddress) - -#define PCBvOutPortD(dwIOAddress, dwData) \ - outl(dwData, dwIOAddress) - #define PCAvDelayByIO(uDelayUnit) \ do { \ unsigned char byData; \ diff --git a/drivers/staging/vt6655/vntwifi.c b/drivers/staging/vt6655/vntwifi.c index 4d425e0c76d4..59f66fe47352 100644 --- a/drivers/staging/vt6655/vntwifi.c +++ b/drivers/staging/vt6655/vntwifi.c @@ -543,10 +543,6 @@ VNTWIFIvGetTxRate( } else { /* Infrastructure: rate decided from AP Node, index = 0 */ wTxDataRate = (pMgmt->sNodeDBTable[0].wTxDataRate); -#ifdef PLICE_DEBUG - pr_debug("GetTxRate:AP MAC is %pM,TxRate is %d\n", - pMgmt->sNodeDBTable[0].abyMACAddr, wTxDataRate); -#endif pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates; pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates; diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c index f12eef064c45..985e1b99362d 100644 --- a/drivers/staging/vt6655/wcmd.c +++ b/drivers/staging/vt6655/wcmd.c @@ -58,20 +58,18 @@ /*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ static void s_vProbeChannel( - PSDevice pDevice + struct vnt_private *pDevice ); static PSTxMgmtPacket s_MgrMakeProbeRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned char *pScanBSSID, PWLAN_IE_SSID pSSID, @@ -82,7 +80,7 @@ s_MgrMakeProbeRequest( static bool s_bCommandComplete( - PSDevice pDevice + struct vnt_private *pDevice ); /*--------------------- Export Variables --------------------------*/ @@ -104,7 +102,7 @@ s_bCommandComplete( */ static void -vAdHocBeaconStop(PSDevice pDevice) +vAdHocBeaconStop(struct vnt_private *pDevice) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); bool bStop; @@ -151,7 +149,7 @@ vAdHocBeaconStop(PSDevice pDevice) */ static void -vAdHocBeaconRestart(PSDevice pDevice) +vAdHocBeaconRestart(struct vnt_private *pDevice) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -181,7 +179,7 @@ vAdHocBeaconRestart(PSDevice pDevice) static void s_vProbeChannel( - PSDevice pDevice + struct vnt_private *pDevice ) { //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M @@ -216,9 +214,9 @@ s_vProbeChannel( if (pTxPacket != NULL) { for (ii = 0; ii < 2; ii++) { if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail..\n"); + pr_debug("Probe request sending fail..\n"); else - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending..\n"); + pr_debug("Probe request is sending..\n"); } } } @@ -236,7 +234,7 @@ s_vProbeChannel( static PSTxMgmtPacket s_MgrMakeProbeRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned char *pScanBSSID, PWLAN_IE_SSID pSSID, @@ -287,7 +285,7 @@ vCommandTimerWait( unsigned int MSecond ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; init_timer(&pDevice->sTimerCommand); pDevice->sTimerCommand.data = (unsigned long) pDevice; @@ -302,7 +300,7 @@ vCommandTimer( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; PWLAN_IE_SSID pItemSSID; PWLAN_IE_SSID pItemSSIDCurr; @@ -330,12 +328,12 @@ vCommandTimer( if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { s_bCommandComplete(pDevice); - CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP); + CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_AP); spin_unlock_irq(&pDevice->lock); return; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_SCAN_START\n"); + pr_debug("eCommandState= WLAN_CMD_SCAN_START\n"); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; // wait all Data TD complete if (pDevice->iTDUsed[TYPE_AC0DMA] != 0) { @@ -355,11 +353,12 @@ vCommandTimer( // Set Baseband's sensitivity back. // Set channel back set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); + pr_debug("Scanning, set back to channel: [%d]\n", + pMgmt->uCurrChannel); if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) - CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC); + CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_ADHOC); else - CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE); + CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_STATION); vAdHocBeaconRestart(pDevice); s_bCommandComplete(pDevice); @@ -367,7 +366,8 @@ vCommandTimer( } else { //2008-8-4 <add> by chester if (!is_channel_valid(pMgmt->uScanChannel)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d\n", pMgmt->uScanChannel); + pr_debug("Invalid channel pMgmt->uScanChannel = %d\n", + pMgmt->uScanChannel); s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -387,11 +387,13 @@ vCommandTimer( vAdHocBeaconStop(pDevice); if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel)) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SCAN Channel: %d\n", pMgmt->uScanChannel); + pr_debug("SCAN Channel: %d\n", + pMgmt->uScanChannel); else - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel); + pr_debug("SET SCAN Channel Fail: %d\n", + pMgmt->uScanChannel); - CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_UNKNOWN); + CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_UNSPECIFIED); pMgmt->uScanChannel++; //2008-8-4 <modify> by chester if (!is_channel_valid(pMgmt->uScanChannel) && @@ -422,11 +424,12 @@ vCommandTimer( // Set Baseband's sensitivity back. // Set channel back set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); + pr_debug("Scanning, set back to channel: [%d]\n", + pMgmt->uCurrChannel); if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) - CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC); + CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_ADHOC); else - CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE); + CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_STATION); pMgmt->eScanState = WMAC_NO_SCANNING; vAdHocBeaconRestart(pDevice); @@ -451,7 +454,7 @@ vCommandTimer( spin_unlock_irq(&pDevice->lock); return; } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Disassociation Packet..\n"); + pr_debug("Send Disassociation Packet..\n"); // reason = 8 : disassoc because sta has left vMgrDisassocBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (8), &Status); pDevice->bLinkPass = false; @@ -470,7 +473,7 @@ vCommandTimer( spin_unlock_irq(&pDevice->lock); return; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " CARDbRadioPowerOff\n"); + pr_debug(" CARDbRadioPowerOff\n"); //2008-09-02 <mark> by chester s_bCommandComplete(pDevice); break; @@ -496,15 +499,16 @@ vCommandTimer( pr_debug("chester-abyDesireSSID=%s\n", ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cmd: desire ssid = %s\n", pItemSSID->abySSID); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); + pr_debug(" cmd: desire ssid = %s\n", pItemSSID->abySSID); + pr_debug(" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pItemSSID->len =%d\n", pItemSSID->len); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pItemSSIDCurr->len = %d\n", pItemSSIDCurr->len); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " desire ssid = %s\n", pItemSSID->abySSID); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " curr ssid = %s\n", pItemSSIDCurr->abySSID); + pr_debug(" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); + pr_debug(" pItemSSID->len =%d\n", pItemSSID->len); + pr_debug(" pItemSSIDCurr->len = %d\n", + pItemSSIDCurr->len); + pr_debug(" desire ssid = %s\n", pItemSSID->abySSID); + pr_debug(" curr ssid = %s\n", pItemSSIDCurr->abySSID); } if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || @@ -541,7 +545,7 @@ vCommandTimer( pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT; vCommandTimerWait((void *)pDevice, AUTHENTICATE_TIMEOUT); spin_unlock_irq(&pDevice->lock); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); + pr_debug(" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); return; } } @@ -560,7 +564,7 @@ vCommandTimer( // start own IBSS vMgrCreateOwnIBSS((void *)pDevice, &Status); if (Status != CMD_STATUS_SUCCESS) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail !\n"); + pr_debug(" WLAN_CMD_IBSS_CREATE fail !\n"); BSSvAddMulticastNode(pDevice); } @@ -572,7 +576,7 @@ vCommandTimer( // start own IBSS vMgrCreateOwnIBSS((void *)pDevice, &Status); if (Status != CMD_STATUS_SUCCESS) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail !\n"); + pr_debug(" WLAN_CMD_IBSS_CREATE fail !\n"); BSSvAddMulticastNode(pDevice); if (netif_queue_stopped(pDevice->dev)) @@ -580,7 +584,7 @@ vCommandTimer( pDevice->bLinkPass = true; } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); + pr_debug("Disconnect SSID none\n"); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT { union iwreq_data wrqu; @@ -598,15 +602,15 @@ vCommandTimer( break; case WLAN_AUTHENTICATE_WAIT: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_AUTHENTICATE_WAIT\n"); + pr_debug("eCommandState == WLAN_AUTHENTICATE_WAIT\n"); if (pMgmt->eCurrState == WMAC_STATE_AUTH) { // Call mgr to begin the association pDevice->byLinkWaitCount = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCurrState == WMAC_STATE_AUTH\n"); + pr_debug("eCurrState == WMAC_STATE_AUTH\n"); vMgrAssocBeginSta((void *)pDevice, pMgmt, &Status); if (Status == CMD_STATUS_SUCCESS) { pDevice->byLinkWaitCount = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState = WLAN_ASSOCIATE_WAIT\n"); + pr_debug("eCommandState = WLAN_ASSOCIATE_WAIT\n"); pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT); spin_unlock_irq(&pDevice->lock); @@ -629,7 +633,7 @@ vCommandTimer( case WLAN_ASSOCIATE_WAIT: if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCurrState == WMAC_STATE_ASSOC\n"); + pr_debug("eCurrState == WMAC_STATE_ASSOC\n"); if (pDevice->ePSMode != WMAC_POWER_CAM) PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval); @@ -647,7 +651,6 @@ vCommandTimer( if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); -#ifdef TxInSleep if (pDevice->IsTxDataTrigger) { //TxDataTimer is not triggered at the first time del_timer(&pDevice->sTimerTxData); init_timer(&pDevice->sTimerTxData); @@ -660,7 +663,7 @@ vCommandTimer( pDevice->IsTxDataTrigger = true; add_timer(&pDevice->sTimerTxData); -#endif + } else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay! @@ -676,7 +679,7 @@ vCommandTimer( break; case WLAN_CMD_AP_MODE_START: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_AP_MODE_START\n"); + pr_debug("eCommandState == WLAN_CMD_AP_MODE_START\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { del_timer(&pMgmt->sTimerSecondCallback); @@ -693,12 +696,12 @@ vCommandTimer( vMgrCreateOwnIBSS((void *)pDevice, &Status); if (Status != CMD_STATUS_SUCCESS) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail !\n"); + pr_debug(" vMgrCreateOwnIBSS fail !\n"); // alway turn off unicast bit MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_UNICAST); pDevice->byRxMode &= ~RCR_UNICAST; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode); + pr_debug("wcmd: rx_mode = %x\n", pDevice->byRxMode); BSSvAddMulticastNode(pDevice); if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); @@ -720,7 +723,7 @@ vCommandTimer( pDevice->bMoreData = true; } if (!device_dma0_xmit(pDevice, skb, 0)) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail\n"); + pr_debug("Multicast ps tx fail\n"); pMgmt->sNodeDBTable[0].wEnQueueCnt--; } @@ -730,8 +733,9 @@ vCommandTimer( for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive && pMgmt->sNodeDBTable[ii].bRxPSPoll) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n", - ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); + pr_debug("Index=%d Enqueu Cnt= %d\n", + ii, + pMgmt->sNodeDBTable[ii].wEnQueueCnt); while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) { if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { // clear tx map @@ -742,7 +746,7 @@ vCommandTimer( pDevice->bMoreData = true; } if (!device_dma0_xmit(pDevice, skb, ii)) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail\n"); + pr_debug("sta ps tx fail\n"); pMgmt->sNodeDBTable[ii].wEnQueueCnt--; // check if sta ps enabled, and wait next pspoll. @@ -754,7 +758,8 @@ vCommandTimer( // clear tx map pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear\n", ii); + pr_debug("Index=%d PS queue clear\n", + ii); } pMgmt->sNodeDBTable[ii].bRxPSPoll = false; } @@ -764,7 +769,7 @@ vCommandTimer( break; case WLAN_CMD_RADIO_START: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_RADIO_START\n"); + pr_debug("eCommandState == WLAN_CMD_RADIO_START\n"); if (pDevice->bRadioCmd) CARDbRadioPowerOn(pDevice); else @@ -787,7 +792,7 @@ vCommandTimer( } pDevice->byBBVGACurrent = pDevice->byBBVGANew; BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SetVGAGainOffset %02X\n", pDevice->byBBVGACurrent); + pr_debug("SetVGAGainOffset %02X\n", pDevice->byBBVGACurrent); s_bCommandComplete(pDevice); break; @@ -802,7 +807,7 @@ vCommandTimer( static bool s_bCommandComplete( - PSDevice pDevice + struct vnt_private *pDevice ) { PWLAN_IE_SSID pSSID; @@ -825,7 +830,7 @@ s_bCommandComplete( pDevice->bCmdRunning = true; switch (pDevice->eCommand) { case WLAN_CMD_BSSID_SCAN: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_BSSID_SCAN\n"); + pr_debug("eCommandState= WLAN_CMD_BSSID_SCAN\n"); pDevice->eCommandState = WLAN_CMD_SCAN_START; pMgmt->uScanChannel = 0; if (pSSID->len != 0) @@ -840,7 +845,7 @@ s_bCommandComplete( pSSID->len = WLAN_SSID_MAXLEN; if (pSSID->len != 0) memcpy(pDevice->pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_SSID_START\n"); + pr_debug("eCommandState= WLAN_CMD_SSID_START\n"); break; case WLAN_CMD_DISASSOCIATE: pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START; @@ -876,7 +881,7 @@ bool bScheduleCommand( unsigned char *pbyItem0 ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; if (pDevice->cbFreeCmdQueue == 0) return false; @@ -945,7 +950,7 @@ bool bClearBSSID_SCAN( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx; unsigned int ii; @@ -967,7 +972,7 @@ vResetCommandTimer( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; //delete timer del_timer(&pDevice->sTimerCommand); @@ -984,13 +989,12 @@ vResetCommandTimer( pDevice->bCmdClear = false; } -#ifdef TxInSleep void BSSvSecondTxData( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); pDevice->nTxDataTimeCout++; @@ -1003,20 +1007,17 @@ BSSvSecondTxData( } spin_lock_irq(&pDevice->lock); -#if 1 - if ((pDevice->bLinkPass && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking - pDevice->fWPA_Authened) { //wpa linking -#else - if (pDevice->bLinkPass == true) { -#endif - 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); - return; + /* open && sharekey linking */ + if ((pDevice->bLinkPass && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || + pDevice->fWPA_Authened) { /* wpa linking */ + pDevice->fTxDataInSleep = true; + PSbSendNullPacket(pDevice); /* send null packet */ + pDevice->fTxDataInSleep = false; } -#endif + + spin_unlock_irq(&pDevice->lock); + + pDevice->sTimerTxData.expires = RUN_AT(10*HZ); /* 10s callback */ + add_timer(&pDevice->sTimerTxData); +} diff --git a/drivers/staging/vt6655/wcmd.h b/drivers/staging/vt6655/wcmd.h index 126b61c48791..6ef04de69f37 100644 --- a/drivers/staging/vt6655/wcmd.h +++ b/drivers/staging/vt6655/wcmd.h @@ -114,11 +114,10 @@ vCommandTimerWait( void *hDeviceContext, unsigned int MSecond ); -#ifdef TxInSleep + void BSSvSecondTxData( void *hDeviceContext ); -#endif #endif //__WCMD_H__ diff --git a/drivers/staging/vt6655/wctl.c b/drivers/staging/vt6655/wctl.c index fddea9fc9cfe..5a54d98d985a 100644 --- a/drivers/staging/vt6655/wctl.c +++ b/drivers/staging/vt6655/wctl.c @@ -105,7 +105,8 @@ bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader) * Return Value: index number in Defragment Database * */ -unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader) +unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, + PS802_11Header pMACHeader) { unsigned int ii; @@ -133,7 +134,7 @@ unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader) * Return Value: index number in Defragment Database * */ -unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader) +unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, PS802_11Header pMACHeader) { unsigned int ii; @@ -169,7 +170,8 @@ unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader) * Return Value: true if it is valid fragment packet and we have resource to defragment; otherwise false * */ -bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV) +bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, + unsigned int cbFrameLength, bool bWEP, bool bExtIV) { unsigned int uHeaderSize; diff --git a/drivers/staging/vt6655/wctl.h b/drivers/staging/vt6655/wctl.h index 1ffb2734cfae..f0995d86f71f 100644 --- a/drivers/staging/vt6655/wctl.h +++ b/drivers/staging/vt6655/wctl.h @@ -97,9 +97,9 @@ do { \ /*--------------------- Export Functions --------------------------*/ bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); -bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, +bool WCTLbHandleFragment(struct vnt_private *, PS802_11Header pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV); -unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader); -unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader); +unsigned int WCTLuSearchDFCB(struct vnt_private *, PS802_11Header pMACHeader); +unsigned int WCTLuInsertDFCB(struct vnt_private *, PS802_11Header pMACHeader); #endif // __WCTL_H__ diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c index e88e11606db0..c73c39d7adfd 100644 --- a/drivers/staging/vt6655/wmgr.c +++ b/drivers/staging/vt6655/wmgr.c @@ -80,19 +80,14 @@ #include "rf.h" #include "iowpa.h" -#define PLICE_DEBUG - /*--------------------- Static Definitions -------------------------*/ /*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; - /*--------------------- Static Functions --------------------------*/ //2008-8-4 <add> by chester static bool ChannelExceedZoneType( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byCurrChannel ); @@ -100,7 +95,7 @@ static bool ChannelExceedZoneType( static PSTxMgmtPacket s_MgrMakeAssocRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned char *pDAddr, unsigned short wCurrCapInfo, @@ -113,7 +108,7 @@ s_MgrMakeAssocRequest( static void s_vMgrRxAssocRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket, unsigned int uNodeIndex @@ -122,7 +117,7 @@ s_vMgrRxAssocRequest( static PSTxMgmtPacket s_MgrMakeReAssocRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned char *pDAddr, unsigned short wCurrCapInfo, @@ -135,7 +130,7 @@ s_MgrMakeReAssocRequest( static void s_vMgrRxAssocResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket, bool bReAssocType @@ -144,7 +139,7 @@ s_vMgrRxAssocResponse( static void s_vMgrRxDisassociation( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ); @@ -153,7 +148,7 @@ s_vMgrRxDisassociation( static void s_vMgrRxAuthenSequence_1( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PWLAN_FR_AUTHEN pFrame ); @@ -161,7 +156,7 @@ s_vMgrRxAuthenSequence_1( static void s_vMgrRxAuthenSequence_2( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PWLAN_FR_AUTHEN pFrame ); @@ -169,7 +164,7 @@ s_vMgrRxAuthenSequence_2( static void s_vMgrRxAuthenSequence_3( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PWLAN_FR_AUTHEN pFrame ); @@ -177,7 +172,7 @@ s_vMgrRxAuthenSequence_3( static void s_vMgrRxAuthenSequence_4( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PWLAN_FR_AUTHEN pFrame ); @@ -185,7 +180,7 @@ s_vMgrRxAuthenSequence_4( static void s_vMgrRxAuthentication( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ); @@ -193,7 +188,7 @@ s_vMgrRxAuthentication( static void s_vMgrRxDeauthentication( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ); @@ -203,7 +198,7 @@ s_vMgrRxDeauthentication( static void s_vMgrRxProbeRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ); @@ -211,7 +206,7 @@ s_vMgrRxProbeRequest( static void s_vMgrRxProbeResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ); @@ -220,7 +215,7 @@ s_vMgrRxProbeResponse( static void s_vMgrRxBeacon( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket, bool bInScan @@ -236,7 +231,7 @@ s_vMgrFormatTIM( static PSTxMgmtPacket s_MgrMakeBeacon( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned short wCurrCapInfo, unsigned short wCurrBeaconPeriod, @@ -252,7 +247,7 @@ s_MgrMakeBeacon( static PSTxMgmtPacket s_MgrMakeAssocResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned short wCurrCapInfo, unsigned short wAssocStatus, @@ -266,7 +261,7 @@ s_MgrMakeAssocResponse( static PSTxMgmtPacket s_MgrMakeReAssocResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned short wCurrCapInfo, unsigned short wAssocStatus, @@ -280,7 +275,7 @@ s_MgrMakeReAssocResponse( static PSTxMgmtPacket s_MgrMakeProbeResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned short wCurrCapInfo, unsigned short wCurrBeaconPeriod, @@ -305,7 +300,7 @@ s_vMgrLogStatus( static void s_vMgrSynchBSS( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned int uBSSMode, PKnownBSS pCurr, PCMD_STATUS pStatus @@ -320,7 +315,7 @@ s_bCipherMatch( ); static void Encyption_Rebuild( - PSDevice pDevice, + struct vnt_private *pDevice, PKnownBSS pCurr ); @@ -343,7 +338,7 @@ vMgrObjectInit( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; int ii; @@ -375,7 +370,7 @@ vMgrTimerInit( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; init_timer(&pMgmt->sTimerSecondCallback); @@ -388,7 +383,6 @@ vMgrTimerInit( pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer; pDevice->sTimerCommand.expires = RUN_AT(HZ); -#ifdef TxInSleep init_timer(&pDevice->sTimerTxData); pDevice->sTimerTxData.data = (unsigned long) pDevice; pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData; @@ -396,7 +390,6 @@ vMgrTimerInit( pDevice->fTxDataInSleep = false; pDevice->IsTxDataTrigger = false; pDevice->nTxDataTimeCout = 0; -#endif pDevice->cbFreeCmdQueue = CMD_Q_SIZE; pDevice->uCmdDequeueIdx = 0; @@ -418,7 +411,7 @@ vMgrObjectReset( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; pMgmt->eCurrMode = WMAC_MODE_STANDBY; @@ -445,7 +438,7 @@ vMgrAssocBeginSta( PCMD_STATUS pStatus ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSTxMgmtPacket pTxPacket; pMgmt->wCurrCapInfo = 0; @@ -511,7 +504,7 @@ vMgrReAssocBeginSta( PCMD_STATUS pStatus ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSTxMgmtPacket pTxPacket; pMgmt->wCurrCapInfo = 0; @@ -553,9 +546,9 @@ vMgrReAssocBeginSta( /* send the frame */ *pStatus = csMgmt_xmit(pDevice, pTxPacket); if (*pStatus != CMD_STATUS_PENDING) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx failed.\n"); + pr_debug("Mgt:Reassociation tx failed\n"); else - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx sending.\n"); + pr_debug("Mgt:Reassociation tx sending\n"); } } @@ -578,7 +571,7 @@ vMgrDisassocBeginSta( PCMD_STATUS pStatus ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSTxMgmtPacket pTxPacket = NULL; WLAN_FR_DISASSOC sFrame; @@ -630,7 +623,7 @@ vMgrDisassocBeginSta( static void s_vMgrRxAssocRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket, unsigned int uNodeIndex @@ -697,9 +690,9 @@ s_vMgrRxAssocRequest( // set max tx rate pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; -#ifdef PLICE_DEBUG + pr_debug("RxAssocRequest:wTxDataRate is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate); -#endif + // Todo: check sta preamble, if ap can't support, set status code pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); @@ -720,8 +713,8 @@ s_vMgrRxAssocRequest( if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) pDevice->bBarkerPreambleMd = true; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Associate AID= %d\n", wAssocAID); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", + pr_info("Associate AID= %d\n", wAssocAID); + pr_info("MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", sFrame.pHdr->sA3.abyAddr2[0], sFrame.pHdr->sA3.abyAddr2[1], sFrame.pHdr->sA3.abyAddr2[2], @@ -729,7 +722,7 @@ s_vMgrRxAssocRequest( sFrame.pHdr->sA3.abyAddr2[4], sFrame.pHdr->sA3.abyAddr2[5] ); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n", + pr_info("Max Support rate = %d\n", pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); } else { /* TODO: received STA under state1 handle */ @@ -755,9 +748,9 @@ s_vMgrRxAssocRequest( /* send the frame */ Status = csMgmt_xmit(pDevice, pTxPacket); if (Status != CMD_STATUS_PENDING) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx failed\n"); + pr_debug("Mgt:Assoc response tx failed\n"); else - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx sending..\n"); + pr_debug("Mgt:Assoc response tx sending..\n"); } } @@ -780,7 +773,7 @@ s_vMgrRxAssocRequest( static void s_vMgrRxReAssocRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket, unsigned int uNodeIndex @@ -845,9 +838,9 @@ s_vMgrRxReAssocRequest( // set max tx rate pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; -#ifdef PLICE_DEBUG + pr_debug("RxReAssocRequest:TxDataRate is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate); -#endif + // Todo: check sta preamble, if ap can't support, set status code pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); @@ -869,8 +862,8 @@ s_vMgrRxReAssocRequest( if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) pDevice->bBarkerPreambleMd = true; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Rx ReAssociate AID= %d\n", wAssocAID); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", + pr_info("Rx ReAssociate AID= %d\n", wAssocAID); + pr_info("MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", sFrame.pHdr->sA3.abyAddr2[0], sFrame.pHdr->sA3.abyAddr2[1], sFrame.pHdr->sA3.abyAddr2[2], @@ -878,7 +871,7 @@ s_vMgrRxReAssocRequest( sFrame.pHdr->sA3.abyAddr2[4], sFrame.pHdr->sA3.abyAddr2[5] ); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n", + pr_info("Max Support rate = %d\n", pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); } @@ -903,9 +896,9 @@ s_vMgrRxReAssocRequest( Status = csMgmt_xmit(pDevice, pTxPacket); if (Status != CMD_STATUS_PENDING) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx failed\n"); + pr_debug("Mgt:ReAssoc response tx failed\n"); else - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx sending..\n"); + pr_debug("Mgt:ReAssoc response tx sending..\n"); } } @@ -922,7 +915,7 @@ s_vMgrRxReAssocRequest( static void s_vMgrRxAssocResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket, bool bReAssocType @@ -963,13 +956,14 @@ s_vMgrRxAssocResponse( // set AID pMgmt->wCurrAID = cpu_to_le16((*(sFrame.pwAid))); if ((pMgmt->wCurrAID >> 14) != (BIT0 | BIT1)) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AID from AP, has two msb clear.\n"); + pr_debug("AID from AP, has two msb clear\n"); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Association Successful, AID=%d.\n", pMgmt->wCurrAID & ~(BIT14 | BIT15)); + pr_info("Association Successful, AID=%d\n", + pMgmt->wCurrAID & ~(BIT14 | BIT15)); pMgmt->eCurrState = WMAC_STATE_ASSOC; BSSvUpdateAPNode((void *)pDevice, sFrame.pwCapInfo, sFrame.pSuppRates, sFrame.pExtSuppRates); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID); + pr_info("Link with AP(SSID): %s\n", pItemSSID->abySSID); pDevice->bLinkPass = true; pDevice->uBBVGADiffCount = 0; if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) { @@ -1075,7 +1069,7 @@ vMgrAuthenBeginSta( PCMD_STATUS pStatus ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; WLAN_FR_AUTHEN sFrame; PSTxMgmtPacket pTxPacket = NULL; @@ -1131,7 +1125,7 @@ vMgrDeAuthenBeginSta( PCMD_STATUS pStatus ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; WLAN_FR_DEAUTHEN sFrame; PSTxMgmtPacket pTxPacket = NULL; @@ -1175,7 +1169,7 @@ vMgrDeAuthenBeginSta( static void s_vMgrRxAuthentication( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ) @@ -1208,8 +1202,8 @@ s_vMgrRxAuthentication( s_vMgrRxAuthenSequence_4(pDevice, pMgmt, &sFrame); break; default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Auth Sequence error, seq = %d\n", - cpu_to_le16((*(sFrame.pwAuthSequence)))); + pr_debug("Auth Sequence error, seq = %d\n", + cpu_to_le16((*(sFrame.pwAuthSequence)))); break; } } @@ -1229,7 +1223,7 @@ s_vMgrRxAuthentication( static void s_vMgrRxAuthenSequence_1( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PWLAN_FR_AUTHEN pFrame ) @@ -1241,7 +1235,7 @@ s_vMgrRxAuthenSequence_1( // Insert a Node entry if (!BSSDBbIsSTAInNodeDB(pMgmt, pFrame->pHdr->sA3.abyAddr2, &uNodeIndex)) { - BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); + BSSvCreateOneNode(pDevice, &uNodeIndex); memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, pFrame->pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); } @@ -1308,9 +1302,9 @@ s_vMgrRxAuthenSequence_1( if (pDevice->bEnableHostapd) return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx..\n"); + pr_debug("Mgt:Authreq_reply sequence_1 tx..\n"); if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx failed.\n"); + pr_debug("Mgt:Authreq_reply sequence_1 tx failed\n"); } /*+ @@ -1328,7 +1322,7 @@ s_vMgrRxAuthenSequence_1( static void s_vMgrRxAuthenSequence_2( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PWLAN_FR_AUTHEN pFrame ) @@ -1339,11 +1333,11 @@ s_vMgrRxAuthenSequence_2( switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) { case WLAN_AUTH_ALG_OPENSYSTEM: if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) { - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n"); + pr_info("802.11 Authen (OPEN) Successful\n"); pMgmt->eCurrState = WMAC_STATE_AUTH; timer_expire(pDevice->sTimerCommand, 0); } else { - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n"); + pr_info("802.11 Authen (OPEN) Failed\n"); s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); pMgmt->eCurrState = WMAC_STATE_IDLE; } @@ -1383,16 +1377,17 @@ s_vMgrRxAuthenSequence_2( pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; // send the frame if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx failed.\n"); + pr_debug("Mgt:Auth_reply sequence_2 tx failed\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx ...\n"); + pr_debug("Mgt:Auth_reply sequence_2 tx ...\n"); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:rx Auth_reply sequence_2 status error ...\n"); + pr_debug("Mgt:rx Auth_reply sequence_2 status error ...\n"); s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); } break; default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt: rx auth.seq = 2 unknown AuthAlgorithm=%d\n", cpu_to_le16((*(pFrame->pwAuthAlgorithm)))); + pr_debug("Mgt: rx auth.seq = 2 unknown AuthAlgorithm=%d\n", + cpu_to_le16((*(pFrame->pwAuthAlgorithm)))); break; } } @@ -1413,7 +1408,7 @@ s_vMgrRxAuthenSequence_2( static void s_vMgrRxAuthenSequence_3( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PWLAN_FR_AUTHEN pFrame ) @@ -1446,7 +1441,7 @@ s_vMgrRxAuthenSequence_3( pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence = 0; } uStatusCode = WLAN_MGMT_STATUS_SUCCESS; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Challenge text check ok..\n"); + pr_debug("Challenge text check ok..\n"); reply: // send auth reply @@ -1479,7 +1474,7 @@ reply: return; if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_4 tx failed.\n"); + pr_debug("Mgt:Authreq_reply sequence_4 tx failed\n"); } /*+ @@ -1495,17 +1490,17 @@ reply: static void s_vMgrRxAuthenSequence_4( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PWLAN_FR_AUTHEN pFrame ) { if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) { - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n"); + pr_info("802.11 Authen (SHAREDKEY) Successful\n"); pMgmt->eCurrState = WMAC_STATE_AUTH; timer_expire(pDevice->sTimerCommand, 0); } else{ - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n"); + pr_info("802.11 Authen (SHAREDKEY) Failed\n"); s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); pMgmt->eCurrState = WMAC_STATE_IDLE; } @@ -1525,7 +1520,7 @@ s_vMgrRxAuthenSequence_4( static void s_vMgrRxDisassociation( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ) @@ -1542,13 +1537,14 @@ s_vMgrRxDisassociation( if (BSSDBbIsSTAInNodeDB(pMgmt, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) BSSvRemoveOneNode(pDevice, uNodeIndex); else - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx disassoc, sta not found\n"); + pr_debug("Rx disassoc, sta not found\n"); } else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { sFrame.len = pRxPacket->cbMPDULen; sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header; vMgrDecodeDisassociation(&sFrame); - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason))); + pr_info("AP disassociated me, reason=%d\n", + cpu_to_le16(*(sFrame.pwReason))); //TODO: do something let upper layer know or //try to send associate packet again because of inactivity timeout if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) { @@ -1595,7 +1591,7 @@ s_vMgrRxDisassociation( static void s_vMgrRxDeauthentication( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ) @@ -1613,13 +1609,14 @@ s_vMgrRxDeauthentication( if (BSSDBbIsSTAInNodeDB(pMgmt, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) BSSvRemoveOneNode(pDevice, uNodeIndex); else - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Rx deauth, sta not found\n"); + pr_info("Rx deauth, sta not found\n"); } else { if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { sFrame.len = pRxPacket->cbMPDULen; sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header; vMgrDecodeDeauthen(&sFrame); - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason)))); + pr_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)) { @@ -1678,7 +1675,7 @@ s_vMgrRxDeauthentication( -*/ static bool ChannelExceedZoneType( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned char byCurrChannel ) { @@ -1715,7 +1712,7 @@ ChannelExceedZoneType( static void s_vMgrRxBeacon( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket, bool bInScan @@ -1723,7 +1720,7 @@ s_vMgrRxBeacon( { PKnownBSS pBSSList; WLAN_FR_BEACON sFrame; - QWORD qwTSFOffset; + u64 qwTSFOffset; bool bIsBSSIDEqual = false; bool bIsSSIDEqual = false; bool bTSFLargeDiff = false; @@ -1735,8 +1732,8 @@ s_vMgrRxBeacon( 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; @@ -1757,7 +1754,7 @@ s_vMgrRxBeacon( (sFrame.pwCapInfo == NULL) || (sFrame.pSSID == NULL) || (sFrame.pSuppRates == NULL)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n"); + pr_debug("Rx beacon frame error\n"); return; } @@ -1792,7 +1789,7 @@ s_vMgrRxBeacon( pBSSList = BSSpAddrIsInBSSList((void *)pDevice, sFrame.pHdr->sA3.abyAddr3, sFrame.pSSID); if (pBSSList == NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Beacon/insert: RxChannel = : %d\n", byCurrChannel); + pr_debug("Beacon/insert: RxChannel = : %d\n", byCurrChannel); BSSbInsertToBSSList((void *)pDevice, sFrame.pHdr->sA3.abyAddr3, *sFrame.pqwTimestamp, @@ -1966,7 +1963,7 @@ s_vMgrRxBeacon( } } -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Beacon 2\n"); +// pr_debug("Beacon 2\n"); // check if CF field exists if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)) { if (sFrame.pCFParms->wCFPDurRemaining > 0) { @@ -1974,32 +1971,22 @@ s_vMgrRxBeacon( } } - 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) { @@ -2038,18 +2025,18 @@ s_vMgrRxBeacon( // send out ps-poll packet if (pMgmt->bInTIM) - PSvSendPSPOLL((PSDevice)pDevice); + PSvSendPSPOLL(pDevice); } else { pMgmt->bInTIMWake = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n"); + pr_debug("BCN: Not In TIM..\n"); if (!pDevice->bPWBitOn) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Send Null Packet\n"); + pr_debug("BCN: Send Null Packet\n"); if (PSbSendNullPacket(pDevice)) pDevice->bPWBitOn = true; } if (PSbConsiderPowerDown(pDevice, false, false)) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Power down now...\n"); + pr_debug("BCN: Power down now...\n"); } } @@ -2089,7 +2076,7 @@ s_vMgrRxBeacon( pMgmt->sNodeDBTable[uNodeIndex].uInActiveCount = 0; } else { // Todo, initial Node content - BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); + BSSvCreateOneNode(pDevice, &uNodeIndex); pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, @@ -2108,16 +2095,14 @@ s_vMgrRxBeacon( memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, sFrame.pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; -#ifdef PLICE_DEBUG { pr_debug("s_vMgrRxBeacon:TxDataRate is %d,Index is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate, uNodeIndex); } -#endif } // if other stations joined, indicate connection to upper layer.. if (pMgmt->eCurrState == WMAC_STATE_STARTED) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed]\n"); + pr_debug("Current IBSS State: [Started]........to: [Jointed]\n"); pMgmt->eCurrState = WMAC_STATE_JOINTED; pDevice->bLinkPass = true; if (netif_queue_stopped(pDevice->dev)) @@ -2143,7 +2128,7 @@ s_vMgrRxBeacon( (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, WLAN_RATES_MAXLEN_11B); // set HW beacon interval and re-synchronizing.... - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rejoining to Other Adhoc group with same SSID........\n"); + pr_debug("Rejoining to Other Adhoc group with same SSID........\n"); VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, pMgmt->wCurrBeaconPeriod); CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, qwLocalTSF); CARDvUpdateNextTBTT(pDevice->PortOffset, qwTimestamp, pMgmt->wCurrBeaconPeriod); @@ -2190,20 +2175,20 @@ vMgrCreateOwnIBSS( PCMD_STATUS pStatus ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; unsigned short wMaxBasicRate; 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}; unsigned char abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; unsigned short wSuppRate; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n"); + pr_debug("Create Basic Service Set .......\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) { if ((pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) && @@ -2312,18 +2297,18 @@ vMgrCreateOwnIBSS( if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { // AP mode BSSID = MAC addr memcpy(pMgmt->abyCurrBSSID, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "AP beacon created BSSID:%pM\n", + pr_info("AP beacon created BSSID:%pM\n", pMgmt->abyCurrBSSID); } 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]; @@ -2333,7 +2318,7 @@ vMgrCreateOwnIBSS( pMgmt->abyCurrBSSID[0] &= ~IEEE_ADDR_GROUP; pMgmt->abyCurrBSSID[0] |= IEEE_ADDR_UNIVERSAL; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Adhoc beacon created bssid:%pM\n", + pr_info("Adhoc beacon created bssid:%pM\n", pMgmt->abyCurrBSSID); } @@ -2371,9 +2356,9 @@ vMgrCreateOwnIBSS( pMgmt->byERPContext = 0; if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { - CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP); + CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_AP); } else { - CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC); + CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_ADHOC); } CARDbSetPhyParameter(pMgmt->pAdapter, @@ -2426,7 +2411,7 @@ vMgrJoinBSSBegin( PCMD_STATUS pStatus ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSMgmtObject pMgmt = pDevice->pMgmt; PKnownBSS pCurr = NULL; unsigned int ii, uu; @@ -2447,7 +2432,7 @@ vMgrJoinBSSBegin( if (ii == MAX_BSS_NUM) { *pStatus = CMD_STATUS_RESOURCES; - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "BSS finding:BSS list is empty.\n"); + pr_info("BSS finding:BSS list is empty\n"); return; } @@ -2462,11 +2447,12 @@ vMgrJoinBSSBegin( if (pCurr == NULL) { *pStatus = CMD_STATUS_RESOURCES; pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Scanning [%s] not found, disconnected !\n", pItemSSID->abySSID); + pr_info("Scanning [%s] not found, disconnected !\n", + pItemSSID->abySSID); return; } - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP(BSS) finding:Found a AP(BSS)..\n"); + pr_info("AP(BSS) finding:Found a AP(BSS)..\n"); if (WLAN_GET_CAP_INFO_ESS(cpu_to_le16(pCurr->wCapInfo))) { if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) { // patch for CISCO migration mode @@ -2544,10 +2530,11 @@ vMgrJoinBSSBegin( if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { bool bResult = bAdd_PMKID_Candidate((void *)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate: 1(%d)\n", bResult); + pr_debug("bAdd_PMKID_Candidate: 1(%d)\n", + bResult); if (!bResult) { vFlush_PMKID_Candidate((void *)pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFlush_PMKID_Candidate: 4\n"); + pr_debug("vFlush_PMKID_Candidate: 4\n"); bAdd_PMKID_Candidate((void *)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); } } @@ -2555,9 +2542,9 @@ vMgrJoinBSSBegin( // Preamble type auto-switch: if AP can receive short-preamble cap, // we can turn on too. - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Join ESS\n"); + pr_debug("Join ESS\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End of Join AP -- A/B/G Action\n"); + pr_debug("End of Join AP -- A/B/G Action\n"); } else { pMgmt->eCurrState = WMAC_STATE_IDLE; } @@ -2615,8 +2602,8 @@ vMgrJoinBSSBegin( pMgmt->eCurrState = WMAC_STATE_STARTED; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Join IBSS ok:%pM\n", - pMgmt->abyCurrBSSID); + pr_debug("Join IBSS ok:%pM\n", + pMgmt->abyCurrBSSID); // Preamble type auto-switch: if AP can receive short-preamble cap, // and if registry setting is short preamble we can turn on too. @@ -2641,7 +2628,7 @@ vMgrJoinBSSBegin( static void s_vMgrSynchBSS( - PSDevice pDevice, + struct vnt_private *pDevice, unsigned int uBSSMode, PKnownBSS pCurr, PCMD_STATUS pStatus @@ -2663,7 +2650,7 @@ s_vMgrSynchBSS( pDevice->eEncryptionStatus, &(pMgmt->byCSSPK), &(pMgmt->byCSSGK))) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_bCipherMatch Fail .......\n"); + pr_debug("s_bCipherMatch Fail .......\n"); return; } @@ -2676,7 +2663,6 @@ s_vMgrSynchBSS( } // Init the BSS informations - pDevice->bCCK = true; pDevice->bProtectMode = false; MACvDisableProtectMD(pDevice->PortOffset); pDevice->bBarkerPreambleMd = false; @@ -2701,8 +2687,7 @@ s_vMgrSynchBSS( MACvReadBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:set CurrBSSID address = " - "%pM\n", pMgmt->abyCurrBSSID); + pr_debug("Sync:set CurrBSSID address = %pM\n", pMgmt->abyCurrBSSID); if (pCurr->eNetworkTypeInUse == PHY_TYPE_11A) { if ((pMgmt->eConfigPHYMode == PHY_TYPE_11A) || @@ -2742,13 +2727,13 @@ s_vMgrSynchBSS( } if (WLAN_GET_CAP_INFO_ESS(pCurr->wCapInfo)) { - CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_INFRASTRUCTURE); + CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, NL80211_IFTYPE_STATION); // Add current BSS to Candidate list // This should only works for WPA2 BSS, and WPA2 BSS check must be done before. if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) CARDbAdd_PMKID_Candidate(pMgmt->pAdapter, pMgmt->abyCurrBSSID, pCurr->sRSNCapObj.bRSNCapExist, pCurr->sRSNCapObj.wRSNCap); } else { - CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_ADHOC); + CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, NL80211_IFTYPE_ADHOC); } if (!CARDbSetPhyParameter(pMgmt->pAdapter, @@ -2757,19 +2742,20 @@ s_vMgrSynchBSS( pCurr->sERP.byERP, pMgmt->abyCurrSuppRates, pMgmt->abyCurrExtSuppRates)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType); + pr_debug("<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType); return; } // set channel and clear NAV if (!set_channel(pMgmt->pAdapter, pCurr->uChannel)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel); + pr_debug("<----s_bSynchBSS Set Channel [%d]\n", + pCurr->uChannel); return; } pMgmt->uCurrChannel = pCurr->uChannel; pMgmt->eCurrentPHYMode = ePhyType; pMgmt->byERPContext = pCurr->sERP.byERP; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:Set to channel = [%d]\n", (int)pCurr->uChannel); + pr_debug("Sync:Set to channel = [%d]\n", (int)pCurr->uChannel); *pStatus = CMD_STATUS_SUCCESS; @@ -2779,7 +2765,7 @@ s_vMgrSynchBSS( //mike add: fix NetworkManager 0.7.0 hidden ssid mode in WPA encryption // ,need reset eAuthenMode and eEncryptionStatus static void Encyption_Rebuild( - PSDevice pDevice, + struct vnt_private *pDevice, PKnownBSS pCurr ) { @@ -2894,7 +2880,7 @@ s_vMgrFormatTIM( static PSTxMgmtPacket s_MgrMakeBeacon( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned short wCurrCapInfo, unsigned short wCurrBeaconPeriod, @@ -3113,7 +3099,7 @@ s_MgrMakeBeacon( static PSTxMgmtPacket s_MgrMakeProbeResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned short wCurrCapInfo, unsigned short wCurrBeaconPeriod, @@ -3295,7 +3281,7 @@ s_MgrMakeProbeResponse( static PSTxMgmtPacket s_MgrMakeAssocRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned char *pDAddr, unsigned short wCurrCapInfo, @@ -3555,7 +3541,7 @@ s_MgrMakeAssocRequest( static PSTxMgmtPacket s_MgrMakeReAssocRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned char *pDAddr, unsigned short wCurrCapInfo, @@ -3800,7 +3786,7 @@ s_MgrMakeReAssocRequest( static PSTxMgmtPacket s_MgrMakeAssocResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned short wCurrCapInfo, unsigned short wAssocStatus, @@ -3871,7 +3857,7 @@ s_MgrMakeAssocResponse( static PSTxMgmtPacket s_MgrMakeReAssocResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, unsigned short wCurrCapInfo, unsigned short wAssocStatus, @@ -3943,7 +3929,7 @@ s_MgrMakeReAssocResponse( static void s_vMgrRxProbeResponse( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ) @@ -3966,13 +3952,14 @@ s_vMgrRxProbeResponse( (sFrame.pwCapInfo == NULL) || (sFrame.pSSID == NULL) || (sFrame.pSuppRates == NULL)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p]\n", pRxPacket->p80211Header); + pr_debug("Probe resp:Fail addr:[%p]\n", + pRxPacket->p80211Header); DBG_PORT80(0xCC); return; } if (sFrame.pSSID->len == 0) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0\n"); + pr_debug("Rx Probe resp: SSID len = 0\n"); if (sFrame.pDSParms != NULL) { if (byCurrChannel > CB_MAX_CHANNEL_24G) { @@ -4026,7 +4013,8 @@ s_vMgrRxProbeResponse( (void *)pRxPacket ); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp/insert: RxChannel = : %d\n", byCurrChannel); + pr_debug("Probe resp/insert: RxChannel = : %d\n", + byCurrChannel); BSSbInsertToBSSList((void *)pDevice, sFrame.pHdr->sA3.abyAddr3, *sFrame.pqwTimestamp, @@ -4062,7 +4050,7 @@ s_vMgrRxProbeResponse( static void s_vMgrRxProbeRequest( - PSDevice pDevice, + struct vnt_private *pDevice, PSMgmtObject pMgmt, PSRxMgmtPacket pRxPacket ) @@ -4115,7 +4103,7 @@ s_vMgrRxProbeRequest( /* send the frame */ Status = csMgmt_xmit(pDevice, pTxPacket); if (Status != CMD_STATUS_PENDING) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx failed\n"); + pr_debug("Mgt:Probe response tx failed\n"); } } } @@ -4141,7 +4129,7 @@ vMgrRxManagePacket( PSRxMgmtPacket pRxPacket ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; bool bInScan = false; unsigned int uNodeIndex = 0; NODE_STATE eNodeState = 0; @@ -4155,7 +4143,7 @@ vMgrRxManagePacket( switch (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl))) { case WLAN_FSTYPE_ASSOCREQ: // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocreq\n"); + pr_debug("rx assocreq\n"); if (eNodeState < NODE_AUTH) { // send deauth notification // reason = (6) class 2 received from nonauth sta @@ -4165,7 +4153,7 @@ vMgrRxManagePacket( (6), &Status ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 1\n"); + pr_debug("wmgr: send vMgrDeAuthenBeginSta 1\n"); } else { s_vMgrRxAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex); } @@ -4173,14 +4161,14 @@ vMgrRxManagePacket( case WLAN_FSTYPE_ASSOCRESP: // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp1\n"); + pr_debug("rx assocresp1\n"); s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, false); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp2\n"); + pr_debug("rx assocresp2\n"); break; case WLAN_FSTYPE_REASSOCREQ: // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocreq\n"); + pr_debug("rx reassocreq\n"); // Todo: reassoc if (eNodeState < NODE_AUTH) { // send deauth notification @@ -4191,7 +4179,7 @@ vMgrRxManagePacket( (6), &Status ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 2\n"); + pr_debug("wmgr: send vMgrDeAuthenBeginSta 2\n"); } s_vMgrRxReAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex); @@ -4199,7 +4187,7 @@ vMgrRxManagePacket( case WLAN_FSTYPE_REASSOCRESP: // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocresp\n"); + pr_debug("rx reassocresp\n"); s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, true); break; @@ -4210,7 +4198,7 @@ vMgrRxManagePacket( case WLAN_FSTYPE_PROBERESP: // Frame Clase = 0 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx proberesp\n"); + pr_debug("rx proberesp\n"); s_vMgrRxProbeResponse(pDevice, pMgmt, pRxPacket); break; @@ -4225,12 +4213,12 @@ vMgrRxManagePacket( case WLAN_FSTYPE_ATIM: // Frame Clase = 1 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx atim\n"); + pr_debug("rx atim\n"); break; case WLAN_FSTYPE_DISASSOC: // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx disassoc\n"); + pr_debug("rx disassoc\n"); if (eNodeState < NODE_AUTH) { // send deauth notification // reason = (6) class 2 received from nonauth sta @@ -4240,25 +4228,25 @@ vMgrRxManagePacket( (6), &Status ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 3\n"); + pr_debug("wmgr: send vMgrDeAuthenBeginSta 3\n"); } s_vMgrRxDisassociation(pDevice, pMgmt, pRxPacket); break; case WLAN_FSTYPE_AUTHEN: // Frame Clase = 1 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx authen\n"); + pr_debug("rx authen\n"); s_vMgrRxAuthentication(pDevice, pMgmt, pRxPacket); break; case WLAN_FSTYPE_DEAUTHEN: // Frame Clase = 1 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx deauthen\n"); + pr_debug("rx deauthen\n"); s_vMgrRxDeauthentication(pDevice, pMgmt, pRxPacket); break; default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx unknown mgmt\n"); + pr_debug("rx unknown mgmt\n"); } } @@ -4279,7 +4267,7 @@ bMgrPrepareBeaconToSend( PSMgmtObject pMgmt ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; PSTxMgmtPacket pTxPacket; if (pDevice->bEncryptionEnable || pDevice->bEnable8021x) @@ -4331,46 +4319,46 @@ s_vMgrLogStatus( { switch (wStatus) { case WLAN_MGMT_STATUS_UNSPEC_FAILURE: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Unspecified error.\n"); + pr_info("Status code == Unspecified error\n"); break; case WLAN_MGMT_STATUS_CAPS_UNSUPPORTED: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Can't support all requested capabilities.\n"); + pr_info("Status code == Can't support all requested capabilities\n"); break; case WLAN_MGMT_STATUS_REASSOC_NO_ASSOC: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Reassoc denied, can't confirm original Association.\n"); + pr_info("Status code == Reassoc denied, can't confirm original Association\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, undefine in spec\n"); + pr_info("Status code == Assoc denied, undefine in spec\n"); break; case WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Peer doesn't support authen algorithm.\n"); + pr_info("Status code == Peer doesn't support authen algorithm\n"); break; case WLAN_MGMT_STATUS_RX_AUTH_NOSEQ: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen frame received out of sequence.\n"); + pr_info("Status code == Authen frame received out of sequence\n"); break; case WLAN_MGMT_STATUS_CHALLENGE_FAIL: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, challenge failure.\n"); + pr_info("Status code == Authen rejected, challenge failure\n"); break; case WLAN_MGMT_STATUS_AUTH_TIMEOUT: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, timeout waiting for next frame.\n"); + pr_info("Status code == Authen rejected, timeout waiting for next frame\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, AP too busy.\n"); + pr_info("Status code == Assoc denied, AP too busy\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_RATES: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we haven't enough basic rates.\n"); + pr_info("Status code == Assoc denied, we haven't enough basic rates\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_SHORTPREAMBLE: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support short preamble.\n"); + pr_info("Status code == Assoc denied, we do not support short preamble\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_PBCC: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support PBCC.\n"); + pr_info("Status code == Assoc denied, we do not support PBCC\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_AGILITY: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support channel agility.\n"); + pr_info("Status code == Assoc denied, we do not support channel agility\n"); break; default: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Unknown status code %d.\n", wStatus); + pr_info("Unknown status code %d\n", wStatus); break; } } @@ -4398,11 +4386,12 @@ bAdd_PMKID_Candidate( PSRSNCapObject psRSNCapObj ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; struct pmkid_candidate *pCandidateList; unsigned int ii = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + pr_debug("bAdd_PMKID_Candidate START: (%d)\n", + (int)pDevice->gsPMKIDCandidate.NumCandidates); if ((pDevice == NULL) || (pbyBSSID == NULL) || (psRSNCapObj == NULL)) return false; @@ -4432,7 +4421,8 @@ bAdd_PMKID_Candidate( memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN); pDevice->gsPMKIDCandidate.NumCandidates++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + pr_debug("NumCandidates:%d\n", + (int)pDevice->gsPMKIDCandidate.NumCandidates); return true; } @@ -4455,7 +4445,7 @@ vFlush_PMKID_Candidate( void *hDeviceContext ) { - PSDevice pDevice = (PSDevice)hDeviceContext; + struct vnt_private *pDevice = hDeviceContext; if (pDevice == NULL) return; @@ -4549,8 +4539,9 @@ s_bCipherMatch( } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%d, %d, %d, %d, EncStatus:%d\n", - byMulticastCipher, byCipherMask, pBSSNode->bWPAValid, pBSSNode->bWPA2Valid, EncStatus); + pr_debug("%d, %d, %d, %d, EncStatus:%d\n", + byMulticastCipher, byCipherMask, + pBSSNode->bWPAValid, pBSSNode->bWPA2Valid, EncStatus); // mask our cap. with BSS if (EncStatus == Ndis802_11Encryption1Enabled) { diff --git a/drivers/staging/vt6655/wmgr.h b/drivers/staging/vt6655/wmgr.h index a71daed7fa0b..ce939b30ac2a 100644 --- a/drivers/staging/vt6655/wmgr.h +++ b/drivers/staging/vt6655/wmgr.h @@ -175,7 +175,7 @@ typedef struct tagSTxMgmtPacket { // Rx Management Packet descriptor typedef struct tagSRxMgmtPacket { PUWLAN_80211HDR p80211Header; - QWORD qwLocalTSF; + u64 qwLocalTSF; unsigned int cbMPDULen; unsigned int cbPayloadLen; unsigned int uRSSI; diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c index 7b1bab91a9cf..5d4eca8512af 100644 --- a/drivers/staging/vt6655/wpa.c +++ b/drivers/staging/vt6655/wpa.c @@ -43,8 +43,6 @@ #include "80211mgr.h" /*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; - static const unsigned char abyOUI00[4] = { 0x00, 0x50, 0xf2, 0x00 }; static const unsigned char abyOUI01[4] = { 0x00, 0x50, 0xf2, 0x01 }; static const unsigned char abyOUI02[4] = { 0x00, 0x50, 0xf2, 0x02 }; @@ -115,13 +113,13 @@ WPA_ParseRSN( WPA_ClearRSN(pBSSList); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WPA_ParseRSN: [%d]\n", pRSN->len); + pr_debug("WPA_ParseRSN: [%d]\n", pRSN->len); // information element header makes sense if ((pRSN->len >= 6) // oui1(4)+ver(2) && (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) && (pRSN->wVersion == 1)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal RSN\n"); + pr_debug("Legal RSN\n"); // update each variable if pRSN is long enough to contain the variable if (pRSN->len >= 10) { //OUI1(4)+ver(2)+GKSuite(4) @@ -139,13 +137,14 @@ WPA_ParseRSN( // any vendor checks here pBSSList->byGKType = WPA_NONE; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byGKType: %x\n", pBSSList->byGKType); + pr_debug("byGKType: %x\n", pBSSList->byGKType); } if (pRSN->len >= 12) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2) j = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType)); + pr_debug("wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n", + pRSN->wPKCount, sizeof(pBSSList->abyPKType)); for (i = 0; (i < pRSN->wPKCount) && (j < ARRAY_SIZE(pBSSList->abyPKType)); i++) { if (pRSN->len >= 12+i*4+4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i) if (!memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4)) @@ -163,19 +162,20 @@ WPA_ParseRSN( break; } pBSSList->wPKCount = (unsigned short)j; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wPKCount: %d\n", pBSSList->wPKCount); + pr_debug("wPKCount: %d\n", pBSSList->wPKCount); } m = pRSN->wPKCount; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "m: %d\n", m); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "14+m*4: %d\n", 14+m*4); + pr_debug("m: %d\n", m); + pr_debug("14+m*4: %d\n", 14+m*4); if (pRSN->len >= 14+m*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2) // overlay IE_RSN_Auth structure into correct place pIE_RSN_Auth = (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI; j = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n", - pIE_RSN_Auth->wAuthCount, sizeof(pBSSList->abyAuthType)); + pr_debug("wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n", + pIE_RSN_Auth->wAuthCount, + sizeof(pBSSList->abyAuthType)); for (i = 0; (i < pIE_RSN_Auth->wAuthCount) && (j < ARRAY_SIZE(pBSSList->abyAuthType)); i++) { if (pRSN->len >= 14+4+(m+i)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i) if (!memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI01, 4)) @@ -191,14 +191,14 @@ WPA_ParseRSN( } if (j > 0) pBSSList->wAuthCount = (unsigned short)j; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAuthCount: %d\n", pBSSList->wAuthCount); + pr_debug("wAuthCount: %d\n", pBSSList->wAuthCount); } if (pIE_RSN_Auth != NULL) { n = pIE_RSN_Auth->wAuthCount; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "n: %d\n", n); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "14+4+(m+n)*4: %d\n", 14+4+(m+n)*4); + pr_debug("n: %d\n", n); + pr_debug("14+4+(m+n)*4: %d\n", 14+4+(m+n)*4); if (pRSN->len+2 >= 14+4+(m+n)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*n)+Cap(2) pbyCaps = (unsigned char *)pIE_RSN_Auth->AuthKSList[n].abyOUI; diff --git a/drivers/staging/vt6655/wpa2.c b/drivers/staging/vt6655/wpa2.c index 4e1b63be380f..bb335ef51172 100644 --- a/drivers/staging/vt6655/wpa2.c +++ b/drivers/staging/vt6655/wpa2.c @@ -35,8 +35,6 @@ #include "device.h" #include "wmgr.h" -/*--------------------- Static Definitions -------------------------*/ -static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ @@ -116,7 +114,7 @@ WPA2vParseRSN( unsigned char *pbyOUI; bool bUseGK = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WPA2_ParseRSN: [%d]\n", pRSN->len); + pr_debug("WPA2_ParseRSN: [%d]\n", pRSN->len); WPA2_ClearRSN(pBSSNode); @@ -135,7 +133,7 @@ WPA2vParseRSN( // information element header makes sense if ((pRSN->byElementID == WLAN_EID_RSN) && (pRSN->wVersion == 1)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal 802.11i RSN\n"); + pr_debug("Legal 802.11i RSN\n"); pbyOUI = &(pRSN->abyRSN[0]); if (!memcmp(pbyOUI, abyOUIWEP40, 4)) @@ -153,7 +151,7 @@ WPA2vParseRSN( // any vendor checks here pBSSNode->byCSSGK = WLAN_11i_CSS_UNKNOWN; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "802.11i CSS: %X\n", pBSSNode->byCSSGK); + pr_debug("802.11i CSS: %X\n", pBSSNode->byCSSGK); if (pRSN->len == 6) { pBSSNode->bWPA2Valid = true; @@ -186,7 +184,8 @@ WPA2vParseRSN( pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN; } pbyOUI += 4; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]); + pr_debug("abyCSSPK[%d]: %X\n", + j-1, pBSSNode->abyCSSPK[j-1]); } else break; } //for @@ -206,7 +205,7 @@ WPA2vParseRSN( return; } pBSSNode->wCSSPKCount = (unsigned short)j; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wCSSPKCount: %d\n", pBSSNode->wCSSPKCount); + pr_debug("wCSSPKCount: %d\n", pBSSNode->wCSSPKCount); } m = *((unsigned short *)&(pRSN->abyRSN[4])); @@ -224,12 +223,15 @@ WPA2vParseRSN( else // any vendor checks here pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_UNKNOWN; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyAKMSSAuthType[%d]: %X\n", j-1, pBSSNode->abyAKMSSAuthType[j-1]); + pr_debug("abyAKMSSAuthType[%d]: %X\n", + j-1, + pBSSNode->abyAKMSSAuthType[j-1]); } else break; } pBSSNode->wAKMSSAuthCount = (unsigned short)j; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount); + pr_debug("wAKMSSAuthCount: %d\n", + pBSSNode->wAKMSSAuthCount); n = *((unsigned short *)&(pRSN->abyRSN[6+4*m])); if (pRSN->len >= 12 + 4 * m + 4 * n) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSSCnt(2)+AKMSS(4*n)+Cap(2) diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index 5f454ca2a3bc..dab1e8078652 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c @@ -50,9 +50,6 @@ static const int frequency_list[] = { }; /*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; - /*--------------------- Static Functions --------------------------*/ /*--------------------- Export Variables --------------------------*/ @@ -83,13 +80,13 @@ static void wpadev_setup(struct net_device *dev) * */ -static int wpa_init_wpadev(PSDevice pDevice) +static int wpa_init_wpadev(struct vnt_private *pDevice) { - PSDevice wpadev_priv; + struct vnt_private *wpadev_priv; struct net_device *dev = pDevice->dev; int ret = 0; - pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", + pDevice->wpadev = alloc_netdev(sizeof(*wpadev_priv), "vntwpa", NET_NAME_UNKNOWN, wpadev_setup); if (pDevice->wpadev == NULL) return -ENOMEM; @@ -103,8 +100,7 @@ static int wpa_init_wpadev(PSDevice pDevice) pDevice->wpadev->mem_end = dev->mem_end; ret = register_netdev(pDevice->wpadev); if (ret) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdev(WPA) failed!\n", - dev->name); + pr_debug("%s: register_netdev(WPA) failed!\n", dev->name); free_netdev(pDevice->wpadev); return -1; } @@ -115,8 +111,8 @@ static int wpa_init_wpadev(PSDevice pDevice) return -ENOMEM; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdev %s for WPA management\n", - dev->name, pDevice->wpadev->name); + pr_debug("%s: Registered netdev %s for WPA management\n", + dev->name, pDevice->wpadev->name); return 0; } @@ -134,7 +130,7 @@ static int wpa_init_wpadev(PSDevice pDevice) * */ -static int wpa_release_wpadev(PSDevice pDevice) +static int wpa_release_wpadev(struct vnt_private *pDevice) { if (pDevice->skb) { dev_kfree_skb(pDevice->skb); @@ -142,8 +138,8 @@ static int wpa_release_wpadev(PSDevice pDevice) } if (pDevice->wpadev) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", - pDevice->dev->name, pDevice->wpadev->name); + pr_debug("%s: Netdevice %s unregistered\n", + pDevice->dev->name, pDevice->wpadev->name); unregister_netdev(pDevice->wpadev); free_netdev(pDevice->wpadev); pDevice->wpadev = NULL; @@ -166,7 +162,7 @@ static int wpa_release_wpadev(PSDevice pDevice) * */ -int wpa_set_wpadev(PSDevice pDevice, int val) +int wpa_set_wpadev(struct vnt_private *pDevice, int val) { if (val) return wpa_init_wpadev(pDevice); @@ -188,7 +184,7 @@ int wpa_set_wpadev(PSDevice pDevice, int val) * */ -int wpa_set_keys(PSDevice pDevice, void *ctx, +int wpa_set_keys(struct vnt_private *pDevice, void *ctx, bool fcpfkernel) __must_hold(&pDevice->lock) { struct viawget_wpa_param *param = ctx; @@ -196,7 +192,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, 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; @@ -206,7 +202,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, param->u.wpa_key.seq_len > MAX_KEY_LEN) return -EINVAL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d\n", param->u.wpa_key.alg_name); + pr_debug("param->u.wpa_key.alg_name = %d\n", param->u.wpa_key.alg_name); if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pDevice->bEncryptionEnable = false; @@ -224,7 +220,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, } else { spin_unlock_irq(&pDevice->lock); if (param->u.wpa_key.key && - copy_from_user(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len)) { + copy_from_user(&abyKey[0], + (void __user *)param->u.wpa_key.key, + param->u.wpa_key.key_len)) { spin_lock_irq(&pDevice->lock); return -EINVAL; } @@ -262,7 +260,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, } else { spin_unlock_irq(&pDevice->lock); if (param->u.wpa_key.seq && - copy_from_user(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len)) { + copy_from_user(&abySeq[0], + (void __user *)param->u.wpa_key.seq, + param->u.wpa_key.seq_len)) { spin_lock_irq(&pDevice->lock); return -EINVAL; } @@ -272,15 +272,15 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, 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 (param->u.wpa_key.key_index >= MAX_GROUP_KEY) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return dwKeyIndex > 3\n"); + pr_debug("return dwKeyIndex > 3\n"); return -EINVAL; } @@ -300,7 +300,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, else byKeyDecMode = KEY_CTL_WEP; - // Fix HCT test that set 256 bits KEY and Ndis802_11Encryption3Enabled + /* Fix HCT test that set 256 bits KEY and Ndis802_11Encryption3Enabled */ if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { if (param->u.wpa_key.key_len == MAX_KEY_LEN) byKeyDecMode = KEY_CTL_TKIP; @@ -315,29 +315,29 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, byKeyDecMode = KEY_CTL_WEP; } - // Check TKIP key length + /* Check TKIP key length */ if ((byKeyDecMode == KEY_CTL_TKIP) && (param->u.wpa_key.key_len != MAX_KEY_LEN)) { - // TKIP Key must be 256 bits - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return- TKIP Key must be 256 bits!\n"); + /* TKIP Key must be 256 bits */ + pr_debug("return- TKIP Key must be 256 bits!\n"); return -EINVAL; } - // Check AES key length + /* Check AES key length */ if ((byKeyDecMode == KEY_CTL_CCMP) && (param->u.wpa_key.key_len != AES_KEY_LEN)) { - // AES Key must be 128 bits + /* AES Key must be 128 bits */ return -EINVAL; } - // spin_lock_irq(&pDevice->lock); + /* spin_lock_irq(&pDevice->lock); */ if (is_broadcast_ether_addr(¶m->addr[0]) || (param->addr == NULL)) { - // If is_broadcast_ether_addr, set the key as every key entry's group key. - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n"); + /* If is_broadcast_ether_addr, set the key as every key entry's group key. */ + pr_debug("Groupe Key Assign\n"); if (KeybSetAllGroupKey(&(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, - (PQWORD) &(KeyRSC), + (u64 *) &KeyRSC, (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, @@ -345,27 +345,27 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, KeybSetDefaultKey(&(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, - (PQWORD) &(KeyRSC), + (u64 *) &KeyRSC, (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, pDevice->byLocalID)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n"); + pr_debug("GROUP Key Assign\n"); } else { return -EINVAL; } } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Assign.\n"); - // BSSID not 0xffffffffffff - // Pairwise Key can't be WEP + pr_debug("Pairwise Key Assign\n"); + /* BSSID not 0xffffffffffff */ + /* Pairwise Key can't be WEP */ if (byKeyDecMode == KEY_CTL_WEP) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key can't be WEP\n"); + pr_debug("Pairwise Key can't be WEP\n"); return -EINVAL; } - dwKeyIndex |= (1 << 30); // set pairwise key + dwKeyIndex |= (1 << 30); /* set pairwise key */ if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) return -EINVAL; @@ -373,18 +373,18 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, ¶m->addr[0], dwKeyIndex, param->u.wpa_key.key_len, - (PQWORD) &(KeyRSC), + (u64 *) &KeyRSC, (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, pDevice->byLocalID)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); + pr_debug("Pairwise Key Set\n"); } else { - // Key Table Full + /* Key Table Full */ return -EINVAL; } - } // BSSID not 0xffffffffffff + } /* BSSID not 0xffffffffffff */ if ((ret == 0) && ((param->u.wpa_key.set_tx) != 0)) { pDevice->byKeyIndex = (unsigned char)param->u.wpa_key.key_index; pDevice->bTransmitKey = true; @@ -408,7 +408,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, * */ -static int wpa_set_wpa(PSDevice pDevice, +static int wpa_set_wpa(struct vnt_private *pDevice, struct viawget_wpa_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; @@ -433,7 +433,7 @@ static int wpa_set_wpa(PSDevice pDevice, * */ -static int wpa_set_disassociate(PSDevice pDevice, +static int wpa_set_disassociate(struct vnt_private *pDevice, struct viawget_wpa_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; @@ -462,7 +462,7 @@ static int wpa_set_disassociate(PSDevice pDevice, * */ -static int wpa_set_scan(PSDevice pDevice, +static int wpa_set_scan(struct vnt_private *pDevice, struct viawget_wpa_param *param) { spin_lock_irq(&pDevice->lock); @@ -487,7 +487,7 @@ static int wpa_set_scan(PSDevice pDevice, * */ -static int wpa_get_bssid(PSDevice pDevice, +static int wpa_get_bssid(struct vnt_private *pDevice, struct viawget_wpa_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; @@ -511,7 +511,7 @@ static int wpa_get_bssid(PSDevice pDevice, * */ -static int wpa_get_ssid(PSDevice pDevice, +static int wpa_get_ssid(struct vnt_private *pDevice, struct viawget_wpa_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; @@ -539,7 +539,7 @@ static int wpa_get_ssid(PSDevice pDevice, * */ -static int wpa_get_scan(PSDevice pDevice, +static int wpa_get_scan(struct vnt_private *pDevice, struct viawget_wpa_param *param) { struct viawget_scan_result *scan_buf; @@ -636,7 +636,7 @@ static int wpa_get_scan(PSDevice pDevice, ret = -EFAULT; param->u.scan_results.scan_count = count; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " param->u.scan_results.scan_count = %d\n", count); + pr_debug(" param->u.scan_results.scan_count = %d\n", count); kfree(pBuf); return ret; @@ -656,7 +656,7 @@ static int wpa_get_scan(PSDevice pDevice, * */ -static int wpa_set_associate(PSDevice pDevice, +static int wpa_set_associate(struct vnt_private *pDevice, struct viawget_wpa_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; @@ -665,13 +665,15 @@ static int wpa_set_associate(PSDevice pDevice, unsigned char abyWPAIE[64]; bool bWepEnabled = false; - // set key type & algorithm - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); + /* set key type & algorithm */ + pr_debug("pairwise_suite = %d\n", + param->u.wpa_associate.pairwise_suite); + pr_debug("group_suite = %d\n", param->u.wpa_associate.group_suite); + pr_debug("key_mgmt_suite = %d\n", + param->u.wpa_associate.key_mgmt_suite); + pr_debug("auth_alg = %d\n", param->u.wpa_associate.auth_alg); + pr_debug("mode = %d\n", param->u.wpa_associate.mode); + pr_debug("wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); if (param->u.wpa_associate.wpa_ie_len) { if (!param->u.wpa_associate.wpa_ie) @@ -686,13 +688,13 @@ static int wpa_set_associate(PSDevice pDevice, pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; else pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; - // set ssid + /* set ssid */ memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSID->byElementID = WLAN_EID_SSID; pItemSSID->len = param->u.wpa_associate.ssid_len; memcpy(pItemSSID->abySSID, param->u.wpa_associate.ssid, pItemSSID->len); - // set bssid + /* set bssid */ if (memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0) memcpy(pMgmt->abyDesireBSSID, param->u.wpa_associate.bssid, 6); else @@ -800,7 +802,7 @@ static int wpa_set_associate(PSDevice pDevice, * */ -int wpa_ioctl(PSDevice pDevice, struct iw_point *p) +int wpa_ioctl(struct vnt_private *pDevice, struct iw_point *p) { struct viawget_wpa_param *param; int ret = 0; @@ -822,60 +824,60 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) switch (param->cmd) { case VIAWGET_SET_WPA: ret = wpa_set_wpa(pDevice, param); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA\n"); + pr_debug("VIAWGET_SET_WPA\n"); break; case VIAWGET_SET_KEY: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY\n"); + pr_debug("VIAWGET_SET_KEY\n"); spin_lock_irq(&pDevice->lock); ret = wpa_set_keys(pDevice, param, false); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_SET_SCAN: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN\n"); + pr_debug("VIAWGET_SET_SCAN\n"); ret = wpa_set_scan(pDevice, param); break; case VIAWGET_GET_SCAN: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SCAN\n"); + pr_debug("VIAWGET_GET_SCAN\n"); ret = wpa_get_scan(pDevice, param); wpa_ioctl = 1; break; case VIAWGET_GET_SSID: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID\n"); + pr_debug("VIAWGET_GET_SSID\n"); ret = wpa_get_ssid(pDevice, param); wpa_ioctl = 1; break; case VIAWGET_GET_BSSID: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID\n"); + pr_debug("VIAWGET_GET_BSSID\n"); ret = wpa_get_bssid(pDevice, param); wpa_ioctl = 1; break; case VIAWGET_SET_ASSOCIATE: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE\n"); + pr_debug("VIAWGET_SET_ASSOCIATE\n"); ret = wpa_set_associate(pDevice, param); break; case VIAWGET_SET_DISASSOCIATE: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE\n"); + pr_debug("VIAWGET_SET_DISASSOCIATE\n"); ret = wpa_set_disassociate(pDevice, param); break; case VIAWGET_SET_DROP_UNENCRYPT: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT\n"); + pr_debug("VIAWGET_SET_DROP_UNENCRYPT\n"); break; case VIAWGET_SET_DEAUTHENTICATE: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE\n"); + pr_debug("VIAWGET_SET_DEAUTHENTICATE\n"); break; default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ioctl: unknown cmd=%d\n", - param->cmd); + pr_debug("wpa_ioctl: unknown cmd=%d\n", + param->cmd); ret = -EOPNOTSUPP; goto out; } diff --git a/drivers/staging/vt6655/wpactl.h b/drivers/staging/vt6655/wpactl.h index f7638baf340d..c1b4a7292061 100644 --- a/drivers/staging/vt6655/wpactl.h +++ b/drivers/staging/vt6655/wpactl.h @@ -57,8 +57,8 @@ enum wpa_key_mgmt { KEY_MGMT_802_1X, KEY_MGMT_CCKM, KEY_MGMT_PSK, KEY_MGMT_NONE, /*--------------------- Export Functions --------------------------*/ -int wpa_set_wpadev(PSDevice pDevice, int val); -int wpa_ioctl(PSDevice pDevice, struct iw_point *p); -int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel); +int wpa_set_wpadev(struct vnt_private *, int val); +int wpa_ioctl(struct vnt_private *, struct iw_point *p); +int wpa_set_keys(struct vnt_private *, void *ctx, bool fcpfkernel); #endif // __WPACL_H__ diff --git a/drivers/staging/vt6655/wroute.c b/drivers/staging/vt6655/wroute.c index 4da3fef139dc..d1171fa3446e 100644 --- a/drivers/staging/vt6655/wroute.c +++ b/drivers/staging/vt6655/wroute.c @@ -42,8 +42,6 @@ /*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ -static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ /*--------------------- Export Variables --------------------------*/ @@ -62,7 +60,7 @@ static int msglevel = MSG_LEVEL_INFO; * Return Value: true if packet duplicate; otherwise false * */ -bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, +bool ROUTEbRelay(struct vnt_private *pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex) { PSMgmtObject pMgmt = pDevice->pMgmt; @@ -78,8 +76,7 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned char *pbyBSSID; if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 0) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Relay can't allocate TD1..\n"); + pr_debug("Relay can't allocate TD1..\n"); return false; } @@ -102,11 +99,10 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { pTransmitKey = NULL; - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_DEBUG "KEY is NULL. [%d]\n", - pDevice->pMgmt->eCurrMode); + pr_debug("KEY is NULL. [%d]\n", + pDevice->pMgmt->eCurrMode); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get GTK.\n"); + pr_debug("Get GTK\n"); } } diff --git a/drivers/staging/vt6655/wroute.h b/drivers/staging/vt6655/wroute.h index 3abc1d36f89d..e59eec955cac 100644 --- a/drivers/staging/vt6655/wroute.h +++ b/drivers/staging/vt6655/wroute.h @@ -39,6 +39,7 @@ /*--------------------- Export Functions --------------------------*/ -bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex); +bool ROUTEbRelay(struct vnt_private *pDevice, unsigned char *pbySkbData, + unsigned int uDataLen, unsigned int uNodeIndex); #endif /* __WROUTE_H__ */ |