diff options
Diffstat (limited to 'drivers/staging/vt6655')
54 files changed, 1162 insertions, 1822 deletions
diff --git a/drivers/staging/vt6655/80211hdr.h b/drivers/staging/vt6655/80211hdr.h index ba155cdded2f..e05d13544ea2 100644 --- a/drivers/staging/vt6655/80211hdr.h +++ b/drivers/staging/vt6655/80211hdr.h @@ -33,7 +33,6 @@ #include "ttype.h" -/*--------------------- Export Definitions -------------------------*/ /* bit type */ #define BIT0 0x00000001 #define BIT1 0x00000002 @@ -315,10 +314,4 @@ typedef union tagUWLAN_80211HDR { WLAN_80211HDR_A4 sA4; } UWLAN_80211HDR, *PUWLAN_80211HDR; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - #endif /* __80211HDR_H__ */ diff --git a/drivers/staging/vt6655/80211mgr.c b/drivers/staging/vt6655/80211mgr.c index 9aa2e46c4a5d..96b0d61623e4 100644 --- a/drivers/staging/vt6655/80211mgr.c +++ b/drivers/staging/vt6655/80211mgr.c @@ -102,8 +102,6 @@ vMgrEncodeBeacon( WLAN_BEACON_OFF_CAPINFO); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID; - - return; } /*+ @@ -228,8 +226,6 @@ vMgrDecodeBeacon( } pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); } - - return; } /*+ @@ -250,8 +246,6 @@ vMgrEncodeIBSSATIM( { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; pFrame->len = WLAN_HDR_ADDR3_LEN; - - return; } /*+ @@ -271,8 +265,6 @@ vMgrDecodeIBSSATIM( ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - - return; } /*+ @@ -299,8 +291,6 @@ vMgrEncodeDisassociation( WLAN_DISASSOC_OFF_REASON); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON + sizeof(*(pFrame->pwReason)); - - return; } /*+ @@ -325,8 +315,6 @@ vMgrDecodeDisassociation( pFrame->pwReason = (unsigned short *) (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_DISASSOC_OFF_REASON); - - return; } /*+ @@ -355,7 +343,6 @@ vMgrEncodeAssocRequest( WLAN_ASSOCREQ_OFF_LISTEN_INT); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCREQ_OFF_LISTEN_INT + sizeof(*(pFrame->pwListenInterval)); - return; } /*+ @@ -426,7 +413,6 @@ vMgrDecodeAssocRequest( } pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); } - return; } /*+ @@ -459,8 +445,6 @@ vMgrEncodeAssocResponse( WLAN_ASSOCRESP_OFF_AID); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid)); - - return; } /*+ @@ -511,7 +495,6 @@ vMgrDecodeAssocResponse( } else { pFrame->pExtSuppRates = NULL; } - return; } /*+ @@ -544,8 +527,6 @@ vMgrEncodeReassocRequest( WLAN_REASSOCREQ_OFF_CURR_AP); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP + sizeof(*(pFrame->pAddrCurrAP)); - - return; } /*+ @@ -565,6 +546,7 @@ vMgrDecodeReassocRequest( ) { PWLAN_IE pItem; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ @@ -619,7 +601,6 @@ vMgrDecodeReassocRequest( } pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); } - return; } /*+ @@ -640,7 +621,6 @@ vMgrEncodeProbeRequest( { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; pFrame->len = WLAN_HDR_ADDR3_LEN; - return; } /*+ @@ -694,7 +674,6 @@ vMgrDecodeProbeRequest( pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); } - return; } /*+ @@ -728,8 +707,6 @@ vMgrEncodeProbeResponse( pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO + sizeof(*(pFrame->pwCapInfo)); - - return; } /*+ @@ -850,7 +827,6 @@ vMgrDecodeProbeResponse( pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); } - return; } /*+ @@ -883,8 +859,6 @@ vMgrEncodeAuthen( WLAN_AUTHEN_OFF_STATUS); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS + sizeof(*(pFrame->pwStatus)); - - return; } /*+ @@ -925,8 +899,6 @@ vMgrDecodeAuthen( if (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len) && pItem->byElementID == WLAN_EID_CHALLENGE) pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem; - - return; } /*+ @@ -953,8 +925,6 @@ vMgrEncodeDeauthen( WLAN_DEAUTHEN_OFF_REASON); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON + sizeof(*(pFrame->pwReason)); - - return; } /*+ @@ -979,8 +949,6 @@ vMgrDecodeDeauthen( pFrame->pwReason = (unsigned short *) (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_DEAUTHEN_OFF_REASON); - - return; } /*+ @@ -1014,8 +982,6 @@ vMgrEncodeReassocResponse( pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid)); - - return; } /*+ @@ -1061,5 +1027,4 @@ vMgrDecodeReassocResponse( (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) { pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; } - return; } diff --git a/drivers/staging/vt6655/80211mgr.h b/drivers/staging/vt6655/80211mgr.h index 065238beb4f4..8b126bbd9fa5 100644 --- a/drivers/staging/vt6655/80211mgr.h +++ b/drivers/staging/vt6655/80211mgr.h @@ -34,8 +34,6 @@ #include "ttype.h" #include "80211hdr.h" -/*--------------------- Export Definitions -------------------------*/ - #define WLAN_MIN_ARRAY 1 /* Information Element ID value */ @@ -202,12 +200,6 @@ #define MEASURE_MODE_INCAPABLE 0x02 #define MEASURE_MODE_REFUSED 0x04 -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - /* Information Element Types */ #pragma pack(1) @@ -472,14 +464,11 @@ typedef struct tagWLAN_FR_BEACON { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - /* fixed fields */ PQWORD pqwTimestamp; unsigned short *pwBeaconInterval; unsigned short *pwCapInfo; - /*-- info elements ----------*/ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; -/* PWLAN_IE_FH_PARMS pFHParms; */ PWLAN_IE_DS_PARMS pDSParms; PWLAN_IE_CF_PARMS pCFParms; PWLAN_IE_TIM pTIM; @@ -501,10 +490,6 @@ typedef struct tagWLAN_FR_IBSSATIM { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - - /* fixed fields */ - /* info elements */ - /* this frame type has a null body */ } WLAN_FR_IBSSATIM, *PWLAN_FR_IBSSATIM; /* Disassociation */ @@ -513,9 +498,7 @@ typedef struct tagWLAN_FR_DISASSOC { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ unsigned short *pwReason; - /*-- info elements ----------*/ } WLAN_FR_DISASSOC, *PWLAN_FR_DISASSOC; /* Association Request */ @@ -524,10 +507,8 @@ typedef struct tagWLAN_FR_ASSOCREQ { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ unsigned short *pwCapInfo; unsigned short *pwListenInterval; - /*-- info elements ----------*/ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_RSN pRSN; @@ -543,11 +524,9 @@ typedef struct tagWLAN_FR_ASSOCRESP { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ unsigned short *pwCapInfo; unsigned short *pwStatus; unsigned short *pwAid; - /*-- info elements ----------*/ PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_SUPP_RATES pExtSuppRates; } WLAN_FR_ASSOCRESP, *PWLAN_FR_ASSOCRESP; @@ -558,13 +537,9 @@ typedef struct tagWLAN_FR_REASSOCREQ { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - - /*-- fixed fields -----------*/ unsigned short *pwCapInfo; unsigned short *pwListenInterval; PIEEE_ADDR pAddrCurrAP; - - /*-- info elements ----------*/ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_RSN pRSN; @@ -578,11 +553,9 @@ typedef struct tagWLAN_FR_REASSOCRESP { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ unsigned short *pwCapInfo; unsigned short *pwStatus; unsigned short *pwAid; - /*-- info elements ----------*/ PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_SUPP_RATES pExtSuppRates; } WLAN_FR_REASSOCRESP, *PWLAN_FR_REASSOCRESP; @@ -593,8 +566,6 @@ typedef struct tagWLAN_FR_PROBEREQ { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ - /*-- info elements ----------*/ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_SUPP_RATES pExtSuppRates; @@ -606,11 +577,9 @@ typedef struct tagWLAN_FR_PROBERESP { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ PQWORD pqwTimestamp; unsigned short *pwBeaconInterval; unsigned short *pwCapInfo; - /*-- info elements ----------*/ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_DS_PARMS pDSParms; @@ -633,11 +602,9 @@ typedef struct tagWLAN_FR_AUTHEN { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ unsigned short *pwAuthAlgorithm; unsigned short *pwAuthSequence; unsigned short *pwStatus; - /*-- info elements ----------*/ PWLAN_IE_CHALLENGE pChallenge; } WLAN_FR_AUTHEN, *PWLAN_FR_AUTHEN; @@ -647,14 +614,9 @@ typedef struct tagWLAN_FR_DEAUTHEN { unsigned int len; unsigned char *pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ unsigned short *pwReason; - - /*-- info elements ----------*/ } WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN; -/*--------------------- Export Functions --------------------------*/ - void vMgrEncodeBeacon( PWLAN_FR_BEACON pFrame diff --git a/drivers/staging/vt6655/IEEE11h.c b/drivers/staging/vt6655/IEEE11h.c index 6cfad1c04026..180a27cc74d7 100644 --- a/drivers/staging/vt6655/IEEE11h.c +++ b/drivers/staging/vt6655/IEEE11h.c @@ -41,7 +41,6 @@ #include "channel.h" /*--------------------- Static Definitions -------------------------*/ -static int msglevel = MSG_LEVEL_INFO; #pragma pack(1) @@ -98,185 +97,11 @@ typedef struct _WLAN_FRAME_TPCREP { /*--------------------- Static Variables --------------------------*/ /*--------------------- Static Functions --------------------------*/ -static bool s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq, - unsigned int uLength) -{ - size_t uNumOfEIDs = 0; - bool bResult = true; - - if (uLength <= WLAN_A3FR_MAXLEN) - memcpy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength); - uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ, - sMSRReqEIDs))/ - (sizeof(WLAN_IE_MEASURE_REQ))); - pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP) - (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]); - pMgmt->uLengthOfRepEIDs = 0; - bResult = CARDbStartMeasure(pMgmt->pAdapter, - ((PWLAN_FRAME_MSRREQ) - (pMgmt->abyCurrentMSRReq))->sMSRReqEIDs, - uNumOfEIDs -); - return bResult; -} - -static bool s_bRxTPCReq(PSMgmtObject pMgmt, - PWLAN_FRAME_TPCREQ pTPCReq, - unsigned char byRate, - unsigned char byRSSI) -{ - PWLAN_FRAME_TPCREP pFrame; - PSTxMgmtPacket pTxPacket = NULL; - - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + - sizeof(STxMgmtPacket)); - - pFrame = (PWLAN_FRAME_TPCREP)((unsigned char *)pTxPacket + - sizeof(STxMgmtPacket)); - - pFrame->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION) -); - - memcpy(pFrame->Header.abyAddr1, - pTPCReq->Header.abyAddr2, - WLAN_ADDR_LEN); - memcpy(pFrame->Header.abyAddr2, - CARDpGetCurrentAddress(pMgmt->pAdapter), - WLAN_ADDR_LEN); - memcpy(pFrame->Header.abyAddr3, - pMgmt->abyCurrBSSID, - WLAN_BSSID_LEN); - - pFrame->byCategory = 0; - pFrame->byAction = 3; - pFrame->byDialogToken = ((PWLAN_FRAME_MSRREQ) - (pMgmt->abyCurrentMSRReq))->byDialogToken; - - pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP; - pFrame->sTPCRepEIDs.len = 2; - pFrame->sTPCRepEIDs.byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter); - switch (byRate) { - case RATE_54M: - pFrame->sTPCRepEIDs.byLinkMargin = 65 - byRSSI; - break; - case RATE_48M: - pFrame->sTPCRepEIDs.byLinkMargin = 66 - byRSSI; - break; - case RATE_36M: - pFrame->sTPCRepEIDs.byLinkMargin = 70 - byRSSI; - break; - case RATE_24M: - pFrame->sTPCRepEIDs.byLinkMargin = 74 - byRSSI; - break; - case RATE_18M: - pFrame->sTPCRepEIDs.byLinkMargin = 77 - byRSSI; - break; - case RATE_12M: - pFrame->sTPCRepEIDs.byLinkMargin = 79 - byRSSI; - break; - case RATE_9M: - pFrame->sTPCRepEIDs.byLinkMargin = 81 - byRSSI; - break; - case RATE_6M: - default: - pFrame->sTPCRepEIDs.byLinkMargin = 82 - byRSSI; - break; - } - - pTxPacket->cbMPDULen = sizeof(WLAN_FRAME_TPCREP); - pTxPacket->cbPayloadLen = sizeof(WLAN_FRAME_TPCREP) - - WLAN_HDR_ADDR3_LEN; - if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING) - return false; - return true; -} /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -/*+ - * - * Description: - * Handles action management frames. - * - * Parameters: - * In: - * pMgmt - Management Object structure - * pRxPacket - Received packet - * Out: - * none - * - * Return Value: None. - * - -*/ -bool -IEEE11hbMgrRxAction(void *pMgmtHandle, void *pRxPacket) -{ - PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; - PWLAN_FRAME_ACTION pAction = NULL; - unsigned int uLength = 0; - PWLAN_IE_CH_SW pChannelSwitch = NULL; - - /* decode the frame */ - uLength = ((PSRxMgmtPacket)pRxPacket)->cbMPDULen; - if (uLength > WLAN_A3FR_MAXLEN) - return false; - - pAction = (PWLAN_FRAME_ACTION) - (((PSRxMgmtPacket)pRxPacket)->p80211Header); - - if (pAction->byCategory == 0) { - switch (pAction->byAction) { - case ACTION_MSRREQ: - return s_bRxMSRReq(pMgmt, - (PWLAN_FRAME_MSRREQ) - pAction, - uLength); - break; - case ACTION_MSRREP: - break; - case ACTION_TPCREQ: - return s_bRxTPCReq(pMgmt, - (PWLAN_FRAME_TPCREQ) pAction, - ((PSRxMgmtPacket)pRxPacket)->byRxRate, - (unsigned char) - ((PSRxMgmtPacket)pRxPacket)->uRSSI); - break; - case ACTION_TPCREP: - break; - case ACTION_CHSW: - pChannelSwitch = (PWLAN_IE_CH_SW) (pAction->abyVars); - if ((pChannelSwitch->byElementID == WLAN_EID_CH_SWITCH) - && (pChannelSwitch->len == 3)) { - /* valid element id */ - CARDbChannelSwitch(pMgmt->pAdapter, - pChannelSwitch->byMode, - get_channel_mapping(pMgmt->pAdapter, - pChannelSwitch->byChannel, - pMgmt->eCurrentPHYMode), - pChannelSwitch->byCount); - } - break; - default: - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Unknown Action = %d\n", - pAction->byAction); - break; - } - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unknown Category = %d\n", - pAction->byCategory); - pAction->byCategory |= 0x80; - - return true; - } - return true; -} - bool IEEE11hbMSRRepTx(void *pMgmtHandle) { PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; diff --git a/drivers/staging/vt6655/IEEE11h.h b/drivers/staging/vt6655/IEEE11h.h index 8819fa1563b7..551922022b19 100644 --- a/drivers/staging/vt6655/IEEE11h.h +++ b/drivers/staging/vt6655/IEEE11h.h @@ -35,16 +35,6 @@ #include "80211hdr.h" #include "80211mgr.h" -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - bool IEEE11hbMSRRepTx( void *pMgmtHandle ); diff --git a/drivers/staging/vt6655/aes_ccmp.c b/drivers/staging/vt6655/aes_ccmp.c index 4ccfe06481fc..a25e6cf844ed 100644 --- a/drivers/staging/vt6655/aes_ccmp.c +++ b/drivers/staging/vt6655/aes_ccmp.c @@ -35,6 +35,7 @@ #include "device.h" #include "80211hdr.h" +#include "aes_ccmp.h" /*--------------------- Static Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/aes_ccmp.h b/drivers/staging/vt6655/aes_ccmp.h index cc02e645aa56..fe0c506205d5 100644 --- a/drivers/staging/vt6655/aes_ccmp.h +++ b/drivers/staging/vt6655/aes_ccmp.h @@ -32,15 +32,6 @@ #include "ttype.h" -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned short wFrameSize); #endif /* __AES_H__ */ diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 6f95fb618dc3..f212b88c8cec 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -57,7 +57,7 @@ #include "rf.h" /*--------------------- Static Definitions -------------------------*/ -//static int msglevel =MSG_LEVEL_DEBUG; +/* static int msglevel =MSG_LEVEL_DEBUG; */ static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Classes ----------------------------*/ @@ -75,7 +75,7 @@ static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Variables --------------------------*/ #define CB_VT3253_INIT_FOR_RFMD 446 -unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = { +static unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = { {0x00, 0x30}, {0x01, 0x00}, {0x02, 0x00}, @@ -525,7 +525,7 @@ unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = { }; #define CB_VT3253B0_INIT_FOR_RFMD 256 -unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = { +static unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = { {0x00, 0x31}, {0x01, 0x00}, {0x02, 0x00}, @@ -785,8 +785,8 @@ unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = { }; #define CB_VT3253B0_AGC_FOR_RFMD2959 195 -// For RFMD2959 -unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = { +/* For RFMD2959 */ +static unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = { {0xF0, 0x00}, {0xF1, 0x3E}, {0xF0, 0x80}, @@ -985,8 +985,8 @@ unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = { }; #define CB_VT3253B0_INIT_FOR_AIROHA2230 256 -// For AIROHA -unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = { +/* For AIROHA */ +static unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = { {0x00, 0x31}, {0x01, 0x00}, {0x02, 0x00}, @@ -1095,7 +1095,7 @@ unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = { {0x69, 0x00}, {0x6a, 0x00}, {0x6b, 0x00}, - {0x6c, 0x00}, //RobertYu:20050125, request by JJSue + {0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */ {0x6d, 0x03}, {0x6e, 0x01}, {0x6f, 0x00}, @@ -1246,8 +1246,8 @@ unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = { }; #define CB_VT3253B0_INIT_FOR_UW2451 256 -//For UW2451 -unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = { +/* For UW2451 */ +static unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = { {0x00, 0x31}, {0x01, 0x00}, {0x02, 0x00}, @@ -1356,7 +1356,7 @@ unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = { {0x69, 0x00}, {0x6a, 0x00}, {0x6b, 0x00}, - {0x6c, 0x00}, //RobertYu:20050125, request by JJSue + {0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */ {0x6d, 0x03}, {0x6e, 0x01}, {0x6f, 0x00}, @@ -1507,8 +1507,8 @@ unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = { }; #define CB_VT3253B0_AGC 193 -// For AIROHA -unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = { +/* For AIROHA */ +static unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = { {0xF0, 0x00}, {0xF1, 0x00}, {0xF0, 0x80}, @@ -1704,7 +1704,7 @@ unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = { {0xF0, 0x00}, }; -const unsigned short awcFrameTime[MAX_RATE] = +static const unsigned short awcFrameTime[MAX_RATE] = {10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216}; /*--------------------- Static Functions --------------------------*/ @@ -1783,29 +1783,29 @@ BBuGetFrameTime( uRate = (unsigned int)awcFrameTime[uRateIdx]; - if (uRateIdx <= 3) { //CCK mode - if (byPreambleType == 1) //Short + if (uRateIdx <= 3) { /* CCK mode */ + if (byPreambleType == 1) /* Short */ uPreamble = 96; else uPreamble = 192; - uFrameTime = (cbFrameLength * 80) / uRate; //????? + uFrameTime = (cbFrameLength * 80) / uRate; /* ????? */ uTmp = (uFrameTime * uRate) / 80; if (cbFrameLength != uTmp) uFrameTime++; return uPreamble + uFrameTime; } else { - uFrameTime = (cbFrameLength * 8 + 22) / uRate; //???????? + uFrameTime = (cbFrameLength * 8 + 22) / uRate; /* ???????? */ uTmp = ((uFrameTime * uRate) - 22) / 8; if (cbFrameLength != uTmp) uFrameTime++; - uFrameTime = uFrameTime * 4; //??????? + uFrameTime = uFrameTime * 4; /* ??????? */ if (byPktType != PK_TYPE_11A) - uFrameTime += 6; //?????? + uFrameTime += 6; /* ?????? */ - return 20 + uFrameTime; //?????? + return 20 + uFrameTime; /* ?????? */ } } @@ -1856,7 +1856,7 @@ BBvCalculateParameter( cbUsCount = cbBitCount / 2; if (byPreambleType == 1) *pbyPhySgn = 0x09; - else // long preamble + else /* long preamble */ *pbyPhySgn = 0x01; break; @@ -1869,7 +1869,7 @@ BBvCalculateParameter( cbUsCount++; if (byPreambleType == 1) *pbyPhySgn = 0x0a; - else // long preamble + else /* long preamble */ *pbyPhySgn = 0x02; break; @@ -1886,79 +1886,79 @@ BBvCalculateParameter( } if (byPreambleType == 1) *pbyPhySgn = 0x0b; - else // long preamble + else /* long preamble */ *pbyPhySgn = 0x03; break; case RATE_6M: - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - *pbyPhySgn = 0x9B; //1001 1011 - } else {//11g, 2.4GHZ - *pbyPhySgn = 0x8B; //1000 1011 + if (byPacketType == PK_TYPE_11A) { /*11a, 5GHZ */ + *pbyPhySgn = 0x9B; /* 1001 1011 */ + } else {/* 11g, 2.4GHZ */ + *pbyPhySgn = 0x8B; /* 1000 1011 */ } break; case RATE_9M: - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - *pbyPhySgn = 0x9F; //1001 1111 - } else {//11g, 2.4GHZ - *pbyPhySgn = 0x8F; //1000 1111 + if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ + *pbyPhySgn = 0x9F; /* 1001 1111 */ + } else {/* 11g, 2.4GHZ */ + *pbyPhySgn = 0x8F; /* 1000 1111 */ } break; case RATE_12M: - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - *pbyPhySgn = 0x9A; //1001 1010 - } else {//11g, 2.4GHZ - *pbyPhySgn = 0x8A; //1000 1010 + if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ + *pbyPhySgn = 0x9A; /* 1001 1010 */ + } else {/* 11g, 2.4GHZ */ + *pbyPhySgn = 0x8A; /* 1000 1010 */ } break; case RATE_18M: - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - *pbyPhySgn = 0x9E; //1001 1110 - } else {//11g, 2.4GHZ - *pbyPhySgn = 0x8E; //1000 1110 + if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ + *pbyPhySgn = 0x9E; /* 1001 1110 */ + } else {/* 11g, 2.4GHZ */ + *pbyPhySgn = 0x8E; /* 1000 1110 */ } break; case RATE_24M: - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - *pbyPhySgn = 0x99; //1001 1001 - } else {//11g, 2.4GHZ - *pbyPhySgn = 0x89; //1000 1001 + if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ + *pbyPhySgn = 0x99; /* 1001 1001 */ + } else {/* 11g, 2.4GHZ */ + *pbyPhySgn = 0x89; /* 1000 1001 */ } break; case RATE_36M: - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - *pbyPhySgn = 0x9D; //1001 1101 - } else {//11g, 2.4GHZ - *pbyPhySgn = 0x8D; //1000 1101 + if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ + *pbyPhySgn = 0x9D; /* 1001 1101 */ + } else {/* 11g, 2.4GHZ */ + *pbyPhySgn = 0x8D; /* 1000 1101 */ } break; case RATE_48M: - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - *pbyPhySgn = 0x98; //1001 1000 - } else {//11g, 2.4GHZ - *pbyPhySgn = 0x88; //1000 1000 + if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ + *pbyPhySgn = 0x98; /* 1001 1000 */ + } else {/* 11g, 2.4GHZ */ + *pbyPhySgn = 0x88; /* 1000 1000 */ } break; case RATE_54M: - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - *pbyPhySgn = 0x9C; //1001 1100 - } else {//11g, 2.4GHZ - *pbyPhySgn = 0x8C; //1000 1100 + if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ + *pbyPhySgn = 0x9C; /* 1001 1100 */ + } else {/* 11g, 2.4GHZ */ + *pbyPhySgn = 0x8C; /* 1000 1100 */ } break; default: - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - *pbyPhySgn = 0x9C; //1001 1100 - } else {//11g, 2.4GHZ - *pbyPhySgn = 0x8C; //1000 1100 + if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */ + *pbyPhySgn = 0x9C; /* 1001 1100 */ + } else {/* 11g, 2.4GHZ */ + *pbyPhySgn = 0x8C; /* 1000 1100 */ } break; } @@ -1987,24 +1987,24 @@ BBvCalculateParameter( * Return Value: true if succeeded; false if failed. * */ -bool BBbReadEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char *pbyData) +bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData) { unsigned short ww; unsigned char byValue; - // BB reg offset + /* BB reg offset */ VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr); - // turn on REGR + /* turn on REGR */ MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGR); - // W_MAX_TIMEOUT is the timeout period + /* W_MAX_TIMEOUT is the timeout period */ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue); if (byValue & BBREGCTL_DONE) break; } - // get BB data + /* get BB data */ VNSvInPortB(dwIoBase + MAC_REG_BBREGDATA, pbyData); if (ww == W_MAX_TIMEOUT) { @@ -2029,19 +2029,19 @@ bool BBbReadEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned ch * Return Value: true if succeeded; false if failed. * */ -bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byData) +bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData) { unsigned short ww; unsigned char byValue; - // BB reg offset + /* BB reg offset */ VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr); - // set BB data + /* set BB data */ VNSvOutPortB(dwIoBase + MAC_REG_BBREGDATA, byData); - // turn on BBREGCTL_REGW + /* turn on BBREGCTL_REGW */ MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGW); - // W_MAX_TIMEOUT is the timeout period + /* W_MAX_TIMEOUT is the timeout period */ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue); if (byValue & BBREGCTL_DONE) @@ -2070,7 +2070,7 @@ bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned c * Return Value: true if all TestBits are set; false otherwise. * */ -bool BBbIsRegBitsOn(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits) +bool BBbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits) { unsigned char byOrgData; @@ -2092,7 +2092,7 @@ bool BBbIsRegBitsOn(unsigned long dwIoBase, unsigned char byBBAddr, unsigned cha * Return Value: true if all TestBits are clear; false otherwise. * */ -bool BBbIsRegBitsOff(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits) +bool BBbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits) { unsigned char byOrgData; @@ -2119,7 +2119,7 @@ bool BBbVT3253Init(PSDevice pDevice) { bool bResult = true; int ii; - unsigned long dwIoBase = pDevice->PortOffset; + void __iomem *dwIoBase = pDevice->PortOffset; unsigned char byRFType = pDevice->byRFType; unsigned char byLocalID = pDevice->byLocalID; @@ -2183,22 +2183,22 @@ bool BBbVT3253Init(PSDevice pDevice) for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++) bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_UW2451[ii][0], byVT3253B0_UW2451[ii][1]); - // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) - //bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41); - // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) - //bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28); - // Select VC1/VC2, CR215 = 0x02->0x06 + /* Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) */ + /*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/ + /* Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) */ + /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/ + /* Select VC1/VC2, CR215 = 0x02->0x06 */ bResult &= BBbWriteEmbedded(dwIoBase, 0xd7, 0x06); - //{{RobertYu:20050125, request by Jack + /* {{RobertYu:20050125, request by Jack */ bResult &= BBbWriteEmbedded(dwIoBase, 0x90, 0x20); bResult &= BBbWriteEmbedded(dwIoBase, 0x97, 0xeb); - //}} + /* }} */ - //{{RobertYu:20050221, request by Jack + /* {{RobertYu:20050221, request by Jack */ bResult &= BBbWriteEmbedded(dwIoBase, 0xa6, 0x00); bResult &= BBbWriteEmbedded(dwIoBase, 0xa8, 0x30); - //}} + /* }} */ bResult &= BBbWriteEmbedded(dwIoBase, 0xb0, 0x58); for (ii = 0; ii < CB_VT3253B0_AGC; ii++) @@ -2212,7 +2212,7 @@ bool BBbVT3253Init(PSDevice pDevice) pDevice->ldBmThreshold[1] = -50; pDevice->ldBmThreshold[2] = 0; pDevice->ldBmThreshold[3] = 0; - //}} RobertYu + /* }} RobertYu */ } else if (byRFType == RF_VT3226) { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) @@ -2229,22 +2229,22 @@ bool BBbVT3253Init(PSDevice pDevice) pDevice->ldBmThreshold[1] = -48; pDevice->ldBmThreshold[2] = 0; pDevice->ldBmThreshold[3] = 0; - // Fix VT3226 DFC system timing issue + /* Fix VT3226 DFC system timing issue */ MACvSetRFLE_LatchBase(dwIoBase); - //{{ RobertYu: 20050104 + /* {{ RobertYu: 20050104 */ } else if (byRFType == RF_AIROHA7230) { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]); - //{{ RobertYu:20050223, request by JerryChung - // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) - //bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41); - // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) - //bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28); - // Select VC1/VC2, CR215 = 0x02->0x06 + /* {{ RobertYu:20050223, request by JerryChung */ + /* Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) */ + /*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/ + /* Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) */ + /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/ + /* Select VC1/VC2, CR215 = 0x02->0x06 */ bResult &= BBbWriteEmbedded(dwIoBase, 0xd7, 0x06); - //}} + /* }} */ for (ii = 0; ii < CB_VT3253B0_AGC; ii++) bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); @@ -2257,9 +2257,9 @@ bool BBbVT3253Init(PSDevice pDevice) pDevice->ldBmThreshold[1] = -48; pDevice->ldBmThreshold[2] = 0; pDevice->ldBmThreshold[3] = 0; - //}} RobertYu + /* }} RobertYu */ } else { - // No VGA Table now + /* No VGA Table now */ pDevice->bUpdateBBVGA = false; pDevice->abyBBVGA[0] = 0x1C; } @@ -2285,10 +2285,11 @@ bool BBbVT3253Init(PSDevice pDevice) * Return Value: none * */ -void BBvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyBBRegs) +void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyBBRegs) { int ii; unsigned char byBase = 1; + for (ii = 0; ii < BB_MAX_CONTEXT_SIZE; ii++) { BBbReadEmbedded(dwIoBase, (unsigned char)(ii*byBase), pbyBBRegs); pbyBBRegs += byBase; @@ -2312,39 +2313,39 @@ void BBvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyBBRegs) void BBvLoopbackOn(PSDevice pDevice) { unsigned char byData; - unsigned long dwIoBase = pDevice->PortOffset; + void __iomem *dwIoBase = pDevice->PortOffset; - //CR C9 = 0x00 - BBbReadEmbedded(dwIoBase, 0xC9, &pDevice->byBBCRc9);//CR201 + /* CR C9 = 0x00 */ + BBbReadEmbedded(dwIoBase, 0xC9, &pDevice->byBBCRc9); /* CR201 */ BBbWriteEmbedded(dwIoBase, 0xC9, 0); - BBbReadEmbedded(dwIoBase, 0x4D, &pDevice->byBBCR4d);//CR77 + BBbReadEmbedded(dwIoBase, 0x4D, &pDevice->byBBCR4d); /* CR77 */ BBbWriteEmbedded(dwIoBase, 0x4D, 0x90); - //CR 88 = 0x02(CCK), 0x03(OFDM) - BBbReadEmbedded(dwIoBase, 0x88, &pDevice->byBBCR88);//CR136 - - if (pDevice->uConnectionRate <= RATE_11M) { //CCK - // Enable internal digital loopback: CR33 |= 0000 0001 - BBbReadEmbedded(dwIoBase, 0x21, &byData);//CR33 - BBbWriteEmbedded(dwIoBase, 0x21, (unsigned char)(byData | 0x01));//CR33 - // CR154 = 0x00 - BBbWriteEmbedded(dwIoBase, 0x9A, 0); //CR154 - - BBbWriteEmbedded(dwIoBase, 0x88, 0x02);//CR239 - } else { //OFDM - // Enable internal digital loopback:CR154 |= 0000 0001 - BBbReadEmbedded(dwIoBase, 0x9A, &byData);//CR154 - BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData | 0x01));//CR154 - // CR33 = 0x00 - BBbWriteEmbedded(dwIoBase, 0x21, 0); //CR33 - - BBbWriteEmbedded(dwIoBase, 0x88, 0x03);//CR239 + /* CR 88 = 0x02(CCK), 0x03(OFDM) */ + BBbReadEmbedded(dwIoBase, 0x88, &pDevice->byBBCR88); /* CR136 */ + + if (pDevice->uConnectionRate <= RATE_11M) { /* CCK */ + /* Enable internal digital loopback: CR33 |= 0000 0001 */ + BBbReadEmbedded(dwIoBase, 0x21, &byData); /* CR33 */ + BBbWriteEmbedded(dwIoBase, 0x21, (unsigned char)(byData | 0x01)); /* CR33 */ + /* CR154 = 0x00 */ + BBbWriteEmbedded(dwIoBase, 0x9A, 0); /* CR154 */ + + BBbWriteEmbedded(dwIoBase, 0x88, 0x02); /* CR239 */ + } else { /* OFDM */ + /* Enable internal digital loopback:CR154 |= 0000 0001 */ + BBbReadEmbedded(dwIoBase, 0x9A, &byData); /* CR154 */ + BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData | 0x01)); /* CR154 */ + /* CR33 = 0x00 */ + BBbWriteEmbedded(dwIoBase, 0x21, 0); /* CR33 */ + + BBbWriteEmbedded(dwIoBase, 0x88, 0x03); /* CR239 */ } - //CR14 = 0x00 - BBbWriteEmbedded(dwIoBase, 0x0E, 0);//CR14 + /* CR14 = 0x00 */ + BBbWriteEmbedded(dwIoBase, 0x0E, 0); /* CR14 */ - // Disable TX_IQUN + /* Disable TX_IQUN */ BBbReadEmbedded(pDevice->PortOffset, 0x09, &pDevice->byBBCR09); BBbWriteEmbedded(pDevice->PortOffset, 0x09, (unsigned char)(pDevice->byBBCR09 & 0xDE)); } @@ -2365,23 +2366,23 @@ void BBvLoopbackOn(PSDevice pDevice) void BBvLoopbackOff(PSDevice pDevice) { unsigned char byData; - unsigned long dwIoBase = pDevice->PortOffset; - - BBbWriteEmbedded(dwIoBase, 0xC9, pDevice->byBBCRc9);//CR201 - BBbWriteEmbedded(dwIoBase, 0x88, pDevice->byBBCR88);//CR136 - BBbWriteEmbedded(dwIoBase, 0x09, pDevice->byBBCR09);//CR136 - BBbWriteEmbedded(dwIoBase, 0x4D, pDevice->byBBCR4d);//CR77 - - if (pDevice->uConnectionRate <= RATE_11M) { // CCK - // Set the CR33 Bit2 to disable internal Loopback. - BBbReadEmbedded(dwIoBase, 0x21, &byData);//CR33 - BBbWriteEmbedded(dwIoBase, 0x21, (unsigned char)(byData & 0xFE));//CR33 - } else { // OFDM - BBbReadEmbedded(dwIoBase, 0x9A, &byData);//CR154 - BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData & 0xFE));//CR154 + void __iomem *dwIoBase = pDevice->PortOffset; + + BBbWriteEmbedded(dwIoBase, 0xC9, pDevice->byBBCRc9); /* CR201 */ + BBbWriteEmbedded(dwIoBase, 0x88, pDevice->byBBCR88); /* CR136 */ + BBbWriteEmbedded(dwIoBase, 0x09, pDevice->byBBCR09); /* CR136 */ + BBbWriteEmbedded(dwIoBase, 0x4D, pDevice->byBBCR4d); /* CR77 */ + + if (pDevice->uConnectionRate <= RATE_11M) { /* CCK */ + /* Set the CR33 Bit2 to disable internal Loopback. */ + BBbReadEmbedded(dwIoBase, 0x21, &byData);/* CR33 */ + BBbWriteEmbedded(dwIoBase, 0x21, (unsigned char)(byData & 0xFE)); /* CR33 */ + } else { /* OFDM */ + BBbReadEmbedded(dwIoBase, 0x9A, &byData); /* CR154 */ + BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData & 0xFE)); /* CR154 */ } - BBbReadEmbedded(dwIoBase, 0x0E, &byData);//CR14 - BBbWriteEmbedded(dwIoBase, 0x0E, (unsigned char)(byData | 0x80));//CR14 + BBbReadEmbedded(dwIoBase, 0x0E, &byData); /* CR14 */ + BBbWriteEmbedded(dwIoBase, 0x0E, (unsigned char)(byData | 0x80)); /* CR14 */ } /* @@ -2402,19 +2403,19 @@ BBvSetShortSlotTime(PSDevice pDevice) unsigned char byBBRxConf = 0; unsigned char byBBVGA = 0; - BBbReadEmbedded(pDevice->PortOffset, 0x0A, &byBBRxConf);//CR10 + BBbReadEmbedded(pDevice->PortOffset, 0x0A, &byBBRxConf); /* CR10 */ if (pDevice->bShortSlotTime) - byBBRxConf &= 0xDF;//1101 1111 + byBBRxConf &= 0xDF; /* 1101 1111 */ else - byBBRxConf |= 0x20;//0010 0000 + byBBRxConf |= 0x20; /* 0010 0000 */ - // patch for 3253B0 Baseband with Cardbus module + /* patch for 3253B0 Baseband with Cardbus module */ BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byBBVGA); if (byBBVGA == pDevice->abyBBVGA[0]) - byBBRxConf |= 0x20;//0010 0000 + byBBRxConf |= 0x20; /* 0010 0000 */ - BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf);//CR10 + BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf); /* CR10 */ } void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData) @@ -2423,16 +2424,16 @@ void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData) BBbWriteEmbedded(pDevice->PortOffset, 0xE7, byData); - BBbReadEmbedded(pDevice->PortOffset, 0x0A, &byBBRxConf);//CR10 - // patch for 3253B0 Baseband with Cardbus module + BBbReadEmbedded(pDevice->PortOffset, 0x0A, &byBBRxConf); /* CR10 */ + /* patch for 3253B0 Baseband with Cardbus module */ if (byData == pDevice->abyBBVGA[0]) - byBBRxConf |= 0x20;//0010 0000 + byBBRxConf |= 0x20; /* 0010 0000 */ else if (pDevice->bShortSlotTime) - byBBRxConf &= 0xDF;//1101 1111 + byBBRxConf &= 0xDF; /* 1101 1111 */ else - byBBRxConf |= 0x20;//0010 0000 + byBBRxConf |= 0x20; /* 0010 0000 */ pDevice->byBBVGACurrent = byData; - BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf);//CR10 + BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf); /* CR10 */ } /* @@ -2448,7 +2449,7 @@ void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData) * */ void -BBvSoftwareReset(unsigned long dwIoBase) +BBvSoftwareReset(void __iomem *dwIoBase) { BBbWriteEmbedded(dwIoBase, 0x50, 0x40); BBbWriteEmbedded(dwIoBase, 0x50, 0); @@ -2469,7 +2470,7 @@ BBvSoftwareReset(unsigned long dwIoBase) * */ void -BBvPowerSaveModeON(unsigned long dwIoBase) +BBvPowerSaveModeON(void __iomem *dwIoBase) { unsigned char byOrgData; @@ -2491,7 +2492,7 @@ BBvPowerSaveModeON(unsigned long dwIoBase) * */ void -BBvPowerSaveModeOFF(unsigned long dwIoBase) +BBvPowerSaveModeOFF(void __iomem *dwIoBase) { unsigned char byOrgData; @@ -2515,22 +2516,22 @@ BBvPowerSaveModeOFF(unsigned long dwIoBase) */ void -BBvSetTxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode) +BBvSetTxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode) { unsigned char byBBTxConf; - BBbReadEmbedded(dwIoBase, 0x09, &byBBTxConf);//CR09 + BBbReadEmbedded(dwIoBase, 0x09, &byBBTxConf); /* CR09 */ if (byAntennaMode == ANT_DIVERSITY) { - // bit 1 is diversity + /* bit 1 is diversity */ byBBTxConf |= 0x02; } else if (byAntennaMode == ANT_A) { - // bit 2 is ANTSEL - byBBTxConf &= 0xF9; // 1111 1001 + /* bit 2 is ANTSEL */ + byBBTxConf &= 0xF9; /* 1111 1001 */ } else if (byAntennaMode == ANT_B) { - byBBTxConf &= 0xFD; // 1111 1101 + byBBTxConf &= 0xFD; /* 1111 1101 */ byBBTxConf |= 0x04; } - BBbWriteEmbedded(dwIoBase, 0x09, byBBTxConf);//CR09 + BBbWriteEmbedded(dwIoBase, 0x09, byBBTxConf); /* CR09 */ } /* @@ -2548,21 +2549,21 @@ BBvSetTxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode) */ void -BBvSetRxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode) +BBvSetRxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode) { unsigned char byBBRxConf; - BBbReadEmbedded(dwIoBase, 0x0A, &byBBRxConf);//CR10 + BBbReadEmbedded(dwIoBase, 0x0A, &byBBRxConf); /* CR10 */ if (byAntennaMode == ANT_DIVERSITY) { byBBRxConf |= 0x01; } else if (byAntennaMode == ANT_A) { - byBBRxConf &= 0xFC; // 1111 1100 + byBBRxConf &= 0xFC; /* 1111 1100 */ } else if (byAntennaMode == ANT_B) { - byBBRxConf &= 0xFE; // 1111 1110 + byBBRxConf &= 0xFE; /* 1111 1110 */ byBBRxConf |= 0x02; } - BBbWriteEmbedded(dwIoBase, 0x0A, byBBRxConf);//CR10 + BBbWriteEmbedded(dwIoBase, 0x0A, byBBRxConf); /* CR10 */ } /* @@ -2578,17 +2579,17 @@ BBvSetRxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode) * */ void -BBvSetDeepSleep(unsigned long dwIoBase, unsigned char byLocalID) +BBvSetDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID) { - BBbWriteEmbedded(dwIoBase, 0x0C, 0x17);//CR12 - BBbWriteEmbedded(dwIoBase, 0x0D, 0xB9);//CR13 + BBbWriteEmbedded(dwIoBase, 0x0C, 0x17); /* CR12 */ + BBbWriteEmbedded(dwIoBase, 0x0D, 0xB9); /* CR13 */ } void -BBvExitDeepSleep(unsigned long dwIoBase, unsigned char byLocalID) +BBvExitDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID) { - BBbWriteEmbedded(dwIoBase, 0x0C, 0x00);//CR12 - BBbWriteEmbedded(dwIoBase, 0x0D, 0x01);//CR13 + BBbWriteEmbedded(dwIoBase, 0x0C, 0x00); /* CR12 */ + BBbWriteEmbedded(dwIoBase, 0x0D, 0x01); /* CR13 */ } static @@ -2599,7 +2600,7 @@ s_ulGetRatio(PSDevice pDevice) unsigned long ulMaxPacket; unsigned long ulPacketNum; - //This is a thousand-ratio + /* This is a thousand-ratio */ ulMaxPacket = pDevice->uNumSQ3[RATE_54M]; if (pDevice->uNumSQ3[RATE_54M] != 0) { ulPacketNum = pDevice->uNumSQ3[RATE_54M]; @@ -2751,7 +2752,7 @@ BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ BBvClearAntDivSQ3Value(pDevice); } - } else { //byAntennaState == 1 + } else { /* byAntennaState == 1 */ if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) { del_timer(&pDevice->TimerSQ3Tmax1); @@ -2775,7 +2776,7 @@ BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ pDevice->byAntennaState = 0; BBvClearAntDivSQ3Value(pDevice); } - } //byAntennaState + } /* byAntennaState */ } /*+ @@ -2814,7 +2815,6 @@ TimerSQ3CallBack( add_timer(&pDevice->TimerSQ3Tmax2); spin_unlock_irq(&pDevice->lock); - return; } /*+ @@ -2873,6 +2873,4 @@ TimerState1CallBack( pDevice->byAntennaState = 0; BBvClearAntDivSQ3Value(pDevice); spin_unlock_irq(&pDevice->lock); - - return; } diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h index e31bb7600673..fcf1f9373672 100644 --- a/drivers/staging/vt6655/baseband.h +++ b/drivers/staging/vt6655/baseband.h @@ -34,8 +34,6 @@ #include "tether.h" #include "device.h" -/*--------------------- Export Definitions -------------------------*/ - // // Registers in the BASEBAND // @@ -64,22 +62,12 @@ #define TOP_RATE_2M 0x00200000 #define TOP_RATE_1M 0x00100000 -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Macros ------------------------------*/ - #define BBvClearFOE(dwIoBase) \ BBbWriteEmbedded(dwIoBase, 0xB1, 0) #define BBvSetFOE(dwIoBase) \ BBbWriteEmbedded(dwIoBase, 0xB1, 0x0C) -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - unsigned int BBuGetFrameTime( unsigned char byPreambleType, @@ -99,26 +87,26 @@ BBvCalculateParameter( unsigned char *pbyPhySgn ); -bool BBbReadEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char *pbyData); -bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byData); +bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData); +bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData); -void BBvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyBBRegs); +void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyBBRegs); void BBvLoopbackOn(PSDevice pDevice); void BBvLoopbackOff(PSDevice pDevice); void BBvSetShortSlotTime(PSDevice pDevice); -bool BBbIsRegBitsOn(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits); -bool BBbIsRegBitsOff(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits); +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); // VT3253 Baseband bool BBbVT3253Init(PSDevice pDevice); -void BBvSoftwareReset(unsigned long dwIoBase); -void BBvPowerSaveModeON(unsigned long dwIoBase); -void BBvPowerSaveModeOFF(unsigned long dwIoBase); -void BBvSetTxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode); -void BBvSetRxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode); -void BBvSetDeepSleep(unsigned long dwIoBase, unsigned char byLocalID); -void BBvExitDeepSleep(unsigned long dwIoBase, unsigned char byLocalID); +void BBvSoftwareReset(void __iomem *dwIoBase); +void BBvPowerSaveModeON(void __iomem *dwIoBase); +void BBvPowerSaveModeOFF(void __iomem *dwIoBase); +void BBvSetTxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode); +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 diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 59679cd46816..9569f43a3ed7 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -65,14 +65,14 @@ /*--------------------- Static Variables --------------------------*/ static int msglevel = MSG_LEVEL_INFO; -const unsigned short awHWRetry0[5][5] = { +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}, {RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M}, {RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M}, {RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M} }; -const unsigned short awHWRetry1[5][5] = { +static const unsigned short awHWRetry1[5][5] = { {RATE_18M, RATE_18M, RATE_12M, RATE_6M, RATE_6M}, {RATE_24M, RATE_24M, RATE_18M, RATE_6M, RATE_6M}, {RATE_36M, RATE_36M, RATE_24M, RATE_12M, RATE_12M}, @@ -262,8 +262,6 @@ BSSvClearBSSList( memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS)); } BSSvClearAnyBSSJoinRecord(pDevice); - - return; } /*+ @@ -424,6 +422,7 @@ BSSbInsertToBSSList( if (pRSN != NULL) { unsigned int uLen = pRSN->len + 2; + if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSN - pbyIEs))) { pBSSList->wRSNLen = uLen; memcpy(pBSSList->byRSNIE, pRSN, uLen); @@ -600,6 +599,7 @@ BSSbUpdateToBSSList( if (pRSNWPA != NULL) { unsigned int uLen = pRSNWPA->len + 2; + if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSNWPA - pbyIEs))) { pBSSList->wWPALen = uLen; memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); @@ -611,6 +611,7 @@ BSSbUpdateToBSSList( if (pRSN != NULL) { unsigned int uLen = pRSN->len + 2; + if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSN - pbyIEs))) { pBSSList->wRSNLen = uLen; memcpy(pBSSList->byRSNIE, pRSN, uLen); @@ -900,11 +901,6 @@ BSSvAddMulticastNode( * none. * -*/ -/* 2008-4-14 <add> by chester for led issue */ -#ifdef FOR_LED_ON_NOTEBOOK -bool cc = false; -unsigned int status; -#endif void BSSvSecondCallBack( void *hDeviceContext @@ -925,54 +921,6 @@ BSSvSecondCallBack( pDevice->byERPFlag &= ~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1)); - /* 2008-4-14 <add> by chester for led issue */ -#ifdef FOR_LED_ON_NOTEBOOK - MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO); - if (((!(pDevice->byGPIO & GPIO0_DATA) && (!pDevice->bHWRadioOff)) || - ((pDevice->byGPIO & GPIO0_DATA) && pDevice->bHWRadioOff)) && - (!cc)) { - cc = true; - } else if (cc) { - if (pDevice->bHWRadioOff) { - if (!(pDevice->byGPIO & GPIO0_DATA)) { - if (status == 1) - goto start; - status = 1; - CARDbRadioPowerOff(pDevice); - pMgmt->sNodeDBTable[0].bActive = false; - pMgmt->eCurrMode = WMAC_MODE_STANDBY; - pMgmt->eCurrState = WMAC_STATE_IDLE; - pDevice->bLinkPass = false; - - } - if (pDevice->byGPIO & GPIO0_DATA) { - if (status == 2) - goto start; - status = 2; - CARDbRadioPowerOn(pDevice); - } - } else { - if (pDevice->byGPIO & GPIO0_DATA) { - if (status == 3) - goto start; - status = 3; - CARDbRadioPowerOff(pDevice); - pMgmt->sNodeDBTable[0].bActive = false; - pMgmt->eCurrMode = WMAC_MODE_STANDBY; - pMgmt->eCurrState = WMAC_STATE_IDLE; - pDevice->bLinkPass = false; - - } - if (!(pDevice->byGPIO & GPIO0_DATA)) { - if (status == 4) - goto start; - status = 4; - CARDbRadioPowerOn(pDevice); - } - } - } -start: -#endif if (pDevice->wUseProtectCntDown > 0) { pDevice->wUseProtectCntDown--; @@ -981,7 +929,7 @@ start: pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1)); } - { + if (pDevice->eCommandState == WLAN_ASSOCIATE_WAIT) { pDevice->byReAssocCount++; /* 10 sec timeout */ if ((pDevice->byReAssocCount > 10) && (!pDevice->bLinkPass)) { @@ -990,6 +938,7 @@ start: #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT { union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); @@ -1169,6 +1118,7 @@ start: #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT { union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); @@ -1235,7 +1185,6 @@ start: pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ); add_timer(&pMgmt->sTimerSecondCallback); - return; } /*+ @@ -1270,6 +1219,7 @@ BSSvUpdateNodeTxCounter( unsigned short wFallBackRate = RATE_1M; unsigned char byFallBack; unsigned int ii; + pTxBufHead = (PSTxBufHead) pbyBuffer; if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0) byFallBack = AUTO_FB_0; @@ -1385,8 +1335,6 @@ BSSvUpdateNodeTxCounter( } } } - - return; } /*+ @@ -1456,6 +1404,7 @@ void s_vCheckSensitivity( /* Update BB Reg if RSSI is too strong */ long LocalldBmAverage = 0; long uNumofdBm = 0; + for (ii = 0; ii < RSSI_STAT_COUNT; ii++) { if (pBSSList->ldBmAverage[ii] != 0) { uNumofdBm++; @@ -1494,7 +1443,6 @@ BSSvClearAnyBSSJoinRecord( for (ii = 0; ii < MAX_BSS_NUM; ii++) pMgmt->sBSSList[ii].bSelected = false; - return; } #ifdef Calcu_LinkQual @@ -1535,7 +1483,6 @@ void s_uCalculateLinkQual( pDevice->scStatistic.TxFailCount = 0; pDevice->scStatistic.TxNoRetryOkCount = 0; pDevice->scStatistic.TxRetryOkCount = 0; - return; } #endif @@ -1553,5 +1500,4 @@ void s_vCheckPreEDThreshold( if (pBSSList != NULL) pDevice->byBBPreEDRSSI = (unsigned char) (~(pBSSList->ldBmAverRange) + 1); } - return; } diff --git a/drivers/staging/vt6655/bssdb.h b/drivers/staging/vt6655/bssdb.h index a0938b7dd082..bf299e3b8acf 100644 --- a/drivers/staging/vt6655/bssdb.h +++ b/drivers/staging/vt6655/bssdb.h @@ -35,8 +35,6 @@ #include "80211mgr.h" #include "card.h" -/*--------------------- Export Definitions -------------------------*/ - #define MAX_NODE_NUM 64 #define MAX_BSS_NUM 42 #define LOST_BEACON_COUNT 10 // 10 sec, XP defined @@ -67,18 +65,11 @@ #define MAX_WPA_IE_LEN 64 -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - // // IEEE 802.11 Structures and definitions // -typedef enum _NDIS_802_11_NETWORK_TYPE -{ +typedef enum _NDIS_802_11_NETWORK_TYPE { Ndis802_11FH, Ndis802_11DS, Ndis802_11OFDM5, @@ -99,7 +90,6 @@ typedef struct tagSRSNCapObject { // BSS info(AP) #pragma pack(1) typedef struct tagKnownBSS { - // BSS info bool bActive; unsigned char abyBSSID[WLAN_BSSID_LEN]; unsigned int uChannel; @@ -116,10 +106,8 @@ typedef struct tagKnownBSS { long ldBmMAX; long ldBmAverage[RSSI_STAT_COUNT]; long ldBmAverRange; - //For any BSSID selection improvment bool bSelected; - //++ WPA informations bool bWPAValid; unsigned char byGKType; unsigned char abyPKType[4]; @@ -128,9 +116,7 @@ typedef struct tagKnownBSS { unsigned short wAuthCount; unsigned char byDefaultK_as_PK; unsigned char byReplayIdx; - //-- - //++ WPA2 informations bool bWPA2Valid; unsigned char byCSSGK; unsigned short wCSSPKCount; @@ -138,28 +124,24 @@ typedef struct tagKnownBSS { unsigned short wAKMSSAuthCount; unsigned char abyAKMSSAuthType[4]; - //++ wpactl unsigned char byWPAIE[MAX_WPA_IE_LEN]; unsigned char byRSNIE[MAX_WPA_IE_LEN]; unsigned short wWPALen; unsigned short wRSNLen; - // Clear count unsigned int uClearCount; unsigned int uIELength; QWORD qwBSSTimestamp; - QWORD qwLocalTSF; // local TSF timer + QWORD qwLocalTSF; -// NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; CARD_PHY_TYPE eNetworkTypeInUse; ERPObject sERP; SRSNCapObject sRSNCapObj; - unsigned char abyIEs[1024]; // don't move this field !! + unsigned char abyIEs[1024]; } __attribute__ ((__packed__)) KnownBSS , *PKnownBSS; -//2006-1116-01,<Add> by NomadZhao #pragma pack() typedef enum tagNODE_STATE { @@ -172,7 +154,6 @@ typedef enum tagNODE_STATE { // STA node info typedef struct tagKnownNodeDB { - // STA info bool bActive; unsigned char abyMACAddr[WLAN_ADDR_LEN]; unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; @@ -211,7 +192,6 @@ typedef struct tagKnownNodeDB { unsigned short wTSC15_0; unsigned int uWepKeyLength; unsigned char abyWepKey[WLAN_WEPMAX_KEYLEN]; - // // Auto rate fallback vars bool bIsInFallback; unsigned int uAverageRSSI; @@ -228,8 +208,6 @@ typedef struct tagKnownNodeDB { unsigned int uTimeCount; } KnownNodeDB, *PKnownNodeDB; -/*--------------------- Export Functions --------------------------*/ - PKnownBSS BSSpSearchBSSList( void *hDeviceContext, diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index 05bf48a24f45..4ae8d9362edf 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -87,7 +87,7 @@ static unsigned char abyDefaultSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x0 /*--------------------- Static Variables --------------------------*/ -const unsigned short cwRXBCNTSFOff[MAX_RATE] = +static const unsigned short cwRXBCNTSFOff[MAX_RATE] = {17, 17, 17, 17, 34, 23, 17, 11, 8, 5, 4, 3}; /*--------------------- Static Functions --------------------------*/ @@ -351,6 +351,7 @@ s_vSetRSPINF(PSDevice pDevice, CARD_PHY_TYPE ePHYType, void *pvSupportRateIEs, v bool CARDbIsShortPreamble(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; + if (pDevice->byPreambleType == 0) return false; @@ -372,6 +373,7 @@ bool CARDbIsShortPreamble(void *pDeviceHandler) bool CARDbIsShorSlotTime(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; + return pDevice->bShortSlotTime; } @@ -908,7 +910,7 @@ bool CARDbRadioPowerOff(void *pDeviceHandler) pDevice->bRadioOff = true; //2007-0409-03,<Add> by chester - printk("chester power off\n"); + pr_debug("chester power off\n"); MACvRegBitsOn(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); //LED issue return bResult; } @@ -929,14 +931,17 @@ bool CARDbRadioPowerOn(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; bool bResult = true; - printk("chester power on\n"); + + pr_debug("chester power on\n"); if (pDevice->bRadioControlOff == true) { - if (pDevice->bHWRadioOff == true) printk("chester bHWRadioOff\n"); - if (pDevice->bRadioControlOff == true) printk("chester bRadioControlOff\n"); + if (pDevice->bHWRadioOff == true) + pr_debug("chester bHWRadioOff\n"); + if (pDevice->bRadioControlOff == true) + pr_debug("chester bRadioControlOff\n"); return false; } if (pDevice->bRadioOff == false) { - printk("chester pbRadioOff\n"); + pr_debug("chester pbRadioOff\n"); return true; } BBvExitDeepSleep(pDevice->PortOffset, pDevice->byLocalID); @@ -960,7 +965,7 @@ bool CARDbRadioPowerOn(void *pDeviceHandler) pDevice->bRadioOff = false; // 2007-0409-03,<Add> by chester - printk("chester power on\n"); + pr_debug("chester power on\n"); MACvRegBitsOff(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); //LED issue return bResult; } @@ -998,7 +1003,7 @@ CARDbAdd_PMKID_Candidate( ) { PSDevice pDevice = (PSDevice) pDeviceHandler; - PPMKID_CANDIDATE pCandidateList; + 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); @@ -1573,7 +1578,7 @@ CARDvSafeResetRx( * Return Value: response Control frame rate * */ -unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRateIdx) +static unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRateIdx) { PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int ui = (unsigned int) wRateIdx; @@ -1600,7 +1605,7 @@ unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRate * Return Value: response Control frame rate * */ -unsigned short CARDwGetOFDMControlRate(void *pDeviceHandler, unsigned short wRateIdx) +static unsigned short CARDwGetOFDMControlRate(void *pDeviceHandler, unsigned short wRateIdx) { PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int ui = (unsigned int) wRateIdx; @@ -1767,6 +1772,7 @@ void vUpdateIFS(void *pDeviceHandler) PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned char byMaxMin = 0; + if (pDevice->byPacketType == PK_TYPE_11A) {//0000 0000 0000 0000,11a pDevice->uSlot = C_SLOT_SHORT; pDevice->uSIFS = C_SIFS_A; @@ -1888,7 +1894,7 @@ unsigned char CARDbyGetPktType(void *pDeviceHandler) * Return Value: none * */ -void CARDvSetLoopbackMode(unsigned long dwIoBase, unsigned short wLoopbackMode) +void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode) { switch (wLoopbackMode) { case CARD_LB_NONE: @@ -1977,7 +1983,7 @@ QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2) * Return Value: true if success; otherwise false * */ -bool CARDbGetCurrentTSF(unsigned long dwIoBase, PQWORD pqwCurrTSF) +bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF) { unsigned short ww; unsigned char byData; @@ -2050,7 +2056,7 @@ QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval) * Return Value: none * */ -void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterval) +void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval) { QWORD qwNextTBTT; @@ -2062,8 +2068,6 @@ void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterva VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT)); VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT)); MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); - - return; } /* @@ -2081,15 +2085,13 @@ void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterva * Return Value: none * */ -void CARDvUpdateNextTBTT(unsigned long dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval) +void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD 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)); MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8xh:%8xh] \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8xh:%8xh]\n", (unsigned int) HIDWORD(qwTSF), (unsigned int) LODWORD(qwTSF)); - - return; } diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h index 829be92838b0..2f1a05ef44a1 100644 --- a/drivers/staging/vt6655/card.h +++ b/drivers/staging/vt6655/card.h @@ -32,7 +32,6 @@ #include "ttype.h" #include <linux/types.h> -/*--------------------- Export Definitions -------------------------*/ // // Loopback mode // @@ -48,7 +47,7 @@ #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us #define CB_MAX_CHANNEL_24G 14 -#define CB_MAX_CHANNEL_5G 42 //[20050104] add channel9(5045MHz), 41==>42 +#define CB_MAX_CHANNEL_5G 42 #define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G) typedef enum _CARD_PHY_TYPE { @@ -78,22 +77,16 @@ typedef enum _CARD_OP_MODE { OP_MODE_UNKNOWN } CARD_OP_MODE, *PCARD_OP_MODE; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - 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); -void CARDvSetLoopbackMode(unsigned long dwIoBase, unsigned short wLoopbackMode); +void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode); bool CARDbSoftwareReset(void *pDeviceHandler); -void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterval); -void CARDvUpdateNextTBTT(unsigned long dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval); -bool CARDbGetCurrentTSF(unsigned long dwIoBase, PQWORD pqwCurrTSF); +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); @@ -101,7 +94,6 @@ unsigned char CARDbyGetPktType(void *pDeviceHandler); void CARDvSafeResetTx(void *pDeviceHandler); void CARDvSafeResetRx(void *pDeviceHandler); -//xxx bool CARDbRadioPowerOff(void *pDeviceHandler); bool CARDbRadioPowerOn(void *pDeviceHandler); bool CARDbIsShortPreamble(void *pDeviceHandler); diff --git a/drivers/staging/vt6655/channel.h b/drivers/staging/vt6655/channel.h index c9931d7f6653..4f44c8a3d3cf 100644 --- a/drivers/staging/vt6655/channel.h +++ b/drivers/staging/vt6655/channel.h @@ -26,8 +26,6 @@ #include "ttype.h" #include "card.h" -/*--------------------- Export Classes ----------------------------*/ - typedef struct tagSChannelTblElement { unsigned char byChannelNumber; unsigned int uFrequency; @@ -35,8 +33,6 @@ typedef struct tagSChannelTblElement { unsigned char byMAP; } SChannelTblElement, *PSChannelTblElement; -/*--------------------- Export Functions --------------------------*/ - bool is_channel_valid(unsigned int CountryCode); void init_channel_table(void *pDeviceHandler); unsigned char get_channel_mapping(void *pDeviceHandler, unsigned char byChannelNumber, CARD_PHY_TYPE ePhyType); diff --git a/drivers/staging/vt6655/country.h b/drivers/staging/vt6655/country.h index 415e7672aa32..2365fb13b033 100644 --- a/drivers/staging/vt6655/country.h +++ b/drivers/staging/vt6655/country.h @@ -32,7 +32,6 @@ #include "ttype.h" -/*--------------------- Export Definitions -------------------------*/ /************************************************************************ * The definition here should be complied with the INF country order * Please check with VNWL.inf/VNWL64.inf/VNWL*.inf diff --git a/drivers/staging/vt6655/datarate.c b/drivers/staging/vt6655/datarate.c index f8420d65cd94..565028c4ab03 100644 --- a/drivers/staging/vt6655/datarate.c +++ b/drivers/staging/vt6655/datarate.c @@ -47,11 +47,12 @@ /*--------------------- Static Classes ----------------------------*/ -extern unsigned short TxRate_iwconfig; //2008-5-8 <add> by chester +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}; +static const unsigned char acbyIERate[MAX_RATE] = { +0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C +}; #define AUTORATE_TXOK_CNT 0x0400 #define AUTORATE_TXFAIL_CNT 0x0064 @@ -70,7 +71,7 @@ s_vResetCounter( { unsigned char ii; - // clear statistic counter for auto_rate + /* clear statistic counter for auto_rate */ for (ii = 0; ii <= MAX_RATE; ii++) { psNodeDBTable->uTxOk[ii] = 0; psNodeDBTable->uTxFail[ii] = 0; @@ -102,8 +103,8 @@ DATARATEbyGetRateIdx( { unsigned char ii; - //Erase basicRate flag. - byRate = byRate & 0x7F;//0111 1111 + /* Erase basicRate flag. */ + byRate = byRate & 0x7F;/* 0111 1111 */ for (ii = 0; ii < MAX_RATE; ii++) { if (acbyIERate[ii] == byRate) @@ -151,13 +152,14 @@ wGetRateIdx( { unsigned short ii; - //Erase basicRate flag. - byRate = byRate & 0x7F;//0111 1111 + /* Erase basicRate flag. */ + byRate = byRate & 0x7F;/* 0111 1111 */ for (ii = 0; ii < MAX_RATE; ii++) { if (acbyIERate[ii] == byRate) return ii; } + return 0; } @@ -218,7 +220,7 @@ RATEvParseMaxRate( for (ii = 0; ii < uRateLen; ii++) { byRate = (unsigned char)(pItemRates->abyRates[ii]); if (WLAN_MGMT_IS_BASICRATE(byRate) && bUpdateBasicRate) { - // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate + /* 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)); } @@ -238,9 +240,9 @@ RATEvParseMaxRate( for (ii = 0; ii < uExtRateLen; ii++) { byRate = (unsigned char)(pItemExtRates->abyRates[ii]); - // select highest basic rate + /* select highest basic rate */ if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) { - // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate + /* 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)); } @@ -302,10 +304,9 @@ RATEvTxRateFallBack( unsigned short wIdxUpRate = 0; unsigned long dwTxDiff = 0; - if (pDevice->pMgmt->eScanState != WMAC_NO_SCANNING) { - // Don't do Fallback when scanning Channel + if (pDevice->pMgmt->eScanState != WMAC_NO_SCANNING) + /* Don't do Fallback when scanning Channel */ return; - } psNodeDBTable->uTimeCount++; @@ -357,15 +358,15 @@ RATEvTxRateFallBack( (psNodeDBTable->uTxFail[MAX_RATE] * 4)) { psNodeDBTable->wTxDataRate = wIdxUpRate; } - } else { // adhoc, if uTxOk =0 & uTxFail = 0 + } else { + /* adhoc, if uTxOk =0 & uTxFail = 0 */ if (psNodeDBTable->uTxFail[MAX_RATE] == 0) psNodeDBTable->wTxDataRate = wIdxUpRate; } -//2008-5-8 <add> by chester + + /* 2008-5-8 <add> by chester */ TxRate_iwconfig = psNodeDBTable->wTxDataRate; s_vResetCounter(psNodeDBTable); - - return; } /*+ diff --git a/drivers/staging/vt6655/datarate.h b/drivers/staging/vt6655/datarate.h index e4fad05ad859..0509c4fd2a42 100644 --- a/drivers/staging/vt6655/datarate.h +++ b/drivers/staging/vt6655/datarate.h @@ -29,25 +29,15 @@ #ifndef __DATARATE_H__ #define __DATARATE_H__ -/*--------------------- Export Definitions -------------------------*/ - -#define FALLBACK_PKT_COLLECT_TR_H 50 // pkts -#define FALLBACK_PKT_COLLECT_TR_L 10 // pkts -#define FALLBACK_POLL_SECOND 5 // 5 sec -#define FALLBACK_RECOVER_SECOND 30 // 30 sec -#define FALLBACK_THRESHOLD 15 // percent -#define UPGRADE_THRESHOLD 5 // percent -#define UPGRADE_CNT_THRD 3 // times -#define RETRY_TIMES_THRD_H 2 // times -#define RETRY_TIMES_THRD_L 1 // times - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ +#define FALLBACK_PKT_COLLECT_TR_H 50 +#define FALLBACK_PKT_COLLECT_TR_L 10 +#define FALLBACK_POLL_SECOND 5 +#define FALLBACK_RECOVER_SECOND 30 +#define FALLBACK_THRESHOLD 15 +#define UPGRADE_THRESHOLD 5 +#define UPGRADE_CNT_THRD 3 +#define RETRY_TIMES_THRD_H 2 +#define RETRY_TIMES_THRD_L 1 void RATEvParseMaxRate( diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index c620cbfbaadf..05efa4e1b682 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -36,79 +36,77 @@ #include "ttype.h" #include "tether.h" -/*--------------------- Export Definitions -------------------------*/ - -#define B_OWNED_BY_CHIP 1 // -#define B_OWNED_BY_HOST 0 // +#define B_OWNED_BY_CHIP 1 +#define B_OWNED_BY_HOST 0 // // Bits in the RSR register // -#define RSR_ADDRBROAD 0x80 // 1000 0000 -#define RSR_ADDRMULTI 0x40 // 0100 0000 -#define RSR_ADDRUNI 0x00 // 0000 0000 -#define RSR_IVLDTYP 0x20 // 0010 0000 , invalid packet type -#define RSR_IVLDLEN 0x10 // 0001 0000 , invalid len (> 2312 byte) -#define RSR_BSSIDOK 0x08 // 0000 1000 -#define RSR_CRCOK 0x04 // 0000 0100 -#define RSR_BCNSSIDOK 0x02 // 0000 0010 -#define RSR_ADDROK 0x01 // 0000 0001 +#define RSR_ADDRBROAD 0x80 +#define RSR_ADDRMULTI 0x40 +#define RSR_ADDRUNI 0x00 +#define RSR_IVLDTYP 0x20 +#define RSR_IVLDLEN 0x10 // invalid len (> 2312 byte) +#define RSR_BSSIDOK 0x08 +#define RSR_CRCOK 0x04 +#define RSR_BCNSSIDOK 0x02 +#define RSR_ADDROK 0x01 // // Bits in the new RSR register // -#define NEWRSR_DECRYPTOK 0x10 // 0001 0000 -#define NEWRSR_CFPIND 0x08 // 0000 1000 -#define NEWRSR_HWUTSF 0x04 // 0000 0100 -#define NEWRSR_BCNHITAID 0x02 // 0000 0010 -#define NEWRSR_BCNHITAID0 0x01 // 0000 0001 +#define NEWRSR_DECRYPTOK 0x10 +#define NEWRSR_CFPIND 0x08 +#define NEWRSR_HWUTSF 0x04 +#define NEWRSR_BCNHITAID 0x02 +#define NEWRSR_BCNHITAID0 0x01 // // Bits in the TSR0 register // -#define TSR0_PWRSTS1_2 0xC0 // 1100 0000 -#define TSR0_PWRSTS7 0x20 // 0010 0000 -#define TSR0_NCR 0x1F // 0001 1111 +#define TSR0_PWRSTS1_2 0xC0 +#define TSR0_PWRSTS7 0x20 +#define TSR0_NCR 0x1F // // Bits in the TSR1 register // -#define TSR1_TERR 0x80 // 1000 0000 -#define TSR1_PWRSTS4_6 0x70 // 0111 0000 -#define TSR1_RETRYTMO 0x08 // 0000 1000 -#define TSR1_TMO 0x04 // 0000 0100 -#define TSR1_PWRSTS3 0x02 // 0000 0010 -#define ACK_DATA 0x01 // 0000 0000 +#define TSR1_TERR 0x80 +#define TSR1_PWRSTS4_6 0x70 +#define TSR1_RETRYTMO 0x08 +#define TSR1_TMO 0x04 +#define TSR1_PWRSTS3 0x02 +#define ACK_DATA 0x01 // // Bits in the TCR register // -#define EDMSDU 0x04 // 0000 0100 end of sdu -#define TCR_EDP 0x02 // 0000 0010 end of packet -#define TCR_STP 0x01 // 0000 0001 start of packet +#define EDMSDU 0x04 // end of sdu +#define TCR_EDP 0x02 // end of packet +#define TCR_STP 0x01 // start of packet // max transmit or receive buffer size -#define CB_MAX_BUF_SIZE 2900U // max buffer size +#define CB_MAX_BUF_SIZE 2900U // NOTE: must be multiple of 4 -#define CB_MAX_TX_BUF_SIZE CB_MAX_BUF_SIZE // max Tx buffer size -#define CB_MAX_RX_BUF_SIZE_NORMAL CB_MAX_BUF_SIZE // max Rx buffer size when not use Multi-RD +#define CB_MAX_TX_BUF_SIZE CB_MAX_BUF_SIZE +#define CB_MAX_RX_BUF_SIZE_NORMAL CB_MAX_BUF_SIZE -#define CB_BEACON_BUF_SIZE 512U // default beacon buffer size +#define CB_BEACON_BUF_SIZE 512U -#define CB_MAX_RX_DESC 128 // max # of descriptor -#define CB_MIN_RX_DESC 16 // min # of rx descriptor -#define CB_MAX_TX_DESC 64 // max # of descriptor -#define CB_MIN_TX_DESC 16 // min # of tx descriptor +#define CB_MAX_RX_DESC 128 +#define CB_MIN_RX_DESC 16 +#define CB_MAX_TX_DESC 64 +#define CB_MIN_TX_DESC 16 -#define CB_MAX_RECEIVED_PACKETS 16 // max # of received packets at one time +#define CB_MAX_RECEIVED_PACKETS 16 // limit our receive routine to indicating // this many at a time for 2 reasons: // 1. driver flow control to protocol layer // 2. limit the time used in ISR routine -#define CB_EXTRA_RD_NUM 32 // default # of Extra RD -#define CB_RD_NUM 32 // default # of RD -#define CB_TD_NUM 32 // default # of TD +#define CB_EXTRA_RD_NUM 32 +#define CB_RD_NUM 32 +#define CB_TD_NUM 32 // max number of physical segments // in a single NDIS packet. Above this threshold, the packet @@ -128,61 +126,61 @@ #ifdef __BIG_ENDIAN // WMAC definition FIFO Control -#define FIFOCTL_AUTO_FB_1 0x0010 // 0001 0000 0000 0000 -#define FIFOCTL_AUTO_FB_0 0x0008 // 0000 1000 0000 0000 -#define FIFOCTL_GRPACK 0x0004 // 0000 0100 0000 0000 -#define FIFOCTL_11GA 0x0003 // 0000 0011 0000 0000 -#define FIFOCTL_11GB 0x0002 // 0000 0010 0000 0000 -#define FIFOCTL_11B 0x0001 // 0000 0001 0000 0000 -#define FIFOCTL_11A 0x0000 // 0000 0000 0000 0000 -#define FIFOCTL_RTS 0x8000 // 0000 0000 1000 0000 -#define FIFOCTL_ISDMA0 0x4000 // 0000 0000 0100 0000 -#define FIFOCTL_GENINT 0x2000 // 0000 0000 0010 0000 -#define FIFOCTL_TMOEN 0x1000 // 0000 0000 0001 0000 -#define FIFOCTL_LRETRY 0x0800 // 0000 0000 0000 1000 -#define FIFOCTL_CRCDIS 0x0400 // 0000 0000 0000 0100 -#define FIFOCTL_NEEDACK 0x0200 // 0000 0000 0000 0010 -#define FIFOCTL_LHEAD 0x0100 // 0000 0000 0000 0001 +#define FIFOCTL_AUTO_FB_1 0x0010 +#define FIFOCTL_AUTO_FB_0 0x0008 +#define FIFOCTL_GRPACK 0x0004 +#define FIFOCTL_11GA 0x0003 +#define FIFOCTL_11GB 0x0002 +#define FIFOCTL_11B 0x0001 +#define FIFOCTL_11A 0x0000 +#define FIFOCTL_RTS 0x8000 +#define FIFOCTL_ISDMA0 0x4000 +#define FIFOCTL_GENINT 0x2000 +#define FIFOCTL_TMOEN 0x1000 +#define FIFOCTL_LRETRY 0x0800 +#define FIFOCTL_CRCDIS 0x0400 +#define FIFOCTL_NEEDACK 0x0200 +#define FIFOCTL_LHEAD 0x0100 //WMAC definition Frag Control -#define FRAGCTL_AES 0x0003 // 0000 0011 0000 0000 -#define FRAGCTL_TKIP 0x0002 // 0000 0010 0000 0000 -#define FRAGCTL_LEGACY 0x0001 // 0000 0001 0000 0000 -#define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000 -#define FRAGCTL_ENDFRAG 0x0300 // 0000 0000 0000 0011 -#define FRAGCTL_MIDFRAG 0x0200 // 0000 0000 0000 0010 -#define FRAGCTL_STAFRAG 0x0100 // 0000 0000 0000 0001 -#define FRAGCTL_NONFRAG 0x0000 // 0000 0000 0000 0000 +#define FRAGCTL_AES 0x0003 +#define FRAGCTL_TKIP 0x0002 +#define FRAGCTL_LEGACY 0x0001 +#define FRAGCTL_NONENCRYPT 0x0000 +#define FRAGCTL_ENDFRAG 0x0300 +#define FRAGCTL_MIDFRAG 0x0200 +#define FRAGCTL_STAFRAG 0x0100 +#define FRAGCTL_NONFRAG 0x0000 #else -#define FIFOCTL_AUTO_FB_1 0x1000 // 0001 0000 0000 0000 -#define FIFOCTL_AUTO_FB_0 0x0800 // 0000 1000 0000 0000 -#define FIFOCTL_GRPACK 0x0400 // 0000 0100 0000 0000 -#define FIFOCTL_11GA 0x0300 // 0000 0011 0000 0000 -#define FIFOCTL_11GB 0x0200 // 0000 0010 0000 0000 -#define FIFOCTL_11B 0x0100 // 0000 0001 0000 0000 -#define FIFOCTL_11A 0x0000 // 0000 0000 0000 0000 -#define FIFOCTL_RTS 0x0080 // 0000 0000 1000 0000 -#define FIFOCTL_ISDMA0 0x0040 // 0000 0000 0100 0000 -#define FIFOCTL_GENINT 0x0020 // 0000 0000 0010 0000 -#define FIFOCTL_TMOEN 0x0010 // 0000 0000 0001 0000 -#define FIFOCTL_LRETRY 0x0008 // 0000 0000 0000 1000 -#define FIFOCTL_CRCDIS 0x0004 // 0000 0000 0000 0100 -#define FIFOCTL_NEEDACK 0x0002 // 0000 0000 0000 0010 -#define FIFOCTL_LHEAD 0x0001 // 0000 0000 0000 0001 +#define FIFOCTL_AUTO_FB_1 0x1000 +#define FIFOCTL_AUTO_FB_0 0x0800 +#define FIFOCTL_GRPACK 0x0400 +#define FIFOCTL_11GA 0x0300 +#define FIFOCTL_11GB 0x0200 +#define FIFOCTL_11B 0x0100 +#define FIFOCTL_11A 0x0000 +#define FIFOCTL_RTS 0x0080 +#define FIFOCTL_ISDMA0 0x0040 +#define FIFOCTL_GENINT 0x0020 +#define FIFOCTL_TMOEN 0x0010 +#define FIFOCTL_LRETRY 0x0008 +#define FIFOCTL_CRCDIS 0x0004 +#define FIFOCTL_NEEDACK 0x0002 +#define FIFOCTL_LHEAD 0x0001 //WMAC definition Frag Control -#define FRAGCTL_AES 0x0300 // 0000 0011 0000 0000 -#define FRAGCTL_TKIP 0x0200 // 0000 0010 0000 0000 -#define FRAGCTL_LEGACY 0x0100 // 0000 0001 0000 0000 -#define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000 -#define FRAGCTL_ENDFRAG 0x0003 // 0000 0000 0000 0011 -#define FRAGCTL_MIDFRAG 0x0002 // 0000 0000 0000 0010 -#define FRAGCTL_STAFRAG 0x0001 // 0000 0000 0000 0001 -#define FRAGCTL_NONFRAG 0x0000 // 0000 0000 0000 0000 +#define FRAGCTL_AES 0x0300 +#define FRAGCTL_TKIP 0x0200 +#define FRAGCTL_LEGACY 0x0100 +#define FRAGCTL_NONENCRYPT 0x0000 +#define FRAGCTL_ENDFRAG 0x0003 +#define FRAGCTL_MIDFRAG 0x0002 +#define FRAGCTL_STAFRAG 0x0001 +#define FRAGCTL_NONFRAG 0x0000 -#endif // #ifdef __BIG_ENDIAN +#endif #define TYPE_TXDMA0 0 #define TYPE_AC0DMA 1 @@ -201,8 +199,6 @@ #define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap) #define TD_FLAGS_PS_RETRY 0x04 // check if PS STA frame re-transmit -/*--------------------- Export Types ------------------------------*/ - // ref_sk_buff is used for mapping the skb structure between pre-built driver-obj & running kernel. // Since different kernel version (2.4x) may change skb structure, i.e. pre-built driver-obj // may link to older skb that leads error. @@ -590,12 +586,5 @@ typedef struct tagSKeyEntry { u32 dwKey4[4]; } __attribute__ ((__packed__)) SKeyEntry; -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ #endif // __DESC_H__ diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index 45fc8a0b9b5c..9bf0ea9af66e 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -185,12 +185,6 @@ typedef enum __device_msg_level { MSG_LEVEL_DEBUG = 4 //Only for debug purpose. } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL; -typedef enum __device_init_type { - DEVICE_INIT_COLD = 0, // cold init - DEVICE_INIT_RESET, // reset init or Dx to D0 power remain init - DEVICE_INIT_DXPL // Dx to D0 power lost init -} DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE; - //++ NDIS related #define MAX_BSSIDINFO_4_PMKID 16 @@ -201,8 +195,7 @@ typedef enum __device_init_type { // PMKID Structures typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; -typedef enum _NDIS_802_11_WEP_STATUS -{ +typedef enum _NDIS_802_11_WEP_STATUS { Ndis802_11WEPEnabled, Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, Ndis802_11WEPDisabled, @@ -218,8 +211,7 @@ typedef enum _NDIS_802_11_WEP_STATUS } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; -typedef enum _NDIS_802_11_STATUS_TYPE -{ +typedef enum _NDIS_802_11_STATUS_TYPE { Ndis802_11StatusType_Authentication, Ndis802_11StatusType_MediaStreamMode, Ndis802_11StatusType_PMKID_CandidateList, @@ -227,13 +219,12 @@ typedef enum _NDIS_802_11_STATUS_TYPE } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; //Added new types for PMKID Candidate lists. -typedef struct _PMKID_CANDIDATE { +struct pmkid_candidate { NDIS_802_11_MAC_ADDRESS BSSID; unsigned long Flags; -} PMKID_CANDIDATE, *PPMKID_CANDIDATE; +}; -typedef struct _BSSID_INFO -{ +typedef struct _BSSID_INFO { NDIS_802_11_MAC_ADDRESS BSSID; NDIS_802_11_PMKID_VALUE PMKID; } BSSID_INFO, *PBSSID_INFO; @@ -248,7 +239,7 @@ typedef struct tagSPMKIDCandidateEvent { NDIS_802_11_STATUS_TYPE StatusType; unsigned long Version; // Version of the structure unsigned long NumCandidates; // No. of pmkid candidates - PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; + struct pmkid_candidate CandidateList[MAX_PMKIDLIST]; } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; //-- @@ -293,8 +284,7 @@ typedef struct tagSCache { #define CB_MAX_RX_FRAG 64 // DeFragment Control Block, used for collecting fragments prior to reassembly -typedef struct tagSDeFragControlBlock -{ +typedef struct tagSDeFragControlBlock { unsigned short wSequence; unsigned short wFragNum; unsigned char abyAddr2[ETH_ALEN]; @@ -332,17 +322,6 @@ typedef struct tagSDeFragControlBlock //for device_set_media_duplex #define DEVICE_LINK_CHANGE 0x00000001UL -//PLICE_DEBUG-> - -typedef struct _RxManagementQueue -{ - int packet_num; - int head, tail; - PSRxMgmtPacket Q[NUM]; -} RxManagementQueue, *PSRxManagementQueue; - -//PLICE_DEBUG<- - typedef struct __device_opt { int nRxDescs0; //Number of RX descriptors0 int nRxDescs1; //Number of RX descriptors1 @@ -391,7 +370,7 @@ typedef struct __device_info { CHIP_TYPE chip_id; - unsigned long PortOffset; + void __iomem *PortOffset; unsigned long dwIsr; u32 memaddr; u32 ioaddr; @@ -429,10 +408,7 @@ typedef struct __device_info { unsigned char byRxMode; spinlock_t lock; -//PLICE_DEBUG-> - struct tasklet_struct RxMngWorkItem; - RxManagementQueue rxManeQueue; -//PLICE_DEBUG<- + //PLICE_DEBUG -> pid_t MLMEThr_pid; struct completion notify; @@ -770,41 +746,7 @@ typedef struct __device_info { bool bCommit; } DEVICE_INFO, *PSDevice; -//PLICE_DEBUG-> - -inline static void EnQueue(PSDevice pDevice, PSRxMgmtPacket pRxMgmtPacket) -{ - if ((pDevice->rxManeQueue.tail+1) % NUM == pDevice->rxManeQueue.head) { - return; - } else { - pDevice->rxManeQueue.tail = (pDevice->rxManeQueue.tail + 1) % NUM; - pDevice->rxManeQueue.Q[pDevice->rxManeQueue.tail] = pRxMgmtPacket; - pDevice->rxManeQueue.packet_num++; - } -} - -inline static PSRxMgmtPacket DeQueue(PSDevice pDevice) -{ - PSRxMgmtPacket pRxMgmtPacket; - if (pDevice->rxManeQueue.tail == pDevice->rxManeQueue.head) { - printk("Queue is Empty\n"); - return NULL; - } else { - int x; - //x=pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM; - pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM; - x = pDevice->rxManeQueue.head; - pRxMgmtPacket = pDevice->rxManeQueue.Q[x]; - pDevice->rxManeQueue.packet_num--; - return pRxMgmtPacket; - } -} - -void InitRxManagementQueue(PSDevice pDevice); - -//PLICE_DEBUG<- - -inline static bool device_get_ip(PSDevice pInfo) { +static inline bool device_get_ip(PSDevice pInfo) { struct in_device *in_dev = (struct in_device *)pInfo->dev->ip_ptr; struct in_ifaddr *ifa; diff --git a/drivers/staging/vt6655/device_cfg.h b/drivers/staging/vt6655/device_cfg.h index 1137adede9ee..8e50e538076f 100644 --- a/drivers/staging/vt6655/device_cfg.h +++ b/drivers/staging/vt6655/device_cfg.h @@ -27,7 +27,6 @@ #ifndef __DEVICE_CONFIG_H #define __DEVICE_CONFIG_H -//#include <linux/config.h> #include <linux/types.h> #include "ttype.h" @@ -60,14 +59,12 @@ struct _version { #define DEVICE_VERSION "1.19.12" #endif -//config file #include <linux/fs.h> #include <linux/fcntl.h> #ifndef CONFIG_PATH #define CONFIG_PATH "/etc/vntconfiguration.dat" #endif -//Max: 2378=2312Payload + 30HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR #define PKT_BUF_SZ 2390 #define MAX_UINTS 8 @@ -81,7 +78,7 @@ typedef enum _chip_type { #define ASSERT(x) \ do { \ if (!(x)) { \ - printk(KERN_ERR "assertion %s failed: file %s line %d\n", \ + pr_err("assertion %s failed: file %s line %d\n", \ #x, __func__, __LINE__); \ *(int *)0 = 0; \ } \ diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 1d3908d044d0..0b583a37f5b3 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -98,8 +98,6 @@ MODULE_AUTHOR("VIA Networking Technologies, Inc., <lyndonchen@vntek.com.tw>"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("VIA Networking Solomon-A/B/G Wireless LAN Adapter Driver"); -static int mlme_kill; - #define DEVICE_PARAM(N, D) #define RX_DESC_MIN0 16 @@ -260,7 +258,7 @@ static CHIP_INFO chip_info_table[] = { {0, NULL} }; -const struct pci_device_id vt6655_pci_id_table[] = { +static const struct pci_device_id vt6655_pci_id_table[] = { { PCI_VDEVICE(VIA, 0x3253), (kernel_ulong_t)chip_info_table}, { 0, } }; @@ -285,7 +283,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int device_notify_reboot(struct notifier_block *, unsigned long event, void *ptr); static int viawget_suspend(struct pci_dev *pcid, pm_message_t state); static int viawget_resume(struct pci_dev *pcid); -struct notifier_block device_notifier = { +static struct notifier_block device_notifier = { .notifier_call = device_notify_reboot, .next = NULL, .priority = 0, @@ -302,11 +300,11 @@ 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 int ethtool_ioctl(struct net_device *dev, void *useraddr); +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, DEVICE_INIT_TYPE InitType); +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); @@ -324,6 +322,7 @@ static int Config_FileGetParameter(unsigned char *string, static char *get_chip_name(int chip_id) { int i; + for (i = 0; chip_info_table[i].name != NULL; i++) if (chip_info_table[i].chip_id == chip_id) break; @@ -385,7 +384,8 @@ device_set_options(PSDevice pDevice) { pDevice->b11hEnable = (pDevice->sOpts.flags & DEVICE_FLAGS_80211h_MODE) ? 1 : 0; pDevice->bDiversityRegCtlON = (pDevice->sOpts.flags & DEVICE_FLAGS_DiversityANT) ? 1 : 0; pDevice->uConnectionRate = pDevice->sOpts.data_rate; - if (pDevice->uConnectionRate < RATE_AUTO) pDevice->bFixRate = true; + if (pDevice->uConnectionRate < RATE_AUTO) + pDevice->bFixRate = true; pDevice->byBBType = pDevice->sOpts.bbp_type; pDevice->byPacketType = pDevice->byBBType; @@ -453,7 +453,7 @@ static void s_vCompleteCurrentMeasure(PSDevice pDevice, unsigned char byResult) // Initialisation of MAC & BBP registers // -static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) +static void device_init_registers(PSDevice pDevice) { unsigned int ii; unsigned char byValue; @@ -462,284 +462,309 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) unsigned char byOFDMPwrdBm = 0; int zonetype = 0; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + MACbShutdown(pDevice->PortOffset); BBvSoftwareReset(pDevice->PortOffset); - if ((InitType == DEVICE_INIT_COLD) || - (InitType == DEVICE_INIT_DXPL)) { - // Do MACbSoftwareReset in MACvInitialize - MACbSoftwareReset(pDevice->PortOffset); - // force CCK - pDevice->bCCK = true; - pDevice->bAES = false; - pDevice->bProtectMode = false; //Only used in 11g type, sync with ERP IE - pDevice->bNonERPPresent = false; - pDevice->bBarkerPreambleMd = false; - pDevice->wCurrentRate = RATE_1M; - pDevice->byTopOFDMBasicRate = RATE_24M; - pDevice->byTopCCKBasicRate = RATE_1M; + /* Do MACbSoftwareReset in MACvInitialize */ + MACbSoftwareReset(pDevice->PortOffset); - pDevice->byRevId = 0; //Target to IF pin while programming to RF chip. + /* force CCK */ + pDevice->bCCK = true; + pDevice->bAES = false; - // init MAC - MACvInitialize(pDevice->PortOffset); + /* Only used in 11g type, sync with ERP IE */ + pDevice->bProtectMode = false; - // Get Local ID - VNSvInPortB(pDevice->PortOffset + MAC_REG_LOCALID, &(pDevice->byLocalID)); + pDevice->bNonERPPresent = false; + pDevice->bBarkerPreambleMd = false; + pDevice->wCurrentRate = RATE_1M; + pDevice->byTopOFDMBasicRate = RATE_24M; + pDevice->byTopCCKBasicRate = RATE_1M; - spin_lock_irq(&pDevice->lock); - SROMvReadAllContents(pDevice->PortOffset, pDevice->abyEEPROM); + /* Target to IF pin while programming to RF chip. */ + pDevice->byRevId = 0; - spin_unlock_irq(&pDevice->lock); + /* init MAC */ + MACvInitialize(pDevice->PortOffset); - // Get Channel range + /* Get Local ID */ + VNSvInPortB(pDevice->PortOffset + MAC_REG_LOCALID, &pDevice->byLocalID); + + spin_lock_irq(&pDevice->lock); - pDevice->byMinChannel = 1; - pDevice->byMaxChannel = CB_MAX_CHANNEL; + SROMvReadAllContents(pDevice->PortOffset, pDevice->abyEEPROM); - // Get Antena - byValue = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA); - if (byValue & EEP_ANTINV) - pDevice->bTxRxAntInv = true; + spin_unlock_irq(&pDevice->lock); + + /* Get Channel range */ + pDevice->byMinChannel = 1; + pDevice->byMaxChannel = CB_MAX_CHANNEL; + + /* Get Antena */ + byValue = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA); + if (byValue & EEP_ANTINV) + pDevice->bTxRxAntInv = true; + else + pDevice->bTxRxAntInv = false; + + byValue &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); + /* if not set default is All */ + if (byValue == 0) + byValue = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); + + pDevice->ulDiversityNValue = 100*260; + pDevice->ulDiversityMValue = 100*16; + pDevice->byTMax = 1; + pDevice->byTMax2 = 4; + pDevice->ulSQ3TH = 0; + pDevice->byTMax3 = 64; + + if (byValue == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) { + pDevice->byAntennaCount = 2; + pDevice->byTxAntennaMode = ANT_B; + pDevice->dwTxAntennaSel = 1; + pDevice->dwRxAntennaSel = 1; + + if (pDevice->bTxRxAntInv) + pDevice->byRxAntennaMode = ANT_A; else - pDevice->bTxRxAntInv = false; + pDevice->byRxAntennaMode = ANT_B; - byValue &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); - if (byValue == 0) // if not set default is All - byValue = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); + byValue1 = SROMbyReadEmbedded(pDevice->PortOffset, + EEP_OFS_ANTENNA); - pDevice->ulDiversityNValue = 100*260; - pDevice->ulDiversityMValue = 100*16; - pDevice->byTMax = 1; - pDevice->byTMax2 = 4; - pDevice->ulSQ3TH = 0; - pDevice->byTMax3 = 64; + if ((byValue1 & 0x08) == 0) + pDevice->bDiversityEnable = false; + else + pDevice->bDiversityEnable = true; + } else { + pDevice->bDiversityEnable = false; + pDevice->byAntennaCount = 1; + pDevice->dwTxAntennaSel = 0; + pDevice->dwRxAntennaSel = 0; + + if (byValue & EEP_ANTENNA_AUX) { + pDevice->byTxAntennaMode = ANT_A; - if (byValue == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) { - pDevice->byAntennaCount = 2; + if (pDevice->bTxRxAntInv) + pDevice->byRxAntennaMode = ANT_B; + else + pDevice->byRxAntennaMode = ANT_A; + } else { pDevice->byTxAntennaMode = ANT_B; - pDevice->dwTxAntennaSel = 1; - pDevice->dwRxAntennaSel = 1; + if (pDevice->bTxRxAntInv) pDevice->byRxAntennaMode = ANT_A; else pDevice->byRxAntennaMode = ANT_B; - // chester for antenna - byValue1 = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA); - if ((byValue1 & 0x08) == 0) - pDevice->bDiversityEnable = false; - else - pDevice->bDiversityEnable = true; - } else { - pDevice->bDiversityEnable = false; - pDevice->byAntennaCount = 1; - pDevice->dwTxAntennaSel = 0; - pDevice->dwRxAntennaSel = 0; - if (byValue & EEP_ANTENNA_AUX) { - pDevice->byTxAntennaMode = ANT_A; - if (pDevice->bTxRxAntInv) - pDevice->byRxAntennaMode = ANT_B; - else - pDevice->byRxAntennaMode = ANT_A; - } else { - pDevice->byTxAntennaMode = ANT_B; - if (pDevice->bTxRxAntInv) - pDevice->byRxAntennaMode = ANT_A; - else - pDevice->byRxAntennaMode = ANT_B; - } } - 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); - -//2008-8-4 <add> by chester -//zonetype initial - pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; - zonetype = Config_FileOperation(pDevice, false, NULL); - if (zonetype >= 0) { //read zonetype file ok! - if ((zonetype == 0) && - (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x00)) { //for USA - pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0; - pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :USA\n"); - } else if ((zonetype == 1) && - (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) { //for Japan - pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01; - pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; - } else if ((zonetype == 2) && - (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) { //for Europe - pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02; - pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :Europe\n"); - } + } - else { - if (zonetype != pDevice->abyEEPROM[EEP_OFS_ZONETYPE]) - printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n", zonetype, pDevice->abyEEPROM[EEP_OFS_ZONETYPE]); - else - printk("Read Zonetype file success,use default zonetype setting[%02x]\n", zonetype); - } - } else - printk("Read Zonetype file fail,use default zonetype setting[%02x]\n", SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ZONETYPE)); + 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); + + /* zonetype initial */ + pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; + zonetype = Config_FileOperation(pDevice, false, NULL); + + if (zonetype >= 0) { + if ((zonetype == 0) && + (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x00)) { + /* for USA */ + pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0; + pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :USA\n"); + } else if ((zonetype == 1) && + (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) { + /* for Japan */ + pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01; + pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; + } else if ((zonetype == 2) && + (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) { + /* for Europe */ + pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02; + pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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", + zonetype, + pDevice->abyEEPROM[EEP_OFS_ZONETYPE]); + else + pr_debug("Read Zonetype file success,use default zonetype setting[%02x]\n", + zonetype); + } + } else { + pr_debug("Read Zonetype file fail,use default zonetype setting[%02x]\n", + SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ZONETYPE)); + } - // Get RFType - pDevice->byRFType = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RFTYPE); + /* Get RFType */ + pDevice->byRFType = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RFTYPE); - if ((pDevice->byRFType & RF_EMU) != 0) { - // force change RevID for VT3253 emu + /* force change RevID for VT3253 emu */ + if ((pDevice->byRFType & RF_EMU) != 0) pDevice->byRevId = 0x80; - } - pDevice->byRFType &= RF_MASK; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType); + pDevice->byRFType &= RF_MASK; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType); - if (!pDevice->bZoneRegExist) - pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; + if (!pDevice->bZoneRegExist) + pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType); - //Init RF module - RFbInit(pDevice); + /* Init RF module */ + RFbInit(pDevice); - //Get Desire Power Value - pDevice->byCurPwr = 0xFF; - pDevice->byCCKPwr = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_CCK); - pDevice->byOFDMPwrG = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_OFDMG); + /* Get Desire Power Value */ + pDevice->byCurPwr = 0xFF; + pDevice->byCCKPwr = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_CCK); + pDevice->byOFDMPwrG = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_OFDMG); - // Load power Table + /* Load power Table */ + for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { + pDevice->abyCCKPwrTbl[ii + 1] = + SROMbyReadEmbedded(pDevice->PortOffset, + (unsigned char)(ii + EEP_OFS_CCK_PWR_TBL)); + if (pDevice->abyCCKPwrTbl[ii + 1] == 0) + pDevice->abyCCKPwrTbl[ii+1] = pDevice->byCCKPwr; - for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { - pDevice->abyCCKPwrTbl[ii + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_CCK_PWR_TBL)); - if (pDevice->abyCCKPwrTbl[ii + 1] == 0) - pDevice->abyCCKPwrTbl[ii+1] = pDevice->byCCKPwr; + pDevice->abyOFDMPwrTbl[ii + 1] = + SROMbyReadEmbedded(pDevice->PortOffset, + (unsigned char)(ii + EEP_OFS_OFDM_PWR_TBL)); + if (pDevice->abyOFDMPwrTbl[ii + 1] == 0) + pDevice->abyOFDMPwrTbl[ii + 1] = pDevice->byOFDMPwrG; - pDevice->abyOFDMPwrTbl[ii + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDM_PWR_TBL)); - if (pDevice->abyOFDMPwrTbl[ii + 1] == 0) - pDevice->abyOFDMPwrTbl[ii + 1] = pDevice->byOFDMPwrG; + pDevice->abyCCKDefaultPwr[ii + 1] = byCCKPwrdBm; + pDevice->abyOFDMDefaultPwr[ii + 1] = byOFDMPwrdBm; + } - pDevice->abyCCKDefaultPwr[ii + 1] = byCCKPwrdBm; - pDevice->abyOFDMDefaultPwr[ii + 1] = byOFDMPwrdBm; - } - //2008-8-4 <add> by chester - //recover 12,13 ,14channel for EUROPE by 11 channel - if (((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) || - (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe)) && - (pDevice->byOriginalZonetype == ZoneType_USA)) { - for (ii = 11; ii < 14; ii++) { - pDevice->abyCCKPwrTbl[ii] = pDevice->abyCCKPwrTbl[10]; - pDevice->abyOFDMPwrTbl[ii] = pDevice->abyOFDMPwrTbl[10]; + /* recover 12,13 ,14channel for EUROPE by 11 channel */ + if (((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) || + (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe)) && + (pDevice->byOriginalZonetype == ZoneType_USA)) { + for (ii = 11; ii < 14; ii++) { + pDevice->abyCCKPwrTbl[ii] = pDevice->abyCCKPwrTbl[10]; + pDevice->abyOFDMPwrTbl[ii] = pDevice->abyOFDMPwrTbl[10]; - } } + } - // Load OFDM A Power Table - for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { //RobertYu:20041224, bug using CB_MAX_CHANNEL - pDevice->abyOFDMPwrTbl[ii + CB_MAX_CHANNEL_24G + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDMA_PWR_TBL)); - pDevice->abyOFDMDefaultPwr[ii + CB_MAX_CHANNEL_24G + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDMA_PWR_dBm)); - } - init_channel_table((void *)pDevice); + /* Load OFDM A Power Table */ + for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { + pDevice->abyOFDMPwrTbl[ii + CB_MAX_CHANNEL_24G + 1] = + SROMbyReadEmbedded(pDevice->PortOffset, + (unsigned char)(ii + EEP_OFS_OFDMA_PWR_TBL)); - if (pDevice->byLocalID > REV_ID_VT3253_B1) { - MACvSelectPage1(pDevice->PortOffset); - VNSvOutPortB(pDevice->PortOffset + MAC_REG_MSRCTL + 1, (MSRCTL1_TXPWR | MSRCTL1_CSAPAREN)); - MACvSelectPage0(pDevice->PortOffset); - } + pDevice->abyOFDMDefaultPwr[ii + CB_MAX_CHANNEL_24G + 1] = + SROMbyReadEmbedded(pDevice->PortOffset, + (unsigned char)(ii + EEP_OFS_OFDMA_PWR_dBm)); + } - // use relative tx timeout and 802.11i D4 - MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_CFG, (CFG_TKIPOPT | CFG_NOTXTIMEOUT)); + init_channel_table((void *)pDevice); - // set performance parameter by registry - MACvSetShortRetryLimit(pDevice->PortOffset, pDevice->byShortRetryLimit); - MACvSetLongRetryLimit(pDevice->PortOffset, pDevice->byLongRetryLimit); + if (pDevice->byLocalID > REV_ID_VT3253_B1) { + MACvSelectPage1(pDevice->PortOffset); - // reset TSF counter - VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST); - // enable TSF counter - VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN); + VNSvOutPortB(pDevice->PortOffset + MAC_REG_MSRCTL + 1, + (MSRCTL1_TXPWR | MSRCTL1_CSAPAREN)); - // initialize BBP registers - BBbVT3253Init(pDevice); + MACvSelectPage0(pDevice->PortOffset); + } - if (pDevice->bUpdateBBVGA) { - pDevice->byBBVGACurrent = pDevice->abyBBVGA[0]; - pDevice->byBBVGANew = pDevice->byBBVGACurrent; - BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]); - } - BBvSetRxAntennaMode(pDevice->PortOffset, pDevice->byRxAntennaMode); - BBvSetTxAntennaMode(pDevice->PortOffset, pDevice->byTxAntennaMode); + /* use relative tx timeout and 802.11i D4 */ + MACvWordRegBitsOn(pDevice->PortOffset, + MAC_REG_CFG, (CFG_TKIPOPT | CFG_NOTXTIMEOUT)); - pDevice->byCurrentCh = 0; + /* set performance parameter by registry */ + MACvSetShortRetryLimit(pDevice->PortOffset, pDevice->byShortRetryLimit); + MACvSetLongRetryLimit(pDevice->PortOffset, pDevice->byLongRetryLimit); - // Set BB and packet type at the same time. - // Set Short Slot Time, xIFS, and RSPINF. - if (pDevice->uConnectionRate == RATE_AUTO) - pDevice->wCurrentRate = RATE_54M; - else - pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate; + /* reset TSF counter */ + VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST); + /* enable TSF counter */ + VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN); - // default G Mode - VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_11G); - VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_AUTO); + /* initialize BBP registers */ + BBbVT3253Init(pDevice); - pDevice->bRadioOff = false; + if (pDevice->bUpdateBBVGA) { + pDevice->byBBVGACurrent = pDevice->abyBBVGA[0]; + pDevice->byBBVGANew = pDevice->byBBVGACurrent; + BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]); + } - pDevice->byRadioCtl = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RADIOCTL); - pDevice->bHWRadioOff = false; + BBvSetRxAntennaMode(pDevice->PortOffset, pDevice->byRxAntennaMode); + BBvSetTxAntennaMode(pDevice->PortOffset, pDevice->byTxAntennaMode); - if (pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) { - // Get GPIO - MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO); -//2008-4-14 <add> by chester for led issue -#ifdef FOR_LED_ON_NOTEBOOK - if (pDevice->byGPIO & GPIO0_DATA) - pDevice->bHWRadioOff = true; + pDevice->byCurrentCh = 0; - if (!(pDevice->byGPIO & GPIO0_DATA)) - pDevice->bHWRadioOff = false; - } + /* Set BB and packet type at the same time. */ + /* Set Short Slot Time, xIFS, and RSPINF. */ + if (pDevice->uConnectionRate == RATE_AUTO) + pDevice->wCurrentRate = RATE_54M; + else + pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate; - if (pDevice->bRadioControlOff) - CARDbRadioPowerOff(pDevice); - else - CARDbRadioPowerOn(pDevice); -#else - if (((pDevice->byGPIO & GPIO0_DATA) && !(pDevice->byRadioCtl & EEP_RADIOCTL_INV)) || - (!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) { + /* default G Mode */ + VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_11G); + VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_AUTO); + + pDevice->bRadioOff = false; + + pDevice->byRadioCtl = SROMbyReadEmbedded(pDevice->PortOffset, + EEP_OFS_RADIOCTL); + pDevice->bHWRadioOff = false; + + if (pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) { + /* Get GPIO */ + MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO); + + if (((pDevice->byGPIO & GPIO0_DATA) && + !(pDevice->byRadioCtl & EEP_RADIOCTL_INV)) || + (!(pDevice->byGPIO & GPIO0_DATA) && + (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) pDevice->bHWRadioOff = true; - } } + if (pDevice->bHWRadioOff || pDevice->bRadioControlOff) CARDbRadioPowerOff(pDevice); -#endif -} -pMgmt->eScanType = WMAC_SCAN_PASSIVE; -// get Permanent network address -SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr); -DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Network address = %pM\n", - pDevice->abyCurrentNetAddr); + pMgmt->eScanType = WMAC_SCAN_PASSIVE; -// reset Tx pointer -CARDvSafeResetRx(pDevice); -// reset Rx pointer -CARDvSafeResetTx(pDevice); + /* get Permanent network address */ + SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Network address = %pM\n", + pDevice->abyCurrentNetAddr); -if (pDevice->byLocalID <= REV_ID_VT3253_A1) - MACvRegBitsOn(pDevice->PortOffset, MAC_REG_RCR, RCR_WPAERR); + /* reset Tx pointer */ + CARDvSafeResetRx(pDevice); + /* reset Rx pointer */ + CARDvSafeResetTx(pDevice); -pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; + if (pDevice->byLocalID <= REV_ID_VT3253_A1) + MACvRegBitsOn(pDevice->PortOffset, MAC_REG_RCR, RCR_WPAERR); -// Turn On Rx DMA -MACvReceive0(pDevice->PortOffset); -MACvReceive1(pDevice->PortOffset); + pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; -// start the adapter -MACvStart(pDevice->PortOffset); + /* Turn On Rx DMA */ + MACvReceive0(pDevice->PortOffset); + MACvReceive1(pDevice->PortOffset); -netif_stop_queue(pDevice->dev); + /* start the adapter */ + MACvStart(pDevice->PortOffset); + + netif_stop_queue(pDevice->dev); } -static void device_init_diversity_timer(PSDevice pDevice) { +static void device_init_diversity_timer(PSDevice pDevice) +{ init_timer(&pDevice->TimerSQ3Tmax1); pDevice->TimerSQ3Tmax1.data = (unsigned long) pDevice; pDevice->TimerSQ3Tmax1.function = (TimerFunction)TimerSQ3CallBack; @@ -754,8 +779,6 @@ static void device_init_diversity_timer(PSDevice pDevice) { pDevice->TimerSQ3Tmax3.data = (unsigned long) pDevice; pDevice->TimerSQ3Tmax3.function = (TimerFunction)TimerState1CallBack; pDevice->TimerSQ3Tmax3.expires = RUN_AT(HZ); - - return; } static bool device_release_WPADEV(PSDevice pDevice) @@ -806,8 +829,9 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) PCHIP_INFO pChip_info = (PCHIP_INFO)ent->driver_data; PSDevice pDevice; int rc; + if (device_nics++ >= MAX_UINTS) { - printk(KERN_NOTICE DEVICE_NAME ": already found %d NICs\n", device_nics); + pr_notice(DEVICE_NAME ": already found %d NICs\n", device_nics); return -ENODEV; } @@ -816,7 +840,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) pDevice = (PSDevice) netdev_priv(dev); if (dev == NULL) { - printk(KERN_ERR DEVICE_NAME ": allocate net device failed \n"); + pr_err(DEVICE_NAME ": allocate net device failed\n"); return -ENOMEM; } @@ -824,8 +848,8 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) SET_NETDEV_DEV(dev, &pcid->dev); if (bFirst) { - printk(KERN_NOTICE "%s Ver. %s\n", DEVICE_FULL_DRV_NAM, DEVICE_VERSION); - printk(KERN_NOTICE "Copyright (c) 2003 VIA Networking Technologies, Inc.\n"); + pr_notice("%s Ver. %s\n", DEVICE_FULL_DRV_NAM, DEVICE_VERSION); + pr_notice("Copyright (c) 2003 VIA Networking Technologies, Inc.\n"); bFirst = false; } @@ -841,10 +865,10 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) dev->irq = pcid->irq; #ifdef DEBUG - printk("Before get pci_info memaddr is %x\n", pDevice->memaddr); + pr_debug("Before get pci_info memaddr is %x\n", pDevice->memaddr); #endif if (!device_get_pci_info(pDevice, pcid)) { - printk(KERN_ERR DEVICE_NAME ": Failed to find PCI device.\n"); + pr_err(DEVICE_NAME ": Failed to find PCI device.\n"); device_free_info(pDevice); return -ENODEV; } @@ -853,7 +877,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) #ifdef DEBUG - printk("after get pci_info memaddr is %x, io addr is %x,io_size is %d\n", pDevice->memaddr, pDevice->ioaddr, pDevice->io_size); + pr_debug("after get pci_info memaddr is %x, io addr is %x,io_size is %d\n", pDevice->memaddr, pDevice->ioaddr, pDevice->io_size); { int i; u32 bar, len; @@ -867,9 +891,9 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) 0}; for (i = 0; address[i]; i++) { pci_read_config_dword(pcid, address[i], &bar); - printk("bar %d is %x\n", i, bar); + pr_debug("bar %d is %x\n", i, bar); if (!bar) { - printk("bar %d not implemented\n", i); + pr_debug("bar %d not implemented\n", i); continue; } if (bar & PCI_BASE_ADDRESS_SPACE_IO) { @@ -878,12 +902,12 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) len = bar & (PCI_BASE_ADDRESS_IO_MASK & 0xFFFF); len = len & ~(len - 1); - printk("IO space: len in IO %x, BAR %d\n", len, i); + pr_debug("IO space: len in IO %x, BAR %d\n", len, i); } else { len = bar & 0xFFFFFFF0; len = ~len + 1; - printk("len in MEM %x, BAR %d\n", len, i); + pr_debug("len in MEM %x, BAR %d\n", len, i); } } } @@ -891,17 +915,17 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) #endif - pDevice->PortOffset = (unsigned long)ioremap(pDevice->memaddr & PCI_BASE_ADDRESS_MEM_MASK, pDevice->io_size); + pDevice->PortOffset = ioremap(pDevice->memaddr & PCI_BASE_ADDRESS_MEM_MASK, pDevice->io_size); - if (pDevice->PortOffset == 0) { - printk(KERN_ERR DEVICE_NAME ": Failed to IO remapping ..\n"); + if (pDevice->PortOffset == NULL) { + pr_err(DEVICE_NAME ": Failed to IO remapping ..\n"); device_free_info(pDevice); return -ENODEV; } rc = pci_request_regions(pcid, DEVICE_NAME); if (rc) { - printk(KERN_ERR DEVICE_NAME ": Failed to find PCI device\n"); + pr_err(DEVICE_NAME ": Failed to find PCI device\n"); device_free_info(pDevice); return -ENODEV; } @@ -911,18 +935,14 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) unsigned char value; VNSvInPortB(pDevice->PortOffset+0x4F, &value); - printk("Before write: value is %x\n", value); + pr_debug("Before write: value is %x\n", value); VNSvOutPortB(pDevice->PortOffset, value); VNSvInPortB(pDevice->PortOffset+0x4F, &value); - printk("After write: value is %x\n", value); -#endif - -#ifdef IO_MAP - pDevice->PortOffset = pDevice->ioaddr; + pr_debug("After write: value is %x\n", value); #endif // do reset if (!MACbSoftwareReset(pDevice->PortOffset)) { - printk(KERN_ERR DEVICE_NAME ": Failed to access MAC hardware..\n"); + pr_err(DEVICE_NAME ": Failed to access MAC hardware..\n"); device_free_info(pDevice); return -ENODEV; } @@ -948,7 +968,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) rc = register_netdev(dev); if (rc) { - printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n"); + pr_err(DEVICE_NAME " Failed to register netdev\n"); device_free_info(pDevice); return -ENODEV; } @@ -963,14 +983,10 @@ static void device_print_info(PSDevice pDevice) 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); -#ifdef IO_MAP - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IO=0x%lx ", (unsigned long)pDevice->ioaddr); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d \n", pDevice->dev->irq); -#else + 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); -#endif + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d\n", pDevice->dev->irq); } static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice, @@ -997,7 +1013,8 @@ 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(PSDevice pDevice, struct pci_dev *pcid) +{ u16 pci_cmd; u8 b; unsigned int cis_addr; @@ -1006,6 +1023,7 @@ static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid) { unsigned char value = 0x00; int ii, j; u16 max_lat = 0x0000; + memset(pci_config, 0x00, 256); #endif @@ -1033,17 +1051,18 @@ static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid) { } for (ii = 0, j = 1; ii < 0x100; ii++, j++) { if (j % 16 == 0) { - printk("%x:", pci_config[ii]); - printk("\n"); + pr_debug("%x:", pci_config[ii]); + pr_debug("\n"); } else { - printk("%x:", pci_config[ii]); + pr_debug("%x:", pci_config[ii]); } } #endif return true; } -static void device_free_info(PSDevice pDevice) { +static void device_free_info(PSDevice pDevice) +{ PSDevice ptr; struct net_device *dev = pDevice->dev; @@ -1054,7 +1073,7 @@ static void device_free_info(PSDevice pDevice) { //2008-07-21-01<Add>by MikeLiu //unregister wpadev if (wpa_set_wpadev(pDevice, 0) != 0) - printk("unregister wpadev fail?\n"); + pr_err("unregister wpadev fail?\n"); if (pDevice_Infos == NULL) return; @@ -1079,7 +1098,7 @@ static void device_free_info(PSDevice pDevice) { unregister_netdev(dev); if (pDevice->PortOffset) - iounmap((void *)pDevice->PortOffset); + iounmap(pDevice->PortOffset); if (pDevice->pcid) pci_release_regions(pDevice->pcid); @@ -1087,29 +1106,22 @@ static void device_free_info(PSDevice pDevice) { free_netdev(dev); } -static bool device_init_rings(PSDevice pDevice) { +static bool device_init_rings(PSDevice 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); 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); @@ -1118,13 +1130,12 @@ 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); pci_free_consistent(pDevice->pcid, @@ -1137,13 +1148,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); @@ -1178,7 +1182,8 @@ static bool device_init_rings(PSDevice pDevice) { return true; } -static void device_free_rings(PSDevice pDevice) { +static void device_free_rings(PSDevice pDevice) +{ pci_free_consistent(pDevice->pcid, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + @@ -1198,7 +1203,8 @@ static void device_free_rings(PSDevice pDevice) { ); } -static void device_init_rd0_ring(PSDevice pDevice) { +static void device_init_rd0_ring(PSDevice pDevice) +{ int i; dma_addr_t curr = pDevice->rd0_pool_dma; PSRxDesc pDesc; @@ -1222,7 +1228,8 @@ 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(PSDevice pDevice) +{ int i; dma_addr_t curr = pDevice->rd1_pool_dma; PSRxDesc pDesc; @@ -1246,7 +1253,8 @@ 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(PSDevice pDevice) +{ int i; PSDeFragControlBlock pDeF; @@ -1262,7 +1270,8 @@ static void device_init_defrag_cb(PSDevice pDevice) { pDevice->cbFreeDFCB = pDevice->cbDFCB; } -static void device_free_rd0_ring(PSDevice pDevice) { +static void device_free_rd0_ring(PSDevice pDevice) +{ int i; for (i = 0; i < pDevice->sOpts.nRxDescs0; i++) { @@ -1278,7 +1287,8 @@ static void device_free_rd0_ring(PSDevice pDevice) { } } -static void device_free_rd1_ring(PSDevice pDevice) { +static void device_free_rd1_ring(PSDevice pDevice) +{ int i; for (i = 0; i < pDevice->sOpts.nRxDescs1; i++) { @@ -1294,7 +1304,8 @@ static void device_free_rd1_ring(PSDevice pDevice) { } } -static void device_free_frag_buf(PSDevice pDevice) { +static void device_free_frag_buf(PSDevice pDevice) +{ PSDeFragControlBlock pDeF; int i; @@ -1307,7 +1318,8 @@ static void device_free_frag_buf(PSDevice pDevice) { } } -static void device_init_td0_ring(PSDevice pDevice) { +static void device_init_td0_ring(PSDevice pDevice) +{ int i; dma_addr_t curr; PSTxDesc pDesc; @@ -1331,7 +1343,8 @@ 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(PSDevice pDevice) +{ int i; dma_addr_t curr; PSTxDesc pDesc; @@ -1356,8 +1369,10 @@ 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(PSDevice pDevice) +{ int i; + for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++) { PSTxDesc pDesc = &(pDevice->apTD0Rings[i]); PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; @@ -1373,7 +1388,8 @@ static void device_free_td0_ring(PSDevice pDevice) { } } -static void device_free_td1_ring(PSDevice pDevice) { +static void device_free_td1_ring(PSDevice pDevice) +{ int i; for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++) { @@ -1393,7 +1409,8 @@ static void device_free_td1_ring(PSDevice pDevice) { /*-----------------------------------------------------------------*/ -static int device_rx_srv(PSDevice pDevice, unsigned int uIdx) { +static int device_rx_srv(PSDevice pDevice, unsigned int uIdx) +{ PSRxDesc pRD; int works = 0; @@ -1418,7 +1435,8 @@ 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(PSDevice pDevice, PSRxDesc pRD) +{ PDEVICE_RD_INFO pRDInfo = pRD->pRDInfo; pRDInfo->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); @@ -1438,7 +1456,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(PSDevice pDevice, PSDeFragControlBlock pDeF) +{ pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); if (pDeF->skb == NULL) return false; @@ -1448,7 +1467,8 @@ 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(PSDevice pDevice, unsigned int uIdx) +{ PSTxDesc pTD; bool bFull = false; int works = 0; @@ -1510,7 +1530,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx call back netif..\n"); skb = pTD->pTDInfo->skb; skb->dev = pDevice->apdev; skb_reset_mac_header(skb); @@ -1571,7 +1591,8 @@ 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(PSDevice pDevice, unsigned short status) +{ if (status & ISR_FETALERR) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: Hardware fatal error.\n", @@ -1585,7 +1606,8 @@ 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(PSDevice pDevice, PSTxDesc pDesc) +{ PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; struct sk_buff *skb = pTDInfo->skb; @@ -1599,44 +1621,12 @@ static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc) { dev_kfree_skb_irq(skb); pTDInfo->skb_dma = 0; - pTDInfo->skb = 0; + pTDInfo->skb = NULL; pTDInfo->byFlags = 0; } -//PLICE_DEBUG -> -void InitRxManagementQueue(PSDevice pDevice) +static int device_open(struct net_device *dev) { - pDevice->rxManeQueue.packet_num = 0; - pDevice->rxManeQueue.head = pDevice->rxManeQueue.tail = 0; -} -//PLICE_DEBUG<- - -//PLICE_DEBUG -> -int MlmeThread( - void *Context) -{ - PSDevice pDevice = (PSDevice) Context; - PSRxMgmtPacket pRxMgmtPacket; - - while (1) { - spin_lock_irq(&pDevice->lock); - while (pDevice->rxManeQueue.packet_num != 0) { - pRxMgmtPacket = DeQueue(pDevice); - vMgrRxManagePacket(pDevice, pDevice->pMgmt, pRxMgmtPacket); - } - spin_unlock_irq(&pDevice->lock); - if (mlme_kill == 0) - break; - - schedule(); - if (mlme_kill == 0) - break; - } - - return 0; -} - -static int device_open(struct net_device *dev) { PSDevice pDevice = (PSDevice)netdev_priv(dev); int i; #ifdef WPA_SM_Transtatus @@ -1673,24 +1663,9 @@ static int device_open(struct net_device *dev) { vMgrObjectInit(pDevice); vMgrTimerInit(pDevice); -//PLICE_DEBUG-> -#ifdef TASK_LET - tasklet_init(&pDevice->RxMngWorkItem, (void *)MngWorkItem, (unsigned long)pDevice); -#endif -#ifdef THREAD - InitRxManagementQueue(pDevice); - mlme_kill = 0; - mlme_task = kthread_run(MlmeThread, (void *)pDevice, "MLME"); - if (IS_ERR(mlme_task)) { - printk("thread create fail\n"); - return -1; - } - - mlme_kill = 1; -#endif - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n"); - device_init_registers(pDevice, DEVICE_INIT_COLD); + device_init_registers(pDevice); + MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr); memcpy(pDevice->pMgmt->abyMACAddr, pDevice->abyCurrentNetAddr, ETH_ALEN); device_set_multi(pDevice->dev); @@ -1730,17 +1705,15 @@ static int device_open(struct net_device *dev) { } pDevice->flags |= DEVICE_FLAGS_OPENED; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success..\n"); return 0; } -static int device_close(struct net_device *dev) { +static int device_close(struct net_device *dev) +{ PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = pDevice->pMgmt; //PLICE_DEBUG-> -#ifdef THREAD - mlme_kill = 0; -#endif //PLICE_DEBUG<- //2007-1121-02<Add>by EinsnLiu if (pDevice->bLinkPass) { @@ -1758,9 +1731,6 @@ static int device_close(struct net_device *dev) { del_timer(&pDevice->TimerSQ3Tmax3); } -#ifdef TASK_LET - tasklet_kill(&pDevice->RxMngWorkItem); -#endif netif_stop_queue(dev); pDevice->bCmdRunning = false; MACbShutdown(pDevice->PortOffset); @@ -1782,11 +1752,12 @@ 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close..\n"); return 0; } -static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { +static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) +{ PSDevice pDevice = netdev_priv(dev); unsigned char *pbMPDU; unsigned int cbMPDULen = 0; @@ -1817,7 +1788,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(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeIndex) +{ PSMgmtObject pMgmt = pDevice->pMgmt; PSTxDesc pHeadTD, pLastTD; unsigned int cbFrameBodySize; @@ -1889,7 +1861,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); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = %d\n", pDevice->wCurrentRate); if (pDevice->wCurrentRate <= RATE_11M) { byPktType = PK_TYPE_11B; @@ -1956,7 +1928,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) { +static int device_xmit(struct sk_buff *skb, struct net_device *dev) +{ PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = pDevice->pMgmt; @@ -2032,7 +2005,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Unknown STA not found in node DB\n"); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2070,9 +2043,9 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { } } 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_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 "%x\n", *(pbyBSSID+ii)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "\n"); // get pairwise key @@ -2130,7 +2103,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { if (pDevice->bFixRate) { #ifdef PLICE_DEBUG - printk("Fix Rate: PhyType is %d,ConnectionRate is %d\n", pDevice->eCurrentPHYType, pDevice->uConnectionRate); + pr_debug("Fix Rate: PhyType is %d,ConnectionRate is %d\n", pDevice->eCurrentPHYType, pDevice->uConnectionRate); #endif if (pDevice->eCurrentPHYType == PHY_TYPE_11B) { @@ -2268,7 +2241,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { pDevice->apCurrTD[TYPE_AC0DMA] = pHeadTD; if (pDevice->bFixRate) - printk("FixRate:Rate is %d,TxPower is %d\n", pDevice->wCurrentRate, pDevice->byCurPwr); + pr_debug("FixRate:Rate is %d,TxPower is %d\n", pDevice->wCurrentRate, pDevice->byCurPwr); { unsigned char Protocol_Version; //802.1x Authentication @@ -2276,6 +2249,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { unsigned char Descriptor_type; unsigned short Key_info; bool bTxeapol_key = false; + Protocol_Version = skb->data[ETH_HLEN]; Packet_Type = skb->data[ETH_HLEN+1]; Descriptor_type = skb->data[ETH_HLEN+1+1+2]; @@ -2289,10 +2263,10 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { (Key_info & BIT8) && (Key_info & BIT9)) { //send 2/2 key pDevice->fWPA_Authened = true; if (Descriptor_type == 254) - printk("WPA "); + pr_debug("WPA "); else - printk("WPA2 "); - printk("Authentication completed!!\n"); + pr_debug("WPA2 "); + pr_debug("Authentication completed!!\n"); } } } @@ -2307,7 +2281,8 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { return 0; } -static irqreturn_t device_intr(int irq, void *dev_instance) { +static irqreturn_t device_intr(int irq, void *dev_instance) +{ struct net_device *dev = dev_instance; PSDevice pDevice = (PSDevice)netdev_priv(dev); @@ -2318,6 +2293,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { int handled = 0; unsigned char byData = 0; int ii = 0; + unsigned long flags; MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr); @@ -2331,7 +2307,8 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { handled = 1; MACvIntDisable(pDevice->PortOffset); - spin_lock_irq(&pDevice->lock); + + spin_lock_irqsave(&pDevice->lock, flags); //Make sure current page is 0 VNSvInPortB(pDevice->PortOffset + MAC_REG_PAGE1SEL, &byOrgPageSel); @@ -2351,7 +2328,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ISR_FETALERR\n"); VNSvOutPortB(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, 0); VNSvOutPortW(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI); device_error(pDevice, pDevice->dwIsr); @@ -2560,7 +2537,8 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { if (byOrgPageSel == 1) MACvSelectPage1(pDevice->PortOffset); - spin_unlock_irq(&pDevice->lock); + spin_unlock_irqrestore(&pDevice->lock, flags); + MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); return IRQ_RETVAL(handled); @@ -2574,6 +2552,7 @@ static inline u32 ether_crc(int length, unsigned char *data) 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); @@ -2598,45 +2577,45 @@ static int Config_FileGetParameter(unsigned char *string, return true; } -int Config_FileOperation(PSDevice pDevice,bool fwrite,unsigned char *Parameter) +int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter) { unsigned char *buffer = kmalloc(1024, GFP_KERNEL); unsigned char tmpbuffer[20]; struct file *file; - int result=0; + int result = 0; if (!buffer) { - printk("allocate mem for file fail?\n"); + pr_err("allocate mem for file fail?\n"); return -1; } file = filp_open(CONFIG_PATH, O_RDONLY, 0); if (IS_ERR(file)) { kfree(buffer); - printk("Config_FileOperation:open file fail?\n"); + pr_err("Config_FileOperation:open file fail?\n"); return -1; } if (kernel_read(file, 0, buffer, 1024) < 0) { - printk("read file error?\n"); + pr_err("read file error?\n"); result = -1; goto error1; } if (Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer)!=true) { - printk("get parameter error?\n"); + pr_err("get parameter error?\n"); result = -1; goto error1; } - if (memcmp(tmpbuffer,"USA",3)==0) { + 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; - printk("Unknown Zonetype[%s]?\n",tmpbuffer); + pr_err("Unknown Zonetype[%s]?\n", tmpbuffer); } error1: @@ -2645,7 +2624,8 @@ error1: return result; } -static void device_set_multi(struct net_device *dev) { +static void device_set_multi(struct net_device *dev) +{ PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = pDevice->pMgmt; @@ -2669,6 +2649,7 @@ static void device_set_multi(struct net_device *dev) { memset(mc_filter, 0, sizeof(mc_filter)); netdev_for_each_mc_addr(ha, dev) { int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; + mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31)); } MACvSelectPage1(pDevice->PortOffset); @@ -2689,13 +2670,15 @@ static void device_set_multi(struct net_device *dev) { 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) { +static struct net_device_stats *device_get_stats(struct net_device *dev) +{ PSDevice pDevice = (PSDevice)netdev_priv(dev); return &pDevice->stats; } -static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { +static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +{ PSDevice pDevice = (PSDevice)netdev_priv(dev); struct iwreq *wrq = (struct iwreq *)rq; @@ -2732,6 +2715,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { { char essid[IW_ESSID_MAX_SIZE+1]; + if (wrq->u.essid.length > IW_ESSID_MAX_SIZE) { rc = -E2BIG; break; @@ -2751,6 +2735,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { { char essid[IW_ESSID_MAX_SIZE+1]; + if (wrq->u.essid.pointer) rc = iwctl_giwessid(dev, NULL, &(wrq->u.essid), essid); @@ -2773,13 +2758,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN\n"); rc = -EOPNOTSUPP; break; // Get current station name case SIOCGIWNICKN: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN\n"); rc = -EOPNOTSUPP; break; @@ -2863,7 +2848,8 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { char abyKey[WLAN_WEP232_KEYLEN]; rc = iwctl_giwencode(dev, NULL, &(wrq->u.encoding), abyKey); - if (rc != 0) break; + if (rc != 0) + break; if (wrq->u.encoding.pointer) { if (copy_to_user(wrq->u.encoding.pointer, abyKey, @@ -2875,12 +2861,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW\n"); rc = -EOPNOTSUPP; break; case SIOCSIWTXPOW: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWTXPOW \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWTXPOW\n"); rc = -EOPNOTSUPP; break; @@ -2923,7 +2909,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSENS\n"); rc = -EOPNOTSUPP; break; @@ -2947,49 +2933,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY\n"); rc = -EOPNOTSUPP; break; // Get the spy list case SIOCGIWSPY: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSPY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSPY\n"); rc = -EOPNOTSUPP; break; #endif // WIRELESS_SPY case SIOCGIWPRIV: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPRIV \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n"); rc = iwctl_siwauth(dev, NULL, &(wrq->u.param), NULL); break; case SIOCGIWAUTH: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAUTH \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAUTH\n"); rc = iwctl_giwauth(dev, NULL, &(wrq->u.param), NULL); break; case SIOCSIWGENIE: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWGENIE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 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"); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 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)) { @@ -3009,12 +2996,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODEEXT\n"); rc = iwctl_giwencodeext(dev, NULL, &(wrq->u.encoding), NULL); break; case SIOCSIWMLME: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME\n"); rc = iwctl_siwmlme(dev, NULL, &(wrq->u.data), wrq->u.data.pointer); break; @@ -3067,7 +3054,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { break; case SIOCETHTOOL: - return ethtool_ioctl(dev, (void *)rq->ifr_data); + return ethtool_ioctl(dev, rq->ifr_data); // All other calls are currently unsupported default: @@ -3103,7 +3090,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { return rc; } -static int ethtool_ioctl(struct net_device *dev, void *useraddr) +static int ethtool_ioctl(struct net_device *dev, void __user *useraddr) { u32 ethcmd; @@ -3113,6 +3100,7 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr) switch (ethcmd) { case ETHTOOL_GDRVINFO: { struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; + strncpy(info.driver, DEVICE_NAME, sizeof(info.driver)-1); strncpy(info.version, DEVICE_VERSION, sizeof(info.version)-1); if (copy_to_user(useraddr, &info, sizeof(info))) @@ -3169,6 +3157,7 @@ static int device_notify_reboot(struct notifier_block *nb, unsigned long event, void *p) { struct pci_dev *pdev = NULL; + switch (event) { case SYS_DOWN: case SYS_HALT: @@ -3224,7 +3213,7 @@ viawget_resume(struct pci_dev *pcid) if (netif_running(pDevice->dev)) { spin_lock_irq(&pDevice->lock); MACvRestoreContext(pDevice->PortOffset, pDevice->abyMacContext); - device_init_registers(pDevice, DEVICE_INIT_DXPL); + device_init_registers(pDevice); if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS pMgmt->sNodeDBTable[0].bActive = false; pDevice->bLinkPass = false; diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index 7ddaf2603ba6..0bcf6c7472fe 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -54,6 +54,7 @@ #include "rf.h" #include "iowpa.h" #include "aes_ccmp.h" +#include "dpc.h" /*--------------------- Static Definitions -------------------------*/ @@ -62,7 +63,7 @@ /*--------------------- Static Variables --------------------------*/ static int msglevel = MSG_LEVEL_INFO; -const unsigned char acbyRxRate[MAX_RATE] = +static const unsigned char acbyRxRate[MAX_RATE] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; /*--------------------- Static Functions --------------------------*/ @@ -267,23 +268,6 @@ s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize, *pcbHeaderSize = cbHeaderSize; } -//PLICE_DEBUG -> - -void MngWorkItem(void *Context) -{ - PSRxMgmtPacket pRxMgmtPacket; - PSDevice pDevice = (PSDevice) Context; - - spin_lock_irq(&pDevice->lock); - while (pDevice->rxManeQueue.packet_num != 0) { - pRxMgmtPacket = DeQueue(pDevice); - vMgrRxManagePacket(pDevice, pDevice->pMgmt, pRxMgmtPacket); - } - spin_unlock_irq(&pDevice->lock); -} - -//PLICE_DEBUG<- - bool device_receive_frame( PSDevice pDevice, @@ -340,7 +324,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 1\n"); return false; } @@ -358,7 +342,7 @@ 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 2\n"); return false; } //PLICE_DEBUG-> @@ -545,21 +529,9 @@ device_receive_frame( } pRxPacket->byRxRate = s_byGetRateIdx(*pbyRxRate); pRxPacket->byRxChannel = (*pbyRxSts) >> 2; -//PLICE_DEBUG-> -#ifdef THREAD - EnQueue(pDevice, pRxPacket); -#else - -#ifdef TASK_LET - EnQueue(pDevice, pRxPacket); - tasklet_schedule(&pDevice->RxMngWorkItem); -#else vMgrRxManagePacket((void *)pDevice, pDevice->pMgmt, pRxPacket); -#endif -#endif -//PLICE_DEBUG<- // hostap Deamon handle 802.11 management if (pDevice->bEnableHostapd) { skb->dev = pDevice->apdev; @@ -603,6 +575,7 @@ device_receive_frame( { unsigned char Protocol_Version; //802.1x Authentication unsigned char Packet_Type; //802.1x Authentication + if (bIsWEP) cbIVOffset = 8; else @@ -669,7 +642,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); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wEtherType = %04x\n", wEtherType); if (wEtherType == ETH_P_PAE) { skb->dev = pDevice->apdev; @@ -760,6 +733,7 @@ device_receive_frame( union iwreq_data wrqu; struct iw_michaelmicfailure ev; int keyidx = pbyFrame[cbHeaderSize+3] >> 6; //top two-bits + memset(&ev, 0, sizeof(ev)); ev.flags = keyidx & IW_MICFAILURE_KEY_ID; if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && @@ -1113,6 +1087,7 @@ static bool s_bHandleRxEncryption( // Software TKIP // 1. 3253 A PS802_11Header 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); @@ -1175,7 +1150,8 @@ static bool s_bHostWepRxEncryption( if (byDecMode == KEY_CTL_WEP) { // handle WEP - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byDecMode == KEY_CTL_WEP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byDecMode == KEY_CTL_WEP\n"); + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true) || !bOnFly) { @@ -1214,7 +1190,7 @@ static bool s_bHostWepRxEncryption( // Software TKIP // 1. 3253 A // 2. NotOnFly - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "soft KEY_CTL_TKIP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "soft KEY_CTL_TKIP\n"); pMACHeader = (PS802_11Header)(pbyFrame); TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); @@ -1276,7 +1252,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"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available\n"); } else { skbcpy->dev = pDevice->dev; skbcpy->len = FrameSize; diff --git a/drivers/staging/vt6655/dpc.h b/drivers/staging/vt6655/dpc.h index 0ce31557d5da..4914890115e4 100644 --- a/drivers/staging/vt6655/dpc.h +++ b/drivers/staging/vt6655/dpc.h @@ -33,20 +33,10 @@ #include "device.h" #include "wcmd.h" -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - bool device_receive_frame( PSDevice pDevice, PSRxDesc pCurrRD ); -void MngWorkItem(void *Context); - #endif // __RXTX_H__ diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index 317c2a8ee162..f105c2ac091b 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c @@ -256,8 +256,8 @@ 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", + 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], @@ -265,7 +265,7 @@ static int hostap_add_sta(PSDevice pDevice, param->sta_addr[4], param->sta_addr[5] ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d\n", pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); return 0; @@ -323,7 +323,7 @@ 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", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x\n", (unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags); } else { return -ENOENT; @@ -362,7 +362,7 @@ static int hostap_set_generic_element(PSDevice pDevice, // disable wpa if (pMgmt->wWPAIELen == 0) { pMgmt->eAuthenMode = WMAC_AUTH_OPEN; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA\n"); } else { // enable wpa if ((pMgmt->abyWPAIE[0] == WLAN_EID_RSN_WPA) || @@ -394,8 +394,6 @@ static void hostap_flush_sta(PSDevice pDevice) // reserved node index =0 for multicast node. BSSvClearNodeDBTable(pDevice, 1); pDevice->uAssocCount = 0; - - return; } /* @@ -449,8 +447,8 @@ static int hostap_set_encryption(PSDevice pDevice, 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); + 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); if (param->u.crypt.alg == WPA_ALG_NONE) { if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly) { @@ -458,7 +456,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail\n"); } pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; } @@ -603,10 +601,10 @@ static int hostap_set_encryption(PSDevice pDevice, 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, + 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", + 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], @@ -698,62 +696,62 @@ 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS\n"); ret = -EOPNOTSUPP; goto out; default: diff --git a/drivers/staging/vt6655/hostap.h b/drivers/staging/vt6655/hostap.h index f1a4f2eff058..6e801a428183 100644 --- a/drivers/staging/vt6655/hostap.h +++ b/drivers/staging/vt6655/hostap.h @@ -31,8 +31,6 @@ #include "device.h" -/*--------------------- Export Definitions -------------------------*/ - #define WLAN_RATE_1M BIT0 #define WLAN_RATE_2M BIT1 #define WLAN_RATE_5M5 BIT2 @@ -46,12 +44,6 @@ #define WLAN_RATE_48M BIT10 #define WLAN_RATE_54M BIT11 -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - #ifndef ETH_P_PAE #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ #endif /* ETH_P_PAE */ diff --git a/drivers/staging/vt6655/iocmd.h b/drivers/staging/vt6655/iocmd.h index e499f1b6f531..a665cfd8a482 100644 --- a/drivers/staging/vt6655/iocmd.h +++ b/drivers/staging/vt6655/iocmd.h @@ -31,12 +31,6 @@ #include "ttype.h" -/*--------------------- Export Definitions -------------------------*/ - -//typedef uint32_t u32; -//typedef uint16_t u16; -//typedef uint8_t u8; - // ioctl Command code #define MAGIC_CODE 0x3142 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0) @@ -100,7 +94,7 @@ typedef enum tagWZONETYPE { #pragma pack(1) typedef struct tagSCmdRequest { u8 name[16]; - void *data; + void __user *data; u16 wResult; u16 wCmdCode; } SCmdRequest, *PSCmdRequest; @@ -167,10 +161,6 @@ typedef struct tagSBSSIDItem { u32 uChannel; u8 abyBSSID[BSSID_LEN]; u8 abySSID[SSID_MAXLEN + 1]; - //2006-1116-01,<Modify> by NomadZhao - //u16 wBeaconInterval; - //u16 wCapInfo; - //u8 byNetType; u8 byNetType; u16 wBeaconInterval; u16 wCapInfo; // for address of byNetType at align 4 @@ -228,9 +218,8 @@ typedef struct tagSStatMIBCount { u32 dwIsrUnrecoverableError; u32 dwIsrSoftInterrupt; u32 dwIsrRxNoBuf; - ///////////////////////////////////// - u32 dwIsrUnknown; // unknown interrupt count + u32 dwIsrUnknown; // RSR status count // @@ -349,7 +338,6 @@ typedef struct tagSCmdValue { // hostapd & viawget ioctl related // -// VIAGWET_IOCTL_HOSTAPD ioctl() cmd: enum { VIAWGET_HOSTAPD_FLUSH = 1, VIAWGET_HOSTAPD_ADD_STA = 2, @@ -415,15 +403,6 @@ struct viawget_hostapd_param { } u; }; -//2006-1116-01,<Add> by NomadZhao #pragma pack() -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - #endif //__IOCMD_H__ diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c index 18d11d1f4fa6..65e59336f03b 100644 --- a/drivers/staging/vt6655/ioctl.c +++ b/drivers/staging/vt6655/ioctl.c @@ -123,13 +123,13 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) /* write zonetype */ if (sZoneTypeCmd.ZoneType == ZoneType_USA) { /* set to USA */ - printk("set_ZoneType:USA\n"); + pr_debug("set_ZoneType:USA\n"); } else if (sZoneTypeCmd.ZoneType == ZoneType_Japan) { /* set to Japan */ - printk("set_ZoneType:Japan\n"); + pr_debug("set_ZoneType:Japan\n"); } else if (sZoneTypeCmd.ZoneType == ZoneType_Europe) { /* set to Europe */ - printk("set_ZoneType:Europe\n"); + pr_debug("set_ZoneType:Europe\n"); } } else { /* read zonetype */ @@ -142,7 +142,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) } else if (zonetype == 0x02) { /* Europe */ sZoneTypeCmd.ZoneType = ZoneType_Europe; } else { /* Unknown ZoneType */ - printk("Error:ZoneType[%x] Unknown ???\n", zonetype); + pr_err("Error:ZoneType[%x] Unknown ???\n", zonetype); result = -EFAULT; break; } diff --git a/drivers/staging/vt6655/ioctl.h b/drivers/staging/vt6655/ioctl.h index 2f0db920e2cb..187fc915fd12 100644 --- a/drivers/staging/vt6655/ioctl.h +++ b/drivers/staging/vt6655/ioctl.h @@ -31,14 +31,6 @@ #include "device.h" -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - int private_ioctl(PSDevice pDevice, struct ifreq *rq); #endif // __IOCTL_H__ diff --git a/drivers/staging/vt6655/iowpa.h b/drivers/staging/vt6655/iowpa.h index b7bd1909fa7c..772bc4c2a7b9 100644 --- a/drivers/staging/vt6655/iowpa.h +++ b/drivers/staging/vt6655/iowpa.h @@ -29,8 +29,6 @@ #ifndef __IOWPA_H__ #define __IOWPA_H__ -/*--------------------- Export Definitions -------------------------*/ - #define WPA_IE_LEN 64 //WPA related @@ -127,14 +125,6 @@ struct viawget_scan_result { int maxrate; }; -//2006-1116-01,<Add> by NomadZhao #pragma pack() -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ #endif //__IOWPA_H__ diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index ae2b87f177fb..7ce23b57e78d 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -33,6 +33,7 @@ #include "device.h" #include "ioctl.h" #include "iocmd.h" +#include "iwctl.h" #include "mac.h" #include "card.h" #include "hostap.h" @@ -107,7 +108,7 @@ static int iwctl_commit(struct net_device *dev, void *wrq, char *extra) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT\n"); return 0; } @@ -128,7 +129,7 @@ int iwctl_giwname(struct net_device *dev, * Wireless Handler : set scan */ -int iwctl_siwscan(struct net_device *dev, +static int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -138,11 +139,13 @@ int iwctl_siwscan(struct net_device *dev, 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"); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN\n"); if (pDevice->byReAssocCount > 0) { //reject scan when re-associating! //send scan event to wpa_Supplicant union iwreq_data wrqu; + PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); memset(&wrqu, 0, sizeof(wrqu)); wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); @@ -189,7 +192,7 @@ int iwctl_siwscan(struct net_device *dev, * Wireless Handler : get scan results */ -int iwctl_giwscan(struct net_device *dev, +static int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -207,7 +210,7 @@ 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. @@ -254,6 +257,7 @@ int iwctl_giwscan(struct net_device *dev, //2008-0409-04, <Add> by Einsn Liu { int f = (int)pBSS->uChannel - 1; + if (f < 0)f = 0; iwe.u.freq.m = frequency_list[f] * 100000; iwe.u.freq.e = 1; @@ -349,7 +353,7 @@ int iwctl_siwfreq(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ\n"); // If setting by frequency, convert to a channel if ((wrq->e == 1) && @@ -357,6 +361,7 @@ int iwctl_siwfreq(struct net_device *dev, (wrq->m <= (int) 2.487e8)) { int f = wrq->m / 100000; int c = 0; + while ((c < 14) && (f != frequency_list[c])) c++; wrq->e = 0; @@ -367,6 +372,7 @@ int iwctl_siwfreq(struct net_device *dev, rc = -EOPNOTSUPP; else { 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); rc = -EINVAL; @@ -395,7 +401,7 @@ int iwctl_giwfreq(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ\n"); #ifdef WEXT_USECHANNELS wrq->m = (int)pMgmt->uCurrChannel; @@ -403,6 +409,7 @@ int iwctl_giwfreq(struct net_device *dev, #else { int f = (int)pMgmt->uCurrChannel - 1; + if (f < 0) f = 0; wrq->m = frequency_list[f] * 100000; @@ -426,10 +433,10 @@ int iwctl_siwmode(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Can't set operation mode, hostapd is running\n"); return rc; } @@ -441,7 +448,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc\n"); break; case IW_MODE_AUTO: case IW_MODE_INFRA: @@ -451,7 +458,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure\n"); break; case IW_MODE_MASTER: @@ -465,7 +472,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point\n"); break; case IW_MODE_REPEAT: @@ -491,7 +498,7 @@ int iwctl_giwmode(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE\n"); // If not managed, assume it's ad-hoc switch (pMgmt->eConfigMode) { case WMAC_CONFIG_ESS_STA: @@ -526,7 +533,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n"); if (wrq->pointer) { wrq->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); @@ -633,10 +640,10 @@ int iwctl_siwap(struct net_device *dev, int rc = 0; unsigned char ZeroBSSID[WLAN_BSSID_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP\n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. - printk("SIOCSIWAP(??)-->In scanning...\n"); + pr_debug("SIOCSIWAP(??)-->In scanning..\n"); } if (wrq->sa_family != ARPHRD_ETHER) rc = -EINVAL; @@ -657,6 +664,7 @@ int iwctl_siwap(struct net_device *dev, // then ignore,because you don't known which one to be connect with?? { unsigned int ii, uSameBssidNum = 0; + for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, @@ -689,7 +697,7 @@ int iwctl_giwap(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP\n"); memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); //2008-0410,<Modify> by Einsn Liu @@ -792,18 +800,18 @@ int iwctl_siwessid(struct net_device *dev, //2008-0409-05, <Add> by Einsn Liu unsigned char len; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID\n"); pDevice->fWPA_Authened = false; if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. - printk("SIOCSIWESSID(??)-->In scanning...\n"); + pr_debug("SIOCSIWESSID(??)-->In scanning..\n"); } // Check if we asked for `any' if (wrq->flags == 0) { // Just send an empty SSID list memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pMgmt->abyDesireBSSID, 0xFF, 6); - PRINT_K("set essid to 'any' \n"); + PRINT_K("set essid to 'any'\n"); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT return 0; #endif @@ -819,7 +827,7 @@ int iwctl_siwessid(struct net_device *dev, pItemSSID->len = wrq->length - 1; } else pItemSSID->len = wrq->length; - printk("set essid to %s \n", pItemSSID->abySSID); + pr_debug("set essid to %s\n", pItemSSID->abySSID); //2008-0409-05, <Add> by Einsn Liu len = (pItemSSID->len > ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) ? pItemSSID->len : ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len; if ((pDevice->bLinkPass == true) && @@ -865,7 +873,7 @@ int iwctl_siwessid(struct net_device *dev, } } if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! - printk("SIOCSIWESSID:hidden ssid directly associate.......\n"); + pr_debug("SIOCSIWESSID:hidden ssid directly associate.......\n"); vResetCommandTimer((void *)pDevice); pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); @@ -877,7 +885,7 @@ int iwctl_siwessid(struct net_device *dev, } #endif - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s\n", pItemSSID->abySSID); } if (pDevice->flags & DEVICE_FLAGS_OPENED) @@ -899,7 +907,7 @@ int iwctl_giwessid(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID\n"); // Note : if wrq->u.data.flags != 0, we should // get the relevant SSID from the SSID list... @@ -931,7 +939,7 @@ int iwctl_siwrate(struct net_device *dev, 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE\n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; return rc; @@ -979,19 +987,19 @@ int iwctl_siwrate(struct net_device *dev, if (wrq->fixed != 0) { // Fixed mode // One rate, fixed - printk("Rate Fix\n"); + pr_debug("Rate Fix\n"); pDevice->bFixRate = true; if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) { pDevice->uConnectionRate = 3; } else { pDevice->uConnectionRate = brate; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d\n", pDevice->uConnectionRate); } } else { pDevice->bFixRate = false; pDevice->uConnectionRate = 13; - printk("auto rate:connection_rate is 13\n"); + pr_debug("auto rate:connection_rate is 13\n"); } return rc; @@ -1011,7 +1019,7 @@ int iwctl_giwrate(struct net_device *dev, //Mark the unnecessary sentences. // PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE\n"); { unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; int brate = 0; @@ -1054,10 +1062,11 @@ int iwctl_siwrts(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS\n"); { int rthr = wrq->value; + if (wrq->disabled) rthr = 2312; @@ -1081,7 +1090,7 @@ int iwctl_giwrts(struct net_device *dev, { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS\n"); wrq->value = pDevice->wRTSThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -1102,7 +1111,7 @@ int iwctl_siwfrag(struct net_device *dev, int rc = 0; int fthr = wrq->value; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG\n"); if (wrq->disabled) fthr = 2312; @@ -1127,7 +1136,7 @@ int iwctl_giwfrag(struct net_device *dev, { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG\n"); wrq->value = pDevice->wFragmentationThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -1146,7 +1155,7 @@ int iwctl_siwretry(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY\n"); if (wrq->disabled) { rc = -EINVAL; @@ -1179,7 +1188,8 @@ int iwctl_giwretry(struct net_device *dev, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY\n"); wrq->disabled = 0; // Can't be disabled // Note : by default, display the min retry number @@ -1224,7 +1234,7 @@ int iwctl_siwencode(struct net_device *dev, PSKeyTable pkeytab; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE\n"); if ((wrq->flags & IW_ENCODE_DISABLED) == 0) { //Not disable encryption @@ -1404,7 +1414,7 @@ int iwctl_siwpower(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER\n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; @@ -1426,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R\n"); rc = -EINVAL; break; case IW_POWER_ALL_R: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R\n"); rc = -EINVAL; case IW_POWER_ON: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON\n"); break; default: rc = -EINVAL; @@ -1454,7 +1464,7 @@ int iwctl_giwpower(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int mode = pDevice->ePSMode; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER\n"); wrq->disabled = (mode == WMAC_POWER_CAM); if (wrq->disabled) @@ -1483,7 +1493,7 @@ int iwctl_giwsens(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); long ldBm; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS\n"); if (pDevice->bLinkPass == true) { RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm); wrq->value = ldBm; @@ -1510,7 +1520,7 @@ int iwctl_siwauth(struct net_device *dev, 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n"); switch (wrq->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: wpa_version = wrq->value; @@ -1611,17 +1621,24 @@ int iwctl_giwauth(struct net_device *dev, int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, - char *extra) + char __user *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; + char length; if (wrq->length) { - if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) { - ret = -EINVAL; - goto out; - } + if (wrq->length < 2) + return -EINVAL; + + ret = get_user(length, extra + 1); + if (ret) + return ret; + + if (length + 2 != wrq->length) + return -EINVAL; + if (wrq->length > MAX_WPA_IE_LEN) { ret = -ENOMEM; goto out; @@ -1644,7 +1661,7 @@ out://not completely ...not necessary in wpa_supplicant 0.5.8 int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, - char *extra) + char __user *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1685,7 +1702,7 @@ int iwctl_siwencodeext(struct net_device *dev, u8 key_array[64]; int ret = 0; - PRINT_K("SIOCSIWENCODEEXT...... \n"); + PRINT_K("SIOCSIWENCODEEXT......\n"); param = kzalloc(sizeof(*param), GFP_KERNEL); if (param == NULL) @@ -1765,7 +1782,7 @@ int iwctl_siwencodeext(struct net_device *dev, } if (pDevice->bwextcount == 4) { - printk("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n"); + pr_debug("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n"); pDevice->bwextcount = 0; pDevice->bWPASuppWextEnabled = true; } @@ -1791,25 +1808,30 @@ int iwctl_giwencodeext(struct net_device *dev, int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, - char *extra) + char __user *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - struct iw_mlme *mlme = (struct iw_mlme *)extra; + struct iw_mlme mime; + int ret = 0; - if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) { + ret = copy_from_user(&mime, extra, sizeof(mime)); + if (ret) + return -EFAULT; + + if (memcmp(pMgmt->abyCurrBSSID, mime.addr.sa_data, ETH_ALEN)) { ret = -EINVAL; return ret; } - switch (mlme->cmd) { + switch (mime.cmd) { case IW_MLME_DEAUTH: //this command seems to be not complete,please test it --einsnliu //bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (unsigned char *)&reason); break; case IW_MLME_DISASSOC: if (pDevice->bLinkPass == true) { - printk("iwctl_siwmlme--->send DISASSOCIATE\n"); + pr_debug("iwctl_siwmlme--->send DISASSOCIATE\n"); //clear related flags memset(pMgmt->abyDesireBSSID, 0xFF, 6); KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); diff --git a/drivers/staging/vt6655/iwctl.h b/drivers/staging/vt6655/iwctl.h index 871bd7c4e716..7dd63102182d 100644 --- a/drivers/staging/vt6655/iwctl.h +++ b/drivers/staging/vt6655/iwctl.h @@ -161,16 +161,6 @@ int iwctl_giwpower(struct net_device *dev, struct iw_param *wrq, char *extra); -int iwctl_giwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_siwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - //2008-0409-07, <Add> by Einsn Liu #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT int iwctl_siwauth(struct net_device *dev, @@ -186,12 +176,12 @@ int iwctl_giwauth(struct net_device *dev, int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, - char *extra); + char __user *extra); int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, - char *extra); + char __user *extra); int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, @@ -206,11 +196,11 @@ int iwctl_giwencodeext(struct net_device *dev, int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, - char *extra); + char __user *extra); #endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT //End Add -- //2008-0409-07, <Add> by Einsn Liu extern const struct iw_handler_def iwctl_handler_def; -extern const struct iw_priv_args iwctl_private_args; +extern struct iw_priv_args iwctl_private_args[]; #endif // __IWCTL_H__ diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c index 09a8bf50527b..9339e2a4073a 100644 --- a/drivers/staging/vt6655/key.c +++ b/drivers/staging/vt6655/key.c @@ -58,7 +58,7 @@ static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ static void -s_vCheckKeyTableValid(PSKeyManagement pTable, unsigned long dwIoBase) +s_vCheckKeyTableValid(PSKeyManagement pTable, void __iomem *dwIoBase) { int i; @@ -91,7 +91,7 @@ s_vCheckKeyTableValid(PSKeyManagement pTable, unsigned long dwIoBase) * Return Value: none * */ -void KeyvInitTable(PSKeyManagement pTable, unsigned long dwIoBase) +void KeyvInitTable(PSKeyManagement pTable, void __iomem *dwIoBase) { int i; int jj; @@ -134,7 +134,7 @@ bool KeybGetKey( { int i; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetKey() \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetKey()\n"); *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { @@ -187,7 +187,7 @@ bool KeybSetKey( PQWORD pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, - unsigned long dwIoBase, + void __iomem *dwIoBase, unsigned char byLocalID ) { @@ -252,7 +252,7 @@ bool KeybSetKey( 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 "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: "); for (ii = 0; ii < pKey->uKeyLength; ii++) @@ -315,7 +315,7 @@ bool KeybSetKey( 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 "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: "); @@ -351,7 +351,7 @@ bool KeybRemoveKey( PSKeyManagement pTable, unsigned char *pbyBSSID, unsigned long dwKeyIndex, - unsigned long dwIoBase + void __iomem *dwIoBase ) { int i; @@ -418,7 +418,7 @@ bool KeybRemoveKey( bool KeybRemoveAllKey( PSKeyManagement pTable, unsigned char *pbyBSSID, - unsigned long dwIoBase + void __iomem *dwIoBase ) { int i, u; @@ -453,7 +453,7 @@ bool KeybRemoveAllKey( void KeyvRemoveWEPKey( PSKeyManagement pTable, unsigned long dwKeyIndex, - unsigned long dwIoBase + void __iomem *dwIoBase ) { if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { @@ -468,12 +468,11 @@ void KeyvRemoveWEPKey( } s_vCheckKeyTableValid(pTable, dwIoBase); } - return; } void KeyvRemoveAllWEPKey( PSKeyManagement pTable, - unsigned long dwIoBase + void __iomem *dwIoBase ) { int i; @@ -610,7 +609,7 @@ bool KeybSetDefaultKey( PQWORD pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, - unsigned long dwIoBase, + void __iomem *dwIoBase, unsigned char byLocalID ) { @@ -618,7 +617,7 @@ bool KeybSetDefaultKey( PSKeyItem pKey; unsigned int uKeyIdx; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetDefaultKey: %1x, %d \n", (int)dwKeyIndex, (int)uKeyLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetDefaultKey: %1x, %d\n", (int)dwKeyIndex, (int)uKeyLength); if ((dwKeyIndex & PAIRWISE_KEY) != 0) // Pairwise key return false; @@ -677,10 +676,10 @@ bool KeybSetDefaultKey( 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 "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->abyKey:\n"); for (ii = 0; ii < pKey->uKeyLength; ii++) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%x", pKey->abyKey[ii]); @@ -716,7 +715,7 @@ bool KeybSetAllGroupKey( PQWORD pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, - unsigned long dwIoBase, + void __iomem *dwIoBase, unsigned char byLocalID ) { @@ -772,7 +771,7 @@ bool KeybSetAllGroupKey( 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 "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: "); diff --git a/drivers/staging/vt6655/key.h b/drivers/staging/vt6655/key.h index 4b8b4b6bd6cd..3eb881b69a55 100644 --- a/drivers/staging/vt6655/key.h +++ b/drivers/staging/vt6655/key.h @@ -53,8 +53,7 @@ #define KEY_CTL_CCMP 0x03 #define KEY_CTL_INVALID 0xFF -typedef struct tagSKeyItem -{ +typedef struct tagSKeyItem { bool bKeyValid; unsigned long uKeyLength; unsigned char abyKey[MAX_KEY_LEN]; @@ -67,8 +66,7 @@ typedef struct tagSKeyItem void *pvKeyTable; } SKeyItem, *PSKeyItem; //64 -typedef struct tagSKeyTable -{ +typedef struct tagSKeyTable { unsigned char abyBSSID[ETH_ALEN]; //6 unsigned char byReserved0[2]; //8 SKeyItem PairwiseKey; @@ -82,8 +80,7 @@ typedef struct tagSKeyTable unsigned char byReserved1[6]; } SKeyTable, *PSKeyTable; //348 -typedef struct tagSKeyManagement -{ +typedef struct tagSKeyManagement { SKeyTable KeyTable[MAX_KEY_TABLE]; } SKeyManagement, *PSKeyManagement; @@ -97,7 +94,7 @@ typedef struct tagSKeyManagement /*--------------------- Export Functions --------------------------*/ -void KeyvInitTable(PSKeyManagement pTable, unsigned long dwIoBase); +void KeyvInitTable(PSKeyManagement pTable, void __iomem *dwIoBase); bool KeybGetKey( PSKeyManagement pTable, @@ -114,7 +111,7 @@ bool KeybSetKey( PQWORD pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, - unsigned long dwIoBase, + void __iomem *dwIoBase, unsigned char byLocalID ); @@ -125,7 +122,7 @@ bool KeybSetDefaultKey( PQWORD pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, - unsigned long dwIoBase, + void __iomem *dwIoBase, unsigned char byLocalID ); @@ -133,7 +130,7 @@ bool KeybRemoveKey( PSKeyManagement pTable, unsigned char *pbyBSSID, unsigned long dwKeyIndex, - unsigned long dwIoBase + void __iomem *dwIoBase ); bool KeybGetTransmitKey( @@ -151,18 +148,18 @@ bool KeybCheckPairewiseKey( bool KeybRemoveAllKey( PSKeyManagement pTable, unsigned char *pbyBSSID, - unsigned long dwIoBase + void __iomem *dwIoBase ); void KeyvRemoveWEPKey( PSKeyManagement pTable, unsigned long dwKeyIndex, - unsigned long dwIoBase + void __iomem *dwIoBase ); void KeyvRemoveAllWEPKey( PSKeyManagement pTable, - unsigned long dwIoBase + void __iomem *dwIoBase ); bool KeybSetAllGroupKey( @@ -172,7 +169,7 @@ bool KeybSetAllGroupKey( PQWORD pKeyRSC, unsigned char *pbyKey, unsigned char byKeyDecMode, - unsigned long dwIoBase, + void __iomem *dwIoBase, unsigned char byLocalID ); diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c index af6876a01ee8..9bbc873de702 100644 --- a/drivers/staging/vt6655/mac.c +++ b/drivers/staging/vt6655/mac.c @@ -98,7 +98,7 @@ static int msglevel = MSG_LEVEL_INFO; * Return Value: none * */ -void MACvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyMacRegs) +void MACvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyMacRegs) { int ii; @@ -134,7 +134,7 @@ void MACvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyMacRegs) * Return Value: true if all test bits On; otherwise false * */ -bool MACbIsRegBitsOn(unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits) +bool MACbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byRegOfs, unsigned char byTestBits) { unsigned char byData; @@ -157,7 +157,7 @@ bool MACbIsRegBitsOn(unsigned long dwIoBase, unsigned char byRegOfs, unsigned ch * Return Value: true if all test bits Off; otherwise false * */ -bool MACbIsRegBitsOff(unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits) +bool MACbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byRegOfs, unsigned char byTestBits) { unsigned char byData; @@ -178,7 +178,7 @@ bool MACbIsRegBitsOff(unsigned long dwIoBase, unsigned char byRegOfs, unsigned c * Return Value: true if interrupt is disable; otherwise false * */ -bool MACbIsIntDisable(unsigned long dwIoBase) +bool MACbIsIntDisable(void __iomem *dwIoBase) { unsigned long dwData; @@ -203,7 +203,7 @@ bool MACbIsIntDisable(unsigned long dwIoBase) * Return Value: Mask Value read * */ -unsigned char MACbyReadMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx) +unsigned char MACbyReadMultiAddr(void __iomem *dwIoBase, unsigned int uByteIdx) { unsigned char byData; @@ -228,7 +228,7 @@ unsigned char MACbyReadMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx) * Return Value: none * */ -void MACvWriteMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx, unsigned char byData) +void MACvWriteMultiAddr(void __iomem *dwIoBase, unsigned int uByteIdx, unsigned char byData) { MACvSelectPage1(dwIoBase); VNSvOutPortB(dwIoBase + MAC_REG_MAR0 + uByteIdx, byData); @@ -249,7 +249,7 @@ void MACvWriteMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx, unsigned * Return Value: none * */ -void MACvSetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx) +void MACvSetMultiAddrByHash(void __iomem *dwIoBase, unsigned char byHashIdx) { unsigned int uByteIdx; unsigned char byBitMask; @@ -280,7 +280,7 @@ void MACvSetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx) * Return Value: none * */ -void MACvResetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx) +void MACvResetMultiAddrByHash(void __iomem *dwIoBase, unsigned char byHashIdx) { unsigned int uByteIdx; unsigned char byBitMask; @@ -311,7 +311,7 @@ void MACvResetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx) * Return Value: none * */ -void MACvSetRxThreshold(unsigned long dwIoBase, unsigned char byThreshold) +void MACvSetRxThreshold(void __iomem *dwIoBase, unsigned char byThreshold) { unsigned char byOrgValue; @@ -336,7 +336,7 @@ void MACvSetRxThreshold(unsigned long dwIoBase, unsigned char byThreshold) * Return Value: none * */ -void MACvGetRxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold) +void MACvGetRxThreshold(void __iomem *dwIoBase, unsigned char *pbyThreshold) { // get FCR0 VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold); @@ -357,7 +357,7 @@ void MACvGetRxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold) * Return Value: none * */ -void MACvSetTxThreshold(unsigned long dwIoBase, unsigned char byThreshold) +void MACvSetTxThreshold(void __iomem *dwIoBase, unsigned char byThreshold) { unsigned char byOrgValue; @@ -382,7 +382,7 @@ void MACvSetTxThreshold(unsigned long dwIoBase, unsigned char byThreshold) * Return Value: none * */ -void MACvGetTxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold) +void MACvGetTxThreshold(void __iomem *dwIoBase, unsigned char *pbyThreshold) { // get FCR0 VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold); @@ -403,7 +403,7 @@ void MACvGetTxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold) * Return Value: none * */ -void MACvSetDmaLength(unsigned long dwIoBase, unsigned char byDmaLength) +void MACvSetDmaLength(void __iomem *dwIoBase, unsigned char byDmaLength) { unsigned char byOrgValue; @@ -428,7 +428,7 @@ void MACvSetDmaLength(unsigned long dwIoBase, unsigned char byDmaLength) * Return Value: none * */ -void MACvGetDmaLength(unsigned long dwIoBase, unsigned char *pbyDmaLength) +void MACvGetDmaLength(void __iomem *dwIoBase, unsigned char *pbyDmaLength) { // get FCR0 VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyDmaLength); @@ -449,7 +449,7 @@ void MACvGetDmaLength(unsigned long dwIoBase, unsigned char *pbyDmaLength) * Return Value: none * */ -void MACvSetShortRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit) +void MACvSetShortRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit) { // set SRT VNSvOutPortB(dwIoBase + MAC_REG_SRT, byRetryLimit); @@ -468,7 +468,7 @@ void MACvSetShortRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit) * Return Value: none * */ -void MACvGetShortRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit) +void MACvGetShortRetryLimit(void __iomem *dwIoBase, unsigned char *pbyRetryLimit) { // get SRT VNSvInPortB(dwIoBase + MAC_REG_SRT, pbyRetryLimit); @@ -488,7 +488,7 @@ void MACvGetShortRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit * Return Value: none * */ -void MACvSetLongRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit) +void MACvSetLongRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit) { // set LRT VNSvOutPortB(dwIoBase + MAC_REG_LRT, byRetryLimit); @@ -507,7 +507,7 @@ void MACvSetLongRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit) * Return Value: none * */ -void MACvGetLongRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit) +void MACvGetLongRetryLimit(void __iomem *dwIoBase, unsigned char *pbyRetryLimit) { // get LRT VNSvInPortB(dwIoBase + MAC_REG_LRT, pbyRetryLimit); @@ -527,7 +527,7 @@ void MACvGetLongRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit) * Return Value: none * */ -void MACvSetLoopbackMode(unsigned long dwIoBase, unsigned char byLoopbackMode) +void MACvSetLoopbackMode(void __iomem *dwIoBase, unsigned char byLoopbackMode) { unsigned char byOrgValue; @@ -553,7 +553,7 @@ void MACvSetLoopbackMode(unsigned long dwIoBase, unsigned char byLoopbackMode) * Return Value: true if in Loopback mode; otherwise false * */ -bool MACbIsInLoopbackMode(unsigned long dwIoBase) +bool MACbIsInLoopbackMode(void __iomem *dwIoBase) { unsigned char byOrgValue; @@ -577,7 +577,7 @@ bool MACbIsInLoopbackMode(unsigned long dwIoBase) * Return Value: none * */ -void MACvSetPacketFilter(unsigned long dwIoBase, unsigned short wFilterType) +void MACvSetPacketFilter(void __iomem *dwIoBase, unsigned short wFilterType) { unsigned char byOldRCR; unsigned char byNewRCR = 0; @@ -636,7 +636,7 @@ void MACvSetPacketFilter(unsigned long dwIoBase, unsigned short wFilterType) * Return Value: none * */ -void MACvSaveContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf) +void MACvSaveContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf) { int ii; @@ -667,7 +667,7 @@ void MACvSaveContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf) * Return Value: none * */ -void MACvRestoreContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf) +void MACvRestoreContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf) { int ii; @@ -716,7 +716,7 @@ void MACvRestoreContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf) * Return Value: true if all values are the same; otherwise false * */ -bool MACbCompareContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf) +bool MACbCompareContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf) { unsigned long dwData; @@ -756,7 +756,7 @@ bool MACbCompareContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf) * Return Value: true if Reset Success; otherwise false * */ -bool MACbSoftwareReset(unsigned long dwIoBase) +bool MACbSoftwareReset(void __iomem *dwIoBase) { unsigned char byData; unsigned short ww; @@ -787,7 +787,7 @@ bool MACbSoftwareReset(unsigned long dwIoBase) * Return Value: true if success; otherwise false * */ -bool MACbSafeSoftwareReset(unsigned long dwIoBase) +bool MACbSafeSoftwareReset(void __iomem *dwIoBase) { unsigned char abyTmpRegData[MAC_MAX_CONTEXT_SIZE_PAGE0+MAC_MAX_CONTEXT_SIZE_PAGE1]; bool bRetVal; @@ -819,7 +819,7 @@ bool MACbSafeSoftwareReset(unsigned long dwIoBase) * Return Value: true if success; otherwise false * */ -bool MACbSafeRxOff(unsigned long dwIoBase) +bool MACbSafeRxOff(void __iomem *dwIoBase) { unsigned short ww; unsigned long dwData; @@ -880,7 +880,7 @@ bool MACbSafeRxOff(unsigned long dwIoBase) * Return Value: true if success; otherwise false * */ -bool MACbSafeTxOff(unsigned long dwIoBase) +bool MACbSafeTxOff(void __iomem *dwIoBase) { unsigned short ww; unsigned long dwData; @@ -943,7 +943,7 @@ bool MACbSafeTxOff(unsigned long dwIoBase) * Return Value: true if success; otherwise false * */ -bool MACbSafeStop(unsigned long dwIoBase) +bool MACbSafeStop(void __iomem *dwIoBase) { MACvRegBitsOff(dwIoBase, MAC_REG_TCR, TCR_AUTOBCNTX); @@ -978,7 +978,7 @@ bool MACbSafeStop(unsigned long dwIoBase) * Return Value: true if success; otherwise false * */ -bool MACbShutdown(unsigned long dwIoBase) +bool MACbShutdown(void __iomem *dwIoBase) { // disable MAC IMR MACvIntDisable(dwIoBase); @@ -1005,7 +1005,7 @@ bool MACbShutdown(unsigned long dwIoBase) * Return Value: none * */ -void MACvInitialize(unsigned long dwIoBase) +void MACvInitialize(void __iomem *dwIoBase) { // clear sticky bits MACvClearStckDS(dwIoBase); @@ -1041,7 +1041,7 @@ void MACvInitialize(unsigned long dwIoBase) * Return Value: none * */ -void MACvSetCurrRx0DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr) +void MACvSetCurrRx0DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr) { unsigned short ww; unsigned char byData; @@ -1079,7 +1079,7 @@ void MACvSetCurrRx0DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr * Return Value: none * */ -void MACvSetCurrRx1DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr) +void MACvSetCurrRx1DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr) { unsigned short ww; unsigned char byData; @@ -1117,7 +1117,7 @@ void MACvSetCurrRx1DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr * Return Value: none * */ -void MACvSetCurrTx0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr) +void MACvSetCurrTx0DescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAddr) { unsigned short ww; unsigned char byData; @@ -1155,7 +1155,7 @@ void MACvSetCurrTx0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAd * */ //TxDMA1 = AC0DMA -void MACvSetCurrAC0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr) +void MACvSetCurrAC0DescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAddr) { unsigned short ww; unsigned char byData; @@ -1179,7 +1179,7 @@ void MACvSetCurrAC0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAd VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN); } -void MACvSetCurrTXDescAddr(int iTxType, unsigned long dwIoBase, unsigned long dwCurrDescAddr) +void MACvSetCurrTXDescAddr(int iTxType, void __iomem *dwIoBase, unsigned long dwCurrDescAddr) { if (iTxType == TYPE_AC0DMA) MACvSetCurrAC0DescAddrEx(dwIoBase, dwCurrDescAddr); @@ -1201,7 +1201,7 @@ void MACvSetCurrTXDescAddr(int iTxType, unsigned long dwIoBase, unsigned long dw * Return Value: none * */ -void MACvTimer0MicroSDelay(unsigned long dwIoBase, unsigned int uDelay) +void MACvTimer0MicroSDelay(void __iomem *dwIoBase, unsigned int uDelay) { unsigned char byValue; unsigned int uu, ii; @@ -1236,7 +1236,7 @@ void MACvTimer0MicroSDelay(unsigned long dwIoBase, unsigned int uDelay) * Return Value: none * */ -void MACvOneShotTimer0MicroSec(unsigned long dwIoBase, unsigned int uDelayTime) +void MACvOneShotTimer0MicroSec(void __iomem *dwIoBase, unsigned int uDelayTime) { VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0); VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelayTime); @@ -1257,14 +1257,14 @@ void MACvOneShotTimer0MicroSec(unsigned long dwIoBase, unsigned int uDelayTime) * Return Value: none * */ -void MACvOneShotTimer1MicroSec(unsigned long dwIoBase, unsigned int uDelayTime) +void MACvOneShotTimer1MicroSec(void __iomem *dwIoBase, unsigned int uDelayTime) { VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, 0); VNSvOutPortD(dwIoBase + MAC_REG_TMDATA1, uDelayTime); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, (TMCTL_TMD | TMCTL_TE)); } -void MACvSetMISCFifo(unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData) +void MACvSetMISCFifo(void __iomem *dwIoBase, unsigned short wOffset, unsigned long dwData) { if (wOffset > 273) return; @@ -1273,7 +1273,7 @@ void MACvSetMISCFifo(unsigned long dwIoBase, unsigned short wOffset, unsigned lo VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); } -bool MACbTxDMAOff(unsigned long dwIoBase, unsigned int idx) +bool MACbTxDMAOff(void __iomem *dwIoBase, unsigned int idx) { unsigned char byData; unsigned int ww = 0; @@ -1301,7 +1301,7 @@ bool MACbTxDMAOff(unsigned long dwIoBase, unsigned int idx) return true; } -void MACvClearBusSusInd(unsigned long dwIoBase) +void MACvClearBusSusInd(void __iomem *dwIoBase) { unsigned long dwOrgValue; unsigned int ww; @@ -1323,7 +1323,7 @@ void MACvClearBusSusInd(unsigned long dwIoBase) } } -void MACvEnableBusSusEn(unsigned long dwIoBase) +void MACvEnableBusSusEn(void __iomem *dwIoBase) { unsigned char byOrgValue; unsigned long dwOrgValue; @@ -1345,7 +1345,7 @@ void MACvEnableBusSusEn(unsigned long dwIoBase) } } -bool MACbFlushSYNCFifo(unsigned long dwIoBase) +bool MACbFlushSYNCFifo(void __iomem *dwIoBase) { unsigned char byOrgValue; unsigned int ww; @@ -1369,7 +1369,7 @@ bool MACbFlushSYNCFifo(unsigned long dwIoBase) return true; } -bool MACbPSWakeup(unsigned long dwIoBase) +bool MACbPSWakeup(void __iomem *dwIoBase) { unsigned char byOrgValue; unsigned int ww; @@ -1409,7 +1409,7 @@ bool MACbPSWakeup(unsigned long dwIoBase) * */ -void MACvSetKeyEntry(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, +void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned int uKeyIdx, unsigned char *pbyAddr, u32 *pdwKey, unsigned char byLocalID) { unsigned short wOffset; @@ -1473,7 +1473,7 @@ void MACvSetKeyEntry(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned in * Return Value: none * */ -void MACvDisableKeyEntry(unsigned long dwIoBase, unsigned int uEntryIdx) +void MACvDisableKeyEntry(void __iomem *dwIoBase, unsigned int uEntryIdx) { unsigned short wOffset; @@ -1500,7 +1500,7 @@ void MACvDisableKeyEntry(unsigned long dwIoBase, unsigned int uEntryIdx) * */ -void MACvSetDefaultKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen, +void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID) { unsigned short wOffset; @@ -1549,7 +1549,7 @@ void MACvSetDefaultKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen, * */ /* - void MACvEnableDefaultKey(unsigned long dwIoBase, unsigned char byLocalID) + void MACvEnableDefaultKey(void __iomem *dwIoBase, unsigned char byLocalID) { unsigned short wOffset; unsigned long dwData; @@ -1583,7 +1583,7 @@ void MACvSetDefaultKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen, * Return Value: none * */ -void MACvDisableDefaultKey(unsigned long dwIoBase) +void MACvDisableDefaultKey(void __iomem *dwIoBase) { unsigned short wOffset; unsigned long dwData; @@ -1612,7 +1612,7 @@ void MACvDisableDefaultKey(unsigned long dwIoBase) * Return Value: none * */ -void MACvSetDefaultTKIPKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen, +void MACvSetDefaultTKIPKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID) { unsigned short wOffset; @@ -1665,7 +1665,7 @@ void MACvSetDefaultTKIPKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen, * */ -void MACvSetDefaultKeyCtl(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID) +void MACvSetDefaultKeyCtl(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID) { unsigned short wOffset; unsigned long dwData; diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h index 7333b8b526f4..0bf93759b6af 100644 --- a/drivers/staging/vt6655/mac.h +++ b/drivers/staging/vt6655/mac.h @@ -44,7 +44,6 @@ // #define MAC_MAX_CONTEXT_SIZE_PAGE0 256 #define MAC_MAX_CONTEXT_SIZE_PAGE1 128 -#define MAC_MAX_CONTEXT_SIZE MAC_MAX_CONTEXT_SIZE_PAGE0 + MAC_MAX_CONTEXT_SIZE_PAGE1 // Registers not related to 802.11b #define MAC_REG_BCFG0 0x00 @@ -973,78 +972,78 @@ do { \ /*--------------------- Export Functions --------------------------*/ extern unsigned short TxRate_iwconfig;//2008-5-8 <add> by chester -void MACvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyMacRegs); +void MACvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyMacRegs); -bool MACbIsRegBitsOn(unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits); -bool MACbIsRegBitsOff(unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits); +bool MACbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byRegOfs, unsigned char byTestBits); +bool MACbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byRegOfs, unsigned char byTestBits); -bool MACbIsIntDisable(unsigned long dwIoBase); +bool MACbIsIntDisable(void __iomem *dwIoBase); -unsigned char MACbyReadMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx); -void MACvWriteMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx, unsigned char byData); -void MACvSetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx); -void MACvResetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx); +unsigned char MACbyReadMultiAddr(void __iomem *dwIoBase, unsigned int uByteIdx); +void MACvWriteMultiAddr(void __iomem *dwIoBase, unsigned int uByteIdx, unsigned char byData); +void MACvSetMultiAddrByHash(void __iomem *dwIoBase, unsigned char byHashIdx); +void MACvResetMultiAddrByHash(void __iomem *dwIoBase, unsigned char byHashIdx); -void MACvSetRxThreshold(unsigned long dwIoBase, unsigned char byThreshold); -void MACvGetRxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold); +void MACvSetRxThreshold(void __iomem *dwIoBase, unsigned char byThreshold); +void MACvGetRxThreshold(void __iomem *dwIoBase, unsigned char *pbyThreshold); -void MACvSetTxThreshold(unsigned long dwIoBase, unsigned char byThreshold); -void MACvGetTxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold); +void MACvSetTxThreshold(void __iomem *dwIoBase, unsigned char byThreshold); +void MACvGetTxThreshold(void __iomem *dwIoBase, unsigned char *pbyThreshold); -void MACvSetDmaLength(unsigned long dwIoBase, unsigned char byDmaLength); -void MACvGetDmaLength(unsigned long dwIoBase, unsigned char *pbyDmaLength); +void MACvSetDmaLength(void __iomem *dwIoBase, unsigned char byDmaLength); +void MACvGetDmaLength(void __iomem *dwIoBase, unsigned char *pbyDmaLength); -void MACvSetShortRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit); -void MACvGetShortRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit); +void MACvSetShortRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit); +void MACvGetShortRetryLimit(void __iomem *dwIoBase, unsigned char *pbyRetryLimit); -void MACvSetLongRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit); -void MACvGetLongRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit); +void MACvSetLongRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit); +void MACvGetLongRetryLimit(void __iomem *dwIoBase, unsigned char *pbyRetryLimit); -void MACvSetLoopbackMode(unsigned long dwIoBase, unsigned char byLoopbackMode); -bool MACbIsInLoopbackMode(unsigned long dwIoBase); +void MACvSetLoopbackMode(void __iomem *dwIoBase, unsigned char byLoopbackMode); +bool MACbIsInLoopbackMode(void __iomem *dwIoBase); -void MACvSetPacketFilter(unsigned long dwIoBase, unsigned short wFilterType); +void MACvSetPacketFilter(void __iomem *dwIoBase, unsigned short wFilterType); -void MACvSaveContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf); -void MACvRestoreContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf); -bool MACbCompareContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf); +void MACvSaveContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf); +void MACvRestoreContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf); +bool MACbCompareContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf); -bool MACbSoftwareReset(unsigned long dwIoBase); -bool MACbSafeSoftwareReset(unsigned long dwIoBase); -bool MACbSafeRxOff(unsigned long dwIoBase); -bool MACbSafeTxOff(unsigned long dwIoBase); -bool MACbSafeStop(unsigned long dwIoBase); -bool MACbShutdown(unsigned long dwIoBase); -void MACvInitialize(unsigned long dwIoBase); -void MACvSetCurrRx0DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr); -void MACvSetCurrRx1DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr); -void MACvSetCurrTXDescAddr(int iTxType, unsigned long dwIoBase, unsigned long dwCurrDescAddr); -void MACvSetCurrTx0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr); -void MACvSetCurrAC0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr); -void MACvSetCurrSyncDescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr); -void MACvSetCurrATIMDescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr); -void MACvTimer0MicroSDelay(unsigned long dwIoBase, unsigned int uDelay); -void MACvOneShotTimer0MicroSec(unsigned long dwIoBase, unsigned int uDelayTime); -void MACvOneShotTimer1MicroSec(unsigned long dwIoBase, unsigned int uDelayTime); +bool MACbSoftwareReset(void __iomem *dwIoBase); +bool MACbSafeSoftwareReset(void __iomem *dwIoBase); +bool MACbSafeRxOff(void __iomem *dwIoBase); +bool MACbSafeTxOff(void __iomem *dwIoBase); +bool MACbSafeStop(void __iomem *dwIoBase); +bool MACbShutdown(void __iomem *dwIoBase); +void MACvInitialize(void __iomem *dwIoBase); +void MACvSetCurrRx0DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr); +void MACvSetCurrRx1DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr); +void MACvSetCurrTXDescAddr(int iTxType, void __iomem *dwIoBase, unsigned long dwCurrDescAddr); +void MACvSetCurrTx0DescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAddr); +void MACvSetCurrAC0DescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAddr); +void MACvSetCurrSyncDescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAddr); +void MACvSetCurrATIMDescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAddr); +void MACvTimer0MicroSDelay(void __iomem *dwIoBase, unsigned int uDelay); +void MACvOneShotTimer0MicroSec(void __iomem *dwIoBase, unsigned int uDelayTime); +void MACvOneShotTimer1MicroSec(void __iomem *dwIoBase, unsigned int uDelayTime); -void MACvSetMISCFifo(unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData); +void MACvSetMISCFifo(void __iomem *dwIoBase, unsigned short wOffset, unsigned long dwData); -bool MACbTxDMAOff(unsigned long dwIoBase, unsigned int idx); +bool MACbTxDMAOff(void __iomem *dwIoBase, unsigned int idx); -void MACvClearBusSusInd(unsigned long dwIoBase); -void MACvEnableBusSusEn(unsigned long dwIoBase); +void MACvClearBusSusInd(void __iomem *dwIoBase); +void MACvEnableBusSusEn(void __iomem *dwIoBase); -bool MACbFlushSYNCFifo(unsigned long dwIoBase); -bool MACbPSWakeup(unsigned long dwIoBase); +bool MACbFlushSYNCFifo(void __iomem *dwIoBase); +bool MACbPSWakeup(void __iomem *dwIoBase); -void MACvSetKeyEntry(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, +void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned int uKeyIdx, unsigned char *pbyAddr, u32 *pdwKey, unsigned char byLocalID); -void MACvDisableKeyEntry(unsigned long dwIoBase, unsigned int uEntryIdx); -void MACvSetDefaultKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen, +void MACvDisableKeyEntry(void __iomem *dwIoBase, unsigned int uEntryIdx); +void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID); -void MACvDisableDefaultKey(unsigned long dwIoBase); -void MACvSetDefaultTKIPKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen, +void MACvDisableDefaultKey(void __iomem *dwIoBase); +void MACvSetDefaultTKIPKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen, unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID); -void MACvSetDefaultKeyCtl(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID); +void MACvSetDefaultKeyCtl(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID); #endif // __MAC_H__ diff --git a/drivers/staging/vt6655/mib.h b/drivers/staging/vt6655/mib.h index c0a59489184d..732bddaf5b91 100644 --- a/drivers/staging/vt6655/mib.h +++ b/drivers/staging/vt6655/mib.h @@ -33,13 +33,12 @@ #include "tether.h" #include "desc.h" -/*--------------------- Export Definitions -------------------------*/ // // 802.11 counter // typedef struct tagSDot11Counters { - unsigned long Length; // Length of structure + unsigned long Length; unsigned long long TransmittedFragmentCount; unsigned long long MulticastTransmittedFrameCount; unsigned long long FailedCount; @@ -68,8 +67,7 @@ typedef struct tagSDot11Counters { // typedef struct tagSMib2Counter { long ifIndex; - char ifDescr[256]; // max size 255 plus zero ending - // e.g. "interface 1" + char ifDescr[256]; long ifType; long ifMtu; unsigned long ifSpeed; @@ -93,12 +91,12 @@ typedef struct tagSMib2Counter { } SMib2Counter, *PSMib2Counter; // Value in the ifType entry -#define WIRELESSLANIEEE80211b 6 // +#define WIRELESSLANIEEE80211b 6 // Value in the ifAdminStatus/ifOperStatus entry -#define UP 1 // -#define DOWN 2 // -#define TESTING 3 // +#define UP 1 +#define DOWN 2 +#define TESTING 3 // // RMON counter @@ -182,7 +180,7 @@ typedef struct tagSISRCounters { unsigned long dwIsrMIBNearfull; unsigned long dwIsrRxNoBuf; - unsigned long dwIsrUnknown; // unknown interrupt count + unsigned long dwIsrUnknown; unsigned long dwIsrRx1OK; unsigned long dwIsrATIMTxOK; @@ -191,23 +189,18 @@ typedef struct tagSISRCounters { unsigned long dwIsrATIMEnd; unsigned long dwIsrSYNCFlushOK; unsigned long dwIsrSTIMER1Int; - ///////////////////////////////////// } SISRCounters, *PSISRCounters; // Value in the etherStatsStatus entry -#define VALID 1 // -#define CREATE_REQUEST 2 // -#define UNDER_CREATION 3 // -#define INVALID 4 // +#define VALID 1 +#define CREATE_REQUEST 2 +#define UNDER_CREATION 3 +#define INVALID 4 // // statistic counter // typedef struct tagSStatCounter { - // - // ISR status count - // - // RSR status count // unsigned long dwRsrFrmAlgnErr; @@ -306,24 +299,18 @@ typedef struct tagSStatCounter { #ifdef Calcu_LinkQual //Tx count: - unsigned long TxNoRetryOkCount; //success tx no retry ! - unsigned long TxRetryOkCount; //success tx but retry ! - unsigned long TxFailCount; //fail tx ? + unsigned long TxNoRetryOkCount; + unsigned long TxRetryOkCount; + unsigned long TxFailCount; //Rx count: - unsigned long RxOkCnt; //success rx ! - unsigned long RxFcsErrCnt; //fail rx ? + unsigned long RxOkCnt; + unsigned long RxFcsErrCnt; //statistic unsigned long SignalStren; unsigned long LinkQuality; #endif } SStatCounter, *PSStatCounter; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - void STAvClearAllCounter(PSStatCounter pStatistic); void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr); diff --git a/drivers/staging/vt6655/michael.h b/drivers/staging/vt6655/michael.h index f6c2c15d9cb6..86cb140e3087 100644 --- a/drivers/staging/vt6655/michael.h +++ b/drivers/staging/vt6655/michael.h @@ -33,10 +33,6 @@ #include <linux/types.h> -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - void MIC_vInit(u32 dwK0, u32 dwK1); void MIC_vUnInit(void); @@ -48,8 +44,6 @@ void MIC_vAppend(unsigned char *src, unsigned int nBytes); /* This also resets the message to empty. */ void MIC_vGetMIC(u32 *pdwL, u32 *pdwR); -/*--------------------- Export Macros ------------------------------*/ - /* Rotation functions on 32 bit values */ #define ROL32(A, n) \ (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1))) diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c index 5dfa911c6f49..2a21cbd1c6ac 100644 --- a/drivers/staging/vt6655/power.c +++ b/drivers/staging/vt6655/power.c @@ -113,8 +113,7 @@ PSvEnablePowerSaving( PSbSendNullPacket(pDevice); pDevice->bPWBitOn = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable... \n"); - return; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable...\n"); } /*+ @@ -149,7 +148,6 @@ PSvDisablePowerSaving( PSbSendNullPacket(pDevice); pDevice->bPWBitOn = false; - return; } /*+ @@ -250,11 +248,8 @@ PSvSendPSPOLL( pTxPacket->cbMPDULen = WLAN_HDR_ADDR2_LEN; pTxPacket->cbPayloadLen = 0; // send the frame - if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { + if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n"); - } - - return; } /*+ diff --git a/drivers/staging/vt6655/power.h b/drivers/staging/vt6655/power.h index ce56124acf1b..936f171a6b19 100644 --- a/drivers/staging/vt6655/power.h +++ b/drivers/staging/vt6655/power.h @@ -29,19 +29,10 @@ #ifndef __POWER_H__ #define __POWER_H__ -/*--------------------- Export Definitions -------------------------*/ #define C_PWBT 1000 // micro sec. power up before TBTT #define PS_FAST_INTERVAL 1 // Fast power saving listen interval #define PS_MAX_INTERVAL 4 // MAX power saving listen interval -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - bool PSbConsiderPowerDown( void *hDeviceContext, diff --git a/drivers/staging/vt6655/rc4.c b/drivers/staging/vt6655/rc4.c index 343b815c0a9e..b7819bc702de 100644 --- a/drivers/staging/vt6655/rc4.c +++ b/drivers/staging/vt6655/rc4.c @@ -82,6 +82,7 @@ void rc4_encrypt(PRC4Ext pRC4, unsigned char *pbyDest, unsigned char *pbySrc, unsigned int cbData_len) { unsigned int ii; + for (ii = 0; ii < cbData_len; ii++) pbyDest[ii] = (unsigned char)(pbySrc[ii] ^ rc4_byte(pRC4)); } diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index 99c89a14d89b..42b257f916d3 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -424,7 +424,7 @@ static const unsigned long dwAL7230ChannelTable2[CB_MAX_CHANNEL] = { * Return Value: true if succeeded; false if failed. * */ -static bool s_bAL7230Init(unsigned long dwIoBase) +static bool s_bAL7230Init(void __iomem *dwIoBase) { int ii; bool bResult; @@ -467,7 +467,7 @@ static bool s_bAL7230Init(unsigned long dwIoBase) } // Need to Pull PLLON low when writing channel registers through 3-wire interface -static bool s_bAL7230SelectChannel(unsigned long dwIoBase, unsigned char byChannel) +static bool s_bAL7230SelectChannel(void __iomem *dwIoBase, unsigned char byChannel) { bool bResult; @@ -567,7 +567,7 @@ static bool s_bAL7230SelectChannel(unsigned long dwIoBase, unsigned char byChann * Return Value: true if succeeded; false if failed. * */ -bool IFRFbWriteEmbedded(unsigned long dwIoBase, unsigned long dwData) +bool IFRFbWriteEmbedded(void __iomem *dwIoBase, unsigned long dwData) { unsigned short ww; unsigned long dwValue; @@ -626,7 +626,7 @@ bool IFRFbWriteEmbedded(unsigned long dwIoBase, unsigned long dwData) * Return Value: true if succeeded; false if failed. * */ -static bool RFbAL2230Init(unsigned long dwIoBase) +static bool RFbAL2230Init(void __iomem *dwIoBase) { int ii; bool bResult; @@ -673,7 +673,7 @@ static bool RFbAL2230Init(unsigned long dwIoBase) return bResult; } -static bool RFbAL2230SelectChannel(unsigned long dwIoBase, unsigned char byChannel) +static bool RFbAL2230SelectChannel(void __iomem *dwIoBase, unsigned char byChannel) { bool bResult; @@ -750,6 +750,7 @@ bool RFbInit( ) { bool bResult = true; + switch (pDevice->byRFType) { case RF_AIROHA: case RF_AL2230S: @@ -783,9 +784,10 @@ bool RFbInit( * Return Value: true if succeeded; false if failed. * */ -bool RFbSelectChannel(unsigned long dwIoBase, unsigned char byRFType, unsigned char byChannel) +bool RFbSelectChannel(void __iomem *dwIoBase, unsigned char byRFType, unsigned char byChannel) { bool bResult = true; + switch (byRFType) { case RF_AIROHA: case RF_AL2230S: @@ -818,7 +820,7 @@ bool RFbSelectChannel(unsigned long dwIoBase, unsigned char byRFType, unsigned c * Return Value: None. * */ -bool RFvWriteWakeProgSyn(unsigned long dwIoBase, unsigned char byRFType, unsigned int uChannel) +bool RFvWriteWakeProgSyn(void __iomem *dwIoBase, unsigned char byRFType, unsigned int uChannel) { int ii; unsigned char byInitCount = 0; @@ -871,11 +873,9 @@ bool RFvWriteWakeProgSyn(unsigned long dwIoBase, unsigned char byRFType, unsigne case RF_NOTHING: return true; - break; default: return false; - break; } MACvSetMISCFifo(dwIoBase, MISCFIFO_SYNINFO_IDX, (unsigned long)MAKEWORD(bySleepCount, byInitCount)); @@ -1070,7 +1070,7 @@ RFvRSSITodBm( // Post processing for the 11b/g and 11a. // for save time on changing Reg2,3,5,7,10,12,15 -bool RFbAL7230SelectChannelPostProcess(unsigned long dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel) +bool RFbAL7230SelectChannelPostProcess(void __iomem *dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel) { bool bResult; diff --git a/drivers/staging/vt6655/rf.h b/drivers/staging/vt6655/rf.h index ef3c6de09fec..ba55561c45d2 100644 --- a/drivers/staging/vt6655/rf.h +++ b/drivers/staging/vt6655/rf.h @@ -74,12 +74,12 @@ /*--------------------- Export Functions --------------------------*/ -bool IFRFbWriteEmbedded(unsigned long dwIoBase, unsigned long dwData); -bool RFbSelectChannel(unsigned long dwIoBase, unsigned char byRFType, unsigned char byChannel); +bool IFRFbWriteEmbedded(void __iomem *dwIoBase, unsigned long dwData); +bool RFbSelectChannel(void __iomem *dwIoBase, unsigned char byRFType, unsigned char byChannel); bool RFbInit( PSDevice pDevice ); -bool RFvWriteWakeProgSyn(unsigned long dwIoBase, unsigned char byRFType, unsigned int uChannel); +bool RFvWriteWakeProgSyn(void __iomem *dwIoBase, unsigned char byRFType, unsigned int uChannel); bool RFbSetPower(PSDevice pDevice, unsigned int uRATE, unsigned int uCH); bool RFbRawSetPower( PSDevice pDevice, @@ -95,7 +95,7 @@ RFvRSSITodBm( ); //{{ RobertYu: 20050104 -bool RFbAL7230SelectChannelPostProcess(unsigned long dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel); +bool RFbAL7230SelectChannelPostProcess(void __iomem *dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel); //}} RobertYu #endif // __RF_H__ diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 2219d71885a8..0d45aa076fed 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -78,16 +78,16 @@ static int msglevel = MSG_LEVEL_INFO; #define CRITICAL_PACKET_LEN 256 // if packet size < 256 -> in-direct send // packet size >= 256 -> direct send -const unsigned short wTimeStampOff[2][MAX_RATE] = { +static const unsigned short wTimeStampOff[2][MAX_RATE] = { {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble }; -const unsigned short wFB_Opt0[2][5] = { +static const unsigned short wFB_Opt0[2][5] = { {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, // fallback_rate0 {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, // fallback_rate1 }; -const unsigned short wFB_Opt1[2][5] = { +static const unsigned short wFB_Opt1[2][5] = { {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, // fallback_rate0 {RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1 }; @@ -1084,6 +1084,7 @@ s_vGenerateTxParameter( unsigned char byFBOption = AUTO_FB_NONE; PSTxBufHead pFifoHead = (PSTxBufHead)pTxBufHead; + pFifoHead->wReserved = wCurrentRate; wFifoCtl = pFifoHead->wFIFOCtl; @@ -1103,6 +1104,7 @@ s_vGenerateTxParameter( //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 @@ -1116,6 +1118,7 @@ s_vGenerateTxParameter( //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 @@ -1129,6 +1132,7 @@ s_vGenerateTxParameter( //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; + 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 } @@ -1138,6 +1142,7 @@ s_vGenerateTxParameter( //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; + pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK)); //0:OFDM } } @@ -1146,6 +1151,7 @@ s_vGenerateTxParameter( //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; + 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 } @@ -1155,6 +1161,7 @@ s_vGenerateTxParameter( //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; + pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK)); //1:CCK } } @@ -1958,8 +1965,6 @@ vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pb *pcbHeaderSize = s_cbFillTxBufHead(pDevice, byPktType, pbyTxBufferAddr, cbPayloadSize, uDMAIdx, pHeadTD, psEthHeader, pPacket, bNeedEncrypt, pTransmitKey, uNodeIndex, puMACfragNum); - - return; } /*+ @@ -2027,6 +2032,7 @@ vGenerateMACHeader( if (pDevice->bLongHeader) { PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr; + pMACHeader->wFrameCtl |= (FC_TODS | FC_FROMDS); memcpy(pMACA4Header->abyAddr4, pDevice->abyBSSID, WLAN_ADDR_LEN); } @@ -2045,7 +2051,8 @@ vGenerateMACHeader( pMACHeader->wFrameCtl |= FC_MOREFRAG; } -CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { +CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) +{ PSTxDesc pFrstTD; unsigned char byPktType; unsigned char *pbyTxBufferAddr; @@ -2331,7 +2338,8 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { return CMD_STATUS_PENDING; } -CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { +CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) +{ unsigned char byPktType; unsigned char *pbyBuffer = (unsigned char *)pDevice->tx_beacon_bufs; unsigned int cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN; @@ -2569,7 +2577,7 @@ 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); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vDMA0_tx_80211: p80211Header->sA3.wFrameCtl = %x\n", p80211Header->sA3.wFrameCtl); //Set packet type if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 @@ -2840,6 +2848,4 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un // Poll Transmit the adapter MACvTransmit0(pDevice->PortOffset); - - return; } diff --git a/drivers/staging/vt6655/srom.c b/drivers/staging/vt6655/srom.c index eaddc33c9d2d..5396e5832c22 100644 --- a/drivers/staging/vt6655/srom.c +++ b/drivers/staging/vt6655/srom.c @@ -73,7 +73,7 @@ * Return Value: data read * */ -unsigned char SROMbyReadEmbedded(unsigned long dwIoBase, unsigned char byContntOffset) +unsigned char SROMbyReadEmbedded(void __iomem *dwIoBase, unsigned char byContntOffset) { unsigned short wDelay, wNoACK; unsigned char byWait; @@ -121,7 +121,7 @@ unsigned char SROMbyReadEmbedded(unsigned long dwIoBase, unsigned char byContntO * Return Value: true if succeeded; false if failed. * */ -bool SROMbWriteEmbedded(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byData) +bool SROMbWriteEmbedded(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byData) { unsigned short wDelay, wNoACK; unsigned char byWait; @@ -173,7 +173,7 @@ bool SROMbWriteEmbedded(unsigned long dwIoBase, unsigned char byContntOffset, un * Return Value: none * */ -void SROMvRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits) +void SROMvRegBitsOn(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byBits) { unsigned char byOrgData; @@ -193,7 +193,7 @@ void SROMvRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsign * none * */ -void SROMvRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits) +void SROMvRegBitsOff(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byBits) { unsigned char byOrgData; @@ -215,7 +215,7 @@ void SROMvRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsig * Return Value: true if all test bits on; otherwise false * */ -bool SROMbIsRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits) +bool SROMbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byTestBits) { unsigned char byOrgData; @@ -237,7 +237,7 @@ bool SROMbIsRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsi * Return Value: true if all test bits off; otherwise false * */ -bool SROMbIsRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits) +bool SROMbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byTestBits) { unsigned char byOrgData; @@ -257,7 +257,7 @@ bool SROMbIsRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, uns * Return Value: none * */ -void SROMvReadAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs) +void SROMvReadAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs) { int ii; @@ -281,7 +281,7 @@ void SROMvReadAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs) * Return Value: none * */ -void SROMvWriteAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs) +void SROMvWriteAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs) { int ii; @@ -304,7 +304,7 @@ void SROMvWriteAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs) * Return Value: none * */ -void SROMvReadEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress) +void SROMvReadEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress) { unsigned char ii; @@ -328,7 +328,7 @@ void SROMvReadEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddres * Return Value: none * */ -void SROMvWriteEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress) +void SROMvWriteEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress) { unsigned char ii; @@ -351,7 +351,7 @@ void SROMvWriteEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddre * Return Value: none * */ -void SROMvReadSubSysVenId(unsigned long dwIoBase, unsigned long *pdwSubSysVenId) +void SROMvReadSubSysVenId(void __iomem *dwIoBase, unsigned long *pdwSubSysVenId) { unsigned char *pbyData; @@ -376,7 +376,7 @@ void SROMvReadSubSysVenId(unsigned long dwIoBase, unsigned long *pdwSubSysVenId) * Return Value: true if success; otherwise false * */ -bool SROMbAutoLoad(unsigned long dwIoBase) +bool SROMbAutoLoad(void __iomem *dwIoBase) { unsigned char byWait; int ii; diff --git a/drivers/staging/vt6655/srom.h b/drivers/staging/vt6655/srom.h index 1df58c516ddc..3128e535bbd8 100644 --- a/drivers/staging/vt6655/srom.h +++ b/drivers/staging/vt6655/srom.h @@ -133,23 +133,23 @@ typedef struct tagSSromReg { /*--------------------- Export Functions --------------------------*/ -unsigned char SROMbyReadEmbedded(unsigned long dwIoBase, unsigned char byContntOffset); -bool SROMbWriteEmbedded(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byData); +unsigned char SROMbyReadEmbedded(void __iomem *dwIoBase, unsigned char byContntOffset); +bool SROMbWriteEmbedded(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byData); -void SROMvRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits); -void SROMvRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits); +void SROMvRegBitsOn(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byBits); +void SROMvRegBitsOff(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byBits); -bool SROMbIsRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits); -bool SROMbIsRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits); +bool SROMbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byTestBits); +bool SROMbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byTestBits); -void SROMvReadAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs); -void SROMvWriteAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs); +void SROMvReadAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs); +void SROMvWriteAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs); -void SROMvReadEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress); -void SROMvWriteEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress); +void SROMvReadEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress); +void SROMvWriteEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress); -void SROMvReadSubSysVenId(unsigned long dwIoBase, unsigned long *pdwSubSysVenId); +void SROMvReadSubSysVenId(void __iomem *dwIoBase, unsigned long *pdwSubSysVenId); -bool SROMbAutoLoad(unsigned long dwIoBase); +bool SROMbAutoLoad(void __iomem *dwIoBase); #endif // __EEPROM_H__ diff --git a/drivers/staging/vt6655/tcrc.c b/drivers/staging/vt6655/tcrc.c index ed6868a9c16e..ddc5efd040f9 100644 --- a/drivers/staging/vt6655/tcrc.c +++ b/drivers/staging/vt6655/tcrc.c @@ -41,7 +41,7 @@ /*--------------------- Static Variables --------------------------*/ -// 32-bit CRC table +/* 32-bit CRC table */ static const unsigned long s_adwCrc32Table[256] = { 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h index 155e66439073..e262f1b00e66 100644 --- a/drivers/staging/vt6655/upc.h +++ b/drivers/staging/vt6655/upc.h @@ -35,79 +35,39 @@ /*--------------------- Export Definitions -------------------------*/ // -// For IO mapped -// - -#ifdef IO_MAP - -#define VNSvInPortB(dwIOAddress, pbyData) \ -do { \ - *(pbyData) = inb(dwIOAddress); \ -} while (0) - -#define VNSvInPortW(dwIOAddress, pwData) \ -do { \ - *(pwData) = inw(dwIOAddress); \ -} while (0) - -#define VNSvInPortD(dwIOAddress, pdwData) \ -do { \ - *(pdwData) = inl(dwIOAddress); \ -} while (0) - -#define VNSvOutPortB(dwIOAddress, byData) \ - outb(byData, dwIOAddress) - -#define VNSvOutPortW(dwIOAddress, wData) \ - outw(wData, dwIOAddress) - -#define VNSvOutPortD(dwIOAddress, dwData) \ - outl(dwData, dwIOAddress) - -#else - -// // For memory mapped IO // #define VNSvInPortB(dwIOAddress, pbyData) \ do { \ - volatile unsigned char *pbyAddr = (unsigned char *)(dwIOAddress); \ - *(pbyData) = readb(pbyAddr); \ + *(pbyData) = readb(dwIOAddress); \ } while (0) #define VNSvInPortW(dwIOAddress, pwData) \ do { \ - volatile unsigned short *pwAddr = (unsigned short *)(dwIOAddress); \ - *(pwData) = readw(pwAddr); \ + *(pwData) = readw(dwIOAddress); \ } while (0) #define VNSvInPortD(dwIOAddress, pdwData) \ do { \ - volatile unsigned long *pdwAddr = (unsigned long *)(dwIOAddress); \ - *(pdwData) = readl(pdwAddr); \ + *(pdwData) = readl(dwIOAddress); \ } while (0) #define VNSvOutPortB(dwIOAddress, byData) \ do { \ - volatile unsigned char *pbyAddr = (unsigned char *)(dwIOAddress); \ - writeb((unsigned char)byData, pbyAddr); \ + writeb((unsigned char)byData, dwIOAddress); \ } while (0) #define VNSvOutPortW(dwIOAddress, wData) \ do { \ - volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \ - writew((unsigned short)wData, pwAddr); \ + writew((unsigned short)wData, dwIOAddress); \ } while (0) #define VNSvOutPortD(dwIOAddress, dwData) \ do { \ - volatile unsigned long *pdwAddr = (unsigned long *)(dwIOAddress); \ - writel((unsigned long)dwData, pdwAddr); \ + writel((unsigned long)dwData, dwIOAddress); \ } while (0) -#endif - // // ALWAYS IO-Mapped IO when in 16-bit/32-bit environment // diff --git a/drivers/staging/vt6655/vntwifi.c b/drivers/staging/vt6655/vntwifi.c index 7d61598563c7..4d425e0c76d4 100644 --- a/drivers/staging/vt6655/vntwifi.c +++ b/drivers/staging/vt6655/vntwifi.c @@ -128,6 +128,7 @@ VNTWIFIpGetCurrentSSID( ) { PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; + return (PWLAN_IE_SSID) pMgmt->abyCurrSSID; } @@ -151,6 +152,7 @@ VNTWIFIpGetCurrentChannel( ) { PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; + if (pMgmtHandle != NULL) return pMgmt->uCurrChannel; @@ -177,6 +179,7 @@ VNTWIFIwGetAssocID( ) { PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; + return pMgmt->wCurrAID; } @@ -255,7 +258,7 @@ VNTWIFIbyGetACKTxRate( if (byRxDataRate <= RATE_11M) { byMaxAckRate = RATE_1M; } else { - // 24M is mandatory for 802.11a and 802.11g + /* 24M is mandatory for 802.11a and 802.11g */ byMaxAckRate = RATE_24M; } if (pSupportRateIEs) { @@ -491,7 +494,7 @@ VNTWIFIvUpdateNodeTxCounter( pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts++; if (bTxOk) { - // transmit success, TxAttempts at least plus one + /* transmit success, TxAttempts at least plus one */ pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wRate]++; } else { @@ -500,8 +503,6 @@ VNTWIFIvUpdateNodeTxCounter( pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE]; for (ii = 0; ii < MAX_RATE; ii++) pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii]; - - return; } void @@ -525,7 +526,7 @@ VNTWIFIvGetTxRate( if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) || (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { - // Adhoc Tx rate decided from node DB + /* Adhoc Tx rate decided from node DB */ if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex)) { wTxDataRate = (pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate); pSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrSuppRates); @@ -539,11 +540,11 @@ VNTWIFIvGetTxRate( pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates; pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates; } - } else { // Infrastructure: rate decided from AP Node, index = 0 + } else { /* Infrastructure: rate decided from AP Node, index = 0 */ wTxDataRate = (pMgmt->sNodeDBTable[0].wTxDataRate); #ifdef PLICE_DEBUG - printk(KERN_DEBUG "GetTxRate:AP MAC is %pM,TxRate is %d\n", + pr_debug("GetTxRate:AP MAC is %pM,TxRate is %d\n", pMgmt->sNodeDBTable[0].abyMACAddr, wTxDataRate); #endif @@ -569,7 +570,6 @@ VNTWIFIvGetTxRate( *pbyACKRate = byACKRate; *pbyCCKBasicRate = byCCKBasicRate; *pbyOFDMBasicRate = byOFDMBasicRate; - return; } unsigned char @@ -684,9 +684,8 @@ VNTWIFIbMeasureReport( pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len); pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID; } - if (bEndOfReport) { + if (bEndOfReport) IEEE11hbMSRRepTx(pMgmt); - } return true; } diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c index a689645fa012..f12eef064c45 100644 --- a/drivers/staging/vt6655/wcmd.c +++ b/drivers/staging/vt6655/wcmd.c @@ -216,9 +216,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail..\n"); else - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending..\n"); } } } @@ -234,7 +234,7 @@ s_vProbeChannel( * -*/ -PSTxMgmtPacket +static PSTxMgmtPacket s_MgrMakeProbeRequest( PSDevice pDevice, PSMgmtObject pMgmt, @@ -295,7 +295,6 @@ vCommandTimerWait( // RUN_AT :1 msec ~= (HZ/1024) pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10); add_timer(&pDevice->sTimerCommand); - return; } void @@ -368,7 +367,7 @@ 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); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d\n", pMgmt->uScanChannel); s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -433,9 +432,10 @@ vCommandTimer( vAdHocBeaconRestart(pDevice); //2008-0409-07, <Add> by Einsn Liu #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - if (pMgmt->eScanType == WMAC_SCAN_PASSIVE) - {//send scan event to wpa_Supplicant + if (pMgmt->eScanType == WMAC_SCAN_PASSIVE) { + //send scan event to wpa_Supplicant union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); } @@ -493,7 +493,7 @@ vCommandTimer( spin_unlock_irq(&pDevice->lock); return; } - printk("chester-abyDesireSSID=%s\n", ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID); + 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); @@ -560,7 +560,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail !\n"); BSSvAddMulticastNode(pDevice); } @@ -572,7 +572,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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail !\n"); BSSvAddMulticastNode(pDevice); if (netif_queue_stopped(pDevice->dev)) @@ -584,9 +584,10 @@ vCommandTimer( #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT { union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; - printk("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n"); + pr_debug("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n"); wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } #endif @@ -614,10 +615,10 @@ vCommandTimer( } else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { - printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); + pr_debug("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay! pDevice->byLinkWaitCount++; - printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); + pr_debug("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); vCommandTimerWait((void *)pDevice, AUTHENTICATE_TIMEOUT/2); return; @@ -664,7 +665,7 @@ vCommandTimer( printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay! pDevice->byLinkWaitCount++; - printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); + pr_debug("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT/2); return; @@ -692,7 +693,7 @@ vCommandTimer( vMgrCreateOwnIBSS((void *)pDevice, &Status); if (Status != CMD_STATUS_SUCCESS) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail ! \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail !\n"); // alway turn off unicast bit MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_UNICAST); @@ -719,7 +720,7 @@ vCommandTimer( pDevice->bMoreData = true; } if (!device_dma0_xmit(pDevice, skb, 0)) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail\n"); pMgmt->sNodeDBTable[0].wEnQueueCnt--; } @@ -741,7 +742,7 @@ vCommandTimer( pDevice->bMoreData = true; } if (!device_dma0_xmit(pDevice, skb, ii)) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail\n"); pMgmt->sNodeDBTable[ii].wEnQueueCnt--; // check if sta ps enabled, and wait next pspoll. @@ -753,7 +754,7 @@ 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); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear\n", ii); } pMgmt->sNodeDBTable[ii].bRxPSPoll = false; } @@ -796,7 +797,6 @@ vCommandTimer( } //switch spin_unlock_irq(&pDevice->lock); - return; } static @@ -992,6 +992,7 @@ BSSvSecondTxData( { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + pDevice->nTxDataTimeCout++; if (pDevice->nTxDataTimeCout < 4) //don't tx data if timer less than 40s diff --git a/drivers/staging/vt6655/wcmd.h b/drivers/staging/vt6655/wcmd.h index 2844476d5dc9..126b61c48791 100644 --- a/drivers/staging/vt6655/wcmd.h +++ b/drivers/staging/vt6655/wcmd.h @@ -33,12 +33,9 @@ #include "80211hdr.h" #include "80211mgr.h" -/*--------------------- Export Definitions -------------------------*/ +#define AUTHENTICATE_TIMEOUT 1000 +#define ASSOCIATE_TIMEOUT 1000 -#define AUTHENTICATE_TIMEOUT 1000 //ms -#define ASSOCIATE_TIMEOUT 1000 //ms - -// Command code typedef enum tagCMD_CODE { WLAN_CMD_BSSID_SCAN, WLAN_CMD_SSID, @@ -76,7 +73,6 @@ typedef struct tagCMD_ITEM { bool bForceSCAN; } CMD_ITEM, *PCMD_ITEM; -// Command state typedef enum tagCMD_STATE { WLAN_CMD_SCAN_START, WLAN_CMD_SCAN_END, @@ -92,13 +88,6 @@ typedef enum tagCMD_STATE { WLAN_CMD_IDLE } CMD_STATE, *PCMD_STATE; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ void vResetCommandTimer( void *hDeviceContext diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c index 67384782b702..e88e11606db0 100644 --- a/drivers/staging/vt6655/wmgr.c +++ b/drivers/staging/vt6655/wmgr.c @@ -358,8 +358,6 @@ vMgrObjectInit( pMgmt->byCSSGK = KEY_CTL_NONE; pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI; BSSvClearBSSList((void *)pDevice, false); - - return; } /*+ @@ -403,8 +401,6 @@ vMgrTimerInit( pDevice->cbFreeCmdQueue = CMD_Q_SIZE; pDevice->uCmdDequeueIdx = 0; pDevice->uCmdEnqueueIdx = 0; - - return; } /*+ @@ -429,8 +425,6 @@ vMgrObjectReset( pMgmt->eCurrState = WMAC_STATE_IDLE; pDevice->bEnablePSMode = false; // TODO: timer - - return; } /*+ @@ -498,8 +492,6 @@ vMgrAssocBeginSta( } else { *pStatus = CMD_STATUS_RESOURCES; } - - return; } /*+ @@ -565,8 +557,6 @@ vMgrReAssocBeginSta( else DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx sending.\n"); } - - return; } /*+ @@ -625,8 +615,6 @@ vMgrDisassocBeginSta( pMgmt->eCurrState = WMAC_STATE_IDLE; *pStatus = CMD_STATUS_SUCCESS; } - - return; } /*+ @@ -710,7 +698,7 @@ s_vMgrRxAssocRequest( pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; #ifdef PLICE_DEBUG - printk("RxAssocRequest:wTxDataRate is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate); + 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 = @@ -732,8 +720,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", + 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", sFrame.pHdr->sA3.abyAddr2[0], sFrame.pHdr->sA3.abyAddr2[1], sFrame.pHdr->sA3.abyAddr2[2], @@ -741,7 +729,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", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n", pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); } else { /* TODO: received STA under state1 handle */ @@ -771,8 +759,6 @@ s_vMgrRxAssocRequest( else DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx sending..\n"); } - - return; } /*+ @@ -860,7 +846,7 @@ s_vMgrRxReAssocRequest( pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; #ifdef PLICE_DEBUG - printk("RxReAssocRequest:TxDataRate is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate); + 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 = @@ -883,8 +869,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", + 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", sFrame.pHdr->sA3.abyAddr2[0], sFrame.pHdr->sA3.abyAddr2[1], sFrame.pHdr->sA3.abyAddr2[2], @@ -892,7 +878,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", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n", pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); } @@ -921,7 +907,6 @@ s_vMgrRxReAssocRequest( else DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx sending..\n"); } - return; } /*+ @@ -1070,7 +1055,6 @@ s_vMgrRxAssocResponse( if (pMgmt->eCurrState == WMAC_STATE_ASSOC) timer_expire(pDevice->sTimerCommand, 0); - return; } /*+ @@ -1125,8 +1109,6 @@ vMgrAuthenBeginSta( pMgmt->eCurrState = WMAC_STATE_AUTHPENDING; *pStatus = CMD_STATUS_SUCCESS; } - - return; } /*+ @@ -1178,8 +1160,6 @@ vMgrDeAuthenBeginSta( *pStatus = csMgmt_xmit(pDevice, pTxPacket); if (*pStatus == CMD_STATUS_PENDING) *pStatus = CMD_STATUS_SUCCESS; - - return; } /*+ @@ -1232,7 +1212,6 @@ s_vMgrRxAuthentication( cpu_to_le16((*(sFrame.pwAuthSequence)))); break; } - return; } /*+ @@ -1329,11 +1308,9 @@ s_vMgrRxAuthenSequence_1( if (pDevice->bEnableHostapd) return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); - - return; } /*+ @@ -1418,7 +1395,6 @@ s_vMgrRxAuthenSequence_2( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt: rx auth.seq = 2 unknown AuthAlgorithm=%d\n", cpu_to_le16((*(pFrame->pwAuthAlgorithm)))); break; } - return; } /*+ @@ -1504,8 +1480,6 @@ reply: if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_4 tx failed.\n"); - - return; } /*+ @@ -1596,16 +1570,15 @@ s_vMgrRxDisassociation( #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT { union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; - printk("wireless_send_event--->SIOCGIWAP(disassociated)\n"); + pr_debug("wireless_send_event--->SIOCGIWAP(disassociated)\n"); wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } #endif } /* else, ignore it */ - - return; } /*+ @@ -1677,6 +1650,7 @@ s_vMgrRxDeauthentication( #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT { union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; PRINT_K("wireless_send_event--->SIOCGIWAP(disauthen)\n"); @@ -1688,7 +1662,6 @@ s_vMgrRxDeauthentication( /* else, ignore it. TODO: IBSS authentication service would be implemented here */ } - return; } //2008-8-4 <add> by chester @@ -1993,7 +1966,7 @@ s_vMgrRxBeacon( } } -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Beacon 2 \n"); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Beacon 2\n"); // check if CF field exists if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)) { if (sFrame.pCFParms->wCFPDurRemaining > 0) { @@ -2137,14 +2110,14 @@ s_vMgrRxBeacon( pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; #ifdef PLICE_DEBUG { - printk("s_vMgrRxBeacon:TxDataRate is %d,Index is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate, uNodeIndex); + 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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed]\n"); pMgmt->eCurrState = WMAC_STATE_JOINTED; pDevice->bLinkPass = true; if (netif_queue_stopped(pDevice->dev)) @@ -2197,8 +2170,6 @@ if (bUpdateTSF) { CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF); CARDvUpdateNextTBTT(pDevice->PortOffset, qwTimestamp, pMgmt->wCurrBeaconPeriod); } - - return; } /*+ @@ -2434,8 +2405,6 @@ vMgrCreateOwnIBSS( // Prepare beacon to send if (bMgrPrepareBeaconToSend((void *)pDevice, pMgmt)) *pStatus = CMD_STATUS_SUCCESS; - - return; } /*+ @@ -2574,6 +2543,7 @@ vMgrJoinBSSBegin( // This should only works for WPA2 BSS, and WPA2 BSS check must be done before. 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); if (!bResult) { vFlush_PMKID_Candidate((void *)pDevice); @@ -2656,7 +2626,6 @@ vMgrJoinBSSBegin( pMgmt->eCurrState = WMAC_STATE_IDLE; } } - return; } /*+ @@ -2838,8 +2807,6 @@ static void Encyption_Rebuild( } } } - - return; } /*+ @@ -3144,7 +3111,7 @@ s_MgrMakeBeacon( * -*/ -PSTxMgmtPacket +static PSTxMgmtPacket s_MgrMakeProbeResponse( PSDevice pDevice, PSMgmtObject pMgmt, @@ -3326,7 +3293,7 @@ s_MgrMakeProbeResponse( * -*/ -PSTxMgmtPacket +static PSTxMgmtPacket s_MgrMakeAssocRequest( PSDevice pDevice, PSMgmtObject pMgmt, @@ -3586,7 +3553,7 @@ s_MgrMakeAssocRequest( * -*/ -PSTxMgmtPacket +static PSTxMgmtPacket s_MgrMakeReAssocRequest( PSDevice pDevice, PSMgmtObject pMgmt, @@ -3831,7 +3798,7 @@ s_MgrMakeReAssocRequest( * -*/ -PSTxMgmtPacket +static PSTxMgmtPacket s_MgrMakeAssocResponse( PSDevice pDevice, PSMgmtObject pMgmt, @@ -3902,7 +3869,7 @@ s_MgrMakeAssocResponse( * -*/ -PSTxMgmtPacket +static PSTxMgmtPacket s_MgrMakeReAssocResponse( PSDevice pDevice, PSMgmtObject pMgmt, @@ -3999,13 +3966,13 @@ 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); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0\n"); if (sFrame.pDSParms != NULL) { if (byCurrChannel > CB_MAX_CHANNEL_24G) { @@ -4079,7 +4046,6 @@ s_vMgrRxProbeResponse( (void *)pRxPacket ); } - return; } /*+ @@ -4148,13 +4114,10 @@ s_vMgrRxProbeRequest( if (pTxPacket != NULL) { /* send the frame */ Status = csMgmt_xmit(pDevice, pTxPacket); - if (Status != CMD_STATUS_PENDING) { + if (Status != CMD_STATUS_PENDING) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx failed\n"); - } } } - - return; } /*+ @@ -4297,8 +4260,6 @@ vMgrRxManagePacket( default: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx unknown mgmt\n"); } - - return; } /*+ @@ -4438,7 +4399,7 @@ bAdd_PMKID_Candidate( ) { PSDevice pDevice = (PSDevice)hDeviceContext; - PPMKID_CANDIDATE pCandidateList; + 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); diff --git a/drivers/staging/vt6655/wmgr.h b/drivers/staging/vt6655/wmgr.h index 2312d71bac43..a71daed7fa0b 100644 --- a/drivers/staging/vt6655/wmgr.h +++ b/drivers/staging/vt6655/wmgr.h @@ -83,22 +83,19 @@ typedef void (*TimerFunction)(unsigned long); //+++ NDIS related typedef unsigned char NDIS_802_11_MAC_ADDRESS[6]; -typedef struct _NDIS_802_11_AI_REQFI -{ +typedef struct _NDIS_802_11_AI_REQFI { unsigned short Capabilities; unsigned short ListenInterval; NDIS_802_11_MAC_ADDRESS CurrentAPAddress; } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI; -typedef struct _NDIS_802_11_AI_RESFI -{ +typedef struct _NDIS_802_11_AI_RESFI { unsigned short Capabilities; unsigned short StatusCode; unsigned short AssociationId; } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI; -typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION -{ +typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION { unsigned long Length; unsigned short AvailableRequestFixedIEs; NDIS_802_11_AI_REQFI RequestFixedIEs; @@ -187,8 +184,7 @@ typedef struct tagSRxMgmtPacket { unsigned char byRxChannel; } SRxMgmtPacket, *PSRxMgmtPacket; -typedef struct tagSMgmtObject -{ +typedef struct tagSMgmtObject { void *pAdapter; // MAC address unsigned char abyMACAddr[WLAN_ADDR_LEN]; diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c index 9be59c23d7e6..7b1bab91a9cf 100644 --- a/drivers/staging/vt6655/wpa.c +++ b/drivers/staging/vt6655/wpa.c @@ -73,6 +73,7 @@ WPA_ClearRSN( ) { int ii; + pBSSList->byGKType = WPA_TKIP; for (ii = 0; ii < 4; ii++) pBSSList->abyPKType[ii] = WPA_TKIP; @@ -122,8 +123,8 @@ WPA_ParseRSN( && (pRSN->wVersion == 1)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "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) - { + if (pRSN->len >= 10) { + //OUI1(4)+ver(2)+GKSuite(4) if (!memcmp(pRSN->abyMulticast, abyOUI01, 4)) pBSSList->byGKType = WPA_WEP40; else if (!memcmp(pRSN->abyMulticast, abyOUI02, 4)) @@ -141,8 +142,8 @@ WPA_ParseRSN( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byGKType: %x\n", pBSSList->byGKType); } - if (pRSN->len >= 12) //oui1(4)+ver(2)+GKS(4)+PKSCnt(2) - { + 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)); for (i = 0; (i < pRSN->wPKCount) && (j < ARRAY_SIZE(pBSSList->abyPKType)); i++) { @@ -261,7 +262,6 @@ WPA_SearchRSN( return false; } return true; - break; default: break; diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index 8392d4d1d5ed..5f454ca2a3bc 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c @@ -89,7 +89,8 @@ static int wpa_init_wpadev(PSDevice pDevice) struct net_device *dev = pDevice->dev; int ret = 0; - pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup); + pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", + NET_NAME_UNKNOWN, wpadev_setup); if (pDevice->wpadev == NULL) return -ENOMEM; @@ -556,7 +557,7 @@ static int wpa_get_scan(PSDevice pDevice, ptempBSS = kmalloc(sizeof(KnownBSS), GFP_ATOMIC); if (ptempBSS == NULL) { - printk(KERN_ERR "bubble sort kmalloc memory fail@@@\n"); + pr_err("bubble sort kmalloc memory fail@@@\n"); ret = -ENOMEM; @@ -766,6 +767,7 @@ static int wpa_set_associate(PSDevice pDevice, /*******search if ap_scan=2 ,which is associating request in hidden ssid mode ****/ { PKnownBSS pCurr = NULL; + pCurr = BSSpSearchBSSList(pDevice, pMgmt->abyDesireBSSID, pMgmt->abyDesireSSID, @@ -773,7 +775,7 @@ static int wpa_set_associate(PSDevice pDevice, ); if (pCurr == NULL) { - printk("wpa_set_associate---->hidden mode site survey before associate.......\n"); + pr_debug("wpa_set_associate---->hidden mode site survey before associate.......\n"); bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); } } |