diff options
Diffstat (limited to 'drivers/staging/vt6656')
56 files changed, 3855 insertions, 4996 deletions
diff --git a/drivers/staging/vt6656/80211mgr.c b/drivers/staging/vt6656/80211mgr.c index e6ced95e6fa7..534d490539b6 100644 --- a/drivers/staging/vt6656/80211mgr.c +++ b/drivers/staging/vt6656/80211mgr.c @@ -96,9 +96,10 @@ vMgrEncodeBeacon( { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_BEACON_OFF_TS); + /* Fixed Fields */ + pFrame->pqwTimestamp = + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_BEACON_OFF_TS); pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_BCN_INT); pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) @@ -130,9 +131,10 @@ vMgrDecodeBeacon( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_BEACON_OFF_TS); + /* Fixed Fields */ + pFrame->pqwTimestamp = + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_BEACON_OFF_TS); pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_BCN_INT); pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) @@ -178,7 +180,7 @@ vMgrDecodeBeacon( break; case WLAN_EID_RSN_WPA: if (pFrame->pRSNWPA == NULL) { - if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE) + if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; } break; @@ -391,7 +393,7 @@ vMgrDecodeAssocRequest( break; case WLAN_EID_RSN_WPA: if (pFrame->pRSNWPA == NULL) { - if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE) + if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; } break; @@ -561,7 +563,7 @@ vMgrDecodeReassocRequest( break; case WLAN_EID_RSN_WPA: if (pFrame->pRSNWPA == NULL) - if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE) + if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; break; @@ -671,9 +673,10 @@ vMgrEncodeProbeResponse( { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_PROBERESP_OFF_TS); + /* Fixed Fields */ + pFrame->pqwTimestamp = + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_PROBERESP_OFF_TS); pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_BCN_INT); pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) @@ -706,9 +709,10 @@ vMgrDecodeProbeResponse( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_PROBERESP_OFF_TS); + /* Fixed Fields */ + pFrame->pqwTimestamp = + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_PROBERESP_OFF_TS); pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_BCN_INT); pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) @@ -749,7 +753,7 @@ vMgrDecodeProbeResponse( break; case WLAN_EID_RSN_WPA: if (pFrame->pRSNWPA == NULL) { - if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE) + if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; } break; diff --git a/drivers/staging/vt6656/80211mgr.h b/drivers/staging/vt6656/80211mgr.h index e5db73be0e71..f8e16d8989ea 100644 --- a/drivers/staging/vt6656/80211mgr.h +++ b/drivers/staging/vt6656/80211mgr.h @@ -38,7 +38,7 @@ #define WLAN_MIN_ARRAY 1 -// Information Element ID value +/* Information Element ID value */ #define WLAN_EID_SSID 0 #define WLAN_EID_SUPP_RATES 1 #define WLAN_EID_FH_PARMS 2 @@ -59,10 +59,10 @@ #define WLAN_EID_QUIET 40 #define WLAN_EID_IBSS_DFS 41 #define WLAN_EID_ERP 42 -// reference 802.11i 7.3.2 table 20 +/* reference 802.11i 7.3.2 table 20 */ #define WLAN_EID_RSN 48 #define WLAN_EID_EXTSUPP_RATES 50 -// reference WiFi WPA spec. +/* reference WiFi WPA spec */ #define WLAN_EID_RSN_WPA 221 #ifdef Cisco_ccx @@ -75,7 +75,7 @@ #define WLAN_EID_ERP_USE_PROTECTION 0x02 #define WLAN_EID_ERP_BARKER_MODE 0x04 -// Reason Codes +/* reason codes */ #define WLAN_MGMT_REASON_RSVD 0 #define WLAN_MGMT_REASON_UNSPEC 1 #define WLAN_MGMT_REASON_PRIOR_AUTH_INVALID 2 @@ -100,7 +100,7 @@ #define WLAN_MGMT_REASON_RSNE_CAP_INVALID 22 #define WLAN_MGMT_REASON_80211X_AUTH_FAILED 23 -// Status Codes +/* status codes */ #define WLAN_MGMT_STATUS_SUCCESS 0 #define WLAN_MGMT_STATUS_UNSPEC_FAILURE 1 #define WLAN_MGMT_STATUS_CAPS_UNSUPPORTED 10 @@ -116,19 +116,16 @@ #define WLAN_MGMT_STATUS_ASSOC_DENIED_PBCC 20 #define WLAN_MGMT_STATUS_ASSOC_DENIED_AGILITY 21 -// reference 802.11h 7.3.1.9 -// +/* reference 802.11h 7.3.1.9 */ #define WLAN_MGMT_STATUS_ASSOC_REJECT_BCS_SPECTRUM_MNG 22 #define WLAN_MGMT_STATUS_ASSOC_REJECT_BCS_PWR_CAP 23 #define WLAN_MGMT_STATUS_ASSOC_REJECT_BCS_SUPP_CH 24 -// -// reference 802.11g 7.3.1.9 -// + +/* reference 802.11g 7.3.1.9 */ #define WLAN_MGMT_STATUS_SHORTSLOTTIME_UNSUPPORTED 25 #define WLAN_MGMT_STATUS_DSSSOFDM_UNSUPPORTED 26 -// -// reference 802.11i 7.3.1.9 table 19 -// + +/* reference 802.11i 7.3.1.9 table 19 */ #define WLAN_MGMT_STATUS_INVALID_IE 40 #define WLAN_MGMT_STATUS_GROUP_CIPHER_INVALID 41 #define WLAN_MGMT_STATUS_PAIRWISE_CIPHER_INVALID 42 @@ -137,17 +134,16 @@ #define WLAN_MGMT_STATUS_INVALID_RSN_IE_CAP 45 #define WLAN_MGMT_STATUS_CIPHER_REJECT 46 - - -// Auth Algorithm +/* auth algorithm */ #define WLAN_AUTH_ALG_OPENSYSTEM 0 #define WLAN_AUTH_ALG_SHAREDKEY 1 +/* management frame field offsets */ - -// Management Frame Field Offsets -// Note: Not all fields are listed because of variable lengths. -// Note: These offsets are from the start of the frame data +/* + * Note: Not all fields are listed because of variable lengths + * Note: These offsets are from the start of the frame data + */ #define WLAN_BEACON_OFF_TS 0 #define WLAN_BEACON_OFF_BCN_INT 8 @@ -189,10 +185,7 @@ #define WLAN_DEAUTHEN_OFF_REASON 0 - -// -// Cipher Suite Selectors defined in 802.11i -// +/* cipher suite selectors defined in 802.11i */ #define WLAN_11i_CSS_USE_GROUP 0 #define WLAN_11i_CSS_WEP40 1 #define WLAN_11i_CSS_TKIP 2 @@ -200,24 +193,22 @@ #define WLAN_11i_CSS_WEP104 5 #define WLAN_11i_CSS_UNKNOWN 255 -// -// Authentication and Key Management Suite Selectors defined in 802.11i -// +/* authentication and key management suite selectors defined in 802.11i */ #define WLAN_11i_AKMSS_802_1X 1 #define WLAN_11i_AKMSS_PSK 2 #define WLAN_11i_AKMSS_UNKNOWN 255 -// Measurement type definitions reference ieee 802.11h Table 20b +/* measurement type definitions reference IEEE 802.11h table 20b */ #define MEASURE_TYPE_BASIC 0 #define MEASURE_TYPE_CCA 1 #define MEASURE_TYPE_RPI 2 -// Measurement request mode definitions reference ieee 802.11h Figure 46h +/* measurement request mode definitions reference IEEE 802.11h figure 46h */ #define MEASURE_MODE_ENABLE 0x02 #define MEASURE_MODE_REQ 0x04 #define MEASURE_MODE_REP 0x08 -// Measurement report mode definitions reference ieee 802.11h Figure 46m +/* measurement report mode definitions reference IEEE 802.11h figure 46m */ #define MEASURE_MODE_LATE 0x01 #define MEASURE_MODE_INCAPABLE 0x02 #define MEASURE_MODE_REFUSED 0x04 @@ -228,7 +219,7 @@ /*--------------------- Export Types ------------------------------*/ -// Information Element Types +/* Information Element types */ #pragma pack(1) typedef struct tagWLAN_IE { @@ -237,7 +228,7 @@ typedef struct tagWLAN_IE { } __attribute__ ((__packed__)) WLAN_IE, *PWLAN_IE; -// Service Set Identity (SSID) +/* Service Set IDentity (SSID) */ #pragma pack(1) typedef struct tagWLAN_IE_SSID { BYTE byElementID; @@ -246,7 +237,7 @@ typedef struct tagWLAN_IE_SSID { } __attribute__ ((__packed__)) WLAN_IE_SSID, *PWLAN_IE_SSID; -// Supported Rates +/* Supported Rates */ #pragma pack(1) typedef struct tagWLAN_IE_SUPP_RATES { BYTE byElementID; @@ -255,7 +246,7 @@ typedef struct tagWLAN_IE_SUPP_RATES { } __attribute__ ((__packed__)) WLAN_IE_SUPP_RATES, *PWLAN_IE_SUPP_RATES; -// FH Parameter Set +/* FH Parameter Set */ #pragma pack(1) typedef struct _WLAN_IE_FH_PARMS { BYTE byElementID; @@ -266,7 +257,7 @@ typedef struct _WLAN_IE_FH_PARMS { BYTE byHopIndex; } WLAN_IE_FH_PARMS, *PWLAN_IE_FH_PARMS; -// DS Parameter Set +/* DS Parameter Set */ #pragma pack(1) typedef struct tagWLAN_IE_DS_PARMS { BYTE byElementID; @@ -275,7 +266,7 @@ typedef struct tagWLAN_IE_DS_PARMS { } __attribute__ ((__packed__)) WLAN_IE_DS_PARMS, *PWLAN_IE_DS_PARMS; -// CF Parameter Set +/* CF Parameter Set */ #pragma pack(1) typedef struct tagWLAN_IE_CF_PARMS { BYTE byElementID; @@ -287,7 +278,7 @@ typedef struct tagWLAN_IE_CF_PARMS { } __attribute__ ((__packed__)) WLAN_IE_CF_PARMS, *PWLAN_IE_CF_PARMS; -// TIM +/* TIM */ #pragma pack(1) typedef struct tagWLAN_IE_TIM { BYTE byElementID; @@ -299,7 +290,7 @@ typedef struct tagWLAN_IE_TIM { } __attribute__ ((__packed__)) WLAN_IE_TIM, *PWLAN_IE_TIM; -// IBSS Parameter Set +/* IBSS Parameter Set */ #pragma pack(1) typedef struct tagWLAN_IE_IBSS_PARMS { BYTE byElementID; @@ -308,7 +299,7 @@ typedef struct tagWLAN_IE_IBSS_PARMS { } __attribute__ ((__packed__)) WLAN_IE_IBSS_PARMS, *PWLAN_IE_IBSS_PARMS; -// Challenge Text +/* Challenge Text */ #pragma pack(1) typedef struct tagWLAN_IE_CHALLENGE { BYTE byElementID; @@ -325,10 +316,10 @@ typedef struct tagWLAN_IE_RSN_EXT { WORD wVersion; BYTE abyMulticast[4]; WORD wPKCount; - struct { - BYTE abyOUI[4]; - } PKSList[1]; // the rest is variable so need to - // overlay ieauth structure + struct { + BYTE abyOUI[4]; + } PKSList[1]; + /* the rest is variable so need to overlay ieauth structure */ } WLAN_IE_RSN_EXT, *PWLAN_IE_RSN_EXT; #pragma pack(1) @@ -339,7 +330,7 @@ typedef struct tagWLAN_IE_RSN_AUTH { } AuthKSList[1]; } WLAN_IE_RSN_AUTH, *PWLAN_IE_RSN_AUTH; -// RSN Identity +/* RSN Identity */ #pragma pack(1) typedef struct tagWLAN_IE_RSN { BYTE byElementID; @@ -348,8 +339,7 @@ typedef struct tagWLAN_IE_RSN { BYTE abyRSN[WLAN_MIN_ARRAY]; } WLAN_IE_RSN, *PWLAN_IE_RSN; - -// CCX Identity DavidWang +/* CCX Identity DavidWang */ #pragma pack(1) typedef struct tagWLAN_IE_CCX { BYTE byElementID; @@ -371,9 +361,7 @@ BYTE len; BYTE abyCCXVer[5]; } WLAN_IE_CCX_Ver, *PWLAN_IE_CCX_Ver; - - -// ERP +/* ERP */ #pragma pack(1) typedef struct tagWLAN_IE_ERP { BYTE byElementID; @@ -505,10 +493,9 @@ typedef struct _WLAN_IE_IBSS_DFS { #pragma pack() +/* frame types */ - -// Frame Types -// prototype structure, all mgmt frame types will start with these members +/* prototype structure, all mgmt frame types will start with these members */ typedef struct tagWLAN_FR_MGMT { unsigned int uType; @@ -518,21 +505,21 @@ typedef struct tagWLAN_FR_MGMT { } WLAN_FR_MGMT, *PWLAN_FR_MGMT; -// Beacon frame +/* beacon frame */ typedef struct tagWLAN_FR_BEACON { unsigned int uType; unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; - // fixed fields - PQWORD pqwTimestamp; + /* fixed fields */ + u64 *pqwTimestamp; PWORD pwBeaconInterval; PWORD pwCapInfo; - /*-- info elements ----------*/ + /* info elements */ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; -// PWLAN_IE_FH_PARMS pFHParms; +/* PWLAN_IE_FH_PARMS pFHParms; */ PWLAN_IE_DS_PARMS pDSParms; PWLAN_IE_CF_PARMS pCFParms; PWLAN_IE_TIM pTIM; @@ -549,8 +536,7 @@ typedef struct tagWLAN_FR_BEACON { } WLAN_FR_BEACON, *PWLAN_FR_BEACON; - -// IBSS ATIM frame +/* IBSS ATIM frame */ typedef struct tagWLAN_FR_IBSSATIM { unsigned int uType; @@ -558,36 +544,36 @@ typedef struct tagWLAN_FR_IBSSATIM { PBYTE pBuf; PUWLAN_80211HDR pHdr; - // fixed fields - // info elements - // this frame type has a null body + /* fixed fields */ + /* info elements */ + /* this frame type has a null body */ } WLAN_FR_IBSSATIM, *PWLAN_FR_IBSSATIM; -// Disassociation +/* disassociation */ typedef struct tagWLAN_FR_DISASSOC { unsigned int uType; unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ + /* fixed fields */ PWORD pwReason; - /*-- info elements ----------*/ + /* info elements */ } WLAN_FR_DISASSOC, *PWLAN_FR_DISASSOC; -// Association Request +/* association request */ typedef struct tagWLAN_FR_ASSOCREQ { unsigned int uType; unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ + /* fixed fields */ PWORD pwCapInfo; PWORD pwListenInterval; - /*-- info elements ----------*/ + /* info elements */ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_RSN pRSN; @@ -601,24 +587,24 @@ typedef struct tagWLAN_FR_ASSOCREQ { } WLAN_FR_ASSOCREQ, *PWLAN_FR_ASSOCREQ; -// Association Response +/* association response */ typedef struct tagWLAN_FR_ASSOCRESP { unsigned int uType; unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ + /* fixed fields */ PWORD pwCapInfo; PWORD pwStatus; PWORD pwAid; - /*-- info elements ----------*/ + /* info elements */ PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_SUPP_RATES pExtSuppRates; } WLAN_FR_ASSOCRESP, *PWLAN_FR_ASSOCRESP; -// Reassociation Request +/* reassociation request */ typedef struct tagWLAN_FR_REASSOCREQ { unsigned int uType; @@ -626,12 +612,12 @@ typedef struct tagWLAN_FR_REASSOCREQ { PBYTE pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ + /* fixed fields */ PWORD pwCapInfo; PWORD pwListenInterval; PIEEE_ADDR pAddrCurrAP; - /*-- info elements ----------*/ + /* info elements */ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_RSN pRSN; @@ -643,50 +629,50 @@ typedef struct tagWLAN_FR_REASSOCREQ { } WLAN_FR_REASSOCREQ, *PWLAN_FR_REASSOCREQ; -// Reassociation Response +/* reassociation response */ typedef struct tagWLAN_FR_REASSOCRESP { unsigned int uType; unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ + /* fixed fields */ PWORD pwCapInfo; PWORD pwStatus; PWORD pwAid; - /*-- info elements ----------*/ + /* info elements */ PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_SUPP_RATES pExtSuppRates; } WLAN_FR_REASSOCRESP, *PWLAN_FR_REASSOCRESP; -// Probe Request +/* probe request */ typedef struct tagWLAN_FR_PROBEREQ { unsigned int uType; unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ - /*-- info elements ----------*/ + /* fixed fields */ + /* info elements */ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_SUPP_RATES pExtSuppRates; } WLAN_FR_PROBEREQ, *PWLAN_FR_PROBEREQ; -// Probe Response +/* probe response */ typedef struct tagWLAN_FR_PROBERESP { unsigned int uType; unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ - PQWORD pqwTimestamp; + /* fixed fields */ + u64 *pqwTimestamp; PWORD pwBeaconInterval; PWORD pwCapInfo; - /*-- info elements ----------*/ + /* info elements */ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_DS_PARMS pDSParms; @@ -704,37 +690,38 @@ typedef struct tagWLAN_FR_PROBERESP { } WLAN_FR_PROBERESP, *PWLAN_FR_PROBERESP; -// Authentication +/* authentication */ typedef struct tagWLAN_FR_AUTHEN { unsigned int uType; unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ + /* fixed fields */ PWORD pwAuthAlgorithm; PWORD pwAuthSequence; PWORD pwStatus; - /*-- info elements ----------*/ + /* info elements */ PWLAN_IE_CHALLENGE pChallenge; } WLAN_FR_AUTHEN, *PWLAN_FR_AUTHEN; -// Deauthentication +/* deauthentication */ typedef struct tagWLAN_FR_DEAUTHEN { unsigned int uType; unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; - /*-- fixed fields -----------*/ + /* fixed fields */ PWORD pwReason; - /*-- info elements ----------*/ + /* info elements */ } WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN; /*--------------------- Export Functions --------------------------*/ + void vMgrEncodeBeacon( PWLAN_FR_BEACON pFrame @@ -845,4 +832,4 @@ vMgrDecodeReassocResponse( PWLAN_FR_REASSOCRESP pFrame ); -#endif// __80211MGR_H__ +#endif /* __80211MGR_H__ */ diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c index f7a3b8f8da70..fb6124d9082a 100644 --- a/drivers/staging/vt6656/aes_ccmp.c +++ b/drivers/staging/vt6656/aes_ccmp.c @@ -231,7 +231,7 @@ void AESv128(BYTE *key, BYTE *data, BYTE *ciphertext) * */ -BOOL AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) +bool AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) { BYTE abyNonce[13]; BYTE MIC_IV[16]; @@ -249,7 +249,7 @@ BOOL AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) WORD wHLen = 22; /* 8 is IV, 8 is MIC, 4 is CRC */ WORD wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN; - BOOL bA4 = FALSE; + bool bA4 = false; BYTE byTmp; WORD wCnt; int ii, jj, kk; @@ -257,7 +257,7 @@ BOOL AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; if (WLAN_GET_FC_TODS(*(PWORD) pbyFrame) && WLAN_GET_FC_FROMDS(*(PWORD) pbyFrame)) { - bA4 = TRUE; + bA4 = true; pbyIV += 6; /* 6 is 802.11 address4 */ wHLen += 6; wPayloadSize -= 6; @@ -380,7 +380,7 @@ BOOL AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) /* => above is the packet dec-MIC */ if (!memcmp(abyMIC, abyTmp, 8)) - return TRUE; + return true; else - return FALSE; + return false; } diff --git a/drivers/staging/vt6656/aes_ccmp.h b/drivers/staging/vt6656/aes_ccmp.h index 353bd210a502..a2e2c4e9a5c9 100644 --- a/drivers/staging/vt6656/aes_ccmp.h +++ b/drivers/staging/vt6656/aes_ccmp.h @@ -41,6 +41,6 @@ /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -BOOL AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize); +bool AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize); #endif /* __AES_CCMP_H__ */ diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 385501595b4d..a9f525e9d16e 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -690,7 +690,7 @@ s_vClearSQ3Value(PSDevice pDevice); * */ unsigned int -BBuGetFrameTime ( +BBuGetFrameTime( BYTE byPreambleType, BYTE byPktType, unsigned int cbFrameLength, @@ -756,26 +756,19 @@ BBuGetFrameTime ( * Return Value: none * */ -void -BBvCalculateParameter ( - PSDevice pDevice, - unsigned int cbFrameLength, - WORD wRate, - BYTE byPacketType, - PWORD pwPhyLen, - PBYTE pbyPhySrv, - PBYTE pbyPhySgn - ) +void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, + u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv, + u8 *pbyPhySgn) { - unsigned int cbBitCount; - unsigned int cbUsCount = 0; - unsigned int cbTmp; - BOOL bExtBit; - BYTE byPreambleType = pDevice->byPreambleType; - BOOL bCCK = pDevice->bCCK; + u32 cbBitCount; + u32 cbUsCount = 0; + u32 cbTmp; + int bExtBit; + u8 byPreambleType = pDevice->byPreambleType; + int bCCK = pDevice->bCCK; cbBitCount = cbFrameLength * 8; - bExtBit = FALSE; + bExtBit = false; switch (wRate) { case RATE_1M : @@ -792,7 +785,7 @@ BBvCalculateParameter ( break; case RATE_5M : - if (bCCK == FALSE) + if (bCCK == false) cbBitCount ++; cbUsCount = (cbBitCount * 10) / 55; cbTmp = (cbUsCount * 55) / 10; @@ -806,14 +799,14 @@ BBvCalculateParameter ( case RATE_11M : - if (bCCK == FALSE) + if (bCCK == false) cbBitCount ++; cbUsCount = cbBitCount / 11; cbTmp = cbUsCount * 11; if (cbTmp != cbBitCount) { cbUsCount ++; if ((cbBitCount - cbTmp) <= 3) - bExtBit = TRUE; + bExtBit = true; } if (byPreambleType == 1) *pbyPhySgn = 0x0b; @@ -929,8 +922,7 @@ BBvCalculateParameter ( * Return Value: none * */ -void -BBvSetAntennaMode (PSDevice pDevice, BYTE byAntennaMode) +void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode) { switch (byAntennaMode) { case ANT_TXA: @@ -968,7 +960,7 @@ BBvSetAntennaMode (PSDevice pDevice, BYTE byAntennaMode) * */ -BOOL BBbVT3184Init(PSDevice pDevice) +int BBbVT3184Init(struct vnt_private *pDevice) { int ntStatus; WORD wLength; @@ -984,12 +976,12 @@ BOOL BBbVT3184Init(PSDevice pDevice) EEP_MAX_CONTEXT_SIZE, pDevice->abyEEPROM); if (ntStatus != STATUS_SUCCESS) { - return FALSE; + return false; } // if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04) -// return FALSE; +// return false; //zonetype initial pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; @@ -1105,7 +1097,7 @@ else { MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT); //}} } else { - return TRUE; + return true; } memcpy(abyArray, pbyAddr, wLength); @@ -1144,7 +1136,7 @@ else { ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01); RFbRFTableDownload(pDevice); - return TRUE;//ntStatus; + return true;//ntStatus; } @@ -1161,7 +1153,7 @@ else { * Return Value: none * */ -void BBvLoopbackOn (PSDevice pDevice) +void BBvLoopbackOn(struct vnt_private *pDevice) { BYTE byData; @@ -1214,9 +1206,9 @@ void BBvLoopbackOn (PSDevice pDevice) * Return Value: none * */ -void BBvLoopbackOff (PSDevice pDevice) +void BBvLoopbackOff(struct vnt_private *pDevice) { - BYTE byData; + u8 byData; ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, pDevice->byBBCRc9);//CR201 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, pDevice->byBBCR88);//CR136 @@ -1249,8 +1241,7 @@ void BBvLoopbackOff (PSDevice pDevice) * Return Value: none * */ -void -BBvSetShortSlotTime (PSDevice pDevice) +void BBvSetShortSlotTime(struct vnt_private *pDevice) { BYTE byBBVGA=0; @@ -1267,7 +1258,7 @@ BBvSetShortSlotTime (PSDevice pDevice) } -void BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData) +void BBvSetVGAGainOffset(struct vnt_private *pDevice, BYTE byData) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData); @@ -1294,8 +1285,7 @@ void BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData) * Return Value: none * */ -void -BBvSoftwareReset (PSDevice pDevice) +void BBvSoftwareReset(struct vnt_private *pDevice) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0x40); ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0); @@ -1315,22 +1305,20 @@ BBvSoftwareReset (PSDevice pDevice) * Return Value: none * */ -void -BBvSetDeepSleep (PSDevice pDevice) +void BBvSetDeepSleep(struct vnt_private *pDevice) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13 } -void -BBvExitDeepSleep (PSDevice pDevice) +void BBvExitDeepSleep(struct vnt_private *pDevice) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13 } -static unsigned long s_ulGetLowSQ3(PSDevice pDevice) +static unsigned long s_ulGetLowSQ3(struct vnt_private *pDevice) { int ii; unsigned long ulSQ3 = 0; @@ -1349,7 +1337,7 @@ static unsigned long s_ulGetLowSQ3(PSDevice pDevice) return ulSQ3; } -static unsigned long s_ulGetRatio(PSDevice pDevice) +static unsigned long s_ulGetRatio(struct vnt_private *pDevice) { int ii, jj; unsigned long ulRatio = 0; @@ -1377,9 +1365,7 @@ static unsigned long s_ulGetRatio(PSDevice pDevice) } -static -void -s_vClearSQ3Value (PSDevice pDevice) +static void s_vClearSQ3Value(struct vnt_private *pDevice) { int ii; pDevice->uDiversityCnt = 0; @@ -1406,8 +1392,8 @@ s_vClearSQ3Value (PSDevice pDevice) * */ -void -BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) +void BBvAntennaDiversity(struct vnt_private *pDevice, + u8 byRxRate, u8 bySQ3) { pDevice->uDiversityCnt++; @@ -1541,9 +1527,8 @@ BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) * -*/ -void TimerSQ3CallBack(void *hDeviceContext) +void TimerSQ3CallBack(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack..."); spin_lock_irq(&pDevice->lock); @@ -1579,9 +1564,8 @@ void TimerSQ3CallBack(void *hDeviceContext) * -*/ -void TimerSQ3Tmax3CallBack(void *hDeviceContext) +void TimerSQ3Tmax3CallBack(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3Tmax3CallBack..."); spin_lock_irq(&pDevice->lock); @@ -1607,10 +1591,7 @@ void TimerSQ3Tmax3CallBack(void *hDeviceContext) spin_unlock_irq(&pDevice->lock); } -void -BBvUpdatePreEDThreshold( - PSDevice pDevice, - BOOL bScanning) +void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning) { diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h index 844d5a8b13e5..fba61605a692 100644 --- a/drivers/staging/vt6656/baseband.h +++ b/drivers/staging/vt6656/baseband.h @@ -42,31 +42,30 @@ #define PREAMBLE_LONG 0 #define PREAMBLE_SHORT 1 -// -// Registers in the BASEBAND -// +/* + * Registers in the BASEBAND + */ #define BB_MAX_CONTEXT_SIZE 256 -#define C_SIFS_A 16 // micro sec. +#define C_SIFS_A 16 /* usec */ #define C_SIFS_BG 10 -#define C_EIFS 80 // micro sec. +#define C_EIFS 80 /* usec */ - -#define C_SLOT_SHORT 9 // micro sec. +#define C_SLOT_SHORT 9 /* usec */ #define C_SLOT_LONG 20 -#define C_CWMIN_A 15 // slot time +#define C_CWMIN_A 15 /* slot time */ #define C_CWMIN_B 31 -#define C_CWMAX 1023 // slot time +#define C_CWMAX 1023 /* slot time */ -//0:11A 1:11B 2:11G +/* 0:11A 1:11B 2:11G */ #define BB_TYPE_11A 0 #define BB_TYPE_11B 1 #define BB_TYPE_11G 2 -//0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate) +/* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga (OFDM in BasicRate) */ #define PK_TYPE_11A 0 #define PK_TYPE_11B 1 #define PK_TYPE_11GB 2 @@ -104,33 +103,26 @@ BBuGetFrameTime( WORD wRate ); -void BBvCalculateParameter(PSDevice pDevice, - unsigned int cbFrameLength, - WORD wRate, - BYTE byPacketType, - PWORD pwPhyLen, - PBYTE pbyPhySrv, - PBYTE pbyPhySgn); - -// timer for antenna diversity - -void TimerSQ3CallBack(void *hDeviceContext); -void TimerSQ3Tmax3CallBack(void *hDeviceContext); - -void BBvAntennaDiversity(PSDevice pDevice, BYTE byRxRate, BYTE bySQ3); -void BBvLoopbackOn(PSDevice pDevice); -void BBvLoopbackOff(PSDevice pDevice); -void BBvSoftwareReset(PSDevice pDevice); - -void BBvSetShortSlotTime(PSDevice pDevice); -void BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData); -void BBvSetAntennaMode(PSDevice pDevice, BYTE byAntennaMode); -BOOL BBbVT3184Init(PSDevice pDevice); -void BBvSetDeepSleep(PSDevice pDevice); -void BBvExitDeepSleep(PSDevice pDevice); -void BBvUpdatePreEDThreshold( - PSDevice pDevice, - BOOL bScanning - ); +void BBvCalculateParameter(struct vnt_private *, u32 cbFrameLength, + u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv, + u8 *pbyPhySgn); + +/* timer for antenna diversity */ + +void TimerSQ3CallBack(struct vnt_private *); +void TimerSQ3Tmax3CallBack(struct vnt_private *); + +void BBvAntennaDiversity(struct vnt_private *, u8 byRxRate, u8 bySQ3); +void BBvLoopbackOn(struct vnt_private *); +void BBvLoopbackOff(struct vnt_private *); +void BBvSoftwareReset(struct vnt_private *); + +void BBvSetShortSlotTime(struct vnt_private *); +void BBvSetVGAGainOffset(struct vnt_private *, u8 byData); +void BBvSetAntennaMode(struct vnt_private *, u8 byAntennaMode); +int BBbVT3184Init(struct vnt_private *); +void BBvSetDeepSleep(struct vnt_private *); +void BBvExitDeepSleep(struct vnt_private *); +void BBvUpdatePreEDThreshold(struct vnt_private *, int bScanning); #endif /* __BASEBAND_H__ */ diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index 6a1394192248..e214fcf83868 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -91,9 +91,9 @@ const WORD awHWRetry1[5][5] = { /*--------------------- Static Functions --------------------------*/ -void s_vCheckSensitivity(void *hDeviceContext); -void s_vCheckPreEDThreshold(void *hDeviceContext); -void s_uCalculateLinkQual(void *hDeviceContext); +static void s_vCheckSensitivity(struct vnt_private *pDevice); +static void s_vCheckPreEDThreshold(struct vnt_private *pDevice); +static void s_uCalculateLinkQual(struct vnt_private *pDevice); /*--------------------- Export Variables --------------------------*/ @@ -114,20 +114,19 @@ void s_uCalculateLinkQual(void *hDeviceContext); * -*/ -PKnownBSS BSSpSearchBSSList(void *hDeviceContext, - PBYTE pbyDesireBSSID, - PBYTE pbyDesireSSID, - CARD_PHY_TYPE ePhyType) +PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, + u8 *pbyDesireBSSID, u8 *pbyDesireSSID, + CARD_PHY_TYPE ePhyType) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PBYTE pbyBSSID = NULL; - PWLAN_IE_SSID pSSID = NULL; - PKnownBSS pCurrBSS = NULL; - PKnownBSS pSelect = NULL; - BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; - unsigned int ii = 0; - unsigned int jj = 0; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u8 *pbyBSSID = NULL; + PWLAN_IE_SSID pSSID = NULL; + PKnownBSS pCurrBSS = NULL; + PKnownBSS pSelect = NULL; + u8 ZeroBSSID[WLAN_BSSID_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + int ii = 0; + int jj = 0; + if (pbyDesireBSSID != NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID); @@ -142,15 +141,15 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext, } } - if ((pbyBSSID != NULL)&&(pDevice->bRoaming == FALSE)) { + if ((pbyBSSID != NULL)&&(pDevice->bRoaming == false)) { // match BSSID first for (ii = 0; ii <MAX_BSS_NUM; ii++) { pCurrBSS = &(pMgmt->sBSSList[ii]); - pCurrBSS->bSelected = FALSE; + pCurrBSS->bSelected = false; if ((pCurrBSS->bActive) && - (pCurrBSS->bSelected == FALSE)) { + (pCurrBSS->bSelected == false)) { if (!compare_ether_addr(pCurrBSS->abyBSSID, pbyBSSID)) { if (pSSID != NULL) { // compare ssid @@ -161,7 +160,7 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext, ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) || ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ) { - pCurrBSS->bSelected = TRUE; + pCurrBSS->bSelected = true; return(pCurrBSS); } } @@ -170,7 +169,7 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext, ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) || ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ) { - pCurrBSS->bSelected = TRUE; + pCurrBSS->bSelected = true; return(pCurrBSS); } } @@ -184,9 +183,9 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext, //2007-0721-01<Mark>by MikeLiu // if ((pCurrBSS->bActive) && - // (pCurrBSS->bSelected == FALSE)) { + // (pCurrBSS->bSelected == false)) { - pCurrBSS->bSelected = FALSE; + pCurrBSS->bSelected = false; if (pCurrBSS->bActive) { if (pSSID != NULL) { @@ -237,10 +236,9 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext, pDevice->bSameBSSMaxNum = jj; if (pSelect != NULL) { - pSelect->bSelected = TRUE; - if (pDevice->bRoaming == FALSE) { + pSelect->bSelected = true; + if (pDevice->bRoaming == false) { // Einsn Add @20070907 - memset(pbyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ; } @@ -263,11 +261,10 @@ pDevice->bSameBSSMaxNum = jj; -*/ -void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID) +void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int ii; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (bKeepCurrBSSID) { @@ -277,12 +274,12 @@ void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID) //mike mark: there are two BSSID's in list. If that AP is in hidden ssid mode, one SSID is null, // but other's might not be obvious, so if it associate's with your STA, // you must keep the two of them!! - // bKeepCurrBSSID = FALSE; + // bKeepCurrBSSID = false; continue; } } - pMgmt->sBSSList[ii].bActive = FALSE; + pMgmt->sBSSList[ii].bActive = false; memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS)); } BSSvClearAnyBSSJoinRecord(pDevice); @@ -296,17 +293,15 @@ void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID) * search BSS list by BSSID & SSID if matched * * Return Value: - * TRUE if found. + * true if found. * -*/ -PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext, - PBYTE abyBSSID, - PWLAN_IE_SSID pSSID) +PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice, + u8 *abyBSSID, PWLAN_IE_SSID pSSID) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PKnownBSS pBSSList = NULL; - unsigned int ii; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PKnownBSS pBSSList = NULL; + int ii; for (ii = 0; ii < MAX_BSS_NUM; ii++) { pBSSList = &(pMgmt->sBSSList[ii]); @@ -333,36 +328,34 @@ PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext, * Insert a BSS set into known BSS list * * Return Value: - * TRUE if success. + * true if success. * -*/ -BOOL BSSbInsertToBSSList(void *hDeviceContext, - PBYTE abyBSSIDAddr, - QWORD qwTimestamp, - WORD wBeaconInterval, - WORD wCapInfo, - BYTE byCurrChannel, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pSuppRates, - PWLAN_IE_SUPP_RATES pExtSuppRates, - PERPObject psERP, - PWLAN_IE_RSN pRSN, - PWLAN_IE_RSN_EXT pRSNWPA, - PWLAN_IE_COUNTRY pIE_Country, - PWLAN_IE_QUIET pIE_Quiet, - unsigned int uIELength, - PBYTE pbyIEs, - void *pRxPacketContext) +int BSSbInsertToBSSList(struct vnt_private *pDevice, + u8 *abyBSSIDAddr, + u64 qwTimestamp, + u16 wBeaconInterval, + u16 wCapInfo, + u8 byCurrChannel, + PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pSuppRates, + PWLAN_IE_SUPP_RATES pExtSuppRates, + PERPObject psERP, + PWLAN_IE_RSN pRSN, + PWLAN_IE_RSN_EXT pRSNWPA, + PWLAN_IE_COUNTRY pIE_Country, + PWLAN_IE_QUIET pIE_Quiet, + u32 uIELength, + u8 *pbyIEs, + void *pRxPacketContext) { - - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext; - PKnownBSS pBSSList = NULL; - unsigned int ii; - BOOL bParsingQuiet = FALSE; - + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_rx_mgmt *pRxPacket = + (struct vnt_rx_mgmt *)pRxPacketContext; + PKnownBSS pBSSList = NULL; + unsigned int ii; + bool bParsingQuiet = false; pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]); @@ -375,13 +368,12 @@ BOOL BSSbInsertToBSSList(void *hDeviceContext, if (ii == MAX_BSS_NUM){ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n"); - return FALSE; + return false; } // save the BSS info - pBSSList->bActive = TRUE; + pBSSList->bActive = true; memcpy( pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN); - HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp)); - LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp)); + pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); pBSSList->wCapInfo = cpu_to_le16(wCapInfo); pBSSList->uClearCount = 0; @@ -412,7 +404,7 @@ BOOL BSSbInsertToBSSList(void *hDeviceContext, if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; } else { - if (pBSSList->sERP.bERPExist == TRUE) { + if (pBSSList->sERP.bERPExist == true) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; } else { pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; @@ -428,7 +420,7 @@ BOOL BSSbInsertToBSSList(void *hDeviceContext, (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { // assoc with BSS if (pBSSList == pMgmt->pCurrBSS) { - bParsingQuiet = TRUE; + bParsingQuiet = true; } } @@ -458,27 +450,27 @@ BOOL BSSbInsertToBSSList(void *hDeviceContext, } } - if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == TRUE)) { + if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) { PSKeyItem pTransmitKey = NULL; - BOOL bIs802_1x = FALSE; + bool bIs802_1x = false; for (ii = 0; ii < pBSSList->wAKMSSAuthCount; ii ++) { if (pBSSList->abyAKMSSAuthType[ii] == WLAN_11i_AKMSS_802_1X) { - bIs802_1x = TRUE; + bIs802_1x = true; break; } } - if ((bIs802_1x == TRUE) && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) && + if ((bIs802_1x == true) && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) && ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID, pSSID->len))) { bAdd_PMKID_Candidate((void *) pDevice, pBSSList->abyBSSID, &pBSSList->sRSNCapObj); - if ((pDevice->bLinkPass == TRUE) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { - if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == TRUE) || - (KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == TRUE)) { + if ((pDevice->bLinkPass == true) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { + if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) || + (KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == true)) { pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList; pDevice->gsPMKIDCandidate.Version = 1; @@ -503,7 +495,7 @@ BOOL BSSbInsertToBSSList(void *hDeviceContext, pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN; memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength); - return TRUE; + return true; } @@ -513,43 +505,43 @@ BOOL BSSbInsertToBSSList(void *hDeviceContext, * Update BSS set in known BSS list * * Return Value: - * TRUE if success. + * true if success. * -*/ // TODO: input structure modify -BOOL BSSbUpdateToBSSList(void *hDeviceContext, - QWORD qwTimestamp, - WORD wBeaconInterval, - WORD wCapInfo, - BYTE byCurrChannel, - BOOL bChannelHit, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pSuppRates, - PWLAN_IE_SUPP_RATES pExtSuppRates, - PERPObject psERP, - PWLAN_IE_RSN pRSN, - PWLAN_IE_RSN_EXT pRSNWPA, - PWLAN_IE_COUNTRY pIE_Country, - PWLAN_IE_QUIET pIE_Quiet, - PKnownBSS pBSSList, - unsigned int uIELength, - PBYTE pbyIEs, - void *pRxPacketContext) +int BSSbUpdateToBSSList(struct vnt_private *pDevice, + u64 qwTimestamp, + u16 wBeaconInterval, + u16 wCapInfo, + u8 byCurrChannel, + int bChannelHit, + PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pSuppRates, + PWLAN_IE_SUPP_RATES pExtSuppRates, + PERPObject psERP, + PWLAN_IE_RSN pRSN, + PWLAN_IE_RSN_EXT pRSNWPA, + PWLAN_IE_COUNTRY pIE_Country, + PWLAN_IE_QUIET pIE_Quiet, + PKnownBSS pBSSList, + u32 uIELength, + u8 *pbyIEs, + void *pRxPacketContext) { - int ii, jj; - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext; - signed long ldBm, ldBmSum; - BOOL bParsingQuiet = FALSE; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_rx_mgmt *pRxPacket = + (struct vnt_rx_mgmt *)pRxPacketContext; + int ii, jj; + signed long ldBm, ldBmSum; + bool bParsingQuiet = false; if (pBSSList == NULL) - return FALSE; + return false; - HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp)); - LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp)); + pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); + pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); pBSSList->wCapInfo = cpu_to_le16(wCapInfo); pBSSList->uClearCount = 0; @@ -574,7 +566,7 @@ BOOL BSSbUpdateToBSSList(void *hDeviceContext, if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; } else { - if (pBSSList->sERP.bERPExist == TRUE) { + if (pBSSList->sERP.bERPExist == true) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; } else { pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; @@ -591,7 +583,7 @@ BOOL BSSbUpdateToBSSList(void *hDeviceContext, (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { // assoc with BSS if (pBSSList == pMgmt->pCurrBSS) { - bParsingQuiet = TRUE; + bParsingQuiet = true; } } @@ -643,7 +635,7 @@ BOOL BSSbUpdateToBSSList(void *hDeviceContext, pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN; memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength); - return TRUE; + return true; } @@ -660,13 +652,11 @@ BOOL BSSbUpdateToBSSList(void *hDeviceContext, * -*/ -BOOL BSSbIsSTAInNodeDB(void *hDeviceContext, - PBYTE abyDstAddr, - unsigned int *puNodeIndex) +int BSSbIsSTAInNodeDB(struct vnt_private *pDevice, + u8 *abyDstAddr, u32 *puNodeIndex) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int ii; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + unsigned int ii; // Index = 0 reserved for AP Node for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { @@ -674,12 +664,12 @@ BOOL BSSbIsSTAInNodeDB(void *hDeviceContext, if (!compare_ether_addr(abyDstAddr, pMgmt->sNodeDBTable[ii].abyMACAddr)) { *puNodeIndex = ii; - return TRUE; + return true; } } } - return FALSE; + return false; }; @@ -694,15 +684,14 @@ BOOL BSSbIsSTAInNodeDB(void *hDeviceContext, * None * -*/ -void BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) +void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex) { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; + u32 BigestCount = 0; + u32 SelectIndex; + struct sk_buff *skb; - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int ii; - unsigned int BigestCount = 0; - unsigned int SelectIndex; - struct sk_buff *skb; // Index = 0 reserved for AP Node (In STA mode) // Index = 0 reserved for Broadcast/MultiCast (In AP mode) SelectIndex = 1; @@ -733,7 +722,7 @@ void BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) } memset(&pMgmt->sNodeDBTable[*puNodeIndex], 0, sizeof(KnownNodeDB)); - pMgmt->sNodeDBTable[*puNodeIndex].bActive = TRUE; + pMgmt->sNodeDBTable[*puNodeIndex].bActive = true; pMgmt->sNodeDBTable[*puNodeIndex].uRatePollTimeout = FALLBACK_POLL_SECOND; // for AP mode PS queue skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue); @@ -755,13 +744,11 @@ void BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) * -*/ -void BSSvRemoveOneNode(void *hDeviceContext, unsigned int uNodeIndex) +void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex) { - - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; - struct sk_buff *skb; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; + struct sk_buff *skb; while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL) @@ -782,18 +769,15 @@ void BSSvRemoveOneNode(void *hDeviceContext, unsigned int uNodeIndex) * -*/ -void BSSvUpdateAPNode(void *hDeviceContext, - PWORD pwCapInfo, - PWLAN_IE_SUPP_RATES pSuppRates, - PWLAN_IE_SUPP_RATES pExtSuppRates) +void BSSvUpdateAPNode(struct vnt_private *pDevice, u16 *pwCapInfo, + PWLAN_IE_SUPP_RATES pSuppRates, PWLAN_IE_SUPP_RATES pExtSuppRates) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int uRateLen = WLAN_RATES_MAXLEN; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u32 uRateLen = WLAN_RATES_MAXLEN; memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); - pMgmt->sNodeDBTable[0].bActive = TRUE; + pMgmt->sNodeDBTable[0].bActive = true; if (pDevice->byBBType == BB_TYPE_11B) { uRateLen = WLAN_RATES_MAXLEN_11B; } @@ -806,7 +790,7 @@ void BSSvUpdateAPNode(void *hDeviceContext, RATEvParseMaxRate((void *) pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, - TRUE, + true, &(pMgmt->sNodeDBTable[0].wMaxBasicRate), &(pMgmt->sNodeDBTable[0].wMaxSuppRate), &(pMgmt->sNodeDBTable[0].wSuppRate), @@ -834,21 +818,20 @@ void BSSvUpdateAPNode(void *hDeviceContext, * -*/ -void BSSvAddMulticastNode(void *hDeviceContext) +void BSSvAddMulticastNode(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; if (!pDevice->bEnableHostWEP) memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); memset(pMgmt->sNodeDBTable[0].abyMACAddr, 0xff, WLAN_ADDR_LEN); - pMgmt->sNodeDBTable[0].bActive = TRUE; - pMgmt->sNodeDBTable[0].bPSEnable = FALSE; + pMgmt->sNodeDBTable[0].bActive = true; + pMgmt->sNodeDBTable[0].bPSEnable = false; skb_queue_head_init(&pMgmt->sNodeDBTable[0].sTxPSQueue); RATEvParseMaxRate((void *) pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, - TRUE, + true, &(pMgmt->sNodeDBTable[0].wMaxBasicRate), &(pMgmt->sNodeDBTable[0].wMaxSuppRate), &(pMgmt->sNodeDBTable[0].wSuppRate), @@ -873,26 +856,25 @@ void BSSvAddMulticastNode(void *hDeviceContext) * -*/ -void BSSvSecondCallBack(void *hDeviceContext) +void BSSvSecondCallBack(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int ii; - PWLAN_IE_SSID pItemSSID, pCurrSSID; - unsigned int uSleepySTACnt = 0; - unsigned int uNonShortSlotSTACnt = 0; - unsigned int uLongPreambleSTACnt = 0; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; + PWLAN_IE_SSID pItemSSID, pCurrSSID; + u32 uSleepySTACnt = 0; + u32 uNonShortSlotSTACnt = 0; + u32 uLongPreambleSTACnt = 0; spin_lock_irq(&pDevice->lock); pDevice->uAssocCount = 0; //Power Saving Mode Tx Burst - if ( pDevice->bEnablePSMode == TRUE ) { + if ( pDevice->bEnablePSMode == true ) { pDevice->ulPSModeWaitTx++; if ( pDevice->ulPSModeWaitTx >= 2 ) { pDevice->ulPSModeWaitTx = 0; - pDevice->bPSModeTxBurst = FALSE; + pDevice->bPSModeTxBurst = false; } } @@ -909,10 +891,10 @@ void BSSvSecondCallBack(void *hDeviceContext) if(pDevice->byReAssocCount > 0) { pDevice->byReAssocCount++; - if((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != TRUE)) { //10 sec timeout + if((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) { //10 sec timeout printk("Re-association timeout!!!\n"); pDevice->byReAssocCount = 0; - // if(pDevice->bWPASuppWextEnabled == TRUE) + // if(pDevice->bWPASuppWextEnabled == true) { union iwreq_data wrqu; memset(&wrqu, 0, sizeof (wrqu)); @@ -921,13 +903,13 @@ if(pDevice->byReAssocCount > 0) { wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } } - else if(pDevice->bLinkPass == TRUE) + else if(pDevice->bLinkPass == true) pDevice->byReAssocCount = 0; } pMgmt->eLastState = pMgmt->eCurrState ; - s_uCalculateLinkQual((void *)pDevice); + s_uCalculateLinkQual(pDevice); for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { @@ -1006,27 +988,27 @@ if(pDevice->byReAssocCount > 0) { if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) { if (!pDevice->bProtectMode) { MACvEnableProtectMD(pDevice); - pDevice->bProtectMode = TRUE; + pDevice->bProtectMode = true; } } else { if (pDevice->bProtectMode) { MACvDisableProtectMD(pDevice); - pDevice->bProtectMode = FALSE; + pDevice->bProtectMode = false; } } // on/off short slot time if (uNonShortSlotSTACnt > 0) { if (pDevice->bShortSlotTime) { - pDevice->bShortSlotTime = FALSE; + pDevice->bShortSlotTime = false; BBvSetShortSlotTime(pDevice); vUpdateIFS((void *)pDevice); } } else { if (!pDevice->bShortSlotTime) { - pDevice->bShortSlotTime = TRUE; + pDevice->bShortSlotTime = true; BBvSetShortSlotTime(pDevice); vUpdateIFS((void *)pDevice); } @@ -1037,13 +1019,13 @@ if(pDevice->byReAssocCount > 0) { if (uLongPreambleSTACnt > 0) { if (!pDevice->bBarkerPreambleMd) { MACvEnableBarkerPreambleMd(pDevice); - pDevice->bBarkerPreambleMd = TRUE; + pDevice->bBarkerPreambleMd = true; } } else { if (pDevice->bBarkerPreambleMd) { MACvDisableBarkerPreambleMd(pDevice); - pDevice->bBarkerPreambleMd = FALSE; + pDevice->bBarkerPreambleMd = false; } } @@ -1053,9 +1035,9 @@ if(pDevice->byReAssocCount > 0) { // Check if any STA in PS mode, enable DTIM multicast deliver if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (uSleepySTACnt > 0) - pMgmt->sNodeDBTable[0].bPSEnable = TRUE; + pMgmt->sNodeDBTable[0].bPSEnable = true; else - pMgmt->sNodeDBTable[0].bPSEnable = FALSE; + pMgmt->sNodeDBTable[0].bPSEnable = false; } pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; @@ -1067,8 +1049,8 @@ if(pDevice->byReAssocCount > 0) { if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS if (pDevice->bUpdateBBVGA) { - /* s_vCheckSensitivity((void *) pDevice); */ - s_vCheckPreEDThreshold((void *) pDevice); + s_vCheckSensitivity(pDevice); + s_vCheckPreEDThreshold(pDevice); } if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) && @@ -1080,14 +1062,14 @@ if(pDevice->byReAssocCount > 0) { } if (pMgmt->sNodeDBTable[0].uInActiveCount >= LOST_BEACON_COUNT) { - pMgmt->sNodeDBTable[0].bActive = FALSE; + pMgmt->sNodeDBTable[0].bActive = false; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pMgmt->eCurrState = WMAC_STATE_IDLE; netif_stop_queue(pDevice->dev); - pDevice->bLinkPass = FALSE; + pDevice->bLinkPass = false; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); - pDevice->bRoaming = TRUE; - pDevice->bIsRoaming = FALSE; + pDevice->bRoaming = true; + pDevice->bIsRoaming = false; DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount); /* let wpa supplicant know AP may disconnect */ @@ -1102,10 +1084,10 @@ if(pDevice->byReAssocCount > 0) { } else if (pItemSSID->len != 0) { //Davidwang - if ((pDevice->bEnableRoaming == TRUE)&&(!(pMgmt->Cisco_cckm))) { + if ((pDevice->bEnableRoaming == true)&&(!(pMgmt->Cisco_cckm))) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming ); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming ); - if ((pDevice->bRoaming == TRUE)&&(pDevice->bIsRoaming == TRUE)){ + if ((pDevice->bRoaming == true)&&(pDevice->bIsRoaming == true)){ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fast Roaming ...\n"); BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); bScheduleCommand((void *) pDevice, @@ -1116,12 +1098,12 @@ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming ); pMgmt->abyDesireSSID); pDevice->uAutoReConnectTime = 0; pDevice->uIsroamingTime = 0; - pDevice->bRoaming = FALSE; + pDevice->bRoaming = false; } - else if ((pDevice->bRoaming == FALSE)&&(pDevice->bIsRoaming == TRUE)) { + else if ((pDevice->bRoaming == false)&&(pDevice->bIsRoaming == true)) { pDevice->uIsroamingTime++; if (pDevice->uIsroamingTime >= 20) - pDevice->bIsRoaming = FALSE; + pDevice->bIsRoaming = false; } } @@ -1129,7 +1111,7 @@ else { if (pDevice->uAutoReConnectTime < 10) { pDevice->uAutoReConnectTime++; //network manager support need not do Roaming scan??? - if(pDevice->bWPASuppWextEnabled ==TRUE) + if(pDevice->bWPASuppWextEnabled ==true) pDevice->uAutoReConnectTime = 0; } else { @@ -1169,21 +1151,21 @@ else { if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { if (pDevice->bUpdateBBVGA) { - /* s_vCheckSensitivity((void *) pDevice); */ - s_vCheckPreEDThreshold((void *) pDevice); + s_vCheckSensitivity(pDevice); + s_vCheckPreEDThreshold(pDevice); } if (pMgmt->sNodeDBTable[0].uInActiveCount >=ADHOC_LOST_BEACON_COUNT) { DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount); pMgmt->sNodeDBTable[0].uInActiveCount = 0; pMgmt->eCurrState = WMAC_STATE_STARTED; netif_stop_queue(pDevice->dev); - pDevice->bLinkPass = FALSE; + pDevice->bLinkPass = false; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); } } } - if (pDevice->bLinkPass == TRUE) { + if (pDevice->bLinkPass == true) { if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); } @@ -1207,22 +1189,19 @@ else { * -*/ -void BSSvUpdateNodeTxCounter(void *hDeviceContext, - PSStatCounter pStatistic, - BYTE byTSR, - BYTE byPktNO) +void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, + PSStatCounter pStatistic, u8 byTSR, u8 byPktNO) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int uNodeIndex = 0; - BYTE byTxRetry; - WORD wRate; - WORD wFallBackRate = RATE_1M; - BYTE byFallBack; - unsigned int ii; - PBYTE pbyDestAddr; - BYTE byPktNum; - WORD wFIFOCtl; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u32 uNodeIndex = 0; + u8 byTxRetry; + u16 wRate; + u16 wFallBackRate = RATE_1M; + u8 byFallBack; + int ii; + u8 *pbyDestAddr; + u8 byPktNum; + u16 wFIFOCtl; byPktNum = (byPktNO & 0x0F) >> 4; byTxRetry = (byTSR & 0xF0) >> 4; @@ -1370,13 +1349,11 @@ void BSSvUpdateNodeTxCounter(void *hDeviceContext, * -*/ -void BSSvClearNodeDBTable(void *hDeviceContext, - unsigned int uStartIndex) +void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - struct sk_buff *skb; - unsigned int ii; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct sk_buff *skb; + int ii; for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive) { @@ -1392,12 +1369,11 @@ void BSSvClearNodeDBTable(void *hDeviceContext, } }; -void s_vCheckSensitivity(void *hDeviceContext) +static void s_vCheckSensitivity(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PKnownBSS pBSSList = NULL; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int ii; + PKnownBSS pBSSList = NULL; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { @@ -1424,7 +1400,7 @@ void s_vCheckSensitivity(void *hDeviceContext) if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) { pDevice->uBBVGADiffCount++; if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD) - bScheduleCommand((void *) pDevice, + bScheduleCommand(pDevice, WLAN_CMD_CHANGE_BBSENSITIVITY, NULL); } else { @@ -1435,13 +1411,12 @@ void s_vCheckSensitivity(void *hDeviceContext) } } -void s_uCalculateLinkQual(void *hDeviceContext) +static void s_uCalculateLinkQual(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - unsigned long TxOkRatio, TxCnt; - unsigned long RxOkRatio, RxCnt; - unsigned long RssiRatio; - long ldBm; + unsigned long TxOkRatio, TxCnt; + unsigned long RxOkRatio, RxCnt; + unsigned long RssiRatio; + long ldBm; TxCnt = pDevice->scStatistic.TxNoRetryOkCount + pDevice->scStatistic.TxRetryOkCount + @@ -1451,7 +1426,7 @@ RxCnt = pDevice->scStatistic.RxFcsErrCnt + TxOkRatio = (TxCnt < 6) ? 4000:((pDevice->scStatistic.TxNoRetryOkCount * 4000) / TxCnt); RxOkRatio = (RxCnt < 6) ? 2000:((pDevice->scStatistic.RxOkCnt * 2000) / RxCnt); //decide link quality -if(pDevice->bLinkPass !=TRUE) +if(pDevice->bLinkPass !=true) { pDevice->scStatistic.LinkQuality = 0; pDevice->scStatistic.SignalStren = 0; @@ -1478,28 +1453,28 @@ else pDevice->scStatistic.TxRetryOkCount = 0; } -void BSSvClearAnyBSSJoinRecord(void *hDeviceContext) +void BSSvClearAnyBSSJoinRecord(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int ii; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; for (ii = 0; ii < MAX_BSS_NUM; ii++) - pMgmt->sBSSList[ii].bSelected = FALSE; + pMgmt->sBSSList[ii].bSelected = false; + + return; } -void s_vCheckPreEDThreshold(void *hDeviceContext) +static void s_vCheckPreEDThreshold(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PKnownBSS pBSSList = NULL; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PKnownBSS pBSSList = NULL; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID); if (pBSSList != NULL) { pDevice->byBBPreEDRSSI = (BYTE) (~(pBSSList->ldBmAverRange) + 1); - BBvUpdatePreEDThreshold(pDevice, FALSE); + BBvUpdatePreEDThreshold(pDevice, false); } } } diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h index 806cbf72fb59..08091a0a7c40 100644 --- a/drivers/staging/vt6656/bssdb.h +++ b/drivers/staging/vt6656/bssdb.h @@ -79,20 +79,20 @@ // typedef struct tagSERPObject { - BOOL bERPExist; + bool bERPExist; BYTE byERP; } ERPObject, *PERPObject; typedef struct tagSRSNCapObject { - BOOL bRSNCapExist; + bool bRSNCapExist; WORD wRSNCap; } SRSNCapObject, *PSRSNCapObject; // BSS info(AP) typedef struct tagKnownBSS { // BSS info - BOOL bActive; + bool bActive; BYTE abyBSSID[WLAN_BSSID_LEN]; unsigned int uChannel; BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; @@ -110,10 +110,10 @@ typedef struct tagKnownBSS { signed long ldBmAverage[RSSI_STAT_COUNT]; signed long ldBmAverRange; //For any BSSID selection improvment - BOOL bSelected; + bool bSelected; //++ WPA informations - BOOL bWPAValid; + bool bWPAValid; BYTE byGKType; BYTE abyPKType[4]; WORD wPKCount; @@ -124,7 +124,7 @@ typedef struct tagKnownBSS { //-- //++ WPA2 informations - BOOL bWPA2Valid; + bool bWPA2Valid; BYTE byCSSGK; WORD wCSSPKCount; BYTE abyCSSPK[4]; @@ -141,8 +141,8 @@ typedef struct tagKnownBSS { unsigned int uClearCount; // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN]; unsigned int uIELength; - QWORD qwBSSTimestamp; - QWORD qwLocalTSF; // local TSF timer + u64 qwBSSTimestamp; + u64 qwLocalTSF;/* local TSF timer */ CARD_PHY_TYPE eNetworkTypeInUse; @@ -167,14 +167,14 @@ typedef enum tagNODE_STATE { // STA node info typedef struct tagKnownNodeDB { // STA info - BOOL bActive; + bool bActive; BYTE abyMACAddr[WLAN_ADDR_LEN]; BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; WORD wTxDataRate; - BOOL bShortPreamble; - BOOL bERPExist; - BOOL bShortSlotTime; + bool bShortPreamble; + bool bERPExist; + bool bShortSlotTime; unsigned int uInActiveCount; WORD wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp. WORD wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon. @@ -188,15 +188,15 @@ typedef struct tagKnownNodeDB { WORD wListenInterval; WORD wAID; NODE_STATE eNodeState; - BOOL bPSEnable; - BOOL bRxPSPoll; + bool bPSEnable; + bool bRxPSPoll; BYTE byAuthSequence; unsigned long ulLastRxJiffer; BYTE bySuppRate; DWORD dwFlags; WORD wEnQueueCnt; - BOOL bOnFly; + bool bOnFly; unsigned long long KeyRSC; BYTE byKeyIndex; DWORD dwKeyIndex; @@ -207,7 +207,7 @@ typedef struct tagKnownNodeDB { BYTE abyWepKey[WLAN_WEPMAX_KEYLEN]; // // Auto rate fallback vars - BOOL bIsInFallback; + bool bIsInFallback; unsigned int uAverageRSSI; unsigned int uRateRecoveryTimeout; unsigned int uRatePollTimeout; @@ -225,80 +225,70 @@ typedef struct tagKnownNodeDB { /*--------------------- Export Functions --------------------------*/ -PKnownBSS BSSpSearchBSSList(void *hDeviceContext, - PBYTE pbyDesireBSSID, - PBYTE pbyDesireSSID, - CARD_PHY_TYPE ePhyType); - -PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext, - PBYTE abyBSSID, - PWLAN_IE_SSID pSSID); - -void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID); - -BOOL BSSbInsertToBSSList(void *hDeviceContext, - PBYTE abyBSSIDAddr, - QWORD qwTimestamp, - WORD wBeaconInterval, - WORD wCapInfo, - BYTE byCurrChannel, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pSuppRates, - PWLAN_IE_SUPP_RATES pExtSuppRates, - PERPObject psERP, - PWLAN_IE_RSN pRSN, - PWLAN_IE_RSN_EXT pRSNWPA, - PWLAN_IE_COUNTRY pIE_Country, - PWLAN_IE_QUIET pIE_Quiet, - unsigned int uIELength, - PBYTE pbyIEs, - void *pRxPacketContext); - -BOOL BSSbUpdateToBSSList(void *hDeviceContext, - QWORD qwTimestamp, - WORD wBeaconInterval, - WORD wCapInfo, - BYTE byCurrChannel, - BOOL bChannelHit, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pSuppRates, - PWLAN_IE_SUPP_RATES pExtSuppRates, - PERPObject psERP, - PWLAN_IE_RSN pRSN, - PWLAN_IE_RSN_EXT pRSNWPA, - PWLAN_IE_COUNTRY pIE_Country, - PWLAN_IE_QUIET pIE_Quiet, - PKnownBSS pBSSList, - unsigned int uIELength, - PBYTE pbyIEs, - void *pRxPacketContext); - -BOOL BSSbIsSTAInNodeDB(void *hDeviceContext, - PBYTE abyDstAddr, - unsigned int *puNodeIndex); - -void BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex); - -void BSSvUpdateAPNode(void *hDeviceContext, - PWORD pwCapInfo, - PWLAN_IE_SUPP_RATES pItemRates, - PWLAN_IE_SUPP_RATES pExtSuppRates); - -void BSSvSecondCallBack(void *hDeviceContext); - -void BSSvUpdateNodeTxCounter(void *hDeviceContext, - PSStatCounter pStatistic, - BYTE byTSR, - BYTE byPktNO); - -void BSSvRemoveOneNode(void *hDeviceContext, - unsigned int uNodeIndex); - -void BSSvAddMulticastNode(void *hDeviceContext); - -void BSSvClearNodeDBTable(void *hDeviceContext, - unsigned int uStartIndex); - -void BSSvClearAnyBSSJoinRecord(void *hDeviceContext); +PKnownBSS BSSpSearchBSSList(struct vnt_private *, u8 *pbyDesireBSSID, + u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType); + +PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *, u8 *abyBSSID, + PWLAN_IE_SSID pSSID); + +void BSSvClearBSSList(struct vnt_private *, int bKeepCurrBSSID); + +int BSSbInsertToBSSList(struct vnt_private *, + u8 *abyBSSIDAddr, + u64 qwTimestamp, + u16 wBeaconInterval, + u16 wCapInfo, + u8 byCurrChannel, + PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pSuppRates, + PWLAN_IE_SUPP_RATES pExtSuppRates, + PERPObject psERP, + PWLAN_IE_RSN pRSN, + PWLAN_IE_RSN_EXT pRSNWPA, + PWLAN_IE_COUNTRY pIE_Country, + PWLAN_IE_QUIET pIE_Quiet, + u32 uIELength, + u8 *pbyIEs, + void *pRxPacketContext); + +int BSSbUpdateToBSSList(struct vnt_private *, + u64 qwTimestamp, + u16 wBeaconInterval, + u16 wCapInfo, + u8 byCurrChannel, + int bChannelHit, + PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pSuppRates, + PWLAN_IE_SUPP_RATES pExtSuppRates, + PERPObject psERP, + PWLAN_IE_RSN pRSN, + PWLAN_IE_RSN_EXT pRSNWPA, + PWLAN_IE_COUNTRY pIE_Country, + PWLAN_IE_QUIET pIE_Quiet, + PKnownBSS pBSSList, + u32 uIELength, + u8 *pbyIEs, + void *pRxPacketContext); + +int BSSbIsSTAInNodeDB(struct vnt_private *, PBYTE abyDstAddr, + u32 *puNodeIndex); + +void BSSvCreateOneNode(struct vnt_private *, u32 *puNodeIndex); + +void BSSvUpdateAPNode(struct vnt_private *, u16 *pwCapInfo, + PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pExtSuppRates); + +void BSSvSecondCallBack(struct vnt_private *); + +void BSSvUpdateNodeTxCounter(struct vnt_private *, PSStatCounter pStatistic, + u8 byTSR, u8 byPktNO); + +void BSSvRemoveOneNode(struct vnt_private *, u32 uNodeIndex); + +void BSSvAddMulticastNode(struct vnt_private *); + +void BSSvClearNodeDBTable(struct vnt_private *, u32 uStartIndex); + +void BSSvClearAnyBSSJoinRecord(struct vnt_private *); #endif /* __BSSDB_H__ */ diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 826520b03383..22918a106d73 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -45,6 +45,7 @@ * */ +#include "device.h" #include "tmacro.h" #include "card.h" #include "baseband.h" @@ -91,9 +92,8 @@ const WORD cwRXBCNTSFOff[MAX_RATE] = * Out: * none */ -void CARDbSetMediaChannel(void *pDeviceHandler, unsigned int uConnectionChannel) +void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel) { -PSDevice pDevice = (PSDevice) pDeviceHandler; if (pDevice->byBBType == BB_TYPE_11A) { // 15 ~ 38 if ((uConnectionChannel < (CB_MAX_CHANNEL_24G+1)) || (uConnectionChannel > CB_MAX_CHANNEL)) @@ -149,17 +149,17 @@ PSDevice pDevice = (PSDevice) pDeviceHandler; * Return Value: response Control frame rate * */ -static WORD swGetCCKControlRate(void *pDeviceHandler, WORD wRateIdx) +static u16 swGetCCKControlRate(struct vnt_private *pDevice, u16 wRateIdx) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - unsigned int ui = (unsigned int)wRateIdx; - while (ui > RATE_1M) { - if (pDevice->wBasicRate & ((WORD)1 << ui)) { - return (WORD)ui; - } - ui --; - } - return (WORD)RATE_1M; + u16 ui = wRateIdx; + + while (ui > RATE_1M) { + if (pDevice->wBasicRate & (1 << ui)) + return ui; + ui--; + } + + return RATE_1M; } /* @@ -175,28 +175,33 @@ static WORD swGetCCKControlRate(void *pDeviceHandler, WORD wRateIdx) * Return Value: response Control frame rate * */ -static WORD swGetOFDMControlRate(void *pDeviceHandler, WORD wRateIdx) +static u16 swGetOFDMControlRate(struct vnt_private *pDevice, u16 wRateIdx) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - unsigned int ui = (unsigned int)wRateIdx; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n", pDevice->wBasicRate); - - if (!CARDbIsOFDMinBasicRate(pDevice)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"swGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); - if (wRateIdx > RATE_24M) - wRateIdx = RATE_24M; - return wRateIdx; - } - while (ui > RATE_11M) { - if (pDevice->wBasicRate & ((WORD)1 << ui)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"swGetOFDMControlRate : %d\n", ui); - return (WORD)ui; - } - ui --; - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"swGetOFDMControlRate: 6M\n"); - return (WORD)RATE_24M; + u16 ui = wRateIdx; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n", + pDevice->wBasicRate); + + if (!CARDbIsOFDMinBasicRate(pDevice)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "swGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); + if (wRateIdx > RATE_24M) + wRateIdx = RATE_24M; + return wRateIdx; + } + + while (ui > RATE_11M) { + if (pDevice->wBasicRate & (1 << ui)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "swGetOFDMControlRate: %d\n", ui); + return ui; + } + ui--; + } + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"swGetOFDMControlRate: 6M\n"); + + return RATE_24M; } /* @@ -325,16 +330,15 @@ CARDvCalculateOFDMRParameter ( * Return Value: None. * */ -void CARDvSetRSPINF(void *pDeviceHandler, BYTE byBBType) +void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - BYTE abyServ[4] = {0,0,0,0}; // For CCK - BYTE abySignal[4] = {0,0,0,0}; - WORD awLen[4] = {0,0,0,0}; - BYTE abyTxRate[9] = {0,0,0,0,0,0,0,0,0}; // For OFDM - BYTE abyRsvTime[9] = {0,0,0,0,0,0,0,0,0}; - BYTE abyData[34]; - int i; + u8 abyServ[4] = {0, 0, 0, 0}; /* For CCK */ + u8 abySignal[4] = {0, 0, 0, 0}; + u16 awLen[4] = {0, 0, 0, 0}; + u8 abyTxRate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; /* For OFDM */ + u8 abyRsvTime[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + u8 abyData[34]; + int i; //RSPINF_b_1 BBvCalculateParameter(pDevice, @@ -476,12 +480,10 @@ void CARDvSetRSPINF(void *pDeviceHandler, BYTE byBBType) * Return Value: None. * */ -void vUpdateIFS(void *pDeviceHandler) +void vUpdateIFS(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - //Set SIFS, DIFS, EIFS, SlotTime, CwMin - BYTE byMaxMin = 0; - BYTE byData[4]; + u8 byMaxMin = 0; + u8 byData[4]; if (pDevice->byPacketType==PK_TYPE_11A) {//0000 0000 0000 0000,11a pDevice->uSlot = C_SLOT_SHORT; @@ -499,7 +501,7 @@ void vUpdateIFS(void *pDeviceHandler) } else {// PK_TYPE_11GA & PK_TYPE_11GB BYTE byRate = 0; - BOOL bOFDMRate = FALSE; + bool bOFDMRate = false; unsigned int ii = 0; PWLAN_IE_SUPP_RATES pItemRates = NULL; @@ -511,25 +513,26 @@ void vUpdateIFS(void *pDeviceHandler) } pDevice->uDIFS = C_SIFS_BG + 2*pDevice->uSlot; - pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->sMgmtObj.abyCurrSuppRates; + pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt.abyCurrSuppRates; for (ii = 0; ii < pItemRates->len; ii++) { byRate = (BYTE)(pItemRates->abyRates[ii]&0x7F); if (RATEwGetRateIdx(byRate) > RATE_11M) { - bOFDMRate = TRUE; + bOFDMRate = true; break; } } - if (bOFDMRate == FALSE) { - pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->sMgmtObj.abyCurrExtSuppRates; + if (bOFDMRate == false) { + pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt + .abyCurrExtSuppRates; for (ii = 0; ii < pItemRates->len; ii++) { byRate = (BYTE)(pItemRates->abyRates[ii]&0x7F); if (RATEwGetRateIdx(byRate) > RATE_11M) { - bOFDMRate = TRUE; + bOFDMRate = true; break; } } } - if (bOFDMRate == TRUE) { + if (bOFDMRate == true) { pDevice->uCwMin = C_CWMIN_A; byMaxMin = 4; } else { @@ -561,11 +564,10 @@ void vUpdateIFS(void *pDeviceHandler) &byMaxMin); } -void CARDvUpdateBasicTopRate(void *pDeviceHandler) +void CARDvUpdateBasicTopRate(struct vnt_private *pDevice) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -BYTE byTopOFDM = RATE_24M, byTopCCK = RATE_1M; -BYTE ii; + u8 byTopOFDM = RATE_24M, byTopCCK = RATE_1M; + u8 ii; //Determines the highest basic rate. for (ii = RATE_54M; ii >= RATE_6M; ii --) { @@ -597,13 +599,12 @@ BYTE ii; * Out: * none * - * Return Value: TRUE if succeeded; FALSE if failed. + * Return Value: true if succeeded; false if failed. * */ -void CARDbAddBasicRate(void *pDeviceHandler, WORD wRateIdx) +void CARDbAddBasicRate(struct vnt_private *pDevice, u16 wRateIdx) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -WORD wRate = (WORD)(1<<wRateIdx); + u16 wRate = (1 << wRateIdx); pDevice->wBasicRate |= wRate; @@ -611,21 +612,19 @@ WORD wRate = (WORD)(1<<wRateIdx); CARDvUpdateBasicTopRate(pDevice); } -BOOL CARDbIsOFDMinBasicRate(void *pDeviceHandler) +int CARDbIsOFDMinBasicRate(struct vnt_private *pDevice) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -int ii; + int ii; for (ii = RATE_54M; ii >= RATE_6M; ii --) { if ((pDevice->wBasicRate) & ((WORD)(1<<ii))) - return TRUE; + return true; } - return FALSE; + return false; } -BYTE CARDbyGetPktType(void *pDeviceHandler) +u8 CARDbyGetPktType(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) { return (BYTE)pDevice->byBBType; @@ -654,28 +653,18 @@ BYTE CARDbyGetPktType(void *pDeviceHandler) * Return Value: TSF Offset value * */ -QWORD CARDqGetTSFOffset (BYTE byRxRate, QWORD qwTSF1, QWORD qwTSF2) +u64 CARDqGetTSFOffset(BYTE byRxRate, u64 qwTSF1, u64 qwTSF2) { - QWORD qwTSFOffset; - WORD wRxBcnTSFOffst = 0; + u64 qwTSFOffset = 0; + WORD wRxBcnTSFOffst = 0; - HIDWORD(qwTSFOffset) = 0; - LODWORD(qwTSFOffset) = 0; + wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate % MAX_RATE]; - wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate%MAX_RATE]; - (qwTSF2).u.dwLowDword += (DWORD)(wRxBcnTSFOffst); - if ((qwTSF2).u.dwLowDword < (DWORD)(wRxBcnTSFOffst)) { - (qwTSF2).u.dwHighDword++; - } - LODWORD(qwTSFOffset) = LODWORD(qwTSF1) - LODWORD(qwTSF2); - if (LODWORD(qwTSF1) < LODWORD(qwTSF2)) { - // if borrow needed - HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2) - 1 ; - } - else { - HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2); - }; - return (qwTSFOffset); + qwTSF2 += (u64)wRxBcnTSFOffst; + + qwTSFOffset = qwTSF1 - qwTSF2; + + return qwTSFOffset; } @@ -695,33 +684,25 @@ QWORD CARDqGetTSFOffset (BYTE byRxRate, QWORD qwTSF1, QWORD qwTSF2) * Return Value: none * */ -void CARDvAdjustTSF(void *pDeviceHandler, BYTE byRxRate, - QWORD qwBSSTimestamp, QWORD qwLocalTSF) +void CARDvAdjustTSF(struct vnt_private *pDevice, u8 byRxRate, + u64 qwBSSTimestamp, u64 qwLocalTSF) { + u64 qwTSFOffset = 0; + u8 pbyData[8]; - PSDevice pDevice = (PSDevice) pDeviceHandler; - QWORD qwTSFOffset; - DWORD dwTSFOffset1,dwTSFOffset2; - BYTE pbyData[8]; - - HIDWORD(qwTSFOffset) = 0; - LODWORD(qwTSFOffset) = 0; qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF); // adjust TSF // HW's TSF add TSF Offset reg - dwTSFOffset1 = LODWORD(qwTSFOffset); - dwTSFOffset2 = HIDWORD(qwTSFOffset); - - pbyData[0] = (BYTE)dwTSFOffset1; - pbyData[1] = (BYTE)(dwTSFOffset1>>8); - pbyData[2] = (BYTE)(dwTSFOffset1>>16); - pbyData[3] = (BYTE)(dwTSFOffset1>>24); - pbyData[4] = (BYTE)dwTSFOffset2; - pbyData[5] = (BYTE)(dwTSFOffset2>>8); - pbyData[6] = (BYTE)(dwTSFOffset2>>16); - pbyData[7] = (BYTE)(dwTSFOffset2>>24); + pbyData[0] = (u8)qwTSFOffset; + pbyData[1] = (u8)(qwTSFOffset >> 8); + pbyData[2] = (u8)(qwTSFOffset >> 16); + pbyData[3] = (u8)(qwTSFOffset >> 24); + pbyData[4] = (u8)(qwTSFOffset >> 32); + pbyData[5] = (u8)(qwTSFOffset >> 40); + pbyData[6] = (u8)(qwTSFOffset >> 48); + pbyData[7] = (u8)(qwTSFOffset >> 56); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SET_TSFTBTT, @@ -742,17 +723,15 @@ void CARDvAdjustTSF(void *pDeviceHandler, BYTE byRxRate, * Out: * qwCurrTSF - Current TSF counter * - * Return Value: TRUE if success; otherwise FALSE + * Return Value: true if success; otherwise false * */ -BOOL CARDbGetCurrentTSF(void *pDeviceHandler, PQWORD pqwCurrTSF) +bool CARDbGetCurrentTSF(struct vnt_private *pDevice, u64 *pqwCurrTSF) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - LODWORD(*pqwCurrTSF) = LODWORD(pDevice->qwCurrTSF); - HIDWORD(*pqwCurrTSF) = HIDWORD(pDevice->qwCurrTSF); + *pqwCurrTSF = pDevice->qwCurrTSF; - return(TRUE); + return true; } @@ -764,19 +743,17 @@ BOOL CARDbGetCurrentTSF(void *pDeviceHandler, PQWORD pqwCurrTSF) * In: * pDevice - The adapter to be read * - * Return Value: TRUE if success; otherwise FALSE + * Return Value: true if success; otherwise false * */ -BOOL CARDbClearCurrentTSF(void *pDeviceHandler) +bool CARDbClearCurrentTSF(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - MACvRegBitsOn(pDevice,MAC_REG_TFTCTL,TFTCTL_TSFCNTRST); + MACvRegBitsOn(pDevice, MAC_REG_TFTCTL, TFTCTL_TSFCNTRST); - LODWORD(pDevice->qwCurrTSF) = 0; - HIDWORD(pDevice->qwCurrTSF) = 0; + pDevice->qwCurrTSF = 0; - return(TRUE); + return true; } /* @@ -793,7 +770,7 @@ BOOL CARDbClearCurrentTSF(void *pDeviceHandler) * Return Value: TSF value of next Beacon * */ -QWORD CARDqGetNextTBTT (QWORD qwTSF, WORD wBeaconInterval) +u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval) { unsigned int uLowNextTBTT; @@ -802,18 +779,19 @@ QWORD CARDqGetNextTBTT (QWORD qwTSF, WORD wBeaconInterval) uBeaconInterval = wBeaconInterval * 1024; // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval - uLowNextTBTT = (LODWORD(qwTSF) >> 10) << 10; - uLowRemain = (uLowNextTBTT) % uBeaconInterval; - uHighRemain = ((0x80000000 % uBeaconInterval)* 2 * HIDWORD(qwTSF)) - % uBeaconInterval; - uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval; - uLowRemain = uBeaconInterval - uLowRemain; + uLowNextTBTT = ((qwTSF & 0xffffffffU) >> 10) << 10; + uLowRemain = (uLowNextTBTT) % uBeaconInterval; + uHighRemain = ((0x80000000 % uBeaconInterval) * 2 * (u32)(qwTSF >> 32)) + % uBeaconInterval; + uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval; + uLowRemain = uBeaconInterval - uLowRemain; // check if carry when add one beacon interval - if ((~uLowNextTBTT) < uLowRemain) - HIDWORD(qwTSF) ++ ; + if ((~uLowNextTBTT) < uLowRemain) + qwTSF = ((qwTSF >> 32) + 1) << 32; - LODWORD(qwTSF) = uLowNextTBTT + uLowRemain; + qwTSF = (qwTSF & 0xffffffff00000000UL) | + (u64)(uLowNextTBTT + uLowRemain); return (qwTSF); } @@ -833,32 +811,24 @@ QWORD CARDqGetNextTBTT (QWORD qwTSF, WORD wBeaconInterval) * Return Value: none * */ -void CARDvSetFirstNextTBTT(void *pDeviceHandler, WORD wBeaconInterval) +void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, WORD wBeaconInterval) { + u64 qwNextTBTT = 0; + u8 pbyData[8]; - PSDevice pDevice = (PSDevice) pDeviceHandler; - QWORD qwNextTBTT; - DWORD dwLoTBTT,dwHiTBTT; - BYTE pbyData[8]; - - HIDWORD(qwNextTBTT) = 0; - LODWORD(qwNextTBTT) = 0; - CARDbClearCurrentTSF(pDevice); + CARDbClearCurrentTSF(pDevice); //CARDbGetCurrentTSF(pDevice, &qwNextTBTT); //Get Local TSF counter - qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); + qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); // Set NextTBTT - dwLoTBTT = LODWORD(qwNextTBTT); - dwHiTBTT = HIDWORD(qwNextTBTT); - - pbyData[0] = (BYTE)dwLoTBTT; - pbyData[1] = (BYTE)(dwLoTBTT>>8); - pbyData[2] = (BYTE)(dwLoTBTT>>16); - pbyData[3] = (BYTE)(dwLoTBTT>>24); - pbyData[4] = (BYTE)dwHiTBTT; - pbyData[5] = (BYTE)(dwHiTBTT>>8); - pbyData[6] = (BYTE)(dwHiTBTT>>16); - pbyData[7] = (BYTE)(dwHiTBTT>>24); + pbyData[0] = (u8)qwNextTBTT; + pbyData[1] = (u8)(qwNextTBTT >> 8); + pbyData[2] = (u8)(qwNextTBTT >> 16); + pbyData[3] = (u8)(qwNextTBTT >> 24); + pbyData[4] = (u8)(qwNextTBTT >> 32); + pbyData[5] = (u8)(qwNextTBTT >> 40); + pbyData[6] = (u8)(qwNextTBTT >> 48); + pbyData[7] = (u8)(qwNextTBTT >> 56); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SET_TSFTBTT, @@ -887,27 +857,23 @@ void CARDvSetFirstNextTBTT(void *pDeviceHandler, WORD wBeaconInterval) * Return Value: none * */ -void CARDvUpdateNextTBTT(void *pDeviceHandler, QWORD qwTSF, - WORD wBeaconInterval) +void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, + u16 wBeaconInterval) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - DWORD dwLoTBTT,dwHiTBTT; - BYTE pbyData[8]; + u8 pbyData[8]; qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval); // Set NextTBTT - dwLoTBTT = LODWORD(qwTSF); - dwHiTBTT = HIDWORD(qwTSF); - - pbyData[0] = (BYTE)dwLoTBTT; - pbyData[1] = (BYTE)(dwLoTBTT>>8); - pbyData[2] = (BYTE)(dwLoTBTT>>16); - pbyData[3] = (BYTE)(dwLoTBTT>>24); - pbyData[4] = (BYTE)dwHiTBTT; - pbyData[5] = (BYTE)(dwHiTBTT>>8); - pbyData[6] = (BYTE)(dwHiTBTT>>16); - pbyData[7] = (BYTE)(dwHiTBTT>>24); + + pbyData[0] = (u8)qwTSF; + pbyData[1] = (u8)(qwTSF >> 8); + pbyData[2] = (u8)(qwTSF >> 16); + pbyData[3] = (u8)(qwTSF >> 24); + pbyData[4] = (u8)(qwTSF >> 32); + pbyData[5] = (u8)(qwTSF >> 40); + pbyData[6] = (u8)(qwTSF >> 48); + pbyData[7] = (u8)(qwTSF >> 56); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SET_TSFTBTT, @@ -918,7 +884,8 @@ void CARDvUpdateNextTBTT(void *pDeviceHandler, QWORD qwTSF, ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Card:Update Next TBTT[%8xh:%8xh] \n",(int)HIDWORD(qwTSF), (int)LODWORD(qwTSF)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "Card:Update Next TBTT[%8lx]\n", (unsigned long)qwTSF); return; } @@ -932,18 +899,17 @@ void CARDvUpdateNextTBTT(void *pDeviceHandler, QWORD qwTSF, * Out: * none * - * Return Value: TRUE if success; otherwise FALSE + * Return Value: true if success; otherwise false * */ -BOOL CARDbRadioPowerOff(void *pDeviceHandler) +int CARDbRadioPowerOff(struct vnt_private *pDevice) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -BOOL bResult = TRUE; + int bResult = true; - //if (pDevice->bRadioOff == TRUE) - // return TRUE; + //if (pDevice->bRadioOff == true) + // return true; - pDevice->bRadioOff = TRUE; + pDevice->bRadioOff = true; switch (pDevice->byRFType) { case RF_AL2230: @@ -973,23 +939,21 @@ BOOL bResult = TRUE; * Out: * none * - * Return Value: TRUE if success; otherwise FALSE + * Return Value: true if success; otherwise false * */ -BOOL CARDbRadioPowerOn(void *pDeviceHandler) +int CARDbRadioPowerOn(struct vnt_private *pDevice) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -BOOL bResult = TRUE; - + int bResult = true; - if ((pDevice->bHWRadioOff == TRUE) || (pDevice->bRadioControlOff == TRUE)) { - return FALSE; + if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) { + return false; } - //if (pDevice->bRadioOff == FALSE) - // return TRUE; + //if (pDevice->bRadioOff == false) + // return true; - pDevice->bRadioOff = FALSE; + pDevice->bRadioOff = false; BBvExitDeepSleep(pDevice); @@ -1009,9 +973,8 @@ BOOL bResult = TRUE; return bResult; } -void CARDvSetBSSMode(void *pDeviceHandler) +void CARDvSetBSSMode(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; // Set BB and packet type at the same time.//{{RobertYu:20050222, AL7230 have two TX PA output, only connet to b/g now // so in 11a mode need to set the MAC Reg0x4C to 11b/g mode to turn on PA if( (pDevice->byRFType == RF_AIROHA7230 ) && (pDevice->byBBType == BB_TYPE_11A) ) @@ -1068,30 +1031,23 @@ void CARDvSetBSSMode(void *pDeviceHandler) * Return Value: none. * -*/ -BOOL -CARDbChannelSwitch ( - void *pDeviceHandler, - BYTE byMode, - BYTE byNewChannel, - BYTE byCount - ) +int CARDbChannelSwitch(struct vnt_private *pDevice, u8 byMode, + u8 byNewChannel, u8 byCount) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - BOOL bResult = TRUE; + int bResult = true; - if (byCount == 0) { - pDevice->sMgmtObj.uCurrChannel = byNewChannel; - CARDbSetMediaChannel(pDevice, byNewChannel); - - return bResult; - } + if (byCount == 0) { + pDevice->vnt_mgmt.uCurrChannel = byNewChannel; + CARDbSetMediaChannel(pDevice, byNewChannel); + return bResult; + } pDevice->byChannelSwitchCount = byCount; pDevice->byNewChannel = byNewChannel; - pDevice->bChannelSwitch = TRUE; + pDevice->bChannelSwitch = true; if (byMode == 1) { //bResult=CARDbStopTxPacket(pDevice, PKT_TYPE_802_11_ALL); - pDevice->bStopDataPkt = TRUE; + pDevice->bStopDataPkt = true; } return bResult; } diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index 55962b198831..5123bc7d0dcd 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -28,7 +28,7 @@ #ifndef __CARD_H__ #define __CARD_H__ - +#include "device.h" #include "ttype.h" /*--------------------- Export Definitions -------------------------*/ @@ -58,31 +58,28 @@ typedef enum _CARD_OP_MODE { /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ +struct vnt_private; -void CARDbSetMediaChannel(void *pDeviceHandler, - unsigned int uConnectionChannel); -void CARDvSetRSPINF(void *pDeviceHandler, BYTE byBBType); -void vUpdateIFS(void *pDeviceHandler); -void CARDvUpdateBasicTopRate(void *pDeviceHandler); -void CARDbAddBasicRate(void *pDeviceHandler, WORD wRateIdx); -BOOL CARDbIsOFDMinBasicRate(void *pDeviceHandler); -void CARDvAdjustTSF(void *pDeviceHandler, BYTE byRxRate, - QWORD qwBSSTimestamp, QWORD qwLocalTSF); -BOOL CARDbGetCurrentTSF(void *pDeviceHandler, PQWORD pqwCurrTSF); -BOOL CARDbClearCurrentTSF(void *pDeviceHandler); -void CARDvSetFirstNextTBTT(void *pDeviceHandler, WORD wBeaconInterval); -void CARDvUpdateNextTBTT(void *pDeviceHandler, QWORD qwTSF, +void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel); +void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType); +void vUpdateIFS(struct vnt_private *pDevice); +void CARDvUpdateBasicTopRate(struct vnt_private *pDevice); +void CARDbAddBasicRate(struct vnt_private *pDevice, u16 wRateIdx); +int CARDbIsOFDMinBasicRate(struct vnt_private *pDevice); +void CARDvAdjustTSF(struct vnt_private *pDevice, u8 byRxRate, + u64 qwBSSTimestamp, u64 qwLocalTSF); +bool CARDbGetCurrentTSF(struct vnt_private *pDevice, u64 *pqwCurrTSF); +bool CARDbClearCurrentTSF(struct vnt_private *pDevice); +void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, WORD wBeaconInterval); +void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, WORD wBeaconInterval); -QWORD CARDqGetNextTBTT(QWORD qwTSF, WORD wBeaconInterval); -QWORD CARDqGetTSFOffset(BYTE byRxRate, QWORD qwTSF1, QWORD qwTSF2); -BOOL CARDbRadioPowerOff(void *pDeviceHandler); -BOOL CARDbRadioPowerOn(void *pDeviceHandler); -BYTE CARDbyGetPktType(void *pDeviceHandler); -void CARDvSetBSSMode(void *pDeviceHandler); - -BOOL CARDbChannelSwitch(void *pDeviceHandler, - BYTE byMode, - BYTE byNewChannel, - BYTE byCount); +u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval); +u64 CARDqGetTSFOffset(BYTE byRxRate, u64 qwTSF1, u64 qwTSF2); +int CARDbRadioPowerOff(struct vnt_private *pDevice); +int CARDbRadioPowerOn(struct vnt_private *pDevice); +u8 CARDbyGetPktType(struct vnt_private *pDevice); +void CARDvSetBSSMode(struct vnt_private *pDevice); +int CARDbChannelSwitch(struct vnt_private *pDevice, u8 byMode, + u8 byNewChannel, u8 byCount); #endif /* __CARD_H__ */ diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index 650217607858..4181e3e12ea9 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -50,63 +50,63 @@ static int msglevel = MSG_LEVEL_INFO; static SChannelTblElement sChannelTbl[CB_MAX_CHANNEL+1] = { - {0, 0, FALSE}, - {1, 2412, TRUE}, - {2, 2417, TRUE}, - {3, 2422, TRUE}, - {4, 2427, TRUE}, - {5, 2432, TRUE}, - {6, 2437, TRUE}, - {7, 2442, TRUE}, - {8, 2447, TRUE}, - {9, 2452, TRUE}, - {10, 2457, TRUE}, - {11, 2462, TRUE}, - {12, 2467, TRUE}, - {13, 2472, TRUE}, - {14, 2484, TRUE}, - {183, 4915, TRUE}, //15 - {184, 4920, TRUE}, //16 - {185, 4925, TRUE}, //17 - {187, 4935, TRUE}, //18 - {188, 4940, TRUE}, //19 - {189, 4945, TRUE}, //20 - {192, 4960, TRUE}, //21 - {196, 4980, TRUE}, //22 - {7, 5035, TRUE}, //23 - {8, 5040, TRUE}, //24 - {9, 5045, TRUE}, //25 - {11, 5055, TRUE}, //26 - {12, 5060, TRUE}, //27 - {16, 5080, TRUE}, //28 - {34, 5170, TRUE}, //29 - {36, 5180, TRUE}, //30 - {38, 5190, TRUE}, //31 - {40, 5200, TRUE}, //32 - {42, 5210, TRUE}, //33 - {44, 5220, TRUE}, //34 - {46, 5230, TRUE}, //35 - {48, 5240, TRUE}, //36 - {52, 5260, TRUE}, //37 - {56, 5280, TRUE}, //38 - {60, 5300, TRUE}, //39 - {64, 5320, TRUE}, //40 - {100, 5500, TRUE}, //41 - {104, 5520, TRUE}, //42 - {108, 5540, TRUE}, //43 - {112, 5560, TRUE}, //44 - {116, 5580, TRUE}, //45 - {120, 5600, TRUE}, //46 - {124, 5620, TRUE}, //47 - {128, 5640, TRUE}, //48 - {132, 5660, TRUE}, //49 - {136, 5680, TRUE}, //50 - {140, 5700, TRUE}, //51 - {149, 5745, TRUE}, //52 - {153, 5765, TRUE}, //53 - {157, 5785, TRUE}, //54 - {161, 5805, TRUE}, //55 - {165, 5825, TRUE} //56 + {0, 0, false}, + {1, 2412, true}, + {2, 2417, true}, + {3, 2422, true}, + {4, 2427, true}, + {5, 2432, true}, + {6, 2437, true}, + {7, 2442, true}, + {8, 2447, true}, + {9, 2452, true}, + {10, 2457, true}, + {11, 2462, true}, + {12, 2467, true}, + {13, 2472, true}, + {14, 2484, true}, + {183, 4915, true}, //15 + {184, 4920, true}, //16 + {185, 4925, true}, //17 + {187, 4935, true}, //18 + {188, 4940, true}, //19 + {189, 4945, true}, //20 + {192, 4960, true}, //21 + {196, 4980, true}, //22 + {7, 5035, true}, //23 + {8, 5040, true}, //24 + {9, 5045, true}, //25 + {11, 5055, true}, //26 + {12, 5060, true}, //27 + {16, 5080, true}, //28 + {34, 5170, true}, //29 + {36, 5180, true}, //30 + {38, 5190, true}, //31 + {40, 5200, true}, //32 + {42, 5210, true}, //33 + {44, 5220, true}, //34 + {46, 5230, true}, //35 + {48, 5240, true}, //36 + {52, 5260, true}, //37 + {56, 5280, true}, //38 + {60, 5300, true}, //39 + {64, 5320, true}, //40 + {100, 5500, true}, //41 + {104, 5520, true}, //42 + {108, 5540, true}, //43 + {112, 5560, true}, //44 + {116, 5580, true}, //45 + {120, 5600, true}, //46 + {124, 5620, true}, //47 + {128, 5640, true}, //48 + {132, 5660, true}, //49 + {136, 5680, true}, //50 + {140, 5700, true}, //51 + {149, 5745, true}, //52 + {153, 5765, true}, //53 + {157, 5785, true}, //54 + {161, 5805, true}, //55 + {165, 5825, true} //56 }; @@ -380,26 +380,26 @@ static struct * 15 = 4.9G channel 183 * 16 = 4.9G channel 184 * ..... - * Output: TRUE if the specified 5GHz band is allowed to be used. + * Output: true if the specified 5GHz band is allowed to be used. False otherwise. // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) ************************************************************************/ -BOOL +bool ChannelValid(unsigned int CountryCode, unsigned int ChannelIndex) { - BOOL bValid; + bool bValid; - bValid = FALSE; + bValid = false; /* * If Channel Index is invalid, return invalid */ if ((ChannelIndex > CB_MAX_CHANNEL) || (ChannelIndex == 0)) { - bValid = FALSE; + bValid = false; goto exit; } @@ -422,48 +422,47 @@ exit: * 0x0000000000000003 means channel 1,2 are supported * 0x000000000000000F means channel 1,2,..15 are supported ************************************************************************/ -BOOL +bool CHvChannelGetList ( unsigned int uCountryCodeIdx, PBYTE pbyChannelTable ) { if (uCountryCodeIdx >= CCODE_MAX) { - return (FALSE); + return (false); } memcpy(pbyChannelTable, ChannelRuleTab[uCountryCodeIdx].bChannelIdxList, CB_MAX_CHANNEL); - return (TRUE); + return (true); } -void CHvInitChannelTable(void *pDeviceHandler) +void CHvInitChannelTable(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - BOOL bMultiBand = FALSE; - unsigned int ii; + int bMultiBand = false; + int ii; for (ii = 1; ii <= CB_MAX_CHANNEL; ii++) - sChannelTbl[ii].bValid = FALSE; + sChannelTbl[ii].bValid = false; switch (pDevice->byRFType) { case RF_AL2230: case RF_AL2230S: case RF_VT3226: case RF_VT3226D0: - bMultiBand = FALSE; + bMultiBand = false; break; case RF_AIROHA7230: case RF_VT3342A0: default : - bMultiBand = TRUE; + bMultiBand = true; break; } if ((pDevice->dwDiagRefCount != 0) || - (pDevice->b11hEable == TRUE)) { - if (bMultiBand == TRUE) { + (pDevice->b11hEable == true)) { + if (bMultiBand == true) { for (ii = 0; ii < CB_MAX_CHANNEL; ii++) { - sChannelTbl[ii+1].bValid = TRUE; + sChannelTbl[ii+1].bValid = true; //pDevice->abyRegPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; //pDevice->abyLocalPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; } @@ -473,16 +472,16 @@ void CHvInitChannelTable(void *pDeviceHandler) } } else { for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { - sChannelTbl[ii+1].bValid = TRUE; + sChannelTbl[ii+1].bValid = true; //pDevice->abyRegPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; //pDevice->abyLocalPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; } } } else if (pDevice->byZoneType <= CCODE_MAX) { - if (bMultiBand == TRUE) { + if (bMultiBand == true) { for (ii = 0; ii < CB_MAX_CHANNEL; ii++) { if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) { - sChannelTbl[ii+1].bValid = TRUE; + sChannelTbl[ii+1].bValid = true; //pDevice->abyRegPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; //pDevice->abyLocalPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; } @@ -490,7 +489,7 @@ void CHvInitChannelTable(void *pDeviceHandler) } else { for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) { - sChannelTbl[ii+1].bValid = TRUE; + sChannelTbl[ii+1].bValid = true; //pDevice->abyRegPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; //pDevice->abyLocalPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; } diff --git a/drivers/staging/vt6656/channel.h b/drivers/staging/vt6656/channel.h index e7b3c1231825..9914dba0ba0c 100644 --- a/drivers/staging/vt6656/channel.h +++ b/drivers/staging/vt6656/channel.h @@ -30,6 +30,7 @@ #ifndef _CHANNEL_H_ #define _CHANNEL_H_ +#include "device.h" #include "ttype.h" /*--------------------- Export Definitions -------------------------*/ @@ -39,17 +40,17 @@ typedef struct tagSChannelTblElement { BYTE byChannelNumber; unsigned int uFrequency; - BOOL bValid; + bool bValid; } SChannelTblElement, *PSChannelTblElement; /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -BOOL ChannelValid(unsigned int CountryCode, unsigned int ChannelNum); -void CHvInitChannelTable(void *pDeviceHandler); +bool ChannelValid(unsigned int CountryCode, unsigned int ChannelNum); +void CHvInitChannelTable(struct vnt_private *pDevice); BYTE CHbyGetChannelMapping(BYTE byChannelNumber); -BOOL CHvChannelGetList(unsigned int uCountryCodeIdx, PBYTE pbyChannelTable); +bool CHvChannelGetList(unsigned int uCountryCodeIdx, PBYTE pbyChannelTable); #endif /* _CHANNEL_H_ */ diff --git a/drivers/staging/vt6656/control.c b/drivers/staging/vt6656/control.c index 5d8c5719419b..743ef5fb7fe7 100644 --- a/drivers/staging/vt6656/control.c +++ b/drivers/staging/vt6656/control.c @@ -56,43 +56,34 @@ /*--------------------- Export Functions --------------------------*/ -void ControlvWriteByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, - BYTE byData) +void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, + u8 data) { - BYTE byData1; - byData1 = byData; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - byRegOfs, - byRegType, - 1, - &byData1); + + CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, reg_off, reg, + sizeof(u8), &data); + + return; } -void ControlvReadByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, - PBYTE pbyData) +void ControlvReadByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, + u8 *data) { - int ntStatus; - BYTE byData1; - ntStatus = CONTROLnsRequestIn(pDevice, - MESSAGE_TYPE_READ, - byRegOfs, - byRegType, - 1, - &byData1); - *pbyData = byData1; + CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, + reg_off, reg, sizeof(u8), data); + return; } -void ControlvMaskByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, - BYTE byMask, BYTE byData) +void ControlvMaskByte(struct vnt_private *pDevice, u8 reg_type, u8 reg_off, + u8 reg_mask, u8 data) { - BYTE pbyData[2]; - pbyData[0] = byData; - pbyData[1] = byMask; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - byRegOfs, - byRegType, - 2, - pbyData); + u8 reg_data[2]; + + reg_data[0] = data; + reg_data[1] = reg_mask; + + CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE_MASK, reg_off, + reg_type, ARRAY_SIZE(reg_data), reg_data); + + return; } diff --git a/drivers/staging/vt6656/control.h b/drivers/staging/vt6656/control.h index bbe610fd8b5a..76ce0244e100 100644 --- a/drivers/staging/vt6656/control.h +++ b/drivers/staging/vt6656/control.h @@ -51,28 +51,14 @@ /*--------------------- Export Functions --------------------------*/ -void ControlvWriteByte( - PSDevice pDevice, - BYTE byRegType, - BYTE byRegOfs, - BYTE byData - ); +void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, + u8 data); +void ControlvReadByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, + u8 *data); -void ControlvReadByte( - PSDevice pDevice, - BYTE byRegType, - BYTE byRegOfs, - PBYTE pbyData - ); +void ControlvMaskByte(struct vnt_private *pDevice, u8 reg_type, u8 reg_off, + u8 reg_mask, u8 data); -void ControlvMaskByte( - PSDevice pDevice, - BYTE byRegType, - BYTE byRegOfs, - BYTE byMask, - BYTE byData - ); - #endif /* __CONTROL_H__ */ diff --git a/drivers/staging/vt6656/datarate.c b/drivers/staging/vt6656/datarate.c index 5c2719fa72f7..77464e819f6d 100644 --- a/drivers/staging/vt6656/datarate.c +++ b/drivers/staging/vt6656/datarate.c @@ -54,7 +54,8 @@ /*--------------------- Static Variables --------------------------*/ -//static int msglevel =MSG_LEVEL_DEBUG; + +/* static int msglevel = MSG_LEVEL_DEBUG; */ static int msglevel =MSG_LEVEL_INFO; const BYTE acbyIERate[MAX_RATE] = {0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; @@ -71,7 +72,7 @@ void s_vResetCounter(PKnownNodeDB psNodeDBTable) { BYTE ii; - // clear statistic counter for auto_rate + /* clear statistics counter for auto_rate */ for (ii = 0; ii <= MAX_RATE; ii++) { psNodeDBTable->uTxOk[ii] = 0; psNodeDBTable->uTxFail[ii] = 0; @@ -105,8 +106,8 @@ DATARATEbyGetRateIdx ( { BYTE ii; - //Erase basicRate flag. - byRate = byRate & 0x7F;//0111 1111 + /* erase BasicRate flag */ + byRate = byRate & 0x7F; for (ii = 0; ii < MAX_RATE; ii ++) { if (acbyIERate[ii] == byRate) @@ -159,8 +160,8 @@ RATEwGetRateIdx( { WORD ii; - //Erase basicRate flag. - byRate = byRate & 0x7F;//0111 1111 + /* erase BasicRate flag */ + byRate = byRate & 0x7F; for (ii = 0; ii < MAX_RATE; ii ++) { if (acbyIERate[ii] == byRate) @@ -188,28 +189,19 @@ RATEwGetRateIdx( * Return Value: none * -*/ -void RATEvParseMaxRate( - void *pDeviceHandler, - PWLAN_IE_SUPP_RATES pItemRates, - PWLAN_IE_SUPP_RATES pItemExtRates, - BOOL bUpdateBasicRate, - PWORD pwMaxBasicRate, - PWORD pwMaxSuppRate, - PWORD pwSuppRate, - PBYTE pbyTopCCKRate, - PBYTE pbyTopOFDMRate - ) -{ -PSDevice pDevice = (PSDevice) pDeviceHandler; -unsigned int ii; -BYTE byHighSuppRate = 0; -BYTE byRate = 0; -WORD wOldBasicRate = pDevice->wBasicRate; -unsigned int uRateLen; +void RATEvParseMaxRate(struct vnt_private *pDevice, + PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pItemExtRates, + int bUpdateBasicRate, u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, + u16 *pwSuppRate, u8 *pbyTopCCKRate, u8 *pbyTopOFDMRate) +{ + int ii; + u8 byHighSuppRate = 0, byRate = 0; + u16 wOldBasicRate = pDevice->wBasicRate; + u32 uRateLen; - if (pItemRates == NULL) - return; + if (pItemRates == NULL) + return; *pwSuppRate = 0; uRateLen = pItemRates->len; @@ -226,8 +218,11 @@ unsigned int uRateLen; for (ii = 0; ii < uRateLen; ii++) { byRate = (BYTE)(pItemRates->abyRates[ii]); if (WLAN_MGMT_IS_BASICRATE(byRate) && - (bUpdateBasicRate == TRUE)) { - // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate + (bUpdateBasicRate == true)) { + /* + * add to basic rate set, update pDevice->byTopCCKBasicRate and + * pDevice->byTopOFDMBasicRate + */ CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", RATEwGetRateIdx(byRate)); } @@ -248,9 +243,12 @@ unsigned int uRateLen; for (ii = 0; ii < uExtRateLen ; ii++) { byRate = (BYTE)(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, RATEwGetRateIdx(byRate)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", RATEwGetRateIdx(byRate)); } @@ -260,9 +258,11 @@ unsigned int uRateLen; if (byRate > byHighSuppRate) byHighSuppRate = byRate; *pwSuppRate |= (1<<RATEwGetRateIdx(byRate)); - //DBG_PRN_GRP09(("ParseMaxRate : HighSuppRate: %d, %X\n", RATEwGetRateIdx(byRate), byRate)); + + /* DBG_PRN_GRP09(("ParseMaxRate : HighSuppRate: %d, %X\n", + RATEwGetRateIdx(byRate), byRate)); */ } - } //if(pItemExtRates != NULL) + } if ((pDevice->byPacketType == PK_TYPE_11GB) && CARDbIsOFDMinBasicRate((void *)pDevice)) { @@ -301,27 +301,24 @@ unsigned int uRateLen; #define AUTORATE_TXCNT_THRESHOLD 20 #define AUTORATE_INC_THRESHOLD 30 -void -RATEvTxRateFallBack( - void *pDeviceHandler, - PKnownNodeDB psNodeDBTable - ) +void RATEvTxRateFallBack(struct vnt_private *pDevice, + PKnownNodeDB psNodeDBTable) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -PSMgmtObject pMgmt = &(pDevice->sMgmtObj); -WORD wIdxDownRate = 0; -unsigned int ii; -BOOL bAutoRate[MAX_RATE] = {TRUE,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE}; -DWORD dwThroughputTbl[MAX_RATE] = {10, 20, 55, 110, 60, 90, 120, 180, 240, 360, 480, 540}; -DWORD dwThroughput = 0; -WORD wIdxUpRate = 0; -DWORD dwTxDiff = 0; - - if (pMgmt->eScanState != WMAC_NO_SCANNING) { - // Don't do Fallback when scanning Channel - return; - } - psNodeDBTable->uTimeCount ++; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u16 wIdxDownRate = 0; + int ii; + int bAutoRate[MAX_RATE] = {true, true, true, true, false, false, true, + true, true, true, true, true}; + u32 dwThroughputTbl[MAX_RATE] = {10, 20, 55, 110, 60, 90, 120, 180, + 240, 360, 480, 540}; + u32 dwThroughput = 0; + u16 wIdxUpRate = 0; + u32 dwTxDiff = 0; + + if (pMgmt->eScanState != WMAC_NO_SCANNING) + return; /* Don't do Fallback when scanning Channel */ + + psNodeDBTable->uTimeCount++; if (psNodeDBTable->uTxFail[MAX_RATE] > psNodeDBTable->uTxOk[MAX_RATE]) dwTxDiff = psNodeDBTable->uTxFail[MAX_RATE] - psNodeDBTable->uTxOk[MAX_RATE]; @@ -338,11 +335,11 @@ DWORD dwTxDiff = 0; for (ii = 0; ii < MAX_RATE; ii++) { if (psNodeDBTable->wSuppRate & (0x0001<<ii)) { - if (bAutoRate[ii] == TRUE) { + if (bAutoRate[ii] == true) { wIdxUpRate = (WORD) ii; } } else { - bAutoRate[ii] = FALSE; + bAutoRate[ii] = false; } } @@ -364,7 +361,7 @@ DWORD dwTxDiff = 0; for (ii = psNodeDBTable->wTxDataRate; ii > 0;) { ii--; if ( (dwThroughputTbl[ii] > dwThroughput) && - (bAutoRate[ii]==TRUE) ) { + (bAutoRate[ii]==true) ) { dwThroughput = dwThroughputTbl[ii]; wIdxDownRate = (WORD) ii; } @@ -375,7 +372,7 @@ DWORD dwTxDiff = 0; (psNodeDBTable->uTxFail[MAX_RATE] * 4) ) { psNodeDBTable->wTxDataRate = wIdxUpRate; } - }else { // adhoc, if uTxOk(total) =0 & uTxFail(total) = 0 + } else { /* adhoc, if uTxOk(total) == 0 & uTxFail(total) == 0 */ if (psNodeDBTable->uTxFail[MAX_RATE] == 0) psNodeDBTable->wTxDataRate = wIdxUpRate; } diff --git a/drivers/staging/vt6656/datarate.h b/drivers/staging/vt6656/datarate.h index c6f5163ff9b8..8dc55bd61669 100644 --- a/drivers/staging/vt6656/datarate.h +++ b/drivers/staging/vt6656/datarate.h @@ -29,18 +29,18 @@ #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 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 */ #define RATE_1M 0 #define RATE_2M 1 @@ -69,24 +69,13 @@ -void -RATEvParseMaxRate( - void *pDeviceHandler, - PWLAN_IE_SUPP_RATES pItemRates, - PWLAN_IE_SUPP_RATES pItemExtRates, - BOOL bUpdateBasicRate, - PWORD pwMaxBasicRate, - PWORD pwMaxSuppRate, - PWORD pwSuppRate, - PBYTE pbyTopCCKRate, - PBYTE pbyTopOFDMRate - ); +void RATEvParseMaxRate(struct vnt_private *, PWLAN_IE_SUPP_RATES pItemRates, + PWLAN_IE_SUPP_RATES pItemExtRates, int bUpdateBasicRate, + u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, u16 *pwSuppRate, + u8 *pbyTopCCKRate, u8 *pbyTopOFDMRate); -void -RATEvTxRateFallBack( - void *pDeviceHandler, - PKnownNodeDB psNodeDBTable - ); +void RATEvTxRateFallBack(struct vnt_private *pDevice, + PKnownNodeDB psNodeDBTable); BYTE RATEuSetIE( diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h index 5007e98d1b0e..0c0b614aaa11 100644 --- a/drivers/staging/vt6656/desc.h +++ b/drivers/staging/vt6656/desc.h @@ -36,92 +36,95 @@ #include "ttype.h" #include "tether.h" -// max transmit or receive buffer size -#define CB_MAX_BUF_SIZE 2900U // max buffer size - // NOTE: must be multiple of 4 +/* max transmit or receive 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 +/* max TX buffer size */ +#define CB_MAX_TX_BUF_SIZE CB_MAX_BUF_SIZE +/* max RX buffer size when not use Multi-RD */ +#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 /* default beacon buffer size */ #define MAX_TOTAL_SIZE_WITH_ALL_HEADERS CB_MAX_BUF_SIZE #define MAX_INTERRUPT_SIZE 32 -#define RX_BLOCKS 64 // form 0x60 to 0xA0 -#define TX_BLOCKS 32 // from 0xA0 to 0xC0 - -#define CB_MAX_RX_DESC 128 // max # of descriptor -#define CB_MIN_RX_DESC 16 // min # of rx descriptor -#define CB_MAX_TX_DESC 128 // max # of descriptor -#define CB_MIN_TX_DESC 16 // min # of tx descriptor - -#define CB_RD_NUM 64 // default # of RD -#define CB_TD_NUM 64 // default # of TD - -// -// 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 - -// -// 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 - -// -// Bits in the TSR register -// -#define TSR_RETRYTMO 0x08 // 0000 1000 -#define TSR_TMO 0x04 // 0000 0100 -#define TSR_ACKDATA 0x02 // 0000 0010 -#define TSR_VALID 0x01 // 0000 0001 +#define RX_BLOCKS 64 /* from 0x60 to 0xA0 */ +#define TX_BLOCKS 32 /* from 0xA0 to 0xC0 */ + +#define CB_MAX_RX_DESC 128 /* max # of descriptors */ +#define CB_MIN_RX_DESC 16 /* min # of RX descriptors */ +#define CB_MAX_TX_DESC 128 /* max # of descriptors */ +#define CB_MIN_TX_DESC 16 /* min # of TX descriptors */ + +#define CB_RD_NUM 64 /* default # of RD */ +#define CB_TD_NUM 64 /* default # of TD */ + +/* + * bits in the RSR register + */ +#define RSR_ADDRBROAD 0x80 +#define RSR_ADDRMULTI 0x40 +#define RSR_ADDRUNI 0x00 +#define RSR_IVLDTYP 0x20 /* invalid packet type */ +#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 +#define NEWRSR_CFPIND 0x08 +#define NEWRSR_HWUTSF 0x04 +#define NEWRSR_BCNHITAID 0x02 +#define NEWRSR_BCNHITAID0 0x01 + +/* + * bits in the TSR register + */ +#define TSR_RETRYTMO 0x08 +#define TSR_TMO 0x04 +#define TSR_ACKDATA 0x02 +#define TSR_VALID 0x01 #define CB_PROTOCOL_RESERVED_SECTION 16 -// if retrys excess 15 times , tx will abort, and -// if tx fifo underflow, tx will fail -// we should try to resend it +/* + * if retries exceed 15 times, TX will abort, and + * if TX fifo underflow, TX will fail + * we should try to resend it + */ #define CB_MAX_TX_ABORT_RETRY 3 -#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 - -//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 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 +#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 #define TYPE_TXDMA0 0 #define TYPE_AC0DMA 1 @@ -135,14 +138,14 @@ #define TYPE_RXDMA1 1 #define TYPE_MAXRD 2 -// TD_INFO flags control bit -#define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb -#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 +/* TD_INFO flags control bit */ +#define TD_FLAGS_NETIF_SKB 0x01 /* check if need release skb */ +#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 */ -// -// RsvTime buffer header -// +/* + * RsvTime buffer header + */ typedef struct tagSRrvTime_gRTS { WORD wRTSTxRrvTime_ba; WORD wRTSTxRrvTime_aa; @@ -181,9 +184,9 @@ SRrvTime_atim, *PSRrvTime_atim; typedef const SRrvTime_atim *PCSRrvTime_atim; -// -// RTS buffer header -// +/* + * RTS buffer header + */ typedef struct tagSRTSData { WORD wFrameControl; WORD wDurationID; @@ -257,9 +260,9 @@ SRTS_a_FB, *PSRTS_a_FB; typedef const SRTS_a_FB *PCSRTS_a_FB; -// -// CTS buffer header -// +/* + * CTS buffer header + */ typedef struct tagSCTSData { WORD wFrameControl; WORD wDurationID; @@ -294,9 +297,9 @@ SCTS_FB, *PSCTS_FB; typedef const SCTS_FB *PCSCTS_FB; -// -// Tx FIFO header -// +/* + * TX FIFO header + */ typedef struct tagSTxBufHead { u32 adwTxKey[4]; WORD wFIFOCtl; @@ -314,9 +317,9 @@ typedef struct tagSTxShortBufHead { STxShortBufHead, *PSTxShortBufHead; typedef const STxShortBufHead *PCSTxShortBufHead; -// -// Tx data header -// +/* + * TX data header + */ typedef struct tagSTxDataHead_g { BYTE bySignalField_b; BYTE byServiceField_b; @@ -372,9 +375,9 @@ typedef struct tagSTxDataHead_a_FB { STxDataHead_a_FB, *PSTxDataHead_a_FB; typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB; -// -// MICHDR data header -// +/* + * MICHDR data header + */ typedef struct tagSMICHDRHead { u32 adwHDR0[4]; u32 adwHDR1[4]; diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 25bf03af7733..6bba2e06fa64 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -53,7 +53,7 @@ #undef DEVICE_ETHTOOL_IOCTL_SUPPORT #endif -//please copy below macro to driver_event.c for API +/* please copy below macro to driver_event.c for API */ #define RT_INSMOD_EVENT_FLAG 0x0101 #define RT_UPDEV_EVENT_FLAG 0x0102 #define RT_DISCONNECTED_EVENT_FLAG 0x0103 @@ -61,9 +61,9 @@ #define RT_DOWNDEV_EVENT_FLAG 0x0105 #define RT_RMMOD_EVENT_FLAG 0x0106 -// -// device specific -// +/* + * device specific + */ #include "device_cfg.h" #include "ttype.h" @@ -110,7 +110,7 @@ #define FB_RATE0 0 #define FB_RATE1 1 -// Antenna Mode +/* Antenna Mode */ #define ANT_A 0 #define ANT_B 1 #define ANT_DIVERSITY 2 @@ -125,7 +125,7 @@ #define MAXCHECKHANGCNT 4 -//Packet type +/* Packet type */ #define TX_PKT_UNI 0x00 #define TX_PKT_MULTI 0x01 #define TX_PKT_BROAD 0x02 @@ -137,7 +137,7 @@ #define RUN_AT(x) (jiffies+(x)) #endif -// DMA related +/* DMA related */ #define RESERV_AC0DMA 4 #define PRIVATE_Message 0 @@ -161,30 +161,30 @@ typedef enum __device_init_type { DEVICE_INIT_DXPL /* Dx to D0 power lost init */ } DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE; -//USB +/* USB */ -// -// Enum of context types for SendPacket -// +/* + * Enum of context types for SendPacket + */ typedef enum _CONTEXT_TYPE { CONTEXT_DATA_PACKET = 1, CONTEXT_MGMT_PACKET } CONTEXT_TYPE; -// RCB (Receive Control Block) +/* RCB (Receive Control Block) */ typedef struct _RCB { - void *Next; - signed long Ref; - void *pDevice; - struct urb *pUrb; - SRxMgmtPacket sMngPacket; - struct sk_buff* skb; - BOOL bBoolInUse; + void *Next; + signed long Ref; + void *pDevice; + struct urb *pUrb; + struct vnt_rx_mgmt sMngPacket; + struct sk_buff *skb; + int bBoolInUse; } RCB, *PRCB; -// used to track bulk out irps +/* used to track bulk out irps */ typedef struct _USB_SEND_CONTEXT { void *pDevice; struct sk_buff *pPacket; @@ -193,7 +193,7 @@ typedef struct _USB_SEND_CONTEXT { CONTEXT_TYPE Type; SEthernetHeader sEthHeader; void *Next; - BOOL bBoolInUse; + bool bBoolInUse; unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS]; } USB_SEND_CONTEXT, *PUSB_SEND_CONTEXT; @@ -207,17 +207,17 @@ typedef struct _DEFAULT_CONFIG { signed int eEncryptionStatus; } DEFAULT_CONFIG, *PDEFAULT_CONFIG; -// -// Structure to keep track of usb interrupt packets -// +/* + * Structure to keep track of USB interrupt packets + */ typedef struct { unsigned int uDataLen; PBYTE pDataBuf; -// struct urb *pUrb; - BOOL bInUse; + /* struct urb *pUrb; */ + bool bInUse; } INT_BUFFER, *PINT_BUFFER; -//0:11A 1:11B 2:11G +/* 0:11A 1:11B 2:11G */ typedef enum _VIA_BB_TYPE { BB_TYPE_11A = 0, @@ -225,7 +225,7 @@ typedef enum _VIA_BB_TYPE BB_TYPE_11G } VIA_BB_TYPE, *PVIA_BB_TYPE; -//0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate) +/* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga(OFDM in BasicRate) */ typedef enum _VIA_PKT_TYPE { PK_TYPE_11A = 0, @@ -234,7 +234,7 @@ typedef enum _VIA_PKT_TYPE PK_TYPE_11GA } VIA_PKT_TYPE, *PVIA_PKT_TYPE; -//++ NDIS related +/*++ NDIS related */ typedef enum __DEVICE_NDIS_STATUS { STATUS_SUCCESS = 0, @@ -245,10 +245,10 @@ typedef enum __DEVICE_NDIS_STATUS { #define MAX_BSSIDINFO_4_PMKID 16 #define MAX_PMKIDLIST 5 -//Flags for PMKID Candidate list structure +/* flags for PMKID Candidate list structure */ #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 -// PMKID Structures +/* PMKID Structures */ typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; @@ -272,13 +272,13 @@ typedef enum _NDIS_802_11_WEP_STATUS typedef enum _NDIS_802_11_STATUS_TYPE { - Ndis802_11StatusType_Authentication, - Ndis802_11StatusType_MediaStreamMode, - Ndis802_11StatusType_PMKID_CandidateList, - Ndis802_11StatusTypeMax // not a real type, defined as an upper bound + Ndis802_11StatusType_Authentication, + Ndis802_11StatusType_MediaStreamMode, + Ndis802_11StatusType_PMKID_CandidateList, + Ndis802_11StatusTypeMax, /* not a real type, defined as upper bound */ } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; -//Added new types for PMKID Candidate lists. +/* added new types for PMKID Candidate lists */ typedef struct _PMKID_CANDIDATE { NDIS_802_11_MAC_ADDRESS BSSID; unsigned long Flags; @@ -304,22 +304,17 @@ typedef struct tagSPMKIDCandidateEvent { PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; -//-- - -//++ 802.11h related +/*++ 802.11h related */ #define MAX_QUIET_COUNT 8 typedef struct tagSQuietControl { - BOOL bEnable; + bool bEnable; DWORD dwStartTime; BYTE byPeriod; WORD wDuration; } SQuietControl, *PSQuietControl; -//-- - - -// The receive duplicate detection cache entry +/* The receive duplicate detection cache entry */ typedef struct tagSCacheEntry{ WORD wFmSequence; BYTE abyAddr2[ETH_ALEN]; @@ -329,13 +324,15 @@ typedef struct tagSCacheEntry{ typedef struct tagSCache{ /* The receive cache is updated circularly. The next entry to be written is * indexed by the "InPtr". -*/ + */ unsigned int uInPtr; /* Place to use next */ SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH]; } SCache, *PSCache; #define CB_MAX_RX_FRAG 64 -// DeFragment Control Block, used for collecting fragments prior to reassembly +/* + * DeFragment Control Block, used for collecting fragments prior to reassembly + */ typedef struct tagSDeFragControlBlock { WORD wSequence; @@ -345,27 +342,25 @@ typedef struct tagSDeFragControlBlock struct sk_buff* skb; PBYTE pbyRxBuffer; unsigned int cbFrameLength; - BOOL bInUse; + bool bInUse; } SDeFragControlBlock, *PSDeFragControlBlock; - - -//flags for options +/* flags for options */ #define DEVICE_FLAGS_UNPLUG 0x00000001UL #define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL #define DEVICE_FLAGS_OP_MODE 0x00000004UL #define DEVICE_FLAGS_PS_MODE 0x00000008UL #define DEVICE_FLAGS_80211h_MODE 0x00000010UL -//flags for driver status +/* flags for driver status */ #define DEVICE_FLAGS_OPENED 0x00010000UL #define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL -//flags for capbilities +/* flags for capabilities */ #define DEVICE_FLAGS_TX_ALIGN 0x01000000UL #define DEVICE_FLAGS_HAVE_CAM 0x02000000UL #define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL -//flags for MII status +/* flags for MII status */ #define DEVICE_LINK_FAIL 0x00000001UL #define DEVICE_SPEED_10 0x00000002UL #define DEVICE_SPEED_100 0x00000004UL @@ -373,14 +368,14 @@ typedef struct tagSDeFragControlBlock #define DEVICE_DUPLEX_FULL 0x00000010UL #define DEVICE_AUTONEG_ENABLE 0x00000020UL #define DEVICE_FORCED_BY_EEPROM 0x00000040UL -//for device_set_media_duplex +/* for device_set_media_duplex */ #define DEVICE_LINK_CHANGE 0x00000001UL typedef struct __device_opt { - int nRxDescs0; //Number of RX descriptors0 - int nTxDescs0; //Number of TX descriptors 0, 1, 2, 3 - int rts_thresh; //rts threshold + int nRxDescs0; /* number of RX descriptors 0 */ + int nTxDescs0; /* number of TX descriptors 0, 1, 2, 3 */ + int rts_thresh; /* RTS threshold */ int frag_thresh; int OpMode; int data_rate; @@ -392,429 +387,406 @@ typedef struct __device_opt { } OPTIONS, *POPTIONS; -typedef struct __device_info { +struct vnt_private { + /* netdev */ + struct usb_device *usb; + struct net_device *dev; + struct net_device_stats stats; -// netdev - struct usb_device* usb; - struct net_device* dev; - struct net_device_stats stats; + OPTIONS sOpts; + struct tasklet_struct CmdWorkItem; + struct tasklet_struct EventWorkItem; + struct tasklet_struct ReadWorkItem; + struct tasklet_struct RxMngWorkItem; - OPTIONS sOpts; + u32 rx_buf_sz; + int multicast_limit; + u8 byRxMode; - struct tasklet_struct CmdWorkItem; - struct tasklet_struct EventWorkItem; - struct tasklet_struct ReadWorkItem; - struct tasklet_struct RxMngWorkItem; + spinlock_t lock; - u32 rx_buf_sz; - int multicast_limit; - BYTE byRxMode; + u32 rx_bytes; - spinlock_t lock; + u8 byRevId; - u32 rx_bytes; + u32 flags; + unsigned long Flags; - BYTE byRevId; + SCache sDupRxCache; - u32 flags; - unsigned long Flags; + SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG]; + u32 cbDFCB; + u32 cbFreeDFCB; + u32 uCurrentDFCBIdx; - SCache sDupRxCache; - SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG]; - unsigned int cbDFCB; - unsigned int cbFreeDFCB; - unsigned int uCurrentDFCBIdx; + /* USB */ + struct urb *pControlURB; + struct urb *pInterruptURB; + struct usb_ctrlrequest sUsbCtlRequest; + u32 int_interval; - // +++USB - - struct urb *pControlURB; - struct urb *pInterruptURB; - struct usb_ctrlrequest sUsbCtlRequest; - - unsigned int int_interval; - // - // Variables to track resources for the BULK In Pipe - // - PRCB pRCBMem; - PRCB apRCB[CB_MAX_RX_DESC]; - unsigned int cbRD; - PRCB FirstRecvFreeList; - PRCB LastRecvFreeList; - unsigned int NumRecvFreeList; - PRCB FirstRecvMngList; - PRCB LastRecvMngList; - unsigned int NumRecvMngList; - BOOL bIsRxWorkItemQueued; - BOOL bIsRxMngWorkItemQueued; + /* Variables to track resources for the BULK In Pipe */ + PRCB pRCBMem; + PRCB apRCB[CB_MAX_RX_DESC]; + u32 cbRD; + PRCB FirstRecvFreeList; + PRCB LastRecvFreeList; + u32 NumRecvFreeList; + PRCB FirstRecvMngList; + PRCB LastRecvMngList; + u32 NumRecvMngList; + int bIsRxWorkItemQueued; + int bIsRxMngWorkItemQueued; unsigned long ulRcvRefCount; /* packets that have not returned back */ - // - // Variables to track resources for the BULK Out Pipe - // - - PUSB_SEND_CONTEXT apTD[CB_MAX_TX_DESC]; - unsigned int cbTD; - - // - // Variables to track resources for the Interrupt In Pipe - // - INT_BUFFER intBuf; - BOOL fKillEventPollingThread; - BOOL bEventAvailable; - - - //default config from file by user setting - DEFAULT_CONFIG config_file; - - - // - // Statistic for USB - // protect with spinlock - unsigned long ulBulkInPosted; - unsigned long ulBulkInError; - unsigned long ulBulkInContCRCError; - unsigned long ulBulkInBytesRead; - - unsigned long ulBulkOutPosted; - unsigned long ulBulkOutError; - unsigned long ulBulkOutContCRCError; - unsigned long ulBulkOutBytesWrite; - - unsigned long ulIntInPosted; - unsigned long ulIntInError; - unsigned long ulIntInContCRCError; - unsigned long ulIntInBytesRead; - - - // Version control - WORD wFirmwareVersion; - BYTE byLocalID; - BYTE byRFType; - BYTE byBBRxConf; - - - BYTE byZoneType; - BOOL bZoneRegExist; - - BYTE byOriginalZonetype; - - BOOL bLinkPass; // link status: OK or fail - BYTE abyCurrentNetAddr[ETH_ALEN]; - BYTE abyPermanentNetAddr[ETH_ALEN]; - // SW network address - /* u8 abySoftwareNetAddr[ETH_ALEN]; */ - BOOL bExistSWNetAddr; - - // Adapter statistics - SStatCounter scStatistic; - // 802.11 counter - SDot11Counters s802_11Counter; - - // - // Maintain statistical debug info. - // - unsigned long packetsReceived; - unsigned long packetsReceivedDropped; - unsigned long packetsReceivedOverflow; - unsigned long packetsSent; - unsigned long packetsSentDropped; - unsigned long SendContextsInUse; - unsigned long RcvBuffersInUse; - - - // 802.11 management - SMgmtObject sMgmtObj; - - QWORD qwCurrTSF; - unsigned int cbBulkInMax; - BOOL bPSRxBeacon; - - // 802.11 MAC specific - unsigned int uCurrRSSI; - BYTE byCurrSQ; - - - //Antenna Diversity - BOOL bTxRxAntInv; - DWORD dwRxAntennaSel; - DWORD dwTxAntennaSel; - BYTE byAntennaCount; - BYTE byRxAntennaMode; - BYTE byTxAntennaMode; - BYTE byRadioCtl; - BYTE bHWRadioOff; - - //SQ3 functions for antenna diversity - struct timer_list TimerSQ3Tmax1; - struct timer_list TimerSQ3Tmax2; - struct timer_list TimerSQ3Tmax3; - - BOOL bDiversityRegCtlON; - BOOL bDiversityEnable; - unsigned long ulDiversityNValue; - unsigned long ulDiversityMValue; - BYTE byTMax; - BYTE byTMax2; - BYTE byTMax3; - unsigned long ulSQ3TH; - - unsigned long uDiversityCnt; - BYTE byAntennaState; - unsigned long ulRatio_State0; - unsigned long ulRatio_State1; - unsigned long ulSQ3_State0; - unsigned long ulSQ3_State1; - - unsigned long aulSQ3Val[MAX_RATE]; - unsigned long aulPktNum[MAX_RATE]; + /* Variables to track resources for the BULK Out Pipe */ + PUSB_SEND_CONTEXT apTD[CB_MAX_TX_DESC]; + u32 cbTD; + + /* Variables to track resources for the Interrupt In Pipe */ + INT_BUFFER intBuf; + int fKillEventPollingThread; + int bEventAvailable; + + /* default config from file by user setting */ + DEFAULT_CONFIG config_file; + + + /* Statistic for USB */ + unsigned long ulBulkInPosted; + unsigned long ulBulkInError; + unsigned long ulBulkInContCRCError; + unsigned long ulBulkInBytesRead; + + unsigned long ulBulkOutPosted; + unsigned long ulBulkOutError; + unsigned long ulBulkOutContCRCError; + unsigned long ulBulkOutBytesWrite; + + unsigned long ulIntInPosted; + unsigned long ulIntInError; + unsigned long ulIntInContCRCError; + unsigned long ulIntInBytesRead; + + + /* Version control */ + u16 wFirmwareVersion; + u8 byLocalID; + u8 byRFType; + u8 byBBRxConf; + + + u8 byZoneType; + int bZoneRegExist; + + u8 byOriginalZonetype; + + int bLinkPass; /* link status: OK or fail */ + u8 abyCurrentNetAddr[ETH_ALEN]; + u8 abyPermanentNetAddr[ETH_ALEN]; + + int bExistSWNetAddr; + + /* Adapter statistics */ + SStatCounter scStatistic; + /* 802.11 counter */ + SDot11Counters s802_11Counter; + + /* Maintain statistical debug info. */ + unsigned long packetsReceived; + unsigned long packetsReceivedDropped; + unsigned long packetsReceivedOverflow; + unsigned long packetsSent; + unsigned long packetsSentDropped; + unsigned long SendContextsInUse; + unsigned long RcvBuffersInUse; + + /* 802.11 management */ + struct vnt_manager vnt_mgmt; + + u64 qwCurrTSF; + u32 cbBulkInMax; + int bPSRxBeacon; + + /* 802.11 MAC specific */ + u32 uCurrRSSI; + u8 byCurrSQ; + + /* Antenna Diversity */ + int bTxRxAntInv; + u32 dwRxAntennaSel; + u32 dwTxAntennaSel; + u8 byAntennaCount; + u8 byRxAntennaMode; + u8 byTxAntennaMode; + u8 byRadioCtl; + u8 bHWRadioOff; + + /* SQ3 functions for antenna diversity */ + struct timer_list TimerSQ3Tmax1; + struct timer_list TimerSQ3Tmax2; + struct timer_list TimerSQ3Tmax3; + + int bDiversityRegCtlON; + int bDiversityEnable; + unsigned long ulDiversityNValue; + unsigned long ulDiversityMValue; + u8 byTMax; + u8 byTMax2; + u8 byTMax3; + unsigned long ulSQ3TH; + + unsigned long uDiversityCnt; + u8 byAntennaState; + unsigned long ulRatio_State0; + unsigned long ulRatio_State1; + unsigned long ulSQ3_State0; + unsigned long ulSQ3_State1; + + unsigned long aulSQ3Val[MAX_RATE]; + unsigned long aulPktNum[MAX_RATE]; /* IFS & Cw */ - unsigned int uSIFS; /* Current SIFS */ - unsigned int uDIFS; /* Current DIFS */ - unsigned int uEIFS; /* Current EIFS */ - unsigned int uSlot; /* Current SlotTime */ - unsigned int uCwMin; /* Current CwMin */ - unsigned int uCwMax; /* CwMax is fixed on 1023 */ - - // PHY parameter - BYTE bySIFS; - BYTE byDIFS; - BYTE byEIFS; - BYTE bySlot; - BYTE byCWMaxMin; - - // Rate - VIA_BB_TYPE byBBType; //0: 11A, 1:11B, 2:11G - VIA_PKT_TYPE byPacketType; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate) - WORD wBasicRate; - BYTE byACKRate; - BYTE byTopOFDMBasicRate; - BYTE byTopCCKBasicRate; - - - DWORD dwAotoRateTxOkCnt; - DWORD dwAotoRateTxFailCnt; - DWORD dwErrorRateThreshold[13]; - DWORD dwTPTable[MAX_RATE]; - BYTE abyEEPROM[EEP_MAX_CONTEXT_SIZE]; //DWORD alignment - - BYTE byMinChannel; - BYTE byMaxChannel; - unsigned int uConnectionRate; - - BYTE byPreambleType; - BYTE byShortPreamble; - // CARD_PHY_TYPE - BYTE eConfigPHYMode; - - // For RF Power table - BYTE byCCKPwr; - BYTE byOFDMPwrG; - BYTE byOFDMPwrA; - BYTE byCurPwr; - BYTE abyCCKPwrTbl[14]; - BYTE abyOFDMPwrTbl[14]; - BYTE abyOFDMAPwrTbl[42]; - - WORD wCurrentRate; - WORD wRTSThreshold; - WORD wFragmentationThreshold; - BYTE byShortRetryLimit; - BYTE byLongRetryLimit; - CARD_OP_MODE eOPMode; - BOOL bBSSIDFilter; - WORD wMaxTransmitMSDULifetime; - BYTE abyBSSID[ETH_ALEN]; - BYTE abyDesireBSSID[ETH_ALEN]; - WORD wCTSDuration; // update while speed change - WORD wACKDuration; // update while speed change - WORD wRTSTransmitLen; // update while speed change - BYTE byRTSServiceField; // update while speed change - BYTE byRTSSignalField; // update while speed change - - DWORD dwMaxReceiveLifetime; // dot11MaxReceiveLifetime - - BOOL bCCK; - BOOL bEncryptionEnable; - BOOL bLongHeader; - BOOL bSoftwareGenCrcErr; - BOOL bShortSlotTime; - BOOL bProtectMode; - BOOL bNonERPPresent; - BOOL bBarkerPreambleMd; - - BYTE byERPFlag; - WORD wUseProtectCntDown; - - BOOL bRadioControlOff; - BOOL bRadioOff; - - // Power save - BOOL bEnablePSMode; - WORD wListenInterval; - BOOL bPWBitOn; - WMAC_POWER_MODE ePSMode; - unsigned long ulPSModeWaitTx; - BOOL bPSModeTxBurst; - - // Beacon releated - WORD wSeqCounter; - BOOL bBeaconBufReady; - BOOL bBeaconSent; - BOOL bFixRate; - BYTE byCurrentCh; - unsigned int uScanTime; - - CMD_STATE eCommandState; - - CMD_CODE eCommand; - BOOL bBeaconTx; - BYTE byScanBBType; - - BOOL bStopBeacon; - BOOL bStopDataPkt; - BOOL bStopTx0Pkt; - unsigned int uAutoReConnectTime; - unsigned int uIsroamingTime; - - // 802.11 counter - - CMD_ITEM eCmdQueue[CMD_Q_SIZE]; - unsigned int uCmdDequeueIdx; - unsigned int uCmdEnqueueIdx; - unsigned int cbFreeCmdQueue; - BOOL bCmdRunning; - BOOL bCmdClear; - BOOL bNeedRadioOFF; - - BOOL bEnableRoaming; - BOOL bIsRoaming; - BOOL bFastRoaming; - BYTE bSameBSSMaxNum; - BYTE bSameBSSCurNum; - BOOL bRoaming; - BOOL b11hEable; - unsigned long ulTxPower; - - // Encryption - NDIS_802_11_WEP_STATUS eEncryptionStatus; - BOOL bTransmitKey; - -//mike add :save old Encryption - NDIS_802_11_WEP_STATUS eOldEncryptionStatus; - - SKeyManagement sKey; - DWORD dwIVCounter; - - - RC4Ext SBox; - BYTE abyPRNG[WLAN_WEPMAX_KEYLEN+3]; - BYTE byKeyIndex; - - BOOL bAES; - - unsigned int uKeyLength; - BYTE abyKey[WLAN_WEP232_KEYLEN]; - - // for AP mode - unsigned int uAssocCount; - BOOL bMoreData; - - // QoS - BOOL bGrpAckPolicy; - - - BYTE byAutoFBCtrl; - - BOOL bTxMICFail; - BOOL bRxMICFail; - - - // For Update BaseBand VGA Gain Offset - BOOL bUpdateBBVGA; - unsigned int uBBVGADiffCount; - BYTE byBBVGANew; - BYTE byBBVGACurrent; - BYTE abyBBVGA[BB_VGA_LEVEL]; - signed long ldBmThreshold[BB_VGA_LEVEL]; - - BYTE byBBPreEDRSSI; - BYTE byBBPreEDIndex; - - - BOOL bRadioCmd; - DWORD dwDiagRefCount; - - // For FOE Tuning - BYTE byFOETuning; + u32 uSIFS; /* Current SIFS */ + u32 uDIFS; /* Current DIFS */ + u32 uEIFS; /* Current EIFS */ + u32 uSlot; /* Current SlotTime */ + u32 uCwMin; /* Current CwMin */ + u32 uCwMax; /* CwMax is fixed on 1023 */ + + /* PHY parameter */ + u8 bySIFS; + u8 byDIFS; + u8 byEIFS; + u8 bySlot; + u8 byCWMaxMin; + + /* Rate */ + VIA_BB_TYPE byBBType; /* 0: 11A, 1:11B, 2:11G */ + VIA_PKT_TYPE byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */ + u16 wBasicRate; + u8 byACKRate; + u8 byTopOFDMBasicRate; + u8 byTopCCKBasicRate; + + + u32 dwAotoRateTxOkCnt; + u32 dwAotoRateTxFailCnt; + u32 dwErrorRateThreshold[13]; + u32 dwTPTable[MAX_RATE]; + u8 abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /*u32 alignment */ + + u8 byMinChannel; + u8 byMaxChannel; + u32 uConnectionRate; + + u8 byPreambleType; + u8 byShortPreamble; + /* CARD_PHY_TYPE */ + u8 eConfigPHYMode; + + /* For RF Power table */ + u8 byCCKPwr; + u8 byOFDMPwrG; + u8 byOFDMPwrA; + u8 byCurPwr; + u8 abyCCKPwrTbl[14]; + u8 abyOFDMPwrTbl[14]; + u8 abyOFDMAPwrTbl[42]; + + u16 wCurrentRate; + u16 wRTSThreshold; + u16 wFragmentationThreshold; + u8 byShortRetryLimit; + u8 byLongRetryLimit; + CARD_OP_MODE eOPMode; + int bBSSIDFilter; + u16 wMaxTransmitMSDULifetime; + u8 abyBSSID[ETH_ALEN]; + u8 abyDesireBSSID[ETH_ALEN]; + + u16 wCTSDuration; /* update while speed change */ + u16 wACKDuration; + u16 wRTSTransmitLen; + u8 byRTSServiceField; + u8 byRTSSignalField; + + u32 dwMaxReceiveLifetime; /* dot11MaxReceiveLifetime */ + + int bCCK; + int bEncryptionEnable; + int bLongHeader; + int bSoftwareGenCrcErr; + int bShortSlotTime; + int bProtectMode; + int bNonERPPresent; + int bBarkerPreambleMd; + + u8 byERPFlag; + u16 wUseProtectCntDown; + + int bRadioControlOff; + int bRadioOff; + + /* Power save */ + int bEnablePSMode; + u16 wListenInterval; + int bPWBitOn; + WMAC_POWER_MODE ePSMode; + unsigned long ulPSModeWaitTx; + int bPSModeTxBurst; + + /* Beacon releated */ + u16 wSeqCounter; + int bBeaconBufReady; + int bBeaconSent; + int bFixRate; + u8 byCurrentCh; + u32 uScanTime; + + CMD_STATE eCommandState; + + CMD_CODE eCommand; + int bBeaconTx; + u8 byScanBBType; + + int bStopBeacon; + int bStopDataPkt; + int bStopTx0Pkt; + u32 uAutoReConnectTime; + u32 uIsroamingTime; + + /* 802.11 counter */ + + CMD_ITEM eCmdQueue[CMD_Q_SIZE]; + u32 uCmdDequeueIdx; + u32 uCmdEnqueueIdx; + u32 cbFreeCmdQueue; + int bCmdRunning; + int bCmdClear; + int bNeedRadioOFF; + + int bEnableRoaming; + int bIsRoaming; + int bFastRoaming; + u8 bSameBSSMaxNum; + u8 bSameBSSCurNum; + int bRoaming; + int b11hEable; + unsigned long ulTxPower; + + /* Encryption */ + NDIS_802_11_WEP_STATUS eEncryptionStatus; + int bTransmitKey; + NDIS_802_11_WEP_STATUS eOldEncryptionStatus; + SKeyManagement sKey; + u32 dwIVCounter; + + + RC4Ext SBox; + u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3]; + u8 byKeyIndex; + + int bAES; + + u32 uKeyLength; + u8 abyKey[WLAN_WEP232_KEYLEN]; + + /* for AP mode */ + u32 uAssocCount; + int bMoreData; + + /* QoS */ + int bGrpAckPolicy; + + + u8 byAutoFBCtrl; + + int bTxMICFail; + int bRxMICFail; + + + /* For Update BaseBand VGA Gain Offset */ + int bUpdateBBVGA; + u32 uBBVGADiffCount; + u8 byBBVGANew; + u8 byBBVGACurrent; + u8 abyBBVGA[BB_VGA_LEVEL]; + signed long ldBmThreshold[BB_VGA_LEVEL]; + + u8 byBBPreEDRSSI; + u8 byBBPreEDIndex; + + + int bRadioCmd; + u32 dwDiagRefCount; + + /* For FOE Tuning */ + u8 byFOETuning; + + /* For Auto Power Tunning */ + u8 byAutoPwrTunning; + + /* BaseBand Loopback Use */ + u8 byBBCR4d; + u8 byBBCRc9; + u8 byBBCR88; + u8 byBBCR09; + + /* command timer */ + struct timer_list sTimerCommand; - // For Auto Power Tunning + struct timer_list sTimerTxData; + unsigned long nTxDataTimeCout; + int fTxDataInSleep; + int IsTxDataTrigger; - BYTE byAutoPwrTunning; + int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */ + u8 byReAssocCount; + u8 byLinkWaitCount; - // BaseBand Loopback Use - BYTE byBBCR4d; - BYTE byBBCRc9; - BYTE byBBCR88; - BYTE byBBCR09; + SEthernetHeader sTxEthHeader; + SEthernetHeader sRxEthHeader; + u8 abyBroadcastAddr[ETH_ALEN]; + u8 abySNAP_RFC1042[ETH_ALEN]; + u8 abySNAP_Bridgetunnel[ETH_ALEN]; - // command timer - struct timer_list sTimerCommand; + /* Pre-Authentication & PMK cache */ + SPMKID gsPMKID; + SPMKIDCandidateEvent gsPMKIDCandidate; - struct timer_list sTimerTxData; - unsigned long nTxDataTimeCout; - BOOL fTxDataInSleep; - BOOL IsTxDataTrigger; - BOOL fWPA_Authened; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? - BYTE byReAssocCount; //mike add:re-association retry times! - BYTE byLinkWaitCount; + /* for 802.11h */ + int b11hEnable; - SEthernetHeader sTxEthHeader; - SEthernetHeader sRxEthHeader; - BYTE abyBroadcastAddr[ETH_ALEN]; - BYTE abySNAP_RFC1042[ETH_ALEN]; - BYTE abySNAP_Bridgetunnel[ETH_ALEN]; + int bChannelSwitch; + u8 byNewChannel; + u8 byChannelSwitchCount; - // Pre-Authentication & PMK cache - SPMKID gsPMKID; - SPMKIDCandidateEvent gsPMKIDCandidate; + /* WPA supplicant daemon */ + int bWPADEVUp; + int bwextstep0; + int bwextstep1; + int bwextstep2; + int bwextstep3; + int bWPASuppWextEnabled; + /* user space daemon: hostapd, is used for HOSTAP */ + int bEnableHostapd; + int bEnable8021x; + int bEnableHostWEP; + struct net_device *apdev; + int (*tx_80211)(struct sk_buff *skb, struct net_device *dev); - // for 802.11h - BOOL b11hEnable; - - BOOL bChannelSwitch; - BYTE byNewChannel; - BYTE byChannelSwitchCount; + u32 uChannel; - //WPA supplicant daemon - struct net_device *wpadev; - BOOL bWPADEVUp; - //-- + struct iw_statistics wstats; /* wireless stats */ - BOOL bwextstep0; - BOOL bwextstep1; - BOOL bwextstep2; - BOOL bwextstep3; - BOOL bWPASuppWextEnabled; + int bCommit; -#ifdef HOSTAP - // user space daemon: hostapd, is used for HOSTAP - BOOL bEnableHostapd; - BOOL bEnable8021x; - BOOL bEnableHostWEP; - struct net_device *apdev; - int (*tx_80211)(struct sk_buff *skb, struct net_device *dev); -#endif - unsigned int uChannel; - - struct iw_statistics wstats; // wireless stats - BOOL bCommit; - -} DEVICE_INFO, *PSDevice; +}; @@ -871,9 +843,6 @@ typedef struct __device_info { /*--------------------- Export Functions --------------------------*/ -/* BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, - * unsigned int uNodeIndex); - */ -BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF); +int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF); #endif diff --git a/drivers/staging/vt6656/device_cfg.h b/drivers/staging/vt6656/device_cfg.h index a0b82169dad3..62290d0ac195 100644 --- a/drivers/staging/vt6656/device_cfg.h +++ b/drivers/staging/vt6656/device_cfg.h @@ -38,12 +38,12 @@ struct _version { unsigned char build; } version_t, *pversion_t; -#ifndef FALSE -#define FALSE (0) +#ifndef false +#define false (0) #endif -#ifndef TRUE -#define TRUE (!(FALSE)) +#ifndef true +#define true (!(false)) #endif #define VID_TABLE_SIZE 64 @@ -67,14 +67,14 @@ struct _version { #define DEVICE_VERSION "1.19_12" #endif -//config file +/* 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 +/* Max: 2378 = 2312 Payload + 30HD + 4CRC + 2Padding + 4Len + 8TSF + 4RSR */ #define PKT_BUF_SZ 2390 #define MAX_UINTS 8 diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index e94f6a1647a3..e83f95e1d9a8 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -84,61 +84,23 @@ s_vGetDASA( PSEthernetHeader psEthHeader ); -static -void -s_vProcessRxMACHeader ( - PSDevice pDevice, - PBYTE pbyRxBufferAddr, - unsigned int cbPacketSize, - BOOL bIsWEP, - BOOL bExtIV, - unsigned int *pcbHeadSize - ); - -static BOOL s_bAPModeRxCtl( - PSDevice pDevice, - PBYTE pbyFrame, - signed int iSANodeIndex - ); - - - -static BOOL s_bAPModeRxData ( - PSDevice pDevice, - struct sk_buff *skb, - unsigned int FrameSize, - unsigned int cbHeaderOffset, - signed int iSANodeIndex, - signed int iDANodeIndex - ); +static void s_vProcessRxMACHeader(struct vnt_private *pDevice, + u8 *pbyRxBufferAddr, u32 cbPacketSize, int bIsWEP, int bExtIV, + u32 *pcbHeadSize); +static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, + s32 iSANodeIndex); -static BOOL s_bHandleRxEncryption( - PSDevice pDevice, - PBYTE pbyFrame, - unsigned int FrameSize, - PBYTE pbyRsr, - PBYTE pbyNewRsr, - PSKeyItem * pKeyOut, - int * pbExtIV, - PWORD pwRxTSC15_0, - PDWORD pdwRxTSC47_16 - ); - -static BOOL s_bHostWepRxEncryption( +static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, + u32 FrameSize, u32 cbHeaderOffset, s32 iSANodeIndex, s32 iDANodeIndex); - PSDevice pDevice, - PBYTE pbyFrame, - unsigned int FrameSize, - PBYTE pbyRsr, - BOOL bOnFly, - PSKeyItem pKey, - PBYTE pbyNewRsr, - int * pbExtIV, - PWORD pwRxTSC15_0, - PDWORD pdwRxTSC47_16 +static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, + u32 FrameSize, u8 *pbyRsr, u8 *pbyNewRsr, PSKeyItem *pKeyOut, + s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16); - ); +static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, + u32 FrameSize, u8 *pbyRsr, int bOnFly, PSKeyItem pKey, u8 *pbyNewRsr, + s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16); /*--------------------- Export Variables --------------------------*/ @@ -159,22 +121,16 @@ static BOOL s_bHostWepRxEncryption( * Return Value: None * -*/ -static -void -s_vProcessRxMACHeader ( - PSDevice pDevice, - PBYTE pbyRxBufferAddr, - unsigned int cbPacketSize, - BOOL bIsWEP, - BOOL bExtIV, - unsigned int *pcbHeadSize - ) + +static void s_vProcessRxMACHeader(struct vnt_private *pDevice, + u8 *pbyRxBufferAddr, u32 cbPacketSize, int bIsWEP, int bExtIV, + u32 *pcbHeadSize) { - PBYTE pbyRxBuffer; - unsigned int cbHeaderSize = 0; - PWORD pwType; - PS802_11Header pMACHeader; - int ii; + u8 *pbyRxBuffer; + u32 cbHeaderSize = 0; + u16 *pwType; + PS802_11Header pMACHeader; + int ii; pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); @@ -310,56 +266,39 @@ s_vGetDASA ( } - - -BOOL -RXbBulkInProcessData ( - PSDevice pDevice, - PRCB pRCB, - unsigned long BytesToIndicate - ) +int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, + unsigned long BytesToIndicate) { - - struct net_device_stats* pStats=&pDevice->stats; - struct sk_buff* skb; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PSRxMgmtPacket pRxPacket = &(pMgmt->sRxPacket); - PS802_11Header p802_11Header; - PBYTE pbyRsr; - PBYTE pbyNewRsr; - PBYTE pbyRSSI; - PQWORD pqwTSFTime; - PBYTE pbyFrame; - BOOL bDeFragRx = FALSE; - unsigned int cbHeaderOffset; + struct net_device_stats *pStats = &pDevice->stats; + struct sk_buff *skb; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_rx_mgmt *pRxPacket = &pMgmt->sRxPacket; + PS802_11Header p802_11Header; + u8 *pbyRsr, *pbyNewRsr, *pbyRSSI, *pbyFrame; + u64 *pqwTSFTime; + u32 bDeFragRx = false; + u32 cbHeaderOffset, cbIVOffset; u32 FrameSize; - WORD wEtherType = 0; - signed int iSANodeIndex = -1; - signed int iDANodeIndex = -1; - unsigned int ii; - unsigned int cbIVOffset; - PBYTE pbyRxSts; - PBYTE pbyRxRate; - PBYTE pbySQ; - PBYTE pby3SQ; - unsigned int cbHeaderSize; - PSKeyItem pKey = NULL; - WORD wRxTSC15_0 = 0; - DWORD dwRxTSC47_16 = 0; - SKeyItem STempKey; - // 802.11h RPI - /* signed long ldBm = 0; */ - BOOL bIsWEP = FALSE; - BOOL bExtIV = FALSE; + u16 wEtherType = 0; + s32 iSANodeIndex = -1, iDANodeIndex = -1; + int ii; + u8 *pbyRxSts, *pbyRxRate, *pbySQ, *pby3SQ; + u32 cbHeaderSize; + PSKeyItem pKey = NULL; + u16 wRxTSC15_0 = 0; + u32 dwRxTSC47_16 = 0; + SKeyItem STempKey; + /* signed long ldBm = 0; */ + int bIsWEP = false; int bExtIV = false; u32 dwWbkStatus; - PRCB pRCBIndicate = pRCB; - PBYTE pbyDAddress; - PWORD pwPLCP_Length; - BYTE abyVaildRate[MAX_RATE] = {2,4,11,22,12,18,24,36,48,72,96,108}; - WORD wPLCPwithPadding; - PS802_11Header pMACHeader; - BOOL bRxeapol_key = FALSE; - + PRCB pRCBIndicate = pRCB; + u8 *pbyDAddress; + u16 *pwPLCP_Length; + u8 abyVaildRate[MAX_RATE] + = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; + u16 wPLCPwithPadding; + PS802_11Header pMACHeader; + int bRxeapol_key = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- RXbBulkInProcessData---\n"); @@ -373,13 +312,13 @@ RXbBulkInProcessData ( if (BytesToIndicate != FrameSize) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"------- WRONG Length 1\n"); - return FALSE; + return false; } if ((BytesToIndicate > 2372) || (BytesToIndicate <= 40)) { // Frame Size error drop this packet. DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 2\n"); - return FALSE; + return false; } pbyDAddress = (PBYTE)(skb->data); @@ -397,7 +336,7 @@ RXbBulkInProcessData ( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Wrong PLCP Length %x\n", (int) *pwPLCP_Length); ASSERT(0); - return FALSE; + return false; } for ( ii=RATE_1M;ii<MAX_RATE;ii++) { if ( *pbyRxRate == abyVaildRate[ii] ) { @@ -406,12 +345,12 @@ RXbBulkInProcessData ( } if ( ii==MAX_RATE ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Wrong RxRate %x\n",(int) *pbyRxRate); - return FALSE; + return false; } wPLCPwithPadding = ( (*pwPLCP_Length / 4) + ( (*pwPLCP_Length % 4) ? 1:0 ) ) *4; - pqwTSFTime = (PQWORD) (pbyDAddress + 8 + wPLCPwithPadding); + pqwTSFTime = (u64 *)(pbyDAddress + 8 + wPLCPwithPadding); if(pDevice->byBBType == BB_TYPE_11G) { pby3SQ = pbyDAddress + 8 + wPLCPwithPadding + 12; pbySQ = pby3SQ; @@ -455,12 +394,12 @@ RXbBulkInProcessData ( if (!is_multicast_ether_addr(pMACHeader->abyAddr1)) { if ( WCTLbIsDuplicate(&(pDevice->sDupRxCache), (PS802_11Header) pbyFrame) ) { pDevice->s802_11Counter.FrameDuplicateCount++; - return FALSE; + return false; } if (compare_ether_addr(pDevice->abyCurrentNetAddr, pMACHeader->abyAddr1)) { - return FALSE; + return false; } } @@ -470,7 +409,7 @@ RXbBulkInProcessData ( if (!compare_ether_addr((PBYTE)&(pDevice->sRxEthHeader.abySrcAddr[0]), pDevice->abyCurrentNetAddr)) - return FALSE; + return false; if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) { if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { @@ -484,17 +423,17 @@ RXbBulkInProcessData ( } if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - if (s_bAPModeRxCtl(pDevice, pbyFrame, iSANodeIndex) == TRUE) { - return FALSE; + if (s_bAPModeRxCtl(pDevice, pbyFrame, iSANodeIndex) == true) { + return false; } } if (IS_FC_WEP(pbyFrame)) { - BOOL bRxDecryOK = FALSE; + bool bRxDecryOK = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"rx WEP pkt\n"); - bIsWEP = TRUE; + bIsWEP = true; if ((pDevice->bEnableHostWEP) && (iSANodeIndex >= 0)) { pKey = &STempKey; pKey->byCipherSuite = pMgmt->sNodeDBTable[iSANodeIndex].byCipherSuite; @@ -546,11 +485,11 @@ RXbBulkInProcessData ( // pDevice->s802_11Counter.WEPICVErrorCount.QuadPart++; } } - return FALSE; + return false; } } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WEP Func Fail\n"); - return FALSE; + return false; } if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP)) FrameSize -= 8; // Message Integrity Code @@ -579,14 +518,14 @@ RXbBulkInProcessData ( pbyFrame = skb->data + 8; } else { - return FALSE; + return false; } } // // Management & Control frame Handle // - if ((IS_TYPE_DATA((pbyFrame))) == FALSE) { + if ((IS_TYPE_DATA((pbyFrame))) == false) { // Handle Control & Manage Frame if (IS_TYPE_MGMT((pbyFrame))) { @@ -598,8 +537,7 @@ RXbBulkInProcessData ( pRxPacket->cbMPDULen = FrameSize; pRxPacket->uRSSI = *pbyRSSI; pRxPacket->bySQ = *pbySQ; - HIDWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(HIDWORD(*pqwTSFTime)); - LODWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(LODWORD(*pqwTSFTime)); + pRxPacket->qwLocalTSF = cpu_to_le64(*pqwTSFTime); if (bIsWEP) { // strip IV pbyData1 = WLAN_HDR_A3_DATA_PTR(pbyFrame); @@ -617,7 +555,7 @@ RXbBulkInProcessData ( //Discard beacon packet which channel is 0 if ( (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) == WLAN_FSTYPE_BEACON) || (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) == WLAN_FSTYPE_PROBERESP) ) { - return FALSE; + return false; } } pRxPacket->byRxChannel = (*pbyRxSts) >> 2; @@ -635,7 +573,7 @@ RXbBulkInProcessData ( skb->protocol = htons(ETH_P_802_2); memset(skb->cb, 0, sizeof(skb->cb)); netif_rx(skb); - return TRUE; + return true; } // @@ -643,11 +581,11 @@ RXbBulkInProcessData ( // EnqueueRCB(pDevice->FirstRecvMngList, pDevice->LastRecvMngList, pRCBIndicate); pDevice->NumRecvMngList++; - if ( bDeFragRx == FALSE) { + if ( bDeFragRx == false) { pRCB->Ref++; } - if (pDevice->bIsRxMngWorkItemQueued == FALSE) { - pDevice->bIsRxMngWorkItemQueued = TRUE; + if (pDevice->bIsRxMngWorkItemQueued == false) { + pDevice->bIsRxMngWorkItemQueued = true; tasklet_schedule(&pDevice->RxMngWorkItem); } @@ -655,7 +593,7 @@ RXbBulkInProcessData ( else { // Control Frame }; - return FALSE; + return false; } else { if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { @@ -667,12 +605,12 @@ RXbBulkInProcessData ( pDevice->dev->name); } } - return FALSE; + return false; } } else { // discard DATA packet while not associate || BSSID error - if ((pDevice->bLinkPass == FALSE) || + if ((pDevice->bLinkPass == false) || !(*pbyRsr & RSR_BSSIDOK)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { @@ -680,7 +618,7 @@ RXbBulkInProcessData ( pDevice->dev->name); } } - return FALSE; + return false; } //mike add:station mode check eapol-key challenge---> { @@ -699,7 +637,7 @@ RXbBulkInProcessData ( if (wEtherType == ETH_P_PAE) { //Protocol Type in LLC-Header if(((Protocol_Version==1) ||(Protocol_Version==2)) && (Packet_Type==3)) { //802.1x OR eapol-key challenge frame receive - bRxeapol_key = TRUE; + bRxeapol_key = true; Descriptor_type = skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2]; Key_info = (skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2+1]<<8) |skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2+2] ; if(Descriptor_type==2) { //RSN @@ -726,8 +664,8 @@ RXbBulkInProcessData ( } } else { - if (pMgmt->bInTIMWake == TRUE) { - pMgmt->bInTIMWake = FALSE; + if (pMgmt->bInTIMWake == true) { + pMgmt->bInTIMWake = false; } } } @@ -735,7 +673,7 @@ RXbBulkInProcessData ( // Now it only supports 802.11g Infrastructure Mode, and support rate must up to 54 Mbps if (pDevice->bDiversityEnable && (FrameSize>50) && (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) && - (pDevice->bLinkPass == TRUE)) { + (pDevice->bLinkPass == true)) { BBvAntennaDiversity(pDevice, s_byGetRateIdx(*pbyRxRate), 0); } @@ -764,7 +702,7 @@ RXbBulkInProcessData ( // ----------------------------------------------- - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == TRUE)){ + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)){ BYTE abyMacHdr[24]; // Only 802.1x packet incoming allowed @@ -779,7 +717,7 @@ RXbBulkInProcessData ( if (wEtherType == ETH_P_PAE) { skb->dev = pDevice->apdev; - if (bIsWEP == TRUE) { + if (bIsWEP == true) { // strip IV header(8) memcpy(&abyMacHdr[0], (skb->data + 8), 24); memcpy((skb->data + 8 + cbIVOffset), &abyMacHdr[0], 24); @@ -793,12 +731,12 @@ RXbBulkInProcessData ( skb->protocol = htons(ETH_P_802_2); memset(skb->cb, 0, sizeof(skb->cb)); netif_rx(skb); - return TRUE; + return true; } // check if 802.1x authorized if (!(pMgmt->sNodeDBTable[iSANodeIndex].dwFlags & WLAN_STA_AUTHORIZED)) - return FALSE; + return false; } @@ -852,9 +790,9 @@ RXbBulkInProcessData ( if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) || - (pDevice->bRxMICFail == TRUE)) { + (pDevice->bRxMICFail == true)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC comparison is fail!\n"); - pDevice->bRxMICFail = FALSE; + pDevice->bRxMICFail = false; //pDevice->s802_11Counter.TKIPLocalMICFailures.QuadPart++; pDevice->s802_11Counter.TKIPLocalMICFailures++; if (bDeFragRx) { @@ -864,7 +802,7 @@ RXbBulkInProcessData ( } } //send event to wpa_supplicant - //if(pDevice->bWPASuppWextEnabled == TRUE) + //if(pDevice->bWPASuppWextEnabled == true) { union iwreq_data wrqu; struct iw_michaelmicfailure ev; @@ -888,7 +826,7 @@ RXbBulkInProcessData ( } - return FALSE; + return false; } } @@ -910,11 +848,11 @@ RXbBulkInProcessData ( RSC = dwRxTSC47_16; RSC <<= 16; RSC += wRxTSC15_0; - memcpy(&(pKey->KeyRSC), &RSC, sizeof(QWORD)); + memcpy(&(pKey->KeyRSC), &RSC, sizeof(u64)); - if ( (pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) && - (pDevice->sMgmtObj.eCurrState == WMAC_STATE_ASSOC)) { - // check RSC + if (pDevice->vnt_mgmt.eCurrMode == WMAC_MODE_ESS_STA && + pDevice->vnt_mgmt.eCurrState == WMAC_STATE_ASSOC) { + /* check RSC */ if ( (wRxTSC15_0 < wLocalTSC15_0) && (dwRxTSC47_16 <= dwLocalTSC47_16) && !((dwRxTSC47_16 == 0) && (dwLocalTSC47_16 == 0xFFFFFFFF))) { @@ -932,7 +870,7 @@ RXbBulkInProcessData ( pDevice->dev->name); } } - return FALSE; + return false; } } } @@ -945,7 +883,7 @@ RXbBulkInProcessData ( // Null data, framesize = 12 if (FrameSize < 12) - return FALSE; + return false; if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (s_bAPModeRxData(pDevice, @@ -954,7 +892,7 @@ RXbBulkInProcessData ( cbHeaderOffset, iSANodeIndex, iDANodeIndex - ) == FALSE) { + ) == false) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { @@ -962,7 +900,7 @@ RXbBulkInProcessData ( pDevice->dev->name); } } - return FALSE; + return false; } } @@ -980,22 +918,18 @@ RXbBulkInProcessData ( DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } - return FALSE; + return false; } - return TRUE; + return true; } - -static BOOL s_bAPModeRxCtl ( - PSDevice pDevice, - PBYTE pbyFrame, - signed int iSANodeIndex - ) +static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, + s32 iSANodeIndex) { - PS802_11Header p802_11Header; - CMD_STATUS Status; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PS802_11Header p802_11Header; + CMD_STATUS Status; if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { @@ -1017,7 +951,7 @@ static BOOL s_bAPModeRxCtl ( &Status ); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 1\n"); - return TRUE; + return true; } if (pMgmt->sNodeDBTable[iSANodeIndex].eNodeState < NODE_ASSOC) { // send deassoc notification @@ -1029,13 +963,13 @@ static BOOL s_bAPModeRxCtl ( &Status ); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDisassocBeginSta 2\n"); - return TRUE; + return true; } if (pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable) { // delcare received ps-poll event if (IS_CTL_PSPOLL(pbyFrame)) { - pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; + pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; bScheduleCommand((void *) pDevice, WLAN_CMD_RX_PSPOLL, NULL); @@ -1045,8 +979,8 @@ static BOOL s_bAPModeRxCtl ( // check Data PS state // if PW bit off, send out all PS bufferring packets. if (!IS_FC_POWERMGT(pbyFrame)) { - pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = FALSE; - pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; + pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false; + pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; bScheduleCommand((void *) pDevice, WLAN_CMD_RX_PSPOLL, NULL); @@ -1056,15 +990,15 @@ static BOOL s_bAPModeRxCtl ( } else { if (IS_FC_POWERMGT(pbyFrame)) { - pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = TRUE; + pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = true; // Once if STA in PS state, enable multicast bufferring - pMgmt->sNodeDBTable[0].bPSEnable = TRUE; + pMgmt->sNodeDBTable[0].bPSEnable = true; } else { // clear all pending PS frame. if (pMgmt->sNodeDBTable[iSANodeIndex].wEnQueueCnt > 0) { - pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = FALSE; - pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; + pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false; + pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; bScheduleCommand((void *) pDevice, WLAN_CMD_RX_PSPOLL, NULL); @@ -1089,32 +1023,24 @@ static BOOL s_bAPModeRxCtl ( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n", p802_11Header->abyAddr1); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl ); - return TRUE; + return true; } } } - return FALSE; + return false; } -static BOOL s_bHandleRxEncryption ( - PSDevice pDevice, - PBYTE pbyFrame, - unsigned int FrameSize, - PBYTE pbyRsr, - PBYTE pbyNewRsr, - PSKeyItem * pKeyOut, - int * pbExtIV, - PWORD pwRxTSC15_0, - PDWORD pdwRxTSC47_16 - ) +static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, + u32 FrameSize, u8 *pbyRsr, u8 *pbyNewRsr, PSKeyItem *pKeyOut, + s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16) { - unsigned int PayloadLen = FrameSize; - PBYTE pbyIV; - BYTE byKeyIdx; - PSKeyItem pKey = NULL; - BYTE byDecMode = KEY_CTL_WEP; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u32 PayloadLen = FrameSize; + u8 *pbyIV; + u8 byKeyIdx; + PSKeyItem pKey = NULL; + u8 byDecMode = KEY_CTL_WEP; *pwRxTSC15_0 = 0; @@ -1139,7 +1065,7 @@ static BOOL s_bHandleRxEncryption ( (pMgmt->byCSSPK != KEY_CTL_NONE)) { // unicast pkt use pairwise key DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt\n"); - if (KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, 0xFFFFFFFF, &pKey) == TRUE) { + if (KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, 0xFFFFFFFF, &pKey) == true) { if (pMgmt->byCSSPK == KEY_CTL_TKIP) byDecMode = KEY_CTL_TKIP; else if (pMgmt->byCSSPK == KEY_CTL_CCMP) @@ -1173,24 +1099,24 @@ static BOOL s_bHandleRxEncryption ( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey == NULL\n"); if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; - } else if (pDevice->bLinkPass == TRUE) { + } else if (pDevice->bLinkPass == true) { // pDevice->s802_11Counter.DecryptFailureCount.QuadPart++; } - return FALSE; + return false; } if (byDecMode != pKey->byCipherSuite) { if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; - } else if (pDevice->bLinkPass == TRUE) { + } else if (pDevice->bLinkPass == true) { // pDevice->s802_11Counter.DecryptFailureCount.QuadPart++; } *pKeyOut = NULL; - return FALSE; + return false; } if (byDecMode == KEY_CTL_WEP) { // handle WEP if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || - (((PSKeyTable)(&pKey->pvKeyTable))->bSoftWEP == TRUE)) { + (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true)) { // Software WEP // 1. 3253A // 2. WEP 256 @@ -1238,35 +1164,23 @@ static BOOL s_bHandleRxEncryption ( }// end of TKIP/AES if ((*(pbyIV+3) & 0x20) != 0) - *pbExtIV = TRUE; - return TRUE; + *pbExtIV = true; + return true; } - -static BOOL s_bHostWepRxEncryption ( - PSDevice pDevice, - PBYTE pbyFrame, - unsigned int FrameSize, - PBYTE pbyRsr, - BOOL bOnFly, - PSKeyItem pKey, - PBYTE pbyNewRsr, - int * pbExtIV, - PWORD pwRxTSC15_0, - PDWORD pdwRxTSC47_16 - ) +static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, + u32 FrameSize, u8 *pbyRsr, int bOnFly, PSKeyItem pKey, u8 *pbyNewRsr, + s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int PayloadLen = FrameSize; - PBYTE pbyIV; - BYTE byKeyIdx; - BYTE byDecMode = KEY_CTL_WEP; - PS802_11Header pMACHeader; - - + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PS802_11Header pMACHeader; + u32 PayloadLen = FrameSize; + u8 *pbyIV; + u8 byKeyIdx; + u8 byDecMode = KEY_CTL_WEP; - *pwRxTSC15_0 = 0; - *pdwRxTSC47_16 = 0; + *pwRxTSC15_0 = 0; + *pdwRxTSC47_16 = 0; pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; if ( WLAN_GET_FC_TODS(*(PWORD)pbyFrame) && @@ -1289,18 +1203,18 @@ static BOOL s_bHostWepRxEncryption ( if (byDecMode != pKey->byCipherSuite) { if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; - } else if (pDevice->bLinkPass == TRUE) { + } else if (pDevice->bLinkPass == true) { // pDevice->s802_11Counter.DecryptFailureCount.QuadPart++; } - return FALSE; + return false; } if (byDecMode == KEY_CTL_WEP) { // handle WEP 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 == FALSE)) { + (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true) || + (bOnFly == false)) { // Software WEP // 1. 3253A // 2. WEP 256 @@ -1333,7 +1247,7 @@ static BOOL s_bHostWepRxEncryption ( if (byDecMode == KEY_CTL_TKIP) { - if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (bOnFly == FALSE)) { + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (bOnFly == false)) { // Software TKIP // 1. 3253 A // 2. NotOnFly @@ -1353,7 +1267,7 @@ static BOOL s_bHostWepRxEncryption ( } if (byDecMode == KEY_CTL_CCMP) { - if (bOnFly == FALSE) { + if (bOnFly == false) { // Software CCMP // NotOnFly DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_CCMP\n"); @@ -1369,33 +1283,23 @@ static BOOL s_bHostWepRxEncryption ( }// end of TKIP/AES if ((*(pbyIV+3) & 0x20) != 0) - *pbExtIV = TRUE; - return TRUE; + *pbExtIV = true; + return true; } - - -static BOOL s_bAPModeRxData ( - PSDevice pDevice, - struct sk_buff *skb, - unsigned int FrameSize, - unsigned int cbHeaderOffset, - signed int iSANodeIndex, - signed int iDANodeIndex - ) - +static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, + u32 FrameSize, u32 cbHeaderOffset, s32 iSANodeIndex, s32 iDANodeIndex) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - BOOL bRelayAndForward = FALSE; - BOOL bRelayOnly = FALSE; - BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; - WORD wAID; - + struct sk_buff *skbcpy; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int bRelayAndForward = false; + int bRelayOnly = false; + u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; + u16 wAID; - struct sk_buff* skbcpy = NULL; if (FrameSize > CB_MAX_BUF_SIZE) - return FALSE; + return false; // check DA if (is_multicast_ether_addr((PBYTE)(skb->data+cbHeaderOffset))) { if (pMgmt->sNodeDBTable[0].bPSEnable) { @@ -1417,7 +1321,7 @@ static BOOL s_bAPModeRxData ( } } else { - bRelayAndForward = TRUE; + bRelayAndForward = true; } } else { @@ -1437,10 +1341,10 @@ static BOOL s_bAPModeRxData ( pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n", iDANodeIndex, (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); - return TRUE; + return true; } else { - bRelayOnly = TRUE; + bRelayOnly = true; } } } @@ -1457,23 +1361,22 @@ static BOOL s_bAPModeRxData ( } if (bRelayOnly) - return FALSE; + return false; } // none associate, don't forward if (pDevice->uAssocCount == 0) - return FALSE; + return false; - return TRUE; + return true; } -void RXvWorkItem(void *Context) +void RXvWorkItem(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) Context; - int ntStatus; - PRCB pRCB=NULL; + int ntStatus; + PRCB pRCB = NULL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Rx Polling Thread\n"); spin_lock_irq(&pDevice->lock); @@ -1487,19 +1390,15 @@ void RXvWorkItem(void *Context) DequeueRCB(pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList); ntStatus = PIPEnsBulkInUsbRead(pDevice, pRCB); } - pDevice->bIsRxWorkItemQueued = FALSE; + pDevice->bIsRxWorkItemQueued = false; spin_unlock_irq(&pDevice->lock); } -void -RXvFreeRCB( - PRCB pRCB, - BOOL bReAllocSkb - ) +void RXvFreeRCB(PRCB pRCB, int bReAllocSkb) { - PSDevice pDevice = (PSDevice)pRCB->pDevice; + struct vnt_private *pDevice = pRCB->pDevice; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->RXvFreeRCB\n"); @@ -1507,12 +1406,12 @@ RXvFreeRCB( ASSERT(!pRCB->Ref); // should be 0 ASSERT(pRCB->pDevice); // shouldn't be NULL - if (bReAllocSkb == FALSE) { + if (bReAllocSkb == false) { kfree_skb(pRCB->skb); - bReAllocSkb = TRUE; + bReAllocSkb = true; } - if (bReAllocSkb == TRUE) { + if (bReAllocSkb == true) { pRCB->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); // todo error handling if (pRCB->skb == NULL) { @@ -1529,21 +1428,20 @@ RXvFreeRCB( if ((pDevice->Flags & fMP_POST_READS) && MP_IS_READY(pDevice) && - (pDevice->bIsRxWorkItemQueued == FALSE) ) { + (pDevice->bIsRxWorkItemQueued == false) ) { - pDevice->bIsRxWorkItemQueued = TRUE; + pDevice->bIsRxWorkItemQueued = true; tasklet_schedule(&pDevice->ReadWorkItem); } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----RXFreeRCB %d %d\n",pDevice->NumRecvFreeList, pDevice->NumRecvMngList); } -void RXvMngWorkItem(void *Context) +void RXvMngWorkItem(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) Context; - PRCB pRCB=NULL; - PSRxMgmtPacket pRxPacket; - BOOL bReAllocSkb = FALSE; + PRCB pRCB = NULL; + struct vnt_rx_mgmt *pRxPacket; + int bReAllocSkb = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Rx Mng Thread\n"); @@ -1558,7 +1456,7 @@ void RXvMngWorkItem(void *Context) } ASSERT(pRCB);// cannot be NULL pRxPacket = &(pRCB->sMngPacket); - vMgrRxManagePacket((void *) pDevice, &(pDevice->sMgmtObj), pRxPacket); + vMgrRxManagePacket(pDevice, &pDevice->vnt_mgmt, pRxPacket); pRCB->Ref--; if(pRCB->Ref == 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RxvFreeMng %d %d\n",pDevice->NumRecvFreeList, pDevice->NumRecvMngList); @@ -1568,7 +1466,7 @@ void RXvMngWorkItem(void *Context) } } - pDevice->bIsRxMngWorkItemQueued = FALSE; + pDevice->bIsRxMngWorkItemQueued = false; spin_unlock_irq(&pDevice->lock); } diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h index d4fca43af4fe..786c523f5479 100644 --- a/drivers/staging/vt6656/dpc.h +++ b/drivers/staging/vt6656/dpc.h @@ -45,17 +45,9 @@ void RXvWorkItem(void *Context); void RXvMngWorkItem(void *Context); -void -RXvFreeRCB( - PRCB pRCB, - BOOL bReAllocSkb - ); - -BOOL -RXbBulkInProcessData( - PSDevice pDevice, - PRCB pRCB, - unsigned long BytesToIndicate - ); +void RXvFreeRCB(PRCB pRCB, int bReAllocSkb); + +int RXbBulkInProcessData(struct vnt_private *, PRCB pRCB, + unsigned long BytesToIndicate); #endif /* __RXTX_H__ */ diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index 8831ea03c001..4371a77e9adc 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -56,16 +56,13 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Export Functions --------------------------*/ -BOOL -FIRMWAREbDownload( - PSDevice pDevice - ) +int FIRMWAREbDownload(struct vnt_private *pDevice) { struct device *dev = &pDevice->usb->dev; const struct firmware *fw; int NdisStatus; void *pBuffer = NULL; - BOOL result = FALSE; + bool result = false; u16 wLength; int ii, rc; @@ -102,7 +99,7 @@ FIRMWAREbDownload( goto free_fw; } - result = TRUE; + result = true; free_fw: release_firmware(fw); @@ -114,12 +111,9 @@ out: } MODULE_FIRMWARE(FIRMWARE_NAME); -BOOL -FIRMWAREbBrach2Sram( - PSDevice pDevice - ) +int FIRMWAREbBrach2Sram(struct vnt_private *pDevice) { - int NdisStatus; + int NdisStatus; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Branch to Sram\n"); @@ -132,17 +126,14 @@ FIRMWAREbBrach2Sram( ); if (NdisStatus != STATUS_SUCCESS) { - return (FALSE); + return (false); } else { - return (TRUE); + return (true); } } -BOOL -FIRMWAREbCheckVersion( - PSDevice pDevice - ) +int FIRMWAREbCheckVersion(struct vnt_private *pDevice) { int ntStatus; @@ -156,17 +147,17 @@ FIRMWAREbCheckVersion( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", pDevice->wFirmwareVersion); if (ntStatus != STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Invalid.\n"); - return FALSE; + return false; } if (pDevice->wFirmwareVersion == 0xFFFF) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"In Loader.\n"); - return FALSE; + return false; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", pDevice->wFirmwareVersion); if (pDevice->wFirmwareVersion < FIRMWARE_VERSION) { // branch to loader for download new firmware FIRMWAREbBrach2Sram(pDevice); - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/drivers/staging/vt6656/firmware.h b/drivers/staging/vt6656/firmware.h index b2f5b5818a93..ebab3a6351b3 100644 --- a/drivers/staging/vt6656/firmware.h +++ b/drivers/staging/vt6656/firmware.h @@ -41,19 +41,8 @@ /*--------------------- Export Functions --------------------------*/ -BOOL -FIRMWAREbDownload( - PSDevice pDevice - ); - -BOOL -FIRMWAREbBrach2Sram( - PSDevice pDevice - ); - -BOOL -FIRMWAREbCheckVersion( - PSDevice pDevice - ); +int FIRMWAREbDownload(struct vnt_private *); +int FIRMWAREbBrach2Sram(struct vnt_private *); +int FIRMWAREbCheckVersion(struct vnt_private *); #endif /* __FIRMWARE_H__ */ diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index 26a7d0e4b048..bc5e9da47586 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -60,13 +60,13 @@ static int msglevel =MSG_LEVEL_INFO; * */ -static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) +static int hostap_enable_hostapd(struct vnt_private *pDevice, int rtnl_locked) { - PSDevice apdev_priv; + struct vnt_private *apdev_priv; struct net_device *dev = pDevice->dev; int ret; const struct net_device_ops apdev_netdev_ops = { - .ndo_start_xmit = pDevice->tx_80211, + .ndo_start_xmit = pDevice->tx_80211, }; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name); @@ -120,7 +120,7 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) * */ -static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked) +static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name); @@ -135,9 +135,9 @@ static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked) } kfree(pDevice->apdev); pDevice->apdev = NULL; - pDevice->bEnable8021x = FALSE; - pDevice->bEnableHostWEP = FALSE; - pDevice->bEncryptionEnable = FALSE; + pDevice->bEnable8021x = false; + pDevice->bEnableHostWEP = false; + pDevice->bEncryptionEnable = false; return 0; } @@ -157,7 +157,8 @@ static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked) * */ -int vt6656_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked) +int vt6656_hostap_set_hostapd(struct vnt_private *pDevice, + int val, int rtnl_locked) { if (val < 0 || val > 1) return -EINVAL; @@ -187,8 +188,8 @@ int vt6656_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked) * Return Value: * */ -static int hostap_remove_sta(PSDevice pDevice, - struct viawget_hostapd_param *param) +static int hostap_remove_sta(struct vnt_private *pDevice, + struct viawget_hostapd_param *param) { unsigned int uNodeIndex; @@ -215,22 +216,21 @@ static int hostap_remove_sta(PSDevice pDevice, * Return Value: * */ -static int hostap_add_sta(PSDevice pDevice, - struct viawget_hostapd_param *param) +static int hostap_add_sta(struct vnt_private *pDevice, + struct viawget_hostapd_param *param) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; unsigned int uNodeIndex; + if (!BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) + BSSvCreateOneNode(pDevice, &uNodeIndex); - if (!BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { - BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); - } memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN); pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability; // TODO listenInterval // pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = 1; - pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = FALSE; + pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = false; pMgmt->sNodeDBTable[uNodeIndex].bySuppRate = param->u.add_sta.tx_supp_rates; // set max tx rate @@ -275,10 +275,10 @@ static int hostap_add_sta(PSDevice pDevice, * */ -static int hostap_get_info_sta(PSDevice pDevice, - struct viawget_hostapd_param *param) +static int hostap_get_info_sta(struct vnt_private *pDevice, + struct viawget_hostapd_param *param) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; unsigned int uNodeIndex; if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { @@ -308,10 +308,10 @@ static int hostap_get_info_sta(PSDevice pDevice, * Return Value: * */ -static int hostap_set_flags_sta(PSDevice pDevice, - struct viawget_hostapd_param *param) +static int hostap_set_flags_sta(struct vnt_private *pDevice, + struct viawget_hostapd_param *param) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; unsigned int uNodeIndex; if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { @@ -342,10 +342,10 @@ static int hostap_set_flags_sta(PSDevice pDevice, * Return Value: * */ -static int hostap_set_generic_element(PSDevice pDevice, +static int hostap_set_generic_element(struct vnt_private *pDevice, struct viawget_hostapd_param *param) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -388,7 +388,7 @@ static int hostap_set_generic_element(PSDevice pDevice, * */ -static void hostap_flush_sta(PSDevice pDevice) +static void hostap_flush_sta(struct vnt_private *pDevice) { // reserved node index =0 for multicast node. BSSvClearNodeDBTable(pDevice, 1); @@ -410,21 +410,20 @@ static void hostap_flush_sta(PSDevice pDevice) * Return Value: * */ -static int hostap_set_encryption(PSDevice pDevice, - struct viawget_hostapd_param *param, - int param_len) +static int hostap_set_encryption(struct vnt_private *pDevice, + struct viawget_hostapd_param *param, int param_len) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DWORD dwKeyIndex = 0; - BYTE abyKey[MAX_KEY_LEN]; - BYTE abySeq[MAX_KEY_LEN]; - NDIS_802_11_KEY_RSC KeyRSC; - BYTE byKeyDecMode = KEY_CTL_WEP; - int ret = 0; - int iNodeIndex = -1; - int ii; - BOOL bKeyTableFull = FALSE; - WORD wKeyCtl = 0; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u32 dwKeyIndex = 0; + u8 abyKey[MAX_KEY_LEN]; + u8 abySeq[MAX_KEY_LEN]; + NDIS_802_11_KEY_RSC KeyRSC; + u8 byKeyDecMode = KEY_CTL_WEP; + int ret = 0; + s32 iNodeIndex = -1; + int ii; + int bKeyTableFull = false; + u16 wKeyCtl = 0; param->u.crypt.err = 0; @@ -445,7 +444,7 @@ static int hostap_set_encryption(PSDevice pDevice, iNodeIndex = 0; } else { - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &iNodeIndex) == FALSE) { + if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &iNodeIndex) == false) { param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); return -EINVAL; @@ -456,15 +455,15 @@ static int hostap_set_encryption(PSDevice pDevice, if (param->u.crypt.alg == WPA_ALG_NONE) { - if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly == TRUE) { + if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly == true) { if (KeybRemoveKey( pDevice, &(pDevice->sKey), param->sta_addr, pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex - ) == FALSE) { + ) == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail \n"); } - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = FALSE; + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; } pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = 0; pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = 0; @@ -493,13 +492,13 @@ static int hostap_set_encryption(PSDevice pDevice, dwKeyIndex = (DWORD)(param->u.crypt.idx); if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) { pDevice->byKeyIndex = (BYTE)dwKeyIndex; - pDevice->bTransmitKey = TRUE; + pDevice->bTransmitKey = true; dwKeyIndex |= (1 << 31); } if (param->u.crypt.alg == WPA_ALG_WEP) { - if ((pDevice->bEnable8021x == FALSE) || (iNodeIndex == 0)) { + if ((pDevice->bEnable8021x == false) || (iNodeIndex == 0)) { KeybSetDefaultKey( pDevice, &(pDevice->sKey), dwKeyIndex & ~(BIT30 | USE_KEYRSC), @@ -512,27 +511,25 @@ static int hostap_set_encryption(PSDevice pDevice, } else { // 8021x enable, individual key dwKeyIndex |= (1 << 30); // set pairwise key - if (KeybSetKey(pDevice, - &(pDevice->sKey), - ¶m->sta_addr[0], - dwKeyIndex & ~(USE_KEYRSC), - param->u.crypt.key_len, - (PQWORD) &(KeyRSC), - (PBYTE)abyKey, - KEY_CTL_WEP - ) == TRUE) { + if (KeybSetKey(pDevice, &(pDevice->sKey), + ¶m->sta_addr[0], + dwKeyIndex & ~(USE_KEYRSC), + param->u.crypt.key_len, + &KeyRSC, (PBYTE)abyKey, + KEY_CTL_WEP + ) == true) { - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = TRUE; + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { // Key Table Full - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = FALSE; - bKeyTableFull = TRUE; + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; + bKeyTableFull = true; } } pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; - pDevice->bEncryptionEnable = TRUE; + pDevice->bEncryptionEnable = true; pMgmt->byCSSPK = KEY_CTL_WEP; pMgmt->byCSSGK = KEY_CTL_WEP; pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = KEY_CTL_WEP; @@ -574,11 +571,11 @@ static int hostap_set_encryption(PSDevice pDevice, &(pDevice->sKey), dwKeyIndex, param->u.crypt.key_len, - (PQWORD) &(KeyRSC), + &KeyRSC, abyKey, byKeyDecMode ); - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = TRUE; + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { dwKeyIndex |= (1 << 30); // set pairwise key @@ -587,23 +584,23 @@ static int hostap_set_encryption(PSDevice pDevice, ¶m->sta_addr[0], dwKeyIndex, param->u.crypt.key_len, - (PQWORD) &(KeyRSC), + &KeyRSC, (PBYTE)abyKey, byKeyDecMode - ) == TRUE) { + ) == true) { - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = TRUE; + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { // Key Table Full - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = FALSE; - bKeyTableFull = TRUE; + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; + bKeyTableFull = true; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n"); } } - if (bKeyTableFull == TRUE) { + if (bKeyTableFull == true) { wKeyCtl &= 0x7F00; // clear all key control filed wKeyCtl |= (byKeyDecMode << 4); wKeyCtl |= (byKeyDecMode); @@ -625,7 +622,7 @@ static int hostap_set_encryption(PSDevice pDevice, ); // set wep key - pDevice->bEncryptionEnable = TRUE; + pDevice->bEncryptionEnable = true; pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = byKeyDecMode; pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; @@ -649,14 +646,14 @@ static int hostap_set_encryption(PSDevice pDevice, * Return Value: * */ -static int hostap_get_encryption(PSDevice pDevice, +static int hostap_get_encryption(struct vnt_private *pDevice, struct viawget_hostapd_param *param, int param_len) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int ret = 0; - int ii; - int iNodeIndex =0; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ret = 0; + int ii; + s32 iNodeIndex = 0; param->u.crypt.err = 0; @@ -664,7 +661,7 @@ static int hostap_get_encryption(PSDevice pDevice, if (is_broadcast_ether_addr(param->sta_addr)) { iNodeIndex = 0; } else { - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &iNodeIndex) == FALSE) { + if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &iNodeIndex) == false) { param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); return -EINVAL; @@ -694,7 +691,7 @@ static int hostap_get_encryption(PSDevice pDevice, * */ -int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p) +int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) { struct viawget_hostapd_param *param; int ret = 0; diff --git a/drivers/staging/vt6656/hostap.h b/drivers/staging/vt6656/hostap.h index b660aee1ca0e..f5656cd96a8f 100644 --- a/drivers/staging/vt6656/hostap.h +++ b/drivers/staging/vt6656/hostap.h @@ -61,7 +61,7 @@ #define ARPHRD_IEEE80211 801 #endif -int vt6656_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked); -int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p); +int vt6656_hostap_set_hostapd(struct vnt_private *, int val, int rtnl_locked); +int vt6656_hostap_ioctl(struct vnt_private *, struct iw_point *p); #endif /* __HOSTAP_H__ */ diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index bba31caae036..51990bd3dd45 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -75,23 +75,22 @@ static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */ * if we've gotten no data * -*/ -void INTvWorkItem(void *Context) +void INTvWorkItem(struct vnt_private *pDevice) { - PSDevice pDevice = Context; int ntStatus; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n"); spin_lock_irq(&pDevice->lock); - if (pDevice->fKillEventPollingThread != TRUE) + if (pDevice->fKillEventPollingThread != true) ntStatus = PIPEnsInterruptRead(pDevice); spin_unlock_irq(&pDevice->lock); } -void INTnsProcessData(PSDevice pDevice) +void INTnsProcessData(struct vnt_private *pDevice) { PSINTData pINTData; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct net_device_stats *pStats = &pDevice->stats; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n"); @@ -147,12 +146,12 @@ void INTnsProcessData(PSDevice pDevice) if (pMgmt->byDTIMCount > 0) { pMgmt->byDTIMCount--; pMgmt->sNodeDBTable[0].bRxPSPoll = - FALSE; + false; } else if (pMgmt->byDTIMCount == 0) { /* check if multicast tx buffering */ pMgmt->byDTIMCount = pMgmt->byDTIMPeriod-1; - pMgmt->sNodeDBTable[0].bRxPSPoll = TRUE; + pMgmt->sNodeDBTable[0].bRxPSPoll = true; if (pMgmt->sNodeDBTable[0].bPSEnable) bScheduleCommand((void *) pDevice, WLAN_CMD_RX_PSPOLL, @@ -162,9 +161,9 @@ void INTnsProcessData(PSDevice pDevice) WLAN_CMD_BECON_SEND, NULL); } /* if (pDevice->eOPMode == OP_MODE_AP) */ - pDevice->bBeaconSent = TRUE; + pDevice->bBeaconSent = true; } else { - pDevice->bBeaconSent = FALSE; + pDevice->bBeaconSent = false; } if (pINTData->byISR0 & ISR_TBTT) { if (pDevice->bEnablePSMode) @@ -179,8 +178,7 @@ void INTnsProcessData(PSDevice pDevice) NULL); } } - LODWORD(pDevice->qwCurrTSF) = pINTData->dwLoTSF; - HIDWORD(pDevice->qwCurrTSF) = pINTData->dwHiTSF; + pDevice->qwCurrTSF = cpu_to_le64(pINTData->qwTSF); /*DBG_PRN_GRP01(("ISR0 = %02x , LoTsf = %08x, HiTsf = %08x\n", @@ -204,7 +202,7 @@ void INTnsProcessData(PSDevice pDevice) WLAN_CMD_RADIO, NULL); pDevice->intBuf.uDataLen = 0; - pDevice->intBuf.bInUse = FALSE; + pDevice->intBuf.bInUse = false; pStats->tx_packets = pDevice->scStatistic.ullTsrOK; pStats->tx_bytes = pDevice->scStatistic.ullTxDirectedBytes + diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h index e0d2b07ba608..27c725f1ce11 100644 --- a/drivers/staging/vt6656/int.h +++ b/drivers/staging/vt6656/int.h @@ -47,8 +47,7 @@ typedef struct tagSINTData { BYTE byTSR3; BYTE byPkt3; WORD wTime3; - u32 dwLoTSF; - u32 dwHiTSF; + u64 qwTSF; BYTE byISR0; BYTE byISR1; BYTE byRTSSuccess; @@ -65,7 +64,7 @@ SINTData, *PSINTData; /*--------------------- Export Functions --------------------------*/ -void INTvWorkItem(void *Context); -void INTnsProcessData(PSDevice pDevice); +void INTvWorkItem(struct vnt_private *); +void INTnsProcessData(struct vnt_private *); #endif /* __INT_H__ */ diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h index ae6e2d237b20..c354a77964d8 100644 --- a/drivers/staging/vt6656/iocmd.h +++ b/drivers/staging/vt6656/iocmd.h @@ -122,8 +122,8 @@ typedef struct tagSCmdBSSJoin { u16 wBBPType; u8 ssid[SSID_MAXLEN + 2]; u32 uChannel; - BOOL bPSEnable; - BOOL bShareKeyAuth; + bool bPSEnable; + bool bShareKeyAuth; } __packed SCmdBSSJoin, *PSCmdBSSJoin; @@ -133,7 +133,7 @@ typedef struct tagSCmdBSSJoin { typedef struct tagSCmdZoneTypeSet { - BOOL bWrite; + bool bWrite; WZONETYPE ZoneType; } __packed SCmdZoneTypeSet, *PSCmdZoneTypeSet; @@ -143,7 +143,7 @@ typedef struct tagSWPAResult { u8 proto; u8 key_mgmt; u8 eap_type; - BOOL authenticated; + bool authenticated; } __packed SWPAResult, *PSWPAResult; typedef struct tagSCmdStartAP { @@ -153,17 +153,17 @@ typedef struct tagSCmdStartAP { u8 ssid[SSID_MAXLEN + 2]; u32 uChannel; u32 uBeaconInt; - BOOL bShareKeyAuth; + bool bShareKeyAuth; u8 byBasicRate; } __packed SCmdStartAP, *PSCmdStartAP; typedef struct tagSCmdSetWEP { - BOOL bEnableWep; + bool bEnableWep; u8 byKeyIndex; u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN]; - BOOL bWepKeyAvailable[WEP_NKEYS]; + bool bWepKeyAvailable[WEP_NKEYS]; u32 auWepKeyLength[WEP_NKEYS]; } __packed SCmdSetWEP, *PSCmdSetWEP; @@ -176,7 +176,7 @@ typedef struct tagSBSSIDItem { u16 wBeaconInterval; u16 wCapInfo; u8 byNetType; - BOOL bWEPOn; + bool bWEPOn; u32 uRSSI; } __packed SBSSIDItem; @@ -197,12 +197,12 @@ typedef struct tagSNodeItem { u16 wInActiveCount; u16 wEnQueueCnt; u16 wFlags; - BOOL bPWBitOn; + bool bPWBitOn; u8 byKeyIndex; u16 wWepKeyLength; u8 abyWepKey[WEP_KEYMAXLEN]; // Auto rate fallback vars - BOOL bIsInFallback; + bool bIsInFallback; u32 uTxFailures; u32 uTxAttempts; u16 wFailureRatio; @@ -220,7 +220,7 @@ typedef struct tagSNodeList { typedef struct tagSCmdLinkStatus { - BOOL bLink; + bool bLink; u16 wBSSType; u8 byState; u8 abyBSSID[BSSID_LEN]; diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 52fce6902508..69971f35e490 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -55,7 +55,7 @@ static int msglevel = MSG_LEVEL_INFO; struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); long ldBm; pDevice->wstats.status = pDevice->eOPMode; @@ -91,9 +91,9 @@ int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_point *wrq = &wrqu->data; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_scan_req *req = (struct iw_scan_req *)extra; BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; PWLAN_IE_SSID pItemSSID = NULL; @@ -169,8 +169,8 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, int ii; int jj; int kk; - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PKnownBSS pBSS; PWLAN_IE_SSID pItemSSID; PWLAN_IE_SUPP_RATES pSuppRates; @@ -309,7 +309,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_freq *wrq = &wrqu->freq; int rc = 0; @@ -348,9 +348,9 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_freq *wrq = &wrqu->freq; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ\n"); @@ -379,9 +379,9 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); __u32 *wmode = &wrqu->mode; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int rc = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE\n"); @@ -400,7 +400,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) { pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; if (pDevice->flags & DEVICE_FLAGS_OPENED) - pDevice->bCommit = TRUE; + pDevice->bCommit = true; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); break; @@ -409,7 +409,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) { pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; if (pDevice->flags & DEVICE_FLAGS_OPENED) - pDevice->bCommit = TRUE; + pDevice->bCommit = true; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); break; @@ -422,7 +422,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, if (pMgmt->eConfigMode != WMAC_CONFIG_AP) { pMgmt->eConfigMode = WMAC_CONFIG_AP; if (pDevice->flags & DEVICE_FLAGS_OPENED) - pDevice->bCommit = TRUE; + pDevice->bCommit = true; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); break; @@ -455,7 +455,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL); } else { - pDevice->bLinkPass = FALSE; + pDevice->bLinkPass = false; pMgmt->eCurrState = WMAC_STATE_IDLE; memset(pMgmt->abyCurrBSSID, 0, 6); } @@ -479,7 +479,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, spin_unlock_irq(&pDevice->lock); } - pDevice->bCommit = FALSE; + pDevice->bCommit = false; } @@ -492,9 +492,9 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, int iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); __u32 *wmode = &wrqu->mode; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE\n"); @@ -631,9 +631,9 @@ int iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct sockaddr *wrq = &wrqu->ap_addr; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int rc = 0; BYTE ZeroBSSID[WLAN_BSSID_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -672,7 +672,7 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, } if (pDevice->flags & DEVICE_FLAGS_OPENED) - pDevice->bCommit = TRUE; + pDevice->bCommit = true; } return rc; } @@ -683,9 +683,9 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct sockaddr *wrq = &wrqu->ap_addr; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP\n"); @@ -694,7 +694,7 @@ int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); - if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)) + if ((pDevice->bLinkPass == false) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)) memset(wrq->sa_data, 0, 6); if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) @@ -713,8 +713,8 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq = &wrqu->data; struct sockaddr *sock; struct iw_quality *qual; - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &pDevice->sMgmtObj; + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PKnownBSS pBSS = &pMgmt->sBSSList[0]; int ii; int jj; @@ -771,9 +771,9 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_point *wrq = &wrqu->essid; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PWLAN_IE_SSID pItemSSID; if (pMgmt == NULL) @@ -784,7 +784,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID :\n"); - pDevice->fWPA_Authened = FALSE; + pDevice->fWPA_Authened = false; // Check if we asked for `any' if (wrq->flags == 0) { // Just send an empty SSID list @@ -816,7 +816,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, // Wext wil order another command of siwap to link // with desired AP, so here need not associate?? - if (pDevice->bWPASuppWextEnabled == TRUE) { + if (pDevice->bWPASuppWextEnabled == true) { /*******search if in hidden ssid mode ****/ PKnownBSS pCurr = NULL; BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; @@ -867,7 +867,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, } if (pDevice->flags & DEVICE_FLAGS_OPENED) - pDevice->bCommit = TRUE; + pDevice->bCommit = true; return 0; } @@ -878,9 +878,9 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_point *wrq = &wrqu->essid; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PWLAN_IE_SSID pItemSSID; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID\n"); @@ -908,7 +908,7 @@ int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->bitrate; int rc = 0; u8 brate = 0; @@ -965,7 +965,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, if (wrq->fixed != 0) { // Fixed mode // One rate, fixed - pDevice->bFixRate = TRUE; + pDevice->bFixRate = true; if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) { pDevice->uConnectionRate = 3; } else { @@ -973,7 +973,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); } } else { - pDevice->bFixRate = FALSE; + pDevice->bFixRate = false; pDevice->uConnectionRate = 13; } @@ -986,9 +986,9 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->bitrate; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE\n"); @@ -1024,8 +1024,8 @@ int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, brate = abySupportedRates[pDevice->wCurrentRate]; wrq->value = brate * 500000; // If more than one rate, set auto - if (pDevice->bFixRate == TRUE) - wrq->fixed = TRUE; + if (pDevice->bFixRate == true) + wrq->fixed = true; } return 0; @@ -1037,7 +1037,7 @@ int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, int iwctl_siwrts(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->rts; if ((wrq->value < 0 || wrq->value > 2312) && !wrq->disabled) @@ -1057,7 +1057,7 @@ int iwctl_siwrts(struct net_device *dev, struct iw_request_info *info, int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->rts; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS\n"); @@ -1073,7 +1073,7 @@ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->frag; int rc = 0; int fthr = wrq->value; @@ -1097,7 +1097,7 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->frag; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG\n"); @@ -1113,7 +1113,7 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->retry; int rc = 0; @@ -1146,7 +1146,7 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->retry; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY\n"); wrq->disabled = 0; // Can't be disabled @@ -1173,8 +1173,8 @@ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->encoding; u32 dwKeyIndex = (u32)(wrq->flags & IW_ENCODE_INDEX); int ii; @@ -1229,8 +1229,8 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, } pDevice->byKeyIndex = (BYTE)dwKeyIndex; pDevice->uKeyLength = wrq->length; - pDevice->bTransmitKey = TRUE; - pDevice->bEncryptionEnable = TRUE; + pDevice->bTransmitKey = true; + pDevice->bEncryptionEnable = true; pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; // Do we want to just set the transmit key index? @@ -1244,8 +1244,8 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, // Read the flags if (wrq->flags & IW_ENCODE_DISABLED) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); - pMgmt->bShareKeyAlgorithm = FALSE; - pDevice->bEncryptionEnable = FALSE; + pMgmt->bShareKeyAlgorithm = false; + pDevice->bEncryptionEnable = false; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; if (pDevice->flags & DEVICE_FLAGS_OPENED) { spin_lock_irq(&pDevice->lock); @@ -1256,11 +1256,11 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, } if (wrq->flags & IW_ENCODE_RESTRICTED) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n"); - pMgmt->bShareKeyAlgorithm = TRUE; + pMgmt->bShareKeyAlgorithm = true; } if (wrq->flags & IW_ENCODE_OPEN) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n"); - pMgmt->bShareKeyAlgorithm = FALSE; + pMgmt->bShareKeyAlgorithm = false; } memset(pMgmt->abyDesireBSSID, 0xFF, 6); @@ -1271,8 +1271,8 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->encoding; char abyKey[WLAN_WEP232_KEYLEN]; @@ -1333,8 +1333,8 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_param *wrq = &wrqu->power; int rc = 0; @@ -1385,8 +1385,8 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_param *wrq = &wrqu->power; int mode = pDevice->ePSMode; @@ -1418,12 +1418,12 @@ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->sens; long ldBm; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS\n"); - if (pDevice->bLinkPass == TRUE) { + if (pDevice->bLinkPass == true) { RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); wrq->value = ldBm; } else { @@ -1437,8 +1437,8 @@ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_param *wrq = &wrqu->param; int ret = 0; static int wpa_version = 0; // must be static to save the last value, einsn liu @@ -1508,9 +1508,9 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, case IW_AUTH_80211_AUTH_ALG: PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n", wrq->value); if (wrq->value == IW_AUTH_ALG_OPEN_SYSTEM) - pMgmt->bShareKeyAlgorithm = FALSE; + pMgmt->bShareKeyAlgorithm = false; else if (wrq->value == IW_AUTH_ALG_SHARED_KEY) - pMgmt->bShareKeyAlgorithm = TRUE; + pMgmt->bShareKeyAlgorithm = true; break; case IW_AUTH_WPA_ENABLED: break; @@ -1521,11 +1521,11 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, break; case IW_AUTH_PRIVACY_INVOKED: pDevice->bEncryptionEnable = !!wrq->value; - if (pDevice->bEncryptionEnable == FALSE) { + if (pDevice->bEncryptionEnable == false) { wpa_version = 0; pairwise = 0; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; - pMgmt->bShareKeyAlgorithm = FALSE; + pMgmt->bShareKeyAlgorithm = false; pMgmt->eAuthenMode = WMAC_AUTH_OPEN; PRINT_K("iwctl_siwauth:set WPADEV to disaable at 2?????\n"); } @@ -1547,8 +1547,8 @@ int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info, int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->data; int ret = 0; @@ -1582,8 +1582,8 @@ out: // not completely ...not necessary in wpa_supplicant 0.5.8 int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->data; int ret = 0; int space = wrq->length; @@ -1608,8 +1608,8 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; struct viawget_wpa_param *param=NULL; @@ -1697,28 +1697,28 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, /****this method is so foolish,but there is no other way??? */ if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { if (param->u.wpa_key.key_index ==0) { - pDevice->bwextstep0 = TRUE; + pDevice->bwextstep0 = true; } - if ((pDevice->bwextstep0 == TRUE) && (param->u.wpa_key.key_index == 1)) { - pDevice->bwextstep0 = FALSE; - pDevice->bwextstep1 = TRUE; + if ((pDevice->bwextstep0 == true) && (param->u.wpa_key.key_index == 1)) { + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = true; } - if ((pDevice->bwextstep1 == TRUE) && (param->u.wpa_key.key_index == 2)) { - pDevice->bwextstep1 = FALSE; - pDevice->bwextstep2 = TRUE; + if ((pDevice->bwextstep1 == true) && (param->u.wpa_key.key_index == 2)) { + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = true; } - if ((pDevice->bwextstep2 == TRUE) && (param->u.wpa_key.key_index == 3)) { - pDevice->bwextstep2 = FALSE; - pDevice->bwextstep3 = TRUE; + if ((pDevice->bwextstep2 == true) && (param->u.wpa_key.key_index == 3)) { + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = true; } } - if (pDevice->bwextstep3 == TRUE) { + if (pDevice->bwextstep3 == true) { PRINT_K("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n"); - pDevice->bwextstep0 = FALSE; - pDevice->bwextstep1 = FALSE; - pDevice->bwextstep2 = FALSE; - pDevice->bwextstep3 = FALSE; - pDevice->bWPASuppWextEnabled = TRUE; + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = false; + pDevice->bWPASuppWextEnabled = true; memset(pMgmt->abyDesireBSSID, 0xFF, 6); KeyvInitTable(pDevice, &pDevice->sKey); } @@ -1741,8 +1741,8 @@ int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_mlme *mlme = (struct iw_mlme *)extra; int ret = 0; @@ -1758,7 +1758,7 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, switch (mlme->cmd){ case IW_MLME_DEAUTH: case IW_MLME_DISASSOC: - if (pDevice->bLinkPass == TRUE) { + if (pDevice->bLinkPass == true) { PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n"); bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL); diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 8c78b86b5c80..416175e8ba53 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -60,26 +60,25 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Variables --------------------------*/ /*--------------------- Static Functions --------------------------*/ -static void s_vCheckKeyTableValid(void *pDeviceHandler, - PSKeyManagement pTable) +static void s_vCheckKeyTableValid(struct vnt_private *pDevice, + PSKeyManagement pTable) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i; - WORD wLength = 0; - BYTE pbyData[MAX_KEY_TABLE]; + int i; + u16 wLength = 0; + u8 pbyData[MAX_KEY_TABLE]; for (i=0;i<MAX_KEY_TABLE;i++) { - if ((pTable->KeyTable[i].bInUse == TRUE) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == FALSE) && - (pTable->KeyTable[i].GroupKey[0].bKeyValid == FALSE) && - (pTable->KeyTable[i].GroupKey[1].bKeyValid == FALSE) && - (pTable->KeyTable[i].GroupKey[2].bKeyValid == FALSE) && - (pTable->KeyTable[i].GroupKey[3].bKeyValid == FALSE) + if ((pTable->KeyTable[i].bInUse == true) && + (pTable->KeyTable[i].PairwiseKey.bKeyValid == false) && + (pTable->KeyTable[i].GroupKey[0].bKeyValid == false) && + (pTable->KeyTable[i].GroupKey[1].bKeyValid == false) && + (pTable->KeyTable[i].GroupKey[2].bKeyValid == false) && + (pTable->KeyTable[i].GroupKey[3].bKeyValid == false) ) { - pTable->KeyTable[i].bInUse = FALSE; + pTable->KeyTable[i].bInUse = false; pTable->KeyTable[i].wKeyCtl = 0; - pTable->KeyTable[i].bSoftWEP = FALSE; + pTable->KeyTable[i].bSoftWEP = false; pbyData[wLength++] = (BYTE) i; //MACvDisableKeyEntry(pDevice, i); } @@ -112,27 +111,25 @@ static void s_vCheckKeyTableValid(void *pDeviceHandler, * Return Value: none * */ -void KeyvInitTable(void *pDeviceHandler, PSKeyManagement pTable) +void KeyvInitTable(struct vnt_private *pDevice, PSKeyManagement pTable) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i; - int jj; - BYTE pbyData[MAX_KEY_TABLE+1]; + int i, jj; + u8 pbyData[MAX_KEY_TABLE+1]; spin_lock_irq(&pDevice->lock); for (i=0;i<MAX_KEY_TABLE;i++) { - pTable->KeyTable[i].bInUse = FALSE; - pTable->KeyTable[i].PairwiseKey.bKeyValid = FALSE; + pTable->KeyTable[i].bInUse = false; + pTable->KeyTable[i].PairwiseKey.bKeyValid = false; pTable->KeyTable[i].PairwiseKey.pvKeyTable = (void *)&pTable->KeyTable[i]; for (jj=0; jj < MAX_GROUP_KEY; jj++) { - pTable->KeyTable[i].GroupKey[jj].bKeyValid = FALSE; + pTable->KeyTable[i].GroupKey[jj].bKeyValid = false; pTable->KeyTable[i].GroupKey[jj].pvKeyTable = (void *) &(pTable->KeyTable[i]); } pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].dwGTKeyIndex = 0; - pTable->KeyTable[i].bSoftWEP = FALSE; + pTable->KeyTable[i].bSoftWEP = false; pbyData[i] = (BYTE) i; } pbyData[i] = (BYTE) i; @@ -161,43 +158,43 @@ void KeyvInitTable(void *pDeviceHandler, PSKeyManagement pTable) * Out: * pKey - Key return * - * Return Value: TRUE if found otherwise FALSE + * Return Value: true if found otherwise false * */ -BOOL KeybGetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, - PSKeyItem *pKey) +int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, + PSKeyItem *pKey) { - int i; + 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++) { - if ((pTable->KeyTable[i].bInUse == TRUE) && + if ((pTable->KeyTable[i].bInUse == true) && !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if (dwKeyIndex == 0xFFFFFFFF) { - if (pTable->KeyTable[i].PairwiseKey.bKeyValid == TRUE) { + if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { *pKey = &(pTable->KeyTable[i].PairwiseKey); - return (TRUE); + return (true); } else { - return (FALSE); + return (false); } } else if (dwKeyIndex < MAX_GROUP_KEY) { - if (pTable->KeyTable[i].GroupKey[dwKeyIndex].bKeyValid == TRUE) { + if (pTable->KeyTable[i].GroupKey[dwKeyIndex].bKeyValid == true) { *pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex]); - return (TRUE); + return (true); } else { - return (FALSE); + return (false); } } else { - return (FALSE); + return (false); } } } - return (FALSE); + return (false); } @@ -215,37 +212,28 @@ BOOL KeybGetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, * Out: * none * - * Return Value: TRUE if success otherwise FALSE + * Return Value: true if success otherwise false * */ -BOOL KeybSetKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ) +int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u8 *pbyBSSID, u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i,j; - unsigned int ii; - PSKeyItem pKey; - unsigned int uKeyIdx; + PSKeyItem pKey; + int i, j, ii; + u32 uKeyIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetKey: %X\n", dwKeyIndex); j = (MAX_KEY_TABLE-1); for (i=0;i<(MAX_KEY_TABLE-1);i++) { - if ((pTable->KeyTable[i].bInUse == FALSE) && + if ((pTable->KeyTable[i].bInUse == false) && (j == (MAX_KEY_TABLE-1))) { // found empty table j = i; } - if ((pTable->KeyTable[i].bInUse == TRUE) && + if ((pTable->KeyTable[i].bInUse == true) && !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { // found table already exist if ((dwKeyIndex & PAIRWISE_KEY) != 0) { @@ -257,7 +245,7 @@ BOOL KeybSetKey( } else { // Group key if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) - return (FALSE); + return (false); pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF]); if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key @@ -273,7 +261,7 @@ BOOL KeybSetKey( } pTable->KeyTable[i].wKeyCtl |= 0x8000; // enable on-fly - pKey->bKeyValid = TRUE; + pKey->bKeyValid = true; pKey->uKeyLength = uKeyLength; pKey->dwKeyIndex = dwKeyIndex; pKey->byCipherSuite = byKeyDecMode; @@ -286,13 +274,11 @@ BOOL KeybSetKey( } MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (PDWORD)pKey->abyKey); - if ((dwKeyIndex & USE_KEYRSC) == 0) { - // RSC set by NIC - memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); - } - else { - memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); - } + if ((dwKeyIndex & USE_KEYRSC) == 0) + pKey->KeyRSC = 0; /* RSC set by NIC */ + else + pKey->KeyRSC = *KeyRSC; + pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; @@ -312,12 +298,12 @@ BOOL KeybSetKey( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ", pKey->dwKeyIndex); - return (TRUE); + return (true); } } if (j < (MAX_KEY_TABLE-1)) { memcpy(pTable->KeyTable[j].abyBSSID, pbyBSSID, ETH_ALEN); - pTable->KeyTable[j].bInUse = TRUE; + pTable->KeyTable[j].bInUse = true; if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key pKey = &(pTable->KeyTable[j].PairwiseKey); @@ -327,7 +313,7 @@ BOOL KeybSetKey( } else { // Group key if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) - return (FALSE); + return (false); pKey = &(pTable->KeyTable[j].GroupKey[dwKeyIndex & 0x000000FF]); if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key @@ -343,7 +329,7 @@ BOOL KeybSetKey( } pTable->KeyTable[j].wKeyCtl |= 0x8000; // enable on-fly - pKey->bKeyValid = TRUE; + pKey->bKeyValid = true; pKey->uKeyLength = uKeyLength; pKey->dwKeyIndex = dwKeyIndex; pKey->byCipherSuite = byKeyDecMode; @@ -356,13 +342,11 @@ BOOL KeybSetKey( } MACvSetKeyEntry(pDevice, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (PDWORD)pKey->abyKey); - if ((dwKeyIndex & USE_KEYRSC) == 0) { - // RSC set by NIC - memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); - } - else { - memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); - } + if ((dwKeyIndex & USE_KEYRSC) == 0) + pKey->KeyRSC = 0; /* RSC set by NIC */ + else + pKey->KeyRSC = *KeyRSC; + pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; @@ -381,9 +365,9 @@ BOOL KeybSetKey( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ", pKey->dwKeyIndex); - return (TRUE); + return (true); } - return (FALSE); + return (false); } @@ -398,68 +382,64 @@ BOOL KeybSetKey( * Out: * none * - * Return Value: TRUE if success otherwise FALSE + * Return Value: true if success otherwise false * */ -BOOL KeybRemoveKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID, - DWORD dwKeyIndex - ) + +int KeybRemoveKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u8 *pbyBSSID, u32 dwKeyIndex) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i; - BOOL bReturnValue = FALSE; + int i; + int bReturnValue = false; if (is_broadcast_ether_addr(pbyBSSID)) { // delete all keys if ((dwKeyIndex & PAIRWISE_KEY) != 0) { for (i=0;i<MAX_KEY_TABLE;i++) { - pTable->KeyTable[i].PairwiseKey.bKeyValid = FALSE; + pTable->KeyTable[i].PairwiseKey.bKeyValid = false; } - bReturnValue = TRUE; + bReturnValue = true; } else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { for (i=0;i<MAX_KEY_TABLE;i++) { - pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = FALSE; + pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[i].dwGTKeyIndex & 0x7FFFFFFF)) { // remove Group transmit key pTable->KeyTable[i].dwGTKeyIndex = 0; } } - bReturnValue = TRUE; + bReturnValue = true; } else { - bReturnValue = FALSE; + bReturnValue = false; } } else { for (i=0;i<MAX_KEY_TABLE;i++) { - if ( (pTable->KeyTable[i].bInUse == TRUE) && + if ( (pTable->KeyTable[i].bInUse == true) && !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if ((dwKeyIndex & PAIRWISE_KEY) != 0) { - pTable->KeyTable[i].PairwiseKey.bKeyValid = FALSE; - bReturnValue = TRUE; + pTable->KeyTable[i].PairwiseKey.bKeyValid = false; + bReturnValue = true; break; } else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { - pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = FALSE; + pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[i].dwGTKeyIndex & 0x7FFFFFFF)) { // remove Group transmit key pTable->KeyTable[i].dwGTKeyIndex = 0; } - bReturnValue = TRUE; + bReturnValue = true; break; } else { - bReturnValue = FALSE; + bReturnValue = false; break; } - } //pTable->KeyTable[i].bInUse == TRUE + } //pTable->KeyTable[i].bInUse == true } //for - bReturnValue = TRUE; + bReturnValue = true; } s_vCheckKeyTableValid(pDevice,pTable); @@ -479,31 +459,27 @@ BOOL KeybRemoveKey( * Out: * none * - * Return Value: TRUE if success otherwise FALSE + * Return Value: true if success otherwise false * */ -BOOL KeybRemoveAllKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID - ) +int KeybRemoveAllKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u8 *pbyBSSID) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i,u; + int i, u; for (i=0;i<MAX_KEY_TABLE;i++) { - if ((pTable->KeyTable[i].bInUse == TRUE) && + if ((pTable->KeyTable[i].bInUse == true) && !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { - pTable->KeyTable[i].PairwiseKey.bKeyValid = FALSE; + pTable->KeyTable[i].PairwiseKey.bKeyValid = false; for (u = 0; u < MAX_GROUP_KEY; u++) - pTable->KeyTable[i].GroupKey[u].bKeyValid = FALSE; + pTable->KeyTable[i].GroupKey[u].bKeyValid = false; pTable->KeyTable[i].dwGTKeyIndex = 0; s_vCheckKeyTableValid(pDevice, pTable); - return (TRUE); + return (true); } } - return (FALSE); + return (false); } /* @@ -515,21 +491,17 @@ BOOL KeybRemoveAllKey( * Out: * none * - * Return Value: TRUE if success otherwise FALSE + * Return Value: true if success otherwise false * */ -void KeyvRemoveWEPKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex - ) +void KeyvRemoveWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u32 dwKeyIndex) { - PSDevice pDevice = (PSDevice) pDeviceHandler; if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == TRUE) { + if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == true) { if (pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].byCipherSuite == KEY_CTL_WEP) { - pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = FALSE; + pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex & 0x7FFFFFFF)) { // remove Group transmit key pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = 0; @@ -541,9 +513,8 @@ void KeyvRemoveWEPKey( return; } -void KeyvRemoveAllWEPKey(void *pDeviceHandler, PSKeyManagement pTable) +void KeyvRemoveAllWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable) { - PSDevice pDevice = (PSDevice) pDeviceHandler; int i; for (i = 0; i < MAX_GROUP_KEY; i++) @@ -560,22 +531,23 @@ void KeyvRemoveAllWEPKey(void *pDeviceHandler, PSKeyManagement pTable) * Out: * pKey - Key return * - * Return Value: TRUE if found otherwise FALSE + * Return Value: true if found otherwise false * */ -BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, - PSKeyItem *pKey) +int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, + PSKeyItem *pKey) { - int i, ii; + int i, ii; + + *pKey = NULL; - *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == TRUE) && + if ((pTable->KeyTable[i].bInUse == true) && !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if (dwKeyType == PAIRWISE_KEY) { - if (pTable->KeyTable[i].PairwiseKey.bKeyValid == TRUE) { + if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { *pKey = &(pTable->KeyTable[i].PairwiseKey); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); @@ -586,19 +558,19 @@ BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - return (TRUE); + return (true); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PairwiseKey.bKeyValid == FALSE\n"); - return (FALSE); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PairwiseKey.bKeyValid == false\n"); + return (false); } } // End of Type == PAIRWISE else { if (pTable->KeyTable[i].dwGTKeyIndex == 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ERROR: dwGTKeyIndex == 0 !!!\n"); - return FALSE; + return false; } - if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid == TRUE) { + if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid == true) { *pKey = &(pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)]); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); @@ -610,11 +582,11 @@ BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %X\n", pTable->KeyTable[i].dwGTKeyIndex); - return (TRUE); + return (true); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GroupKey.bKeyValid == FALSE\n"); - return (FALSE); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GroupKey.bKeyValid == false\n"); + return (false); } } // End of Type = GROUP } // BSSID match @@ -624,7 +596,7 @@ BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *(pbyBSSID+ii)); } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - return (FALSE); + return (false); } @@ -637,22 +609,23 @@ BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, * Out: * none * - * Return Value: TRUE if found otherwise FALSE + * Return Value: true if found otherwise false * */ -BOOL KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) +int KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) { - int i; + int i; + + *pKey = NULL; - *pKey = NULL; for (i=0;i<MAX_KEY_TABLE;i++) { - if ((pTable->KeyTable[i].bInUse == TRUE) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == TRUE)) { + if ((pTable->KeyTable[i].bInUse == true) && + (pTable->KeyTable[i].PairwiseKey.bKeyValid == true)) { *pKey = &(pTable->KeyTable[i].PairwiseKey); - return (TRUE); + return (true); } } - return (FALSE); + return (false); } /* @@ -668,37 +641,31 @@ BOOL KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) * Out: * none * - * Return Value: TRUE if success otherwise FALSE + * Return Value: true if success otherwise false * */ -BOOL KeybSetDefaultKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ) + +int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - unsigned int ii; - PSKeyItem pKey; - unsigned int uKeyIdx; + int ii; + PSKeyItem pKey; + u32 uKeyIdx; 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); + return (false); } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) { - return (FALSE); + return (false); } if (uKeyLength > MAX_KEY_LEN) return false; - pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; + pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true; for (ii = 0; ii < ETH_ALEN; ii++) pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; @@ -722,13 +689,13 @@ BOOL KeybSetDefaultKey( if ((uKeyLength == WLAN_WEP232_KEYLEN) && (byKeyDecMode == KEY_CTL_WEP)) { pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0x4000; // disable on-fly disable address match - pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP = TRUE; + pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP = true; } else { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP == FALSE) + if (pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP == false) pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0xC000; // enable on-fly disable address match } - pKey->bKeyValid = TRUE; + pKey->bKeyValid = true; pKey->uKeyLength = uKeyLength; pKey->dwKeyIndex = dwKeyIndex; pKey->byCipherSuite = byKeyDecMode; @@ -742,12 +709,12 @@ BOOL KeybSetDefaultKey( MACvSetKeyEntry(pDevice, pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl, MAX_KEY_TABLE-1, uKeyIdx, pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID, (PDWORD) pKey->abyKey); - if ((dwKeyIndex & USE_KEYRSC) == 0) { - // RSC set by NIC - memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); - } else { - memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); - } + if ((dwKeyIndex & USE_KEYRSC) == 0) + pKey->KeyRSC = 0; /* RSC set by NIC */ + else + pKey->KeyRSC = *KeyRSC; + + pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; @@ -767,7 +734,7 @@ BOOL KeybSetDefaultKey( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n", pKey->dwKeyIndex); - return (TRUE); + return (true); } @@ -784,37 +751,30 @@ BOOL KeybSetDefaultKey( * Out: * none * - * Return Value: TRUE if success otherwise FALSE + * Return Value: true if success otherwise false * */ -BOOL KeybSetAllGroupKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ) + +int KeybSetAllGroupKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i; - unsigned int ii; - PSKeyItem pKey; - unsigned int uKeyIdx; + int i, ii; + PSKeyItem pKey; + u32 uKeyIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %X\n", dwKeyIndex); if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key - return (FALSE); + return (false); } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) { - return (FALSE); + return (false); } for (i=0; i < MAX_KEY_TABLE-1; i++) { - if (pTable->KeyTable[i].bInUse == TRUE) { + if (pTable->KeyTable[i].bInUse == true) { // found table already exist // Group key pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF]); @@ -833,7 +793,7 @@ BOOL KeybSetAllGroupKey( pTable->KeyTable[i].wKeyCtl |= 0x8000; // enable on-fly - pKey->bKeyValid = TRUE; + pKey->bKeyValid = true; pKey->uKeyLength = uKeyLength; pKey->dwKeyIndex = dwKeyIndex; pKey->byCipherSuite = byKeyDecMode; @@ -847,13 +807,11 @@ BOOL KeybSetAllGroupKey( MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pTable->KeyTable[i].abyBSSID, (PDWORD) pKey->abyKey); - if ((dwKeyIndex & USE_KEYRSC) == 0) { - // RSC set by NIC - memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); - } - else { - memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); - } + if ((dwKeyIndex & USE_KEYRSC) == 0) + pKey->KeyRSC = 0; /* RSC set by NIC */ + else + pKey->KeyRSC = *KeyRSC; + pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; @@ -870,7 +828,7 @@ BOOL KeybSetAllGroupKey( //DBG_PRN_GRP12(("pKey->wTSC15_0: %X\n ", pKey->wTSC15_0)); //DBG_PRN_GRP12(("pKey->dwKeyIndex: %lX\n ", pKey->dwKeyIndex)); - } // (pTable->KeyTable[i].bInUse == TRUE) + } // (pTable->KeyTable[i].bInUse == true) } - return (TRUE); + return (true); } diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h index bd35d39621ae..7ecddcd6bcfa 100644 --- a/drivers/staging/vt6656/key.h +++ b/drivers/staging/vt6656/key.h @@ -57,10 +57,10 @@ typedef struct tagSKeyItem { - BOOL bKeyValid; + bool bKeyValid; u32 uKeyLength; BYTE abyKey[MAX_KEY_LEN]; - QWORD KeyRSC; + u64 KeyRSC; DWORD dwTSC47_16; WORD wTSC15_0; BYTE byCipherSuite; @@ -76,9 +76,9 @@ typedef struct tagSKeyTable SKeyItem PairwiseKey; SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328 DWORD dwGTKeyIndex; // GroupTransmitKey Index - BOOL bInUse; + bool bInUse; WORD wKeyCtl; - BOOL bSoftWEP; + bool bSoftWEP; BYTE byReserved1[6]; } SKeyTable, *PSKeyTable; //352 @@ -97,69 +97,37 @@ typedef struct tagSKeyManagement /*--------------------- Export Functions --------------------------*/ -void KeyvInitTable(void *pDeviceHandler, PSKeyManagement pTable); - -BOOL KeybGetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, - PSKeyItem *pKey); - -BOOL KeybSetKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ); - -BOOL KeybRemoveKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID, - DWORD dwKeyIndex - ); - -BOOL KeybRemoveAllKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID - ); - -void KeyvRemoveWEPKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex - ); - -void KeyvRemoveAllWEPKey( - void *pDeviceHandler, - PSKeyManagement pTable - ); - -BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, - PSKeyItem *pKey); - -BOOL KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey); - -BOOL KeybSetDefaultKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ); - -BOOL KeybSetAllGroupKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ); +void KeyvInitTable(struct vnt_private *, PSKeyManagement pTable); + +int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, + PSKeyItem *pKey); + +int KeybSetKey(struct vnt_private *, PSKeyManagement pTable, u8 *pbyBSSID, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode); + +int KeybRemoveKey(struct vnt_private *, PSKeyManagement pTable, + u8 *pbyBSSID, u32 dwKeyIndex); + +int KeybRemoveAllKey(struct vnt_private *, PSKeyManagement pTable, + u8 *pbyBSSID); + +void KeyvRemoveWEPKey(struct vnt_private *, PSKeyManagement pTable, + u32 dwKeyIndex); + +void KeyvRemoveAllWEPKey(struct vnt_private *, PSKeyManagement pTable); + +int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, + PSKeyItem *pKey); + +int KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey); + +int KeybSetDefaultKey(struct vnt_private *, PSKeyManagement pTable, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode); + +int KeybSetAllGroupKey(struct vnt_private *, PSKeyManagement pTable, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode); #endif /* __KEY_H__ */ diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 8fddc7b3930b..76d307b58d52 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -68,11 +68,11 @@ static int msglevel =MSG_LEVEL_INFO; * Return Value: none * */ -void MACvSetMultiAddrByHash (PSDevice pDevice, BYTE byHashIdx) +void MACvSetMultiAddrByHash(struct vnt_private *pDevice, u8 byHashIdx) { - unsigned int uByteIdx; - BYTE byBitMask; - BYTE pbyData[2]; + u8 uByteIdx; + u8 byBitMask; + u8 pbyData[2]; // calculate byte position @@ -110,9 +110,9 @@ void MACvSetMultiAddrByHash (PSDevice pDevice, BYTE byHashIdx) * Return Value: none * */ -void MACvWriteMultiAddr(PSDevice pDevice, unsigned int uByteIdx, BYTE byData) +void MACvWriteMultiAddr(struct vnt_private *pDevice, u32 uByteIdx, u8 byData) { - BYTE byData1; + u8 byData1; byData1 = byData; CONTROLnsRequestOut(pDevice, @@ -135,7 +135,7 @@ void MACvWriteMultiAddr(PSDevice pDevice, unsigned int uByteIdx, BYTE byData) * * */ -void MACbShutdown(PSDevice pDevice) +void MACbShutdown(struct vnt_private *pDevice) { CONTROLnsRequestOutAsyn(pDevice, MESSAGE_TYPE_MACSHUTDOWN, @@ -146,9 +146,9 @@ void MACbShutdown(PSDevice pDevice) ); } -void MACvSetBBType(PSDevice pDevice,BYTE byType) +void MACvSetBBType(struct vnt_private *pDevice, u8 byType) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = byType; @@ -163,9 +163,9 @@ BYTE pbyData[2]; ); } -void MACvSetMISCFifo (PSDevice pDevice, WORD wOffset, DWORD dwData) +void MACvSetMISCFifo(struct vnt_private *pDevice, u16 wOffset, u32 dwData) { -BYTE pbyData[4]; + u8 pbyData[4]; if (wOffset > 273) return; @@ -197,10 +197,10 @@ BYTE pbyData[4]; * Return Value: none * */ -void MACvDisableKeyEntry(PSDevice pDevice, unsigned int uEntryIdx) +void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) { -WORD wOffset; -BYTE byData; + u16 wOffset; + u8 byData; byData = (BYTE) uEntryIdx; @@ -237,20 +237,18 @@ BYTE byData; * Return Value: none * */ -void MACvSetKeyEntry(PSDevice pDevice, WORD wKeyCtl, - unsigned int uEntryIdx, unsigned int uKeyIdx, - PBYTE pbyAddr, PDWORD pdwKey) +void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, + u32 uKeyIdx, u8 *pbyAddr, u32 *pdwKey) { -PBYTE pbyKey; -WORD wOffset; -DWORD dwData1,dwData2; -int ii; -BYTE pbyData[24]; - - if ( pDevice->byLocalID <= MAC_REVISION_A1 ) { - if ( pDevice->sMgmtObj.byCSSPK == KEY_CTL_CCMP ) - return; - } + u8 *pbyKey; + u16 wOffset; + u32 dwData1, dwData2; + int ii; + u8 pbyData[24]; + + if (pDevice->byLocalID <= MAC_REVISION_A1) + if (pDevice->vnt_mgmt.byCSSPK == KEY_CTL_CCMP) + return; wOffset = MISCFIFO_KEYETRY0; wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); @@ -321,9 +319,9 @@ BYTE pbyData[24]; } -void MACvRegBitsOff(PSDevice pDevice, BYTE byRegOfs, BYTE byBits) +void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = 0; pbyData[1] = byBits; @@ -338,9 +336,9 @@ BYTE pbyData[2]; } -void MACvRegBitsOn(PSDevice pDevice, BYTE byRegOfs, BYTE byBits) +void MACvRegBitsOn(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = byBits; @@ -355,9 +353,9 @@ BYTE pbyData[2]; ); } -void MACvWriteWord(PSDevice pDevice, BYTE byRegOfs, WORD wData) +void MACvWriteWord(struct vnt_private *pDevice, u8 byRegOfs, u16 wData) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = (BYTE)(wData & 0xff); @@ -373,9 +371,9 @@ BYTE pbyData[2]; } -void MACvWriteBSSIDAddress(PSDevice pDevice, PBYTE pbyEtherAddr) +void MACvWriteBSSIDAddress(struct vnt_private *pDevice, u8 *pbyEtherAddr) { -BYTE pbyData[6]; + u8 pbyData[6]; pbyData[0] = *((PBYTE)pbyEtherAddr); @@ -394,9 +392,9 @@ BYTE pbyData[6]; ); } -void MACvEnableProtectMD(PSDevice pDevice) +void MACvEnableProtectMD(struct vnt_private *pDevice) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = EnCFG_ProtectMd; @@ -411,9 +409,9 @@ BYTE pbyData[2]; ); } -void MACvDisableProtectMD(PSDevice pDevice) +void MACvDisableProtectMD(struct vnt_private *pDevice) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = 0; @@ -428,9 +426,9 @@ BYTE pbyData[2]; ); } -void MACvEnableBarkerPreambleMd(PSDevice pDevice) +void MACvEnableBarkerPreambleMd(struct vnt_private *pDevice) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = EnCFG_BarkerPream; @@ -445,9 +443,9 @@ BYTE pbyData[2]; ); } -void MACvDisableBarkerPreambleMd(PSDevice pDevice) +void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = 0; @@ -463,12 +461,12 @@ BYTE pbyData[2]; } -void MACvWriteBeaconInterval(PSDevice pDevice, WORD wInterval) +void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval) { -BYTE pbyData[2]; + u8 pbyData[2]; - pbyData[0] = (BYTE) (wInterval & 0xff); - pbyData[1] = (BYTE) (wInterval >> 8); + pbyData[0] = (u8)(wInterval & 0xff); + pbyData[1] = (u8)(wInterval >> 8); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h index 147ac50218d3..6e28500ae5f8 100644 --- a/drivers/staging/vt6656/mac.h +++ b/drivers/staging/vt6656/mac.h @@ -420,24 +420,21 @@ /*--------------------- Export Functions --------------------------*/ -void MACvSetMultiAddrByHash(PSDevice pDevice, BYTE byHashIdx); -void MACvWriteMultiAddr(PSDevice pDevice, unsigned int uByteIdx, BYTE byData); -void MACbShutdown(PSDevice pDevice); -void MACvSetBBType(PSDevice pDevice, BYTE byType); -void MACvSetMISCFifo(PSDevice pDevice, WORD wOffset, DWORD dwData); -void MACvDisableKeyEntry(PSDevice pDevice, unsigned int uEntryIdx); -void MACvSetKeyEntry(PSDevice pDevice, WORD wKeyCtl, unsigned int uEntryIdx, - unsigned int uKeyIdx, PBYTE pbyAddr, PDWORD pdwKey); - -void MACvRegBitsOff(PSDevice pDevice, BYTE byRegOfs, BYTE byBits); -void MACvRegBitsOn(PSDevice pDevice, BYTE byRegOfs, BYTE byBits); -void MACvWriteWord(PSDevice pDevice, BYTE byRegOfs, WORD wData); - -void MACvWriteBSSIDAddress(PSDevice pDevice, PBYTE pbyEtherAddr); -void MACvEnableProtectMD(PSDevice pDevice); -void MACvDisableProtectMD(PSDevice pDevice); -void MACvEnableBarkerPreambleMd(PSDevice pDevice); -void MACvDisableBarkerPreambleMd(PSDevice pDevice); -void MACvWriteBeaconInterval(PSDevice pDevice, WORD wInterval); +void MACvSetMultiAddrByHash(struct vnt_private *, u8); +void MACvWriteMultiAddr(struct vnt_private *, u32, u8); +void MACbShutdown(struct vnt_private *); +void MACvSetBBType(struct vnt_private *, u8); +void MACvSetMISCFifo(struct vnt_private *pDevice, u16, u32); +void MACvDisableKeyEntry(struct vnt_private *, u32); +void MACvSetKeyEntry(struct vnt_private *, u16, u32, u32, u8 *, u32 *); +void MACvRegBitsOff(struct vnt_private *, u8, u8); +void MACvRegBitsOn(struct vnt_private *, u8, u8); +void MACvWriteWord(struct vnt_private *, u8, u16); +void MACvWriteBSSIDAddress(struct vnt_private *, u8 *); +void MACvEnableProtectMD(struct vnt_private *); +void MACvDisableProtectMD(struct vnt_private *); +void MACvEnableBarkerPreambleMd(struct vnt_private *); +void MACvDisableBarkerPreambleMd(struct vnt_private *); +void MACvWriteBeaconInterval(struct vnt_private *, u16); #endif /* __MAC_H__ */ diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index f33086d66496..d5f53e1a74a2 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -73,15 +73,16 @@ #include "iowpa.h" /*--------------------- Static Definitions -------------------------*/ -//static int msglevel =MSG_LEVEL_DEBUG; +/* static int msglevel = MSG_LEVEL_DEBUG; */ static int msglevel =MSG_LEVEL_INFO; -// -// Define module options -// +/* + * define module options + */ -// Version Information -#define DRIVER_AUTHOR "VIA Networking Technologies, Inc., <lyndonchen@vntek.com.tw>" +/* version information */ +#define DRIVER_AUTHOR \ + "VIA Networking Technologies, Inc., <lyndonchen@vntek.com.tw>" MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); @@ -184,16 +185,16 @@ DEVICE_PARAM(BasebandType, "baseband type"); DEVICE_PARAM(b80211hEnable, "802.11h mode"); -// -// Static vars definitions -// +/* + * Static vars definitions + */ static struct usb_device_id vt6656_table[] = { {USB_DEVICE(VNT_USB_VENDOR_ID, VNT_USB_PRODUCT_ID)}, {} }; -// Frequency list (map channels to frequencies) +/* frequency list (map channels to frequencies) */ /* static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, @@ -225,26 +226,27 @@ static void device_set_multi(struct net_device *dev); static int device_close(struct net_device *dev); static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType); -static BOOL device_init_defrag_cb(PSDevice pDevice); -static void device_init_diversity_timer(PSDevice pDevice); +static int device_init_registers(struct vnt_private *pDevice, + DEVICE_INIT_TYPE InitType); +static bool device_init_defrag_cb(struct vnt_private *pDevice); +static void device_init_diversity_timer(struct vnt_private *pDevice); static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev); static int ethtool_ioctl(struct net_device *dev, void *useraddr); -static void device_free_tx_bufs(PSDevice pDevice); -static void device_free_rx_bufs(PSDevice pDevice); -static void device_free_int_bufs(PSDevice pDevice); -static void device_free_frag_bufs(PSDevice pDevice); -static BOOL device_alloc_bufs(PSDevice pDevice); - -static int Read_config_file(PSDevice pDevice); -static unsigned char *Config_FileOperation(PSDevice pDevice); +static void device_free_tx_bufs(struct vnt_private *pDevice); +static void device_free_rx_bufs(struct vnt_private *pDevice); +static void device_free_int_bufs(struct vnt_private *pDevice); +static void device_free_frag_bufs(struct vnt_private *pDevice); +static bool device_alloc_bufs(struct vnt_private *pDevice); + +static int Read_config_file(struct vnt_private *pDevice); +static unsigned char *Config_FileOperation(struct vnt_private *pDevice); static int Config_FileGetParameter(unsigned char *string, unsigned char *dest, unsigned char *source); -static void usb_device_reset(PSDevice pDevice); +static void usb_device_reset(struct vnt_private *pDevice); @@ -254,7 +256,7 @@ static void usb_device_reset(PSDevice pDevice); static void -device_set_options(PSDevice pDevice) { +device_set_options(struct vnt_private *pDevice) { BYTE abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; BYTE abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; @@ -277,22 +279,22 @@ device_set_options(PSDevice pDevice) { pDevice->b11hEnable = X80211h_MODE_DEF; pDevice->eOPMode = OP_MODE_DEF; pDevice->uConnectionRate = DATA_RATE_DEF; - if (pDevice->uConnectionRate < RATE_AUTO) pDevice->bFixRate = TRUE; + if (pDevice->uConnectionRate < RATE_AUTO) pDevice->bFixRate = true; pDevice->byBBType = BBP_TYPE_DEF; pDevice->byPacketType = pDevice->byBBType; pDevice->byAutoFBCtrl = AUTO_FB_0; - pDevice->bUpdateBBVGA = TRUE; + pDevice->bUpdateBBVGA = true; pDevice->byFOETuning = 0; pDevice->byAutoPwrTunning = 0; pDevice->wCTSDuration = 0; pDevice->byPreambleType = 0; - pDevice->bExistSWNetAddr = FALSE; -// pDevice->bDiversityRegCtlON = TRUE; - pDevice->bDiversityRegCtlON = FALSE; + pDevice->bExistSWNetAddr = false; + /* pDevice->bDiversityRegCtlON = true; */ + pDevice->bDiversityRegCtlON = false; } -static void device_init_diversity_timer(PSDevice pDevice) +static void device_init_diversity_timer(struct vnt_private *pDevice) { init_timer(&pDevice->TimerSQ3Tmax1); pDevice->TimerSQ3Tmax1.data = (unsigned long)pDevice; @@ -313,25 +315,25 @@ static void device_init_diversity_timer(PSDevice pDevice) } -// -// Initialization of MAC & BBP registers -// +/* + * initialization of MAC & BBP registers + */ -static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) +static int device_init_registers(struct vnt_private *pDevice, + DEVICE_INIT_TYPE InitType) { - u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - u8 abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; - u8 abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; - BYTE byAntenna; - unsigned int ii; - CMD_CARD_INIT sInitCmd; - int ntStatus = STATUS_SUCCESS; - RSP_CARD_INIT sInitRsp; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - BYTE byTmp; - BYTE byCalibTXIQ = 0; - BYTE byCalibTXDC = 0; - BYTE byCalibRXIQ = 0; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + u8 abySNAP_RFC1042[ETH_ALEN] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; + u8 abySNAP_Bridgetunnel[ETH_ALEN] + = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8}; + u8 byAntenna; + int ii; + CMD_CARD_INIT sInitCmd; + int ntStatus = STATUS_SUCCESS; + RSP_CARD_INIT sInitRsp; + u8 byTmp; + u8 byCalibTXIQ = 0, byCalibTXDC = 0, byCalibRXIQ = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", InitType, pDevice->byPacketType); spin_lock_irq(&pDevice->lock); @@ -343,24 +345,24 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) ETH_ALEN); if ( !FIRMWAREbCheckVersion(pDevice) ) { - if (FIRMWAREbDownload(pDevice) == TRUE) { - if (FIRMWAREbBrach2Sram(pDevice) == FALSE) { + if (FIRMWAREbDownload(pDevice) == true) { + if (FIRMWAREbBrach2Sram(pDevice) == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" FIRMWAREbBrach2Sram fail \n"); spin_unlock_irq(&pDevice->lock); - return FALSE; + return false; } } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" FIRMWAREbDownload fail \n"); spin_unlock_irq(&pDevice->lock); - return FALSE; + return false; } } if ( !BBbVT3184Init(pDevice) ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" BBbVT3184Init fail \n"); spin_unlock_irq(&pDevice->lock); - return FALSE; + return false; } } @@ -371,7 +373,7 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) sInitCmd.byShortRetryLimit = pDevice->byShortRetryLimit; sInitCmd.byLongRetryLimit = pDevice->byLongRetryLimit; - //issue Card_init command to device + /* issue card_init command to device */ ntStatus = CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_CARDINIT, 0, @@ -382,7 +384,7 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) if ( ntStatus != STATUS_SUCCESS ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Issue Card init fail \n"); spin_unlock_irq(&pDevice->lock); - return FALSE; + return false; } if (InitType == DEVICE_INIT_COLD) { @@ -391,10 +393,10 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) if (ntStatus != STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Cardinit request in status fail!\n"); spin_unlock_irq(&pDevice->lock); - return FALSE; + return false; } - //Local ID for AES functions + /* local ID for AES functions */ ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, MAC_REG_LOCALID, @@ -404,15 +406,17 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) if ( ntStatus != STATUS_SUCCESS ) { spin_unlock_irq(&pDevice->lock); - return FALSE; + return false; } - // Do MACbSoftwareReset in MACvInitialize - // force CCK - pDevice->bCCK = TRUE; - pDevice->bProtectMode = FALSE; //Only used in 11g type, sync with ERP IE - pDevice->bNonERPPresent = FALSE; - pDevice->bBarkerPreambleMd = FALSE; + /* do MACbSoftwareReset in MACvInitialize */ + + /* force CCK */ + pDevice->bCCK = true; + pDevice->bProtectMode = false; + /* only used in 11g type, sync with ERP IE */ + pDevice->bNonERPPresent = false; + pDevice->bBarkerPreambleMd = false; if ( pDevice->bFixRate ) { pDevice->wCurrentRate = (WORD) pDevice->uConnectionRate; } else { @@ -426,13 +430,14 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->byTopOFDMBasicRate = RATE_24M; pDevice->byTopCCKBasicRate = RATE_1M; - pDevice->byRevId = 0; //Target to IF pin while programming to RF chip. + pDevice->byRevId = 0; + /* target to IF pin while programming to RF chip */ pDevice->byCurPwr = 0xFF; pDevice->byCCKPwr = pDevice->abyEEPROM[EEP_OFS_PWR_CCK]; pDevice->byOFDMPwrG = pDevice->abyEEPROM[EEP_OFS_PWR_OFDMG]; - // Load power Table - for (ii=0;ii<14;ii++) { + /* load power table */ + for (ii = 0; ii < 14; ii++) { pDevice->abyCCKPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_CCK_PWR_TBL]; if (pDevice->abyCCKPwrTbl[ii] == 0) pDevice->abyCCKPwrTbl[ii] = pDevice->byCCKPwr; @@ -441,8 +446,10 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->abyOFDMPwrTbl[ii] = pDevice->byOFDMPwrG; } - //original zonetype is USA,but customize zonetype is europe, - // then need recover 12,13 ,14 channel with 11 channel + /* + * original zonetype is USA, but custom zonetype is Europe, + * then need to recover 12, 13, 14 channels with 11 channel + */ if(((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) || (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe))&& (pDevice->byOriginalZonetype == ZoneType_USA)) { @@ -452,25 +459,24 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) } } - //{{ RobertYu: 20041124 - pDevice->byOFDMPwrA = 0x34; // same as RFbMA2829SelectChannel - // Load OFDM A Power Table - for (ii=0;ii<CB_MAX_CHANNEL_5G;ii++) { //RobertYu:20041224, bug using CB_MAX_CHANNEL + pDevice->byOFDMPwrA = 0x34; /* same as RFbMA2829SelectChannel */ + + /* load OFDM A power table */ + for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { pDevice->abyOFDMAPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_OFDMA_PWR_TBL]; if (pDevice->abyOFDMAPwrTbl[ii] == 0) pDevice->abyOFDMAPwrTbl[ii] = pDevice->byOFDMPwrA; } - //}} RobertYu byAntenna = pDevice->abyEEPROM[EEP_OFS_ANTENNA]; if (byAntenna & EEP_ANTINV) - pDevice->bTxRxAntInv = TRUE; + pDevice->bTxRxAntInv = true; else - pDevice->bTxRxAntInv = FALSE; + pDevice->bTxRxAntInv = false; byAntenna &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); - if (byAntenna == 0) // if not set default is All + if (byAntenna == 0) /* if not set default is both */ byAntenna = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); if (byAntenna == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) { @@ -478,29 +484,29 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->byTxAntennaMode = ANT_B; pDevice->dwTxAntennaSel = 1; pDevice->dwRxAntennaSel = 1; - if (pDevice->bTxRxAntInv == TRUE) + if (pDevice->bTxRxAntInv == true) pDevice->byRxAntennaMode = ANT_A; else pDevice->byRxAntennaMode = ANT_B; if (pDevice->bDiversityRegCtlON) - pDevice->bDiversityEnable = TRUE; + pDevice->bDiversityEnable = true; else - pDevice->bDiversityEnable = FALSE; + pDevice->bDiversityEnable = false; } else { - pDevice->bDiversityEnable = FALSE; + pDevice->bDiversityEnable = false; pDevice->byAntennaCount = 1; pDevice->dwTxAntennaSel = 0; pDevice->dwRxAntennaSel = 0; if (byAntenna & EEP_ANTENNA_AUX) { pDevice->byTxAntennaMode = ANT_A; - if (pDevice->bTxRxAntInv == TRUE) + if (pDevice->bTxRxAntInv == true) pDevice->byRxAntennaMode = ANT_B; else pDevice->byRxAntennaMode = ANT_A; } else { pDevice->byTxAntennaMode = ANT_B; - if (pDevice->bTxRxAntInv == TRUE) + if (pDevice->bTxRxAntInv == true) pDevice->byRxAntennaMode = ANT_A; else pDevice->byRxAntennaMode = ANT_B; @@ -512,35 +518,34 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->byTMax2 = 4; pDevice->ulSQ3TH = 0; pDevice->byTMax3 = 64; - // ----------------------------------------------------------------- - //Get Auto Fall Back Type + /* get Auto Fall Back type */ pDevice->byAutoFBCtrl = AUTO_FB_0; - // Set SCAN Time + /* set SCAN Time */ pDevice->uScanTime = WLAN_SCAN_MINITIME; - // default Auto Mode - //pDevice->NetworkType = Ndis802_11Automode; + /* default Auto Mode */ + /* pDevice->NetworkType = Ndis802_11Automode; */ pDevice->eConfigPHYMode = PHY_TYPE_AUTO; pDevice->byBBType = BB_TYPE_11G; - // initialize BBP registers + /* initialize BBP registers */ pDevice->ulTxPower = 25; - // Get Channel range + /* get channel range */ pDevice->byMinChannel = 1; pDevice->byMaxChannel = CB_MAX_CHANNEL; - // Get RFType + /* get RFType */ pDevice->byRFType = sInitRsp.byRFType; if ((pDevice->byRFType & RF_EMU) != 0) { - // force change RevID for VT3253 emu - pDevice->byRevId = 0x80; + /* force change RevID for VT3253 emu */ + pDevice->byRevId = 0x80; } - // Load EEPROM calibrated vt3266 parameters + /* load vt3266 calibration parameters in EEPROM */ if (pDevice->byRFType == RF_VT3226D0) { if((pDevice->abyEEPROM[EEP_OFS_MAJOR_VER] == 0x1) && (pDevice->abyEEPROM[EEP_OFS_MINOR_VER] >= 0x4)) { @@ -548,13 +553,32 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) byCalibTXDC = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_DC]; byCalibRXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_RX_IQ]; if( (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) ) { - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFF, 0x03); // CR255, Set BB to support TX/RX IQ and DC compensation Mode - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFB, byCalibTXIQ); // CR251, TX I/Q Imbalance Calibration - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFC, byCalibTXDC); // CR252, TX DC-Offset Calibration - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFD, byCalibRXIQ); // CR253, RX I/Q Imbalance Calibration + /* CR255, enable TX/RX IQ and DC compensation mode */ + ControlvWriteByte(pDevice, + MESSAGE_REQUEST_BBREG, + 0xFF, + 0x03); + /* CR251, TX I/Q Imbalance Calibration */ + ControlvWriteByte(pDevice, + MESSAGE_REQUEST_BBREG, + 0xFB, + byCalibTXIQ); + /* CR252, TX DC-Offset Calibration */ + ControlvWriteByte(pDevice, + MESSAGE_REQUEST_BBREG, + 0xFC, + byCalibTXDC); + /* CR253, RX I/Q Imbalance Calibration */ + ControlvWriteByte(pDevice, + MESSAGE_REQUEST_BBREG, + 0xFD, + byCalibRXIQ); } else { - // turn off BB Calibration compensation - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFF, 0x0); // CR255 + /* CR255, turn off BB Calibration compensation */ + ControlvWriteByte(pDevice, + MESSAGE_REQUEST_BBREG, + 0xFF, + 0x0); } } } @@ -563,26 +587,27 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pMgmt->uIBSSChannel = pDevice->uChannel; CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); - // get Permanent network address + /* get permanent network address */ memcpy(pDevice->abyPermanentNetAddr,&(sInitRsp.byNetAddr[0]),6); memcpy(pDevice->abyCurrentNetAddr, pDevice->abyPermanentNetAddr, ETH_ALEN); - // if exist SW network address, use SW network address. - + /* if exist SW network address, use it */ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n", pDevice->abyCurrentNetAddr); } - // Set BB and packet type at the same time. - // Set Short Slot Time, xIFS, and RSPINF. + /* + * set BB and packet type at the same time + * set Short Slot Time, xIFS, and RSPINF + */ if (pDevice->byBBType == BB_TYPE_11A) { CARDbAddBasicRate(pDevice, RATE_6M); - pDevice->bShortSlotTime = TRUE; + pDevice->bShortSlotTime = true; } else { CARDbAddBasicRate(pDevice, RATE_1M); - pDevice->bShortSlotTime = FALSE; + pDevice->bShortSlotTime = false; } BBvSetShortSlotTime(pDevice); CARDvSetBSSMode(pDevice); @@ -594,7 +619,7 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) } pDevice->byRadioCtl = pDevice->abyEEPROM[EEP_OFS_RADIOCTL]; - pDevice->bHWRadioOff = FALSE; + pDevice->bHWRadioOff = false; if ( (pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) != 0 ) { ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, @@ -605,23 +630,23 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) if ( ntStatus != STATUS_SUCCESS ) { spin_unlock_irq(&pDevice->lock); - return FALSE; + return false; } if ( (byTmp & GPIO3_DATA) == 0 ) { - pDevice->bHWRadioOff = TRUE; + pDevice->bHWRadioOff = true; MACvRegBitsOn(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); } else { MACvRegBitsOff(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); - pDevice->bHWRadioOff = FALSE; + pDevice->bHWRadioOff = false; } - } //EEP_RADIOCTL_ENABLE + } ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_TMLEN,0x38); ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); MACvRegBitsOn(pDevice,MAC_REG_GPIOCTL0,0x01); - if ((pDevice->bHWRadioOff == TRUE) || (pDevice->bRadioControlOff == TRUE)) { + if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) { CARDbRadioPowerOff(pDevice); } else { CARDbRadioPowerOn(pDevice); @@ -629,14 +654,14 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) spin_unlock_irq(&pDevice->lock); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----INIbInitAdapter Exit\n"); - return TRUE; + return true; } #ifdef CONFIG_PM /* Minimal support for suspend and resume */ static int vt6656_suspend(struct usb_interface *intf, pm_message_t message) { - PSDevice device = usb_get_intfdata(intf); + struct vnt_private *device = usb_get_intfdata(intf); if (!device || !device->dev) return -ENODEV; @@ -651,7 +676,7 @@ static int vt6656_suspend(struct usb_interface *intf, pm_message_t message) static int vt6656_resume(struct usb_interface *intf) { - PSDevice device = usb_get_intfdata(intf); + struct vnt_private *device = usb_get_intfdata(intf); if (!device || !device->dev) return -ENODEV; @@ -682,13 +707,13 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) struct usb_device *udev = interface_to_usbdev(intf); int rc = 0; struct net_device *netdev = NULL; - PSDevice pDevice = NULL; + struct vnt_private *pDevice; printk(KERN_NOTICE "%s Ver. %s\n", DEVICE_FULL_DRV_NAM, DEVICE_VERSION); printk(KERN_NOTICE "Copyright (c) 2004 VIA Networking Technologies, Inc.\n"); udev = usb_get_dev(udev); - netdev = alloc_etherdev(sizeof(DEVICE_INFO)); + netdev = alloc_etherdev(sizeof(struct vnt_private)); if (!netdev) { printk(KERN_ERR DEVICE_NAME ": allocate net device failed\n"); rc = -ENOMEM; @@ -696,7 +721,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) } pDevice = netdev_priv(netdev); - memset(pDevice, 0, sizeof(DEVICE_INFO)); + memset(pDevice, 0, sizeof(struct vnt_private)); pDevice->dev = netdev; pDevice->usb = udev; @@ -705,7 +730,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) spin_lock_init(&pDevice->lock); pDevice->tx_80211 = device_dma0_tx_80211; - pDevice->sMgmtObj.pAdapter = (void *) pDevice; + pDevice->vnt_mgmt.pAdapter = (void *) pDevice; netdev->netdev_ops = &device_netdev_ops; netdev->wireless_handlers = @@ -732,7 +757,7 @@ err_nomem: return rc; } -static void device_free_tx_bufs(PSDevice pDevice) +static void device_free_tx_bufs(struct vnt_private *pDevice) { PUSB_SEND_CONTEXT pTxContext; int ii; @@ -740,7 +765,7 @@ static void device_free_tx_bufs(PSDevice pDevice) for (ii = 0; ii < pDevice->cbTD; ii++) { pTxContext = pDevice->apTD[ii]; - //de-allocate URBs + /* deallocate URBs */ if (pTxContext->pUrb) { usb_kill_urb(pTxContext->pUrb); usb_free_urb(pTxContext->pUrb); @@ -751,7 +776,7 @@ static void device_free_tx_bufs(PSDevice pDevice) } -static void device_free_rx_bufs(PSDevice pDevice) +static void device_free_rx_bufs(struct vnt_private *pDevice) { PRCB pRCB; int ii; @@ -759,12 +784,12 @@ static void device_free_rx_bufs(PSDevice pDevice) for (ii = 0; ii < pDevice->cbRD; ii++) { pRCB = pDevice->apRCB[ii]; - //de-allocate URBs + /* deallocate URBs */ if (pRCB->pUrb) { usb_kill_urb(pRCB->pUrb); usb_free_urb(pRCB->pUrb); } - //de-allocate skb + /* deallocate skb */ if (pRCB->skb) dev_kfree_skb(pRCB->skb); } @@ -773,7 +798,7 @@ static void device_free_rx_bufs(PSDevice pDevice) return; } -static void usb_device_reset(PSDevice pDevice) +static void usb_device_reset(struct vnt_private *pDevice) { int status; status = usb_reset_device(pDevice->usb); @@ -782,14 +807,15 @@ static void usb_device_reset(PSDevice pDevice) return ; } -static void device_free_int_bufs(PSDevice pDevice) +static void device_free_int_bufs(struct vnt_private *pDevice) { kfree(pDevice->intBuf.pDataBuf); return; } -static BOOL device_alloc_bufs(PSDevice pDevice) { +static bool device_alloc_bufs(struct vnt_private *pDevice) +{ PUSB_SEND_CONTEXT pTxContext; PRCB pRCB; @@ -805,16 +831,16 @@ static BOOL device_alloc_bufs(PSDevice pDevice) { } pDevice->apTD[ii] = pTxContext; pTxContext->pDevice = (void *) pDevice; - //allocate URBs + /* allocate URBs */ pTxContext->pUrb = usb_alloc_urb(0, GFP_ATOMIC); if (pTxContext->pUrb == NULL) { DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "alloc tx urb failed\n"); goto free_tx; } - pTxContext->bBoolInUse = FALSE; + pTxContext->bBoolInUse = false; } - // allocate rcb mem + /* allocate RCB mem */ pDevice->pRCBMem = kzalloc((sizeof(RCB) * pDevice->cbRD), GFP_KERNEL); if (pDevice->pRCBMem == NULL) { DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s : alloc rx usb context failed\n", pDevice->dev->name); @@ -833,7 +859,7 @@ static BOOL device_alloc_bufs(PSDevice pDevice) { pDevice->apRCB[ii] = pRCB; pRCB->pDevice = (void *) pDevice; - //allocate URBs + /* allocate URBs */ pRCB->pUrb = usb_alloc_urb(0, GFP_ATOMIC); if (pRCB->pUrb == NULL) { @@ -846,7 +872,7 @@ static BOOL device_alloc_bufs(PSDevice pDevice) { goto free_rx_tx; } pRCB->skb->dev = pDevice->dev; - pRCB->bBoolInUse = FALSE; + pRCB->bBoolInUse = false; EnqueueRCB(pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList, pRCB); pDevice->NumRecvFreeList++; pRCB++; @@ -874,7 +900,7 @@ static BOOL device_alloc_bufs(PSDevice pDevice) { goto free_rx_tx; } - return TRUE; + return true; free_rx_tx: device_free_rx_bufs(pDevice); @@ -882,15 +908,16 @@ free_rx_tx: free_tx: device_free_tx_bufs(pDevice); - return FALSE; + return false; } -static BOOL device_init_defrag_cb(PSDevice pDevice) { - int i; - PSDeFragControlBlock pDeF; +static bool device_init_defrag_cb(struct vnt_private *pDevice) +{ + int i; + PSDeFragControlBlock pDeF; /* Init the fragment ctl entries */ for (i = 0; i < CB_MAX_RX_FRAG; i++) { @@ -903,18 +930,19 @@ static BOOL device_init_defrag_cb(PSDevice pDevice) { } pDevice->cbDFCB = CB_MAX_RX_FRAG; pDevice->cbFreeDFCB = pDevice->cbDFCB; - return TRUE; + return true; free_frag: device_free_frag_bufs(pDevice); - return FALSE; + return false; } -static void device_free_frag_bufs(PSDevice pDevice) { - PSDeFragControlBlock pDeF; - int i; +static void device_free_frag_bufs(struct vnt_private *pDevice) +{ + PSDeFragControlBlock pDeF; + int i; for (i = 0; i < CB_MAX_RX_FRAG; i++) { @@ -927,36 +955,39 @@ static void device_free_frag_bufs(PSDevice pDevice) { -BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) { +int device_alloc_frag_buf(struct vnt_private *pDevice, + PSDeFragControlBlock pDeF) +{ pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); if (pDeF->skb == NULL) - return FALSE; + return false; ASSERT(pDeF->skb); pDeF->skb->dev = pDevice->dev; - return TRUE; + return true; } /*-----------------------------------------------------------------*/ -static int device_open(struct net_device *dev) { - PSDevice pDevice=(PSDevice) netdev_priv(dev); +static int device_open(struct net_device *dev) +{ + struct vnt_private *pDevice = netdev_priv(dev); - pDevice->fWPA_Authened = FALSE; + pDevice->fWPA_Authened = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_open...\n"); pDevice->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS; - if (device_alloc_bufs(pDevice) == FALSE) { + if (device_alloc_bufs(pDevice) == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_alloc_bufs fail... \n"); return -ENOMEM; } - if (device_init_defrag_cb(pDevice)== FALSE) { + if (device_init_defrag_cb(pDevice)== false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Initial defragment cb fail \n"); goto free_rx_tx; } @@ -967,25 +998,26 @@ static int device_open(struct net_device *dev) { MP_SET_FLAG(pDevice, fMP_POST_READS); MP_SET_FLAG(pDevice, fMP_POST_WRITES); - //read config file + /* read config file */ Read_config_file(pDevice); - if (device_init_registers(pDevice, DEVICE_INIT_COLD) == FALSE) { + if (device_init_registers(pDevice, DEVICE_INIT_COLD) == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " init register fail\n"); goto free_all; } device_set_multi(pDevice->dev); - // Init for Key Management + /* init for key management */ KeyvInitTable(pDevice,&pDevice->sKey); - memcpy(pDevice->sMgmtObj.abyMACAddr, pDevice->abyCurrentNetAddr, ETH_ALEN); + memcpy(pDevice->vnt_mgmt.abyMACAddr, + pDevice->abyCurrentNetAddr, ETH_ALEN); memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, ETH_ALEN); - pDevice->bStopTx0Pkt = FALSE; - pDevice->bStopDataPkt = FALSE; - pDevice->bRoaming = FALSE; - pDevice->bIsRoaming = FALSE; - pDevice->bEnableRoaming = FALSE; + pDevice->bStopTx0Pkt = false; + pDevice->bStopDataPkt = false; + pDevice->bRoaming = false; + pDevice->bIsRoaming = false; + pDevice->bEnableRoaming = false; if (pDevice->bDiversityRegCtlON) { device_init_diversity_timer(pDevice); } @@ -994,27 +1026,27 @@ static int device_open(struct net_device *dev) { tasklet_init(&pDevice->RxMngWorkItem, (void *)RXvMngWorkItem, (unsigned long)pDevice); tasklet_init(&pDevice->ReadWorkItem, (void *)RXvWorkItem, (unsigned long)pDevice); tasklet_init(&pDevice->EventWorkItem, (void *)INTvWorkItem, (unsigned long)pDevice); - add_timer(&(pDevice->sMgmtObj.sTimerSecondCallback)); - pDevice->int_interval = 100; //Max 100 microframes. + add_timer(&pDevice->vnt_mgmt.sTimerSecondCallback); + pDevice->int_interval = 100; /* max 100 microframes */ pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; - pDevice->bIsRxWorkItemQueued = TRUE; - pDevice->fKillEventPollingThread = FALSE; - pDevice->bEventAvailable = FALSE; + pDevice->bIsRxWorkItemQueued = true; + pDevice->fKillEventPollingThread = false; + pDevice->bEventAvailable = false; - pDevice->bWPADEVUp = FALSE; - pDevice->bwextstep0 = FALSE; - pDevice->bwextstep1 = FALSE; - pDevice->bwextstep2 = FALSE; - pDevice->bwextstep3 = FALSE; - pDevice->bWPASuppWextEnabled = FALSE; + pDevice->bWPADEVUp = false; + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = false; + pDevice->bWPASuppWextEnabled = false; pDevice->byReAssocCount = 0; RXvWorkItem(pDevice); INTvWorkItem(pDevice); - // Patch: if WEP key already set by iwconfig but device not yet open - if ((pDevice->bEncryptionEnable == TRUE) && (pDevice->bTransmitKey == TRUE)) { + /* if WEP key already set by iwconfig but device not yet open */ + if ((pDevice->bEncryptionEnable == true) && (pDevice->bTransmitKey == true)) { spin_lock_irq(&pDevice->lock); KeybSetDefaultKey( pDevice, &(pDevice->sKey), @@ -1028,14 +1060,10 @@ static int device_open(struct net_device *dev) { pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; } - if (pDevice->sMgmtObj.eConfigMode == WMAC_CONFIG_AP) { + if (pDevice->vnt_mgmt.eConfigMode == WMAC_CONFIG_AP) bScheduleCommand((void *) pDevice, WLAN_CMD_RUN_AP, NULL); - } - else { - //mike:mark@2008-11-10 - bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); - /* bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL); */ - } + else + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); netif_stop_queue(pDevice->dev); @@ -1061,13 +1089,13 @@ free_rx_tx: -static int device_close(struct net_device *dev) { - PSDevice pDevice=(PSDevice) netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - - int uu; +static int device_close(struct net_device *dev) +{ + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int uu; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close1 \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close1\n"); if (pDevice == NULL) return -ENODEV; @@ -1078,22 +1106,22 @@ static int device_close(struct net_device *dev) { memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - pMgmt->bShareKeyAlgorithm = FALSE; - pDevice->bEncryptionEnable = FALSE; + pMgmt->bShareKeyAlgorithm = false; + pDevice->bEncryptionEnable = false; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; spin_lock_irq(&pDevice->lock); for (uu = 0; uu < MAX_KEY_TABLE; uu++) MACvDisableKeyEntry(pDevice,uu); spin_unlock_irq(&pDevice->lock); - if ((pDevice->flags & DEVICE_FLAGS_UNPLUG) == FALSE) { + if ((pDevice->flags & DEVICE_FLAGS_UNPLUG) == false) { MACbShutdown(pDevice); } netif_stop_queue(pDevice->dev); MP_SET_FLAG(pDevice, fMP_DISCONNECTED); MP_CLEAR_FLAG(pDevice, fMP_POST_WRITES); MP_CLEAR_FLAG(pDevice, fMP_POST_READS); - pDevice->fKillEventPollingThread = TRUE; + pDevice->fKillEventPollingThread = true; del_timer(&pDevice->sTimerCommand); del_timer(&pMgmt->sTimerSecondCallback); @@ -1108,11 +1136,11 @@ static int device_close(struct net_device *dev) { tasklet_kill(&pDevice->ReadWorkItem); tasklet_kill(&pDevice->EventWorkItem); - pDevice->bRoaming = FALSE; - pDevice->bIsRoaming = FALSE; - pDevice->bEnableRoaming = FALSE; - pDevice->bCmdRunning = FALSE; - pDevice->bLinkPass = FALSE; + pDevice->bRoaming = false; + pDevice->bIsRoaming = false; + pDevice->bEnableRoaming = false; + pDevice->bCmdRunning = false; + pDevice->bLinkPass = false; memset(pMgmt->abyCurrBSSID, 0, 6); pMgmt->eCurrState = WMAC_STATE_IDLE; @@ -1136,7 +1164,7 @@ static int device_close(struct net_device *dev) { static void vt6656_disconnect(struct usb_interface *intf) { - PSDevice device = usb_get_intfdata(intf); + struct vnt_private *device = usb_get_intfdata(intf); if (!device) return; @@ -1156,7 +1184,7 @@ static void vt6656_disconnect(struct usb_interface *intf) static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); spin_lock_irq(&pDevice->lock); @@ -1172,7 +1200,7 @@ static int device_dma0_tx_80211(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); + struct vnt_private *pDevice = netdev_priv(dev); struct net_device_stats *stats = &pDevice->stats; spin_lock_irq(&pDevice->lock); @@ -1217,7 +1245,7 @@ static inline u32 ether_crc(int length, unsigned char *data) return crc; } -//find out the start position of str2 from str1 +/* find out the start position of str2 from str1 */ static unsigned char *kstrstr(const unsigned char *str1, const unsigned char *str2) { int str1_len = strlen(str1); @@ -1246,37 +1274,37 @@ static int Config_FileGetParameter(unsigned char *string, strcat(buf1, "="); source+=strlen(buf1); -//find target string start point + /* find target string start point */ start_p = kstrstr(source,buf1); if (start_p == NULL) - return FALSE; + return false; -//check if current config line is marked by "#" ?? + /* check if current config line is marked by "#" */ for (ii = 1; ; ii++) { if (memcmp(start_p - ii, "\n", 1) == 0) break; if (memcmp(start_p - ii, "#", 1) == 0) - return FALSE; + return false; } -//find target string end point + /* find target string end point */ end_p = kstrstr(start_p,"\n"); - if (end_p == NULL) { //can't find "\n",but don't care - end_p=start_p+strlen(start_p); //no include "\n" - } + if (end_p == NULL) { /* can't find "\n", but don't care */ + end_p = start_p + strlen(start_p); /* no include "\n" */ + } memset(buf2,0,100); - memcpy(buf2,start_p,end_p-start_p); //get the target line + memcpy(buf2, start_p, end_p-start_p); /* get the target line */ buf2[end_p-start_p]='\0'; - //find value + /* find value */ start_p = kstrstr(buf2,"="); if (start_p == NULL) - return FALSE; + return false; memset(buf1,0,100); strcpy(buf1,start_p+1); - //except space + /* except space */ tmp_p = buf1; while(*tmp_p != 0x00) { if(*tmp_p==' ') @@ -1286,29 +1314,22 @@ static int Config_FileGetParameter(unsigned char *string, } memcpy(dest,tmp_p,strlen(tmp_p)); - return TRUE; + return true; } -//if read fail,return NULL,or return data pointer; -static unsigned char *Config_FileOperation(PSDevice pDevice) +/* if read fails, return NULL, or return data pointer */ +static unsigned char *Config_FileOperation(struct vnt_private *pDevice) { unsigned char *config_path = CONFIG_PATH; unsigned char *buffer = NULL; struct file *filp=NULL; mm_segment_t old_fs = get_fs(); - //int oldfsuid=0,oldfsgid=0; + int result = 0; set_fs (KERNEL_DS); - /* Can't do this anymore, so we rely on correct filesystem permissions: - //Make sure a caller can read or write power as root - oldfsuid=current->fsuid; - oldfsgid=current->fsgid; - current->fsuid = 0; - current->fsgid = 0; - */ - - //open file + + /* open file */ filp = filp_open(config_path, O_RDWR, 0); if (IS_ERR(filp)) { printk("Config_FileOperation file Not exist\n"); @@ -1341,11 +1362,6 @@ error1: error2: set_fs (old_fs); - /* - current->fsuid=oldfsuid; - current->fsgid=oldfsgid; - */ - if(result!=0) { kfree(buffer); buffer=NULL; @@ -1353,13 +1369,14 @@ if(result!=0) { return buffer; } -//return --->-1:fail; >=0:successful -static int Read_config_file(PSDevice pDevice) { - int result = 0; - unsigned char tmpbuffer[100]; - unsigned char *buffer = NULL; +/* return --->-1:fail; >=0:successful */ +static int Read_config_file(struct vnt_private *pDevice) +{ + int result = 0; + unsigned char tmpbuffer[100]; + unsigned char *buffer = NULL; - //init config setting + /* init config setting */ pDevice->config_file.ZoneType = -1; pDevice->config_file.eAuthenMode = -1; pDevice->config_file.eEncryptionStatus = -1; @@ -1370,10 +1387,10 @@ static int Read_config_file(PSDevice pDevice) { return result; } -//get zonetype +/* get zonetype */ { memset(tmpbuffer,0,sizeof(tmpbuffer)); - if(Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer) ==TRUE) { + if(Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer) ==true) { if(memcmp(tmpbuffer,"USA",3)==0) { pDevice->config_file.ZoneType=ZoneType_USA; } @@ -1389,15 +1406,15 @@ static int Read_config_file(PSDevice pDevice) { } } -//get other parameter +/* get other parameter */ { memset(tmpbuffer,0,sizeof(tmpbuffer)); - if(Config_FileGetParameter("AUTHENMODE",tmpbuffer,buffer)==TRUE) { + if(Config_FileGetParameter("AUTHENMODE",tmpbuffer,buffer)==true) { pDevice->config_file.eAuthenMode = (int) simple_strtol(tmpbuffer, NULL, 10); } memset(tmpbuffer,0,sizeof(tmpbuffer)); - if(Config_FileGetParameter("ENCRYPTIONMODE",tmpbuffer,buffer)==TRUE) { + if(Config_FileGetParameter("ENCRYPTIONMODE",tmpbuffer,buffer)==true) { pDevice->config_file.eEncryptionStatus= (int) simple_strtol(tmpbuffer, NULL, 10); } } @@ -1406,15 +1423,16 @@ static int Read_config_file(PSDevice pDevice) { return result; } -static void device_set_multi(struct net_device *dev) { - PSDevice pDevice = (PSDevice) netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - u32 mc_filter[2]; - int ii; - struct netdev_hw_addr *ha; - BYTE pbyData[8] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; - BYTE byTmpMode = 0; - int rc; +static void device_set_multi(struct net_device *dev) +{ + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct netdev_hw_addr *ha; + u32 mc_filter[2]; + int ii; + u8 pbyData[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + u8 byTmpMode = 0; + int rc; spin_lock_irq(&pDevice->lock); @@ -1429,9 +1447,9 @@ static void device_set_multi(struct net_device *dev) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode in= %x\n", pDevice->byRxMode); - if (dev->flags & IFF_PROMISC) { // Set promiscuous. + if (dev->flags & IFF_PROMISC) { /* set promiscuous mode */ DBG_PRT(MSG_LEVEL_ERR,KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name); - // Unconditionally log net taps. + /* unconditionally log net taps */ pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST); } else if ((netdev_mc_count(dev) > pDevice->multicast_limit) || @@ -1460,7 +1478,10 @@ static void device_set_multi(struct net_device *dev) { } if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { - // If AP mode, don't enable RCR_UNICAST. Since hw only compare addr1 with local mac. + /* + * If AP mode, don't enable RCR_UNICAST since HW only compares + * addr1 with local MAC + */ pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST); pDevice->byRxMode &= ~(RCR_UNICAST); } @@ -1472,14 +1493,14 @@ static void device_set_multi(struct net_device *dev) { static struct net_device_stats *device_get_stats(struct net_device *dev) { - PSDevice pDevice=(PSDevice) netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); - return &pDevice->stats; + return &pDevice->stats; } static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iwreq *wrq = (struct iwreq *) rq; int rc = 0; @@ -1524,9 +1545,6 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr) return -EOPNOTSUPP; } - -/*------------------------------------------------------------------*/ - MODULE_DEVICE_TABLE(usb, vt6656_table); static struct usb_driver vt6656_driver = { diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c index ab3a55462056..527c259f6758 100644 --- a/drivers/staging/vt6656/power.c +++ b/drivers/staging/vt6656/power.c @@ -70,12 +70,10 @@ static int msglevel = MSG_LEVEL_INFO; * */ -void PSvEnablePowerSaving(void *hDeviceContext, - WORD wListenInterval) +void PSvEnablePowerSaving(struct vnt_private *pDevice, u16 wListenInterval) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - WORD wAID = pMgmt->wCurrAID | BIT14 | BIT15; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u16 wAID = pMgmt->wCurrAID | BIT14 | BIT15; /* set period of power up before TBTT */ MACvWriteWord(pDevice, MAC_REG_PWBT, C_PWBT); @@ -116,13 +114,13 @@ void PSvEnablePowerSaving(void *hDeviceContext, pMgmt->wCountToWakeUp = 0; } - pDevice->bEnablePSMode = TRUE; + pDevice->bEnablePSMode = true; /* We don't send null pkt in ad hoc mode since beacon will handle this. */ if (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) PSbSendNullPacket(pDevice); - pDevice->bPWBitOn = TRUE; + pDevice->bPWBitOn = true; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable...\n"); } @@ -136,10 +134,8 @@ void PSvEnablePowerSaving(void *hDeviceContext, * */ -void PSvDisablePowerSaving(void *hDeviceContext) +void PSvDisablePowerSaving(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - /* PSMgmtObject pMgmt = &(pDevice->sMgmtObj); */ /* disable power saving hw function */ CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_DISABLE_PS, 0, @@ -150,12 +146,12 @@ void PSvDisablePowerSaving(void *hDeviceContext) /* set always listen beacon */ MACvRegBitsOn(pDevice, MAC_REG_PSCTL, PSCTL_ALBCN); - pDevice->bEnablePSMode = FALSE; + pDevice->bEnablePSMode = false; if (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) PSbSendNullPacket(pDevice); - pDevice->bPWBitOn = FALSE; + pDevice->bPWBitOn = false; } /* @@ -164,38 +160,36 @@ void PSvDisablePowerSaving(void *hDeviceContext) * Consider to power down when no more packets to tx or rx. * * Return Value: - * TRUE, if power down success - * FALSE, if fail + * true, if power down success + * false, if fail */ -BOOL PSbConsiderPowerDown(void *hDeviceContext, - BOOL bCheckRxDMA, - BOOL bCheckCountToWakeUp) +int PSbConsiderPowerDown(struct vnt_private *pDevice, int bCheckRxDMA, + int bCheckCountToWakeUp) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - BYTE byData; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u8 byData; /* check if already in Doze mode */ ControlvReadByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); if ((byData & PSCTL_PS) != 0) - return TRUE; + return true; if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) { /* check if in TIM wake period */ if (pMgmt->bInTIMWake) - return FALSE; + return false; } /* check scan state */ if (pDevice->bCmdRunning) - return FALSE; + return false; /* Tx Burst */ if (pDevice->bPSModeTxBurst) - return FALSE; + return false; /* Froce PSEN on */ MACvRegBitsOn(pDevice, MAC_REG_PSCTL, PSCTL_PSEN); @@ -203,16 +197,16 @@ BOOL PSbConsiderPowerDown(void *hDeviceContext, if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) { if (bCheckCountToWakeUp && (pMgmt->wCountToWakeUp == 0 || pMgmt->wCountToWakeUp == 1)) { - return FALSE; + return false; } } - pDevice->bPSRxBeacon = TRUE; + pDevice->bPSRxBeacon = true; /* no Tx, no Rx isr, now go to Doze */ MACvRegBitsOn(pDevice, MAC_REG_PSCTL, PSCTL_GO2DOZE); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n"); - return TRUE; + return true; } /* @@ -225,15 +219,17 @@ BOOL PSbConsiderPowerDown(void *hDeviceContext, * */ -void PSvSendPSPOLL(void *hDeviceContext) +void PSvSendPSPOLL(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PSTxMgmtPacket pTxPacket = NULL; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_tx_mgmt *pTxPacket = NULL; + + memset(pMgmt->pbyPSPacketPool, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_HDR_ADDR2_LEN); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyPSPacketPool; + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); - memset(pMgmt->pbyPSPacketPool, 0, sizeof(STxMgmtPacket) + WLAN_HDR_ADDR2_LEN); - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool; - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); pTxPacket->p80211Header->sA2.wFrameCtl = cpu_to_le16( ( WLAN_SET_FC_FTYPE(WLAN_TYPE_CTL) | @@ -263,24 +259,25 @@ void PSvSendPSPOLL(void *hDeviceContext) * */ -BOOL PSbSendNullPacket(void *hDeviceContext) +int PSbSendNullPacket(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSTxMgmtPacket pTxPacket = NULL; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_tx_mgmt *pTxPacket = NULL; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; u16 flags = 0; - if (pDevice->bLinkPass == FALSE) - return FALSE; + if (pDevice->bLinkPass == false) + return false; - if ((pDevice->bEnablePSMode == FALSE) && - (pDevice->fTxDataInSleep == FALSE)) { - return FALSE; + if ((pDevice->bEnablePSMode == false) && + (pDevice->fTxDataInSleep == false)) { + return false; } - memset(pMgmt->pbyPSPacketPool, 0, sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN); - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool; - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + memset(pMgmt->pbyPSPacketPool, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_NULLDATA_FR_MAXLEN); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyPSPacketPool; + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); flags = WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) | WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL); @@ -303,9 +300,9 @@ BOOL PSbSendNullPacket(void *hDeviceContext) /* log error if sending failed */ if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet failed !\n"); - return FALSE; + return false; } - return TRUE; + return true; } /* @@ -318,11 +315,10 @@ BOOL PSbSendNullPacket(void *hDeviceContext) * */ -BOOL PSbIsNextTBTTWakeUp(void *hDeviceContext) +int PSbIsNextTBTTWakeUp(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - BOOL bWakeUp = FALSE; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int bWakeUp = false; if (pMgmt->wListenInterval >= 2) { if (pMgmt->wCountToWakeUp == 0) @@ -333,8 +329,8 @@ BOOL PSbIsNextTBTTWakeUp(void *hDeviceContext) if (pMgmt->wCountToWakeUp == 1) { /* Turn on wake up to listen next beacon */ MACvRegBitsOn(pDevice, MAC_REG_PSCTL, PSCTL_LNBCN); - pDevice->bPSRxBeacon = FALSE; - bWakeUp = TRUE; + pDevice->bPSRxBeacon = false; + bWakeUp = true; } else if (!pDevice->bPSRxBeacon) { /* Listen until RxBeacon */ MACvRegBitsOn(pDevice, MAC_REG_PSCTL, PSCTL_LNBCN); diff --git a/drivers/staging/vt6656/power.h b/drivers/staging/vt6656/power.h index 41bffe528b44..879b10c0d42e 100644 --- a/drivers/staging/vt6656/power.h +++ b/drivers/staging/vt6656/power.h @@ -48,14 +48,12 @@ /* PSDevice pDevice */ /* PSDevice hDeviceContext */ -BOOL PSbConsiderPowerDown(void *hDeviceContext, - BOOL bCheckRxDMA, - BOOL bCheckCountToWakeUp); - -void PSvDisablePowerSaving(void *hDeviceContext); -void PSvEnablePowerSaving(void *hDeviceContext, WORD wListenInterval); -void PSvSendPSPOLL(void *hDeviceContext); -BOOL PSbSendNullPacket(void *hDeviceContext); -BOOL PSbIsNextTBTTWakeUp(void *hDeviceContext); +int PSbConsiderPowerDown(struct vnt_private *, int bCheckRxDMA, + int bCheckCountToWakeUp); +void PSvDisablePowerSaving(struct vnt_private *); +void PSvEnablePowerSaving(struct vnt_private *, u16 wListenInterval); +void PSvSendPSPOLL(struct vnt_private *); +int PSbSendNullPacket(struct vnt_private *); +int PSbIsNextTBTTWakeUp(struct vnt_private *); #endif /* __POWER_H__ */ diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index 74c0598e37b7..a415705297b2 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -69,7 +69,7 @@ static int msglevel =MSG_LEVEL_INFO; -BYTE abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { +u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { {0x03, 0xF7, 0x90}, {0x03, 0x33, 0x31}, {0x01, 0xB8, 0x02}, @@ -87,7 +87,7 @@ BYTE abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { {0x00, 0x58, 0x0F} }; -BYTE abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = { +u8 abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x03, 0xF7, 0x90}, // channel = 1, Tf = 2412MHz {0x03, 0xF7, 0x90}, // channel = 2, Tf = 2417MHz {0x03, 0xE7, 0x90}, // channel = 3, Tf = 2422MHz @@ -104,7 +104,7 @@ BYTE abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x03, 0xE7, 0xC0} // channel = 14, Tf = 2412M }; -BYTE abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = { +u8 abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = { {0x03, 0x33, 0x31}, // channel = 1, Tf = 2412MHz {0x0B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz @@ -123,7 +123,7 @@ BYTE abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = { // 40MHz reference frequency // Need to Pull PLLON(PE3) low when writing channel registers through 3-wire. -BYTE abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = { +u8 abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = { {0x20, 0x37, 0x90}, // Channel1 // Need modify for 11a {0x13, 0x33, 0x31}, // Channel1 // Need modify for 11a {0x84, 0x1F, 0xF2}, // Need modify for 11a: 451FE2 @@ -146,7 +146,7 @@ BYTE abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = { {0x1A, 0xBA, 0x8F} // Need modify for 11a: 12BACF }; -BYTE abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = { +u8 abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = { {0x2F, 0xF5, 0x20}, // Channel184 // Need modify for 11b/g {0x00, 0x00, 0x01}, // Channel184 // Need modify for 11b/g {0x45, 0x1F, 0xE2}, // Need modify for 11b/g @@ -165,7 +165,7 @@ BYTE abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = { {0x12, 0xBA, 0xCF} // Need modify for 11b/g }; -BYTE abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = { +u8 abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = { {0x20, 0x37, 0x90}, // channel = 1, Tf = 2412MHz {0x20, 0x37, 0x90}, // channel = 2, Tf = 2417MHz {0x20, 0x37, 0x90}, // channel = 3, Tf = 2422MHz @@ -231,7 +231,7 @@ BYTE abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = { {0x2F, 0xF6, 0x10} // channel = 165, Tf = 5825MHz (56) }; -BYTE abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = { +u8 abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = { {0x13, 0x33, 0x31}, // channel = 1, Tf = 2412MHz {0x1B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz @@ -295,7 +295,7 @@ BYTE abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = { {0x02, 0xAA, 0xB1} // channel = 165, Tf = 5825MHz (56) }; -BYTE abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = { +u8 abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = { {0x7F, 0xD7, 0x84}, // channel = 1, Tf = 2412MHz {0x7F, 0xD7, 0x84}, // channel = 2, Tf = 2417MHz {0x7F, 0xD7, 0x84}, // channel = 3, Tf = 2422MHz @@ -360,7 +360,7 @@ BYTE abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = { }; ///{{RobertYu:20051111 -BYTE abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = { +u8 abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x03, 0xFF, 0x80}, {0x02, 0x82, 0xA1}, {0x03, 0xC6, 0xA2}, @@ -374,7 +374,7 @@ BYTE abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x02, 0x00, 0x2A} }; -BYTE abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { +u8 abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x03, 0xFF, 0x80}, {0x03, 0x02, 0x21}, //RobertYu:20060327 {0x03, 0xC6, 0xA2}, @@ -389,7 +389,7 @@ BYTE abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { }; -BYTE abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { +u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x01, 0x97, 0x83}, // channel = 1, Tf = 2412MHz {0x01, 0x97, 0x83}, // channel = 2, Tf = 2417MHz {0x01, 0x97, 0x93}, // channel = 3, Tf = 2422MHz @@ -406,7 +406,7 @@ BYTE abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x03, 0x37, 0xC3} // channel = 14, Tf = 2484MHz }; -BYTE abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { +u8 abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { {0x02, 0x66, 0x64}, // channel = 1, Tf = 2412MHz {0x03, 0x66, 0x64}, // channel = 2, Tf = 2417MHz {0x00, 0x66, 0x64}, // channel = 3, Tf = 2422MHz @@ -426,7 +426,7 @@ BYTE abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { //{{RobertYu:20060502, TWIF 1.14, LO Current for 11b mode -DWORD dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { +u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz @@ -446,7 +446,7 @@ DWORD dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { //{{RobertYu:20060609 -BYTE abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { // 11b/g mode +u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */ {0x03, 0xFF, 0x80}, //update for mode// {0x02, 0x08, 0x81}, {0x00, 0xC6, 0x02}, @@ -469,7 +469,7 @@ BYTE abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { // 11b/g mode // channel56, 5280MHz 0x00C402 for disable Frac // other channels 0x00C602 -BYTE abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = { +u8 abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = { {0x02, 0x05, 0x03}, // channel = 1, Tf = 2412MHz {0x01, 0x15, 0x03}, // channel = 2, Tf = 2417MHz {0x03, 0xC5, 0x03}, // channel = 3, Tf = 2422MHz @@ -535,7 +535,7 @@ BYTE abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = { {0x00, 0x06, 0x03} // channel = 165, Tf = 5825MHz (56), TBD }; -BYTE abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { +u8 abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { {0x01, 0x99, 0x94}, // channel = 1, Tf = 2412MHz {0x02, 0x44, 0x44}, // channel = 2, Tf = 2417MHz {0x02, 0xEE, 0xE4}, // channel = 3, Tf = 2422MHz @@ -606,7 +606,7 @@ BYTE abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { * -*/ -const DWORD dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { +const u32 dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { 0x04040900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x04041900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x04042900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, @@ -682,7 +682,7 @@ const DWORD dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) -const BYTE RFaby11aChannelIndex[200] = { +const u8 RFaby11aChannelIndex[200] = { // 1 2 3 4 5 6 7 8 9 10 00, 00, 00, 00, 00, 00, 23, 24, 25, 00, // 10 26, 27, 00, 00, 00, 28, 00, 00, 00, 00, // 20 @@ -719,27 +719,23 @@ const BYTE RFaby11aChannelIndex[200] = { * Out: * none * - * Return Value: TRUE if succeeded; FALSE if failed. + * Return Value: true if succeeded; false if failed. * */ -BOOL IFRFbWriteEmbedded (PSDevice pDevice, DWORD dwData) +int IFRFbWriteEmbedded(struct vnt_private *pDevice, u32 dwData) { - BYTE pbyData[4]; + u8 pbyData[4]; - pbyData[0] = (BYTE)dwData; - pbyData[1] = (BYTE)(dwData>>8); - pbyData[2] = (BYTE)(dwData>>16); - pbyData[3] = (BYTE)(dwData>>24); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_IFRF, - 0, - 0, - 4, - pbyData - ); + pbyData[0] = (u8)dwData; + pbyData[1] = (u8)(dwData >> 8); + pbyData[2] = (u8)(dwData >> 16); + pbyData[3] = (u8)(dwData >> 24); + + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_IFRF, 0, 0, 4, pbyData); - return TRUE; + return true; } @@ -753,21 +749,16 @@ BOOL IFRFbWriteEmbedded (PSDevice pDevice, DWORD dwData) * Out: * none * - * Return Value: TRUE if succeeded; FALSE if failed. + * Return Value: true if succeeded; false if failed. * */ -BOOL RFbSetPower ( - PSDevice pDevice, - unsigned int uRATE, - unsigned int uCH - ) +int RFbSetPower(struct vnt_private *pDevice, u32 uRATE, u32 uCH) { -BOOL bResult = TRUE; -BYTE byPwr = pDevice->byCCKPwr; + int bResult = true; + u8 byPwr = pDevice->byCCKPwr; - if (pDevice->dwDiagRefCount != 0) { - return TRUE; - } + if (pDevice->dwDiagRefCount) + return true; if (uCH == 0) return -EINVAL; @@ -810,19 +801,16 @@ BYTE byPwr = pDevice->byCCKPwr; * Out: * none * - * Return Value: TRUE if succeeded; FALSE if failed. + * Return Value: true if succeeded; false if failed. * */ -BOOL RFbRawSetPower ( - PSDevice pDevice, - BYTE byPwr, - unsigned int uRATE - ) + +int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE) { -BOOL bResult = TRUE; + int bResult = true; if (pDevice->byCurPwr == byPwr) - return TRUE; + return true; pDevice->byCurPwr = byPwr; @@ -830,7 +818,7 @@ BOOL bResult = TRUE; case RF_AL2230 : if (pDevice->byCurPwr >= AL2230_PWR_IDX_LEN) - return FALSE; + return false; bResult &= IFRFbWriteEmbedded(pDevice, dwAL2230PowerTable[pDevice->byCurPwr]); if (uRATE <= RATE_11M) bResult &= IFRFbWriteEmbedded(pDevice, 0x0001B400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW); @@ -840,7 +828,7 @@ BOOL bResult = TRUE; case RF_AL2230S : if (pDevice->byCurPwr >= AL2230_PWR_IDX_LEN) - return FALSE; + return false; bResult &= IFRFbWriteEmbedded(pDevice, dwAL2230PowerTable[pDevice->byCurPwr]); if (uRATE <= RATE_11M) { bResult &= IFRFbWriteEmbedded(pDevice, 0x040C1400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW); @@ -863,7 +851,7 @@ BOOL bResult = TRUE; bResult &= IFRFbWriteEmbedded(pDevice, 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW); } - if (pDevice->byCurPwr > AL7230_PWR_IDX_LEN) return FALSE; + if (pDevice->byCurPwr > AL7230_PWR_IDX_LEN) return false; // 0x080F1B00 for 3 wire control TxGain(D10) and 0x31 as TX Gain value dwMax7230Pwr = 0x080C0B00 | ( (pDevice->byCurPwr) << 12 ) | @@ -879,7 +867,7 @@ BOOL bResult = TRUE; DWORD dwVT3226Pwr; if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN) - return FALSE; + return false; dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x17 << 8 ) /* Reg7 */ | (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW; bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr); @@ -891,7 +879,7 @@ BOOL bResult = TRUE; DWORD dwVT3226Pwr; if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN) - return FALSE; + return false; if (uRATE <= RATE_11M) { @@ -900,14 +888,22 @@ BOOL bResult = TRUE; bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr); bResult &= IFRFbWriteEmbedded(pDevice, 0x03C6A200+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); - if (pDevice->sMgmtObj.eScanState != WMAC_NO_SCANNING) { - // scanning, the channel number is pDevice->uScanChannel - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"@@@@ RFbRawSetPower> 11B mode uCurrChannel[%d]\n", pDevice->sMgmtObj.uScanChannel); - bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226D0LoCurrentTable[pDevice->sMgmtObj.uScanChannel-1]); //RobertYu:20060420, sometimes didn't change channel just set power with different rate - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"@@@@ RFbRawSetPower> 11B mode uCurrChannel[%d]\n", pDevice->sMgmtObj.uCurrChannel); - bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226D0LoCurrentTable[pDevice->sMgmtObj.uCurrChannel-1]); //RobertYu:20060420, sometimes didn't change channel just set power with different rate - } + if (pDevice->vnt_mgmt.eScanState != WMAC_NO_SCANNING) { + /* scanning, channel number is pDevice->uScanChannel */ + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "RFbRawSetPower> 11B mode uCurrChannel[%d]\n", + pDevice->vnt_mgmt.uScanChannel); + bResult &= IFRFbWriteEmbedded(pDevice, + dwVT3226D0LoCurrentTable[pDevice-> + vnt_mgmt.uScanChannel - 1]); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "RFbRawSetPower> 11B mode uCurrChannel[%d]\n", + pDevice->vnt_mgmt.uCurrChannel); + bResult &= IFRFbWriteEmbedded(pDevice, + dwVT3226D0LoCurrentTable[pDevice-> + vnt_mgmt.uCurrChannel - 1]); + } bResult &= IFRFbWriteEmbedded(pDevice, 0x015C0800+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060420, ok now, new switching power (mini-pci can have bigger power consumption) } else { @@ -928,7 +924,7 @@ BOOL bResult = TRUE; DWORD dwVT3342Pwr; if (pDevice->byCurPwr >= VT3342_PWR_IDX_LEN) - return FALSE; + return false; dwVT3342Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x27 << 8 ) /* Reg7 */ | (BY_VT3342_REG_LEN << 3 ) | IFREGCTL_REGW; @@ -957,17 +953,12 @@ BOOL bResult = TRUE; * Return Value: none * -*/ -void -RFvRSSITodBm ( - PSDevice pDevice, - BYTE byCurrRSSI, - long * pldBm - ) +void RFvRSSITodBm(struct vnt_private *pDevice, u8 byCurrRSSI, long *pldBm) { - BYTE byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03); - signed long b = (byCurrRSSI & 0x3F); - signed long a = 0; - BYTE abyAIROHARF[4] = {0, 18, 0, 40}; + u8 byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03); + signed long b = (byCurrRSSI & 0x3F); + signed long a = 0; + u8 abyAIROHARF[4] = {0, 18, 0, 40}; switch (pDevice->byRFType) { case RF_AL2230: @@ -987,15 +978,12 @@ RFvRSSITodBm ( -void -RFbRFTableDownload ( - PSDevice pDevice - ) +void RFbRFTableDownload(struct vnt_private *pDevice) { -WORD wLength1 = 0,wLength2 = 0 ,wLength3 = 0; -PBYTE pbyAddr1 = NULL,pbyAddr2 = NULL,pbyAddr3 = NULL; -WORD wLength,wValue; -BYTE abyArray[256]; + u16 wLength1 = 0, wLength2 = 0, wLength3 = 0; + u8 *pbyAddr1 = NULL, *pbyAddr2 = NULL, *pbyAddr3 = NULL; + u16 wLength, wValue; + u8 abyArray[256]; switch ( pDevice->byRFType ) { case RF_AL2230: @@ -1134,21 +1122,19 @@ BYTE abyArray[256]; } -// RobertYu:20060412, TWIF1.11 adjust LO Current for 11b mode -BOOL s_bVT3226D0_11bLoCurrentAdjust( - PSDevice pDevice, - BYTE byChannel, - BOOL b11bMode) +int s_bVT3226D0_11bLoCurrentAdjust(struct vnt_private *pDevice, u8 byChannel, + int b11bMode) { - BOOL bResult; + int bResult = true; - bResult = TRUE; - if( b11bMode ) - bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226D0LoCurrentTable[byChannel-1]); - else - bResult &= IFRFbWriteEmbedded(pDevice, 0x016BC600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060412 + if (b11bMode) + bResult &= IFRFbWriteEmbedded(pDevice, + dwVT3226D0LoCurrentTable[byChannel-1]); + else + bResult &= IFRFbWriteEmbedded(pDevice, 0x016bc600 + + (BY_VT3226_REG_LEN << 3) + IFREGCTL_REGW); - return bResult; + return bResult; } diff --git a/drivers/staging/vt6656/rf.h b/drivers/staging/vt6656/rf.h index 72eb27ac436b..9f70cf740bae 100644 --- a/drivers/staging/vt6656/rf.h +++ b/drivers/staging/vt6656/rf.h @@ -60,25 +60,15 @@ /*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Variables --------------------------*/ -extern const BYTE RFaby11aChannelIndex[200]; +extern const u8 RFaby11aChannelIndex[200]; /*--------------------- Export Functions --------------------------*/ -BOOL IFRFbWriteEmbedded(PSDevice pDevice, DWORD dwData); -BOOL RFbSetPower(PSDevice pDevice, unsigned int uRATE, unsigned int uCH); - -BOOL RFbRawSetPower( - PSDevice pDevice, - BYTE byPwr, - unsigned int uRATE - ); - -void RFvRSSITodBm(PSDevice pDevice, BYTE byCurrRSSI, long *pldBm); -void RFbRFTableDownload(PSDevice pDevice); - -BOOL s_bVT3226D0_11bLoCurrentAdjust( - PSDevice pDevice, - BYTE byChannel, - BOOL b11bMode - ); +int IFRFbWriteEmbedded(struct vnt_private *, u32 dwData); +int RFbSetPower(struct vnt_private *, u32 uRATE, u32 uCH); +int RFbRawSetPower(struct vnt_private *, u8 byPwr, u32 uRATE); +void RFvRSSITodBm(struct vnt_private *, u8 byCurrRSSI, long *pldBm); +void RFbRFTableDownload(struct vnt_private *pDevice); +int s_bVT3226D0_11bLoCurrentAdjust(struct vnt_private *, u8 byChannel, + int b11bMode); #endif /* __RF_H__ */ diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 83c04e120935..b939dcf689d6 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -106,181 +106,71 @@ const WORD wFB_Opt1[2][5] = { /*--------------------- Static Functions --------------------------*/ -static -void -s_vSaveTxPktInfo( - PSDevice pDevice, - BYTE byPktNum, - PBYTE pbyDestAddr, - WORD wPktLength, - WORD wFIFOCtl -); - -static -void * -s_vGetFreeContext( - PSDevice pDevice - ); - - -static -void -s_vGenerateTxParameter( - PSDevice pDevice, - BYTE byPktType, - WORD wCurrentRate, - void *pTxBufHead, - void *pvRrvTime, - void *pvRTS, - void *pvCTS, - unsigned int cbFrameSize, - BOOL bNeedACK, - unsigned int uDMAIdx, - PSEthernetHeader psEthHeader - ); - - -static unsigned int s_uFillDataHead( - PSDevice pDevice, - BYTE byPktType, - WORD wCurrentRate, - void *pTxDataHead, - unsigned int cbFrameLength, - unsigned int uDMAIdx, - BOOL bNeedAck, - unsigned int uFragIdx, - unsigned int cbLastFragmentSize, - unsigned int uMACfragNum, - BYTE byFBOption - ); - - - - -static -void -s_vGenerateMACHeader ( - PSDevice pDevice, - PBYTE pbyBufferAddr, - WORD wDuration, - PSEthernetHeader psEthHeader, - BOOL bNeedEncrypt, - WORD wFragType, - unsigned int uDMAIdx, - unsigned int uFragIdx - ); - -static -void -s_vFillTxKey( - PSDevice pDevice, - PBYTE pbyBuf, - PBYTE pbyIVHead, - PSKeyItem pTransmitKey, - PBYTE pbyHdrBuf, - WORD wPayloadLen, - PBYTE pMICHDR - ); - -static -void -s_vSWencryption ( - PSDevice pDevice, - PSKeyItem pTransmitKey, - PBYTE pbyPayloadHead, - WORD wPayloadSize - ); - -static unsigned int s_uGetTxRsvTime( - PSDevice pDevice, - BYTE byPktType, - unsigned int cbFrameLength, - WORD wRate, - BOOL bNeedAck - ); - - -static unsigned int s_uGetRTSCTSRsvTime( - PSDevice pDevice, - BYTE byRTSRsvType, - BYTE byPktType, - unsigned int cbFrameLength, - WORD wCurrentRate - ); - -static -void -s_vFillCTSHead ( - PSDevice pDevice, - unsigned int uDMAIdx, - BYTE byPktType, - void *pvCTS, - unsigned int cbFrameLength, - BOOL bNeedAck, - BOOL bDisCRC, - WORD wCurrentRate, - BYTE byFBOption - ); - -static -void -s_vFillRTSHead( - PSDevice pDevice, - BYTE byPktType, - void *pvRTS, - unsigned int cbFrameLength, - BOOL bNeedAck, - BOOL bDisCRC, - PSEthernetHeader psEthHeader, - WORD wCurrentRate, - BYTE byFBOption - ); - -static unsigned int s_uGetDataDuration( - PSDevice pDevice, - BYTE byDurType, - unsigned int cbFrameLength, - BYTE byPktType, - WORD wRate, - BOOL bNeedAck, - unsigned int uFragIdx, - unsigned int cbLastFragmentSize, - unsigned int uMACfragNum, - BYTE byFBOption - ); - - -static -unsigned int -s_uGetRTSCTSDuration ( - PSDevice pDevice, - BYTE byDurType, - unsigned int cbFrameLength, - BYTE byPktType, - WORD wRate, - BOOL bNeedAck, - BYTE byFBOption - ); +static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, + u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl); + +static void *s_vGetFreeContext(struct vnt_private *pDevice); + +static void s_vGenerateTxParameter(struct vnt_private *pDevice, + u8 byPktType, u16 wCurrentRate, void *pTxBufHead, void *pvRrvTime, + void *pvRTS, void *pvCTS, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx, + PSEthernetHeader psEthHeader); + +static u32 s_uFillDataHead(struct vnt_private *pDevice, + u8 byPktType, u16 wCurrentRate, void *pTxDataHead, u32 cbFrameLength, + u32 uDMAIdx, int bNeedAck, u32 uFragIdx, u32 cbLastFragmentSize, + u32 uMACfragNum, u8 byFBOption); + + +static void s_vGenerateMACHeader(struct vnt_private *pDevice, + u8 *pbyBufferAddr, u16 wDuration, PSEthernetHeader psEthHeader, + int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx); + +static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, + u8 *pbyIVHead, PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen, + u8 *pMICHDR); + +static void s_vSWencryption(struct vnt_private *pDevice, + PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize); + +static unsigned int s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType, + u32 cbFrameLength, u16 wRate, int bNeedAck); + +static u32 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice, u8 byRTSRsvType, + u8 byPktType, u32 cbFrameLength, u16 wCurrentRate); + +static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, + u8 byPktType, void *pvCTS, u32 cbFrameLength, int bNeedAck, + int bDisCRC, u16 wCurrentRate, u8 byFBOption); + +static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, + void *pvRTS, u32 cbFrameLength, int bNeedAck, int bDisCRC, + PSEthernetHeader psEthHeader, u16 wCurrentRate, u8 byFBOption); + +static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType, + u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, + u32 uFragIdx, u32 cbLastFragmentSize, u32 uMACfragNum, + u8 byFBOption); + +static unsigned int s_uGetRTSCTSDuration(struct vnt_private *pDevice, + u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate, + int bNeedAck, u8 byFBOption); /*--------------------- Export Variables --------------------------*/ -static -void * -s_vGetFreeContext( - PSDevice pDevice - ) +static void *s_vGetFreeContext(struct vnt_private *pDevice) { - PUSB_SEND_CONTEXT pContext = NULL; - PUSB_SEND_CONTEXT pReturnContext = NULL; - unsigned int ii; + PUSB_SEND_CONTEXT pContext = NULL; + PUSB_SEND_CONTEXT pReturnContext = NULL; + int ii; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GetFreeContext()\n"); for (ii = 0; ii < pDevice->cbTD; ii++) { pContext = pDevice->apTD[ii]; - if (pContext->bBoolInUse == FALSE) { - pContext->bBoolInUse = TRUE; + if (pContext->bBoolInUse == false) { + pContext->bBoolInUse = true; pReturnContext = pContext; break; } @@ -292,11 +182,10 @@ s_vGetFreeContext( } -static -void -s_vSaveTxPktInfo(PSDevice pDevice, BYTE byPktNum, PBYTE pbyDestAddr, WORD wPktLength, WORD wFIFOCtl) +static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, + u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl) { - PSStatCounter pStatistic=&(pDevice->scStatistic); + PSStatCounter pStatistic = &pDevice->scStatistic; if (is_broadcast_ether_addr(pbyDestAddr)) pStatistic->abyTxPktInfo[byPktNum].byBroadMultiUni = TX_PKT_BROAD; @@ -312,24 +201,15 @@ s_vSaveTxPktInfo(PSDevice pDevice, BYTE byPktNum, PBYTE pbyDestAddr, WORD wPktLe ETH_ALEN); } -static -void -s_vFillTxKey ( - PSDevice pDevice, - PBYTE pbyBuf, - PBYTE pbyIVHead, - PSKeyItem pTransmitKey, - PBYTE pbyHdrBuf, - WORD wPayloadLen, - PBYTE pMICHDR - ) +static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, + u8 *pbyIVHead, PSKeyItem pTransmitKey, u8 *pbyHdrBuf, + u16 wPayloadLen, u8 *pMICHDR) { - PDWORD pdwIV = (PDWORD) pbyIVHead; - PDWORD pdwExtIV = (PDWORD) ((PBYTE)pbyIVHead+4); - WORD wValue; - PS802_11Header pMACHeader = (PS802_11Header)pbyHdrBuf; - DWORD dwRevIVCounter; - + u32 *pdwIV = (u32 *)pbyIVHead; + u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4); + u16 wValue; + PS802_11Header pMACHeader = (PS802_11Header)pbyHdrBuf; + u32 dwRevIVCounter; //Fill TXKEY @@ -430,18 +310,12 @@ s_vFillTxKey ( } -static -void -s_vSWencryption ( - PSDevice pDevice, - PSKeyItem pTransmitKey, - PBYTE pbyPayloadHead, - WORD wPayloadSize - ) +static void s_vSWencryption(struct vnt_private *pDevice, + PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize) { - unsigned int cbICVlen = 4; - DWORD dwICV = 0xFFFFFFFFL; - PDWORD pdwICV; + u32 cbICVlen = 4; + u32 dwICV = 0xffffffff; + u32 *pdwICV; if (pTransmitKey == NULL) return; @@ -479,17 +353,10 @@ s_vSWencryption ( PK_TYPE_11GB 2 PK_TYPE_11GA 3 */ -static -unsigned int -s_uGetTxRsvTime ( - PSDevice pDevice, - BYTE byPktType, - unsigned int cbFrameLength, - WORD wRate, - BOOL bNeedAck - ) +static u32 s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType, + u32 cbFrameLength, u16 wRate, int bNeedAck) { - unsigned int uDataTime, uAckTime; + u32 uDataTime, uAckTime; uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wRate); if (byPktType == PK_TYPE_11B) {//llb,CCK mode @@ -507,17 +374,10 @@ s_uGetTxRsvTime ( } //byFreqType: 0=>5GHZ 1=>2.4GHZ -static -unsigned int -s_uGetRTSCTSRsvTime ( - PSDevice pDevice, - BYTE byRTSRsvType, - BYTE byPktType, - unsigned int cbFrameLength, - WORD wCurrentRate - ) +static u32 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice, + u8 byRTSRsvType, u8 byPktType, u32 cbFrameLength, u16 wCurrentRate) { - unsigned int uRrvTime , uRTSTime, uCTSTime, uAckTime, uDataTime; + u32 uRrvTime, uRTSTime, uCTSTime, uAckTime, uDataTime; uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0; @@ -549,23 +409,13 @@ s_uGetRTSCTSRsvTime ( } //byFreqType 0: 5GHz, 1:2.4Ghz -static -unsigned int -s_uGetDataDuration ( - PSDevice pDevice, - BYTE byDurType, - unsigned int cbFrameLength, - BYTE byPktType, - WORD wRate, - BOOL bNeedAck, - unsigned int uFragIdx, - unsigned int cbLastFragmentSize, - unsigned int uMACfragNum, - BYTE byFBOption - ) +static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType, + u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, + u32 uFragIdx, u32 cbLastFragmentSize, u32 uMACfragNum, + u8 byFBOption) { - BOOL bLastFrag = 0; - unsigned int uAckTime = 0, uNextPktTime = 0; + int bLastFrag = 0; + u32 uAckTime = 0, uNextPktTime = 0; if (uFragIdx == (uMACfragNum-1)) { bLastFrag = 1; @@ -712,25 +562,17 @@ s_uGetDataDuration ( break; } - ASSERT(FALSE); + ASSERT(false); return 0; } //byFreqType: 0=>5GHZ 1=>2.4GHZ -static -unsigned int -s_uGetRTSCTSDuration ( - PSDevice pDevice, - BYTE byDurType, - unsigned int cbFrameLength, - BYTE byPktType, - WORD wRate, - BOOL bNeedAck, - BYTE byFBOption - ) +static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, + u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, + u8 byFBOption) { - unsigned int uCTSTime = 0, uDurTime = 0; + u32 uCTSTime = 0, uDurTime = 0; switch (byDurType) { @@ -814,24 +656,10 @@ s_uGetRTSCTSDuration ( } - - - -static -unsigned int -s_uFillDataHead ( - PSDevice pDevice, - BYTE byPktType, - WORD wCurrentRate, - void *pTxDataHead, - unsigned int cbFrameLength, - unsigned int uDMAIdx, - BOOL bNeedAck, - unsigned int uFragIdx, - unsigned int cbLastFragmentSize, - unsigned int uMACfragNum, - BYTE byFBOption - ) +static u32 s_uFillDataHead(struct vnt_private *pDevice, + u8 byPktType, u16 wCurrentRate, void *pTxDataHead, u32 cbFrameLength, + u32 uDMAIdx, int bNeedAck, u32 uFragIdx, u32 cbLastFragmentSize, + u32 uMACfragNum, u8 byFBOption) { if (pTxDataHead == NULL) { @@ -959,25 +787,12 @@ s_uFillDataHead ( return 0; } - - - -static -void -s_vFillRTSHead ( - PSDevice pDevice, - BYTE byPktType, - void *pvRTS, - unsigned int cbFrameLength, - BOOL bNeedAck, - BOOL bDisCRC, - PSEthernetHeader psEthHeader, - WORD wCurrentRate, - BYTE byFBOption - ) +static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, + void *pvRTS, u32 cbFrameLength, int bNeedAck, int bDisCRC, + PSEthernetHeader psEthHeader, u16 wCurrentRate, u8 byFBOption) { - unsigned int uRTSFrameLen = 20; - WORD wLen = 0x0000; + u32 uRTSFrameLen = 20; + u16 wLen = 0; if (pvRTS == NULL) return; @@ -1190,22 +1005,12 @@ s_vFillRTSHead ( } } -static -void -s_vFillCTSHead ( - PSDevice pDevice, - unsigned int uDMAIdx, - BYTE byPktType, - void *pvCTS, - unsigned int cbFrameLength, - BOOL bNeedAck, - BOOL bDisCRC, - WORD wCurrentRate, - BYTE byFBOption - ) +static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, + u8 byPktType, void *pvCTS, u32 cbFrameLength, int bNeedAck, + int bDisCRC, u16 wCurrentRate, u8 byFBOption) { - unsigned int uCTSFrameLen = 14; - WORD wLen = 0x0000; + u32 uCTSFrameLen = 14; + u16 wLen = 0; if (pvCTS == NULL) { return; @@ -1290,27 +1095,15 @@ s_vFillCTSHead ( * -*/ -static -void -s_vGenerateTxParameter ( - PSDevice pDevice, - BYTE byPktType, - WORD wCurrentRate, - void *pTxBufHead, - void *pvRrvTime, - void *pvRTS, - void *pvCTS, - unsigned int cbFrameSize, - BOOL bNeedACK, - unsigned int uDMAIdx, - PSEthernetHeader psEthHeader - ) +static void s_vGenerateTxParameter(struct vnt_private *pDevice, + u8 byPktType, u16 wCurrentRate, void *pTxBufHead, void *pvRrvTime, + void *pvRTS, void *pvCTS, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx, + PSEthernetHeader psEthHeader) { - unsigned int cbMACHdLen = WLAN_HDR_ADDR3_LEN; /* 24 */ - WORD wFifoCtl; - BOOL bDisCRC = FALSE; - BYTE byFBOption = AUTO_FB_NONE; -// WORD wCurrentRate = pDevice->wCurrentRate; + u32 cbMACHdLen = WLAN_HDR_ADDR3_LEN; /* 24 */ + u16 wFifoCtl; + int bDisCRC = false; + u8 byFBOption = AUTO_FB_NONE; //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter...\n"); PSTxBufHead pFifoHead = (PSTxBufHead)pTxBufHead; @@ -1318,7 +1111,7 @@ s_vGenerateTxParameter ( wFifoCtl = pFifoHead->wFIFOCtl; if (wFifoCtl & FIFOCTL_CRCDIS) { - bDisCRC = TRUE; + bDisCRC = true; } if (wFifoCtl & FIFOCTL_AUTO_FB_0) { @@ -1407,55 +1200,40 @@ s_vGenerateTxParameter ( unsigned int cbFragmentSize,//Hdr+payoad+FCS */ - -BOOL -s_bPacketToWirelessUsb( - PSDevice pDevice, - BYTE byPktType, - PBYTE usbPacketBuf, - BOOL bNeedEncryption, - unsigned int uSkbPacketLen, - unsigned int uDMAIdx, - PSEthernetHeader psEthHeader, - PBYTE pPacket, - PSKeyItem pTransmitKey, - unsigned int uNodeIndex, - WORD wCurrentRate, - unsigned int *pcbHeaderLen, - unsigned int *pcbTotalLen - ) +static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, + u8 *usbPacketBuf, int bNeedEncryption, u32 uSkbPacketLen, u32 uDMAIdx, + PSEthernetHeader psEthHeader, u8 *pPacket, PSKeyItem pTransmitKey, + u32 uNodeIndex, u16 wCurrentRate, u32 *pcbHeaderLen, u32 *pcbTotalLen) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int cbFrameSize, cbFrameBodySize; - PTX_BUFFER pTxBufHead; - unsigned int cb802_1_H_len; - unsigned int cbIVlen = 0, cbICVlen = 0, cbMIClen = 0, - cbMACHdLen = 0, cbFCSlen = 4; - unsigned int cbMICHDR = 0; - BOOL bNeedACK,bRTS; - PBYTE pbyType,pbyMacHdr,pbyIVHead,pbyPayloadHead,pbyTxBufferAddr; - BYTE abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; - BYTE abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; - unsigned int uDuration; - unsigned int cbHeaderLength = 0, uPadding = 0; - void *pvRrvTime; - PSMICHDRHead pMICHDR; - void *pvRTS; - void *pvCTS; - void *pvTxDataHd; - BYTE byFBOption = AUTO_FB_NONE,byFragType; - WORD wTxBufSize; - DWORD dwMICKey0,dwMICKey1,dwMIC_Priority,dwCRC; - PDWORD pdwMIC_L,pdwMIC_R; - BOOL bSoftWEP = FALSE; - - + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u32 cbFrameSize, cbFrameBodySize; + PTX_BUFFER pTxBufHead; + u32 cb802_1_H_len; + u32 cbIVlen = 0, cbICVlen = 0, cbMIClen = 0, cbMACHdLen = 0; + u32 cbFCSlen = 4, cbMICHDR = 0; + int bNeedACK, bRTS; + u8 *pbyType, *pbyMacHdr, *pbyIVHead, *pbyPayloadHead, *pbyTxBufferAddr; + u8 abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; + u8 abySNAP_Bridgetunnel[ETH_ALEN] + = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; + u32 uDuration; + u32 cbHeaderLength = 0, uPadding = 0; + void *pvRrvTime; + PSMICHDRHead pMICHDR; + void *pvRTS; + void *pvCTS; + void *pvTxDataHd; + u8 byFBOption = AUTO_FB_NONE, byFragType; + u16 wTxBufSize; + u32 dwMICKey0, dwMICKey1, dwMIC_Priority, dwCRC; + u32 *pdwMIC_L, *pdwMIC_R; + int bSoftWEP = false; + + pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL; - - pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL; if (bNeedEncryption && pTransmitKey->pvKeyTable) { - if (((PSKeyTable)&pTransmitKey->pvKeyTable)->bSoftWEP == TRUE) - bSoftWEP = TRUE; /* WEP 256 */ + if (((PSKeyTable)pTransmitKey->pvKeyTable)->bSoftWEP == true) + bSoftWEP = true; /* WEP 256 */ } pTxBufHead = (PTX_BUFFER) usbPacketBuf; @@ -1478,23 +1256,23 @@ s_bPacketToWirelessUsb( pTxBufHead->wFIFOCtl |= (WORD)(byPktType<<8); if (pDevice->dwDiagRefCount != 0) { - bNeedACK = FALSE; + bNeedACK = false; pTxBufHead->wFIFOCtl = pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK); } else { //if (pDevice->dwDiagRefCount != 0) { if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { if (is_multicast_ether_addr(psEthHeader->abyDstAddr)) { - bNeedACK = FALSE; + bNeedACK = false; pTxBufHead->wFIFOCtl = pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK); } else { - bNeedACK = TRUE; + bNeedACK = true; pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; } } else { // MSDUs in Infra mode always need ACK - bNeedACK = TRUE; + bNeedACK = true; pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; } } //if (pDevice->dwDiagRefCount != 0) { @@ -1518,7 +1296,7 @@ s_bPacketToWirelessUsb( pTxBufHead->wFragCtl |= (WORD)(cbMACHdLen << 10); //Set FIFOCTL_GrpAckPolicy - if (pDevice->bGrpAckPolicy == TRUE) {//0000 0100 0000 0000 + if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; } @@ -1533,7 +1311,7 @@ s_bPacketToWirelessUsb( } } - if (bSoftWEP != TRUE) { + if (bSoftWEP != true) { if ((bNeedEncryption) && (pTransmitKey != NULL)) { //WEP enabled if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { //WEP40 or WEP104 pTxBufHead->wFragCtl |= FRAGCTL_LEGACY; @@ -1564,7 +1342,7 @@ s_bPacketToWirelessUsb( cbICVlen = 8;//MIC cbMICHDR = sizeof(SMICHDRHead); } - if (bSoftWEP == FALSE) { + if (bSoftWEP == false) { //MAC Header should be padding 0 to DW alignment. uPadding = 4 - (cbMACHdLen%4); uPadding %= 4; @@ -1573,10 +1351,10 @@ s_bPacketToWirelessUsb( cbFrameSize = cbMACHdLen + cbIVlen + (cbFrameBodySize + cbMIClen) + cbICVlen + cbFCSlen; - if ( (bNeedACK == FALSE) ||(cbFrameSize < pDevice->wRTSThreshold) ) { - bRTS = FALSE; + if ( (bNeedACK == false) ||(cbFrameSize < pDevice->wRTSThreshold) ) { + bRTS = false; } else { - bRTS = TRUE; + bRTS = true; pTxBufHead->wFIFOCtl |= (FIFOCTL_RTS | FIFOCTL_LRETRY); } @@ -1584,7 +1362,7 @@ s_bPacketToWirelessUsb( wTxBufSize = sizeof(STxBufHead); if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet if (byFBOption == AUTO_FB_NONE) { - if (bRTS == TRUE) {//RTS_need + if (bRTS == true) {//RTS_need pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize); pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS)); pvRTS = (PSRTS_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR); @@ -1602,7 +1380,7 @@ s_bPacketToWirelessUsb( } } else { // Auto Fall Back - if (bRTS == TRUE) {//RTS_need + if (bRTS == true) {//RTS_need pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize); pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS)); pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR); @@ -1610,7 +1388,7 @@ s_bPacketToWirelessUsb( pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB)); cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB); } - else if (bRTS == FALSE) { //RTS_needless + else if (bRTS == false) { //RTS_needless pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize); pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS)); pvRTS = NULL; @@ -1622,7 +1400,7 @@ s_bPacketToWirelessUsb( } else {//802.11a/b packet if (byFBOption == AUTO_FB_NONE) { - if (bRTS == TRUE) {//RTS_need + if (bRTS == true) {//RTS_need pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR); @@ -1630,7 +1408,7 @@ s_bPacketToWirelessUsb( pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab)); cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab); } - else if (bRTS == FALSE) { //RTS_needless, no MICHDR + else if (bRTS == false) { //RTS_needless, no MICHDR pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); pvRTS = NULL; @@ -1640,7 +1418,7 @@ s_bPacketToWirelessUsb( } } else { // Auto Fall Back - if (bRTS == TRUE) {//RTS_need + if (bRTS == true) {//RTS_need pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR); @@ -1648,7 +1426,7 @@ s_bPacketToWirelessUsb( pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB)); cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB); } - else if (bRTS == FALSE) { //RTS_needless + else if (bRTS == false) { //RTS_needless pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize); pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab)); pvRTS = NULL; @@ -1684,7 +1462,7 @@ s_bPacketToWirelessUsb( s_vGenerateMACHeader(pDevice, pbyMacHdr, (WORD)uDuration, psEthHeader, bNeedEncryption, byFragType, uDMAIdx, 0); - if (bNeedEncryption == TRUE) { + if (bNeedEncryption == true) { //Fill TXKEY s_vFillTxKey(pDevice, (PBYTE)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, pbyMacHdr, (WORD)cbFrameBodySize, (PBYTE)pMICHDR); @@ -1729,14 +1507,14 @@ s_bPacketToWirelessUsb( ASSERT(uLength == cbNdisBodySize); - if ((bNeedEncryption == TRUE) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { + if ((bNeedEncryption == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { /////////////////////////////////////////////////////////////////// - if (pDevice->sMgmtObj.eAuthenMode == WMAC_AUTH_WPANONE) { - dwMICKey0 = *(PDWORD)(&pTransmitKey->abyKey[16]); - dwMICKey1 = *(PDWORD)(&pTransmitKey->abyKey[20]); - } + if (pDevice->vnt_mgmt.eAuthenMode == WMAC_AUTH_WPANONE) { + dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16]); + dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); + } else if ((pTransmitKey->dwKeyIndex & AUTHENTICATOR_KEY) != 0) { dwMICKey0 = *(PDWORD)(&pTransmitKey->abyKey[16]); dwMICKey1 = *(PDWORD)(&pTransmitKey->abyKey[20]); @@ -1769,10 +1547,10 @@ s_bPacketToWirelessUsb( MIC_vGetMIC(pdwMIC_L, pdwMIC_R); MIC_vUnInit(); - if (pDevice->bTxMICFail == TRUE) { + if (pDevice->bTxMICFail == true) { *pdwMIC_L = 0; *pdwMIC_R = 0; - pDevice->bTxMICFail = FALSE; + pDevice->bTxMICFail = false; } //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderLength, uPadding, cbIVlen); @@ -1780,17 +1558,17 @@ s_bPacketToWirelessUsb( } - if (bSoftWEP == TRUE) { + if (bSoftWEP == true) { s_vSWencryption(pDevice, pTransmitKey, (pbyPayloadHead), (WORD)(cbFrameBodySize + cbMIClen)); - } else if ( ((pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) && (bNeedEncryption == TRUE)) || - ((pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) && (bNeedEncryption == TRUE)) || - ((pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) && (bNeedEncryption == TRUE)) ) { + } else if ( ((pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) && (bNeedEncryption == true)) || + ((pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) && (bNeedEncryption == true)) || + ((pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) && (bNeedEncryption == true)) ) { cbFrameSize -= cbICVlen; } - if (pDevice->bSoftwareGenCrcErr == TRUE) { + if (pDevice->bSoftwareGenCrcErr == true) { unsigned int cbLen; PDWORD pdwCRC; @@ -1815,7 +1593,7 @@ s_bPacketToWirelessUsb( pTxBufHead->wFragCtl |= (WORD)byFragType; - return TRUE; + return true; } @@ -1839,19 +1617,11 @@ s_bPacketToWirelessUsb( * -*/ -void -s_vGenerateMACHeader ( - PSDevice pDevice, - PBYTE pbyBufferAddr, - WORD wDuration, - PSEthernetHeader psEthHeader, - BOOL bNeedEncrypt, - WORD wFragType, - unsigned int uDMAIdx, - unsigned int uFragIdx - ) +static void s_vGenerateMACHeader(struct vnt_private *pDevice, + u8 *pbyBufferAddr, u16 wDuration, PSEthernetHeader psEthHeader, + int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx) { - PS802_11Header pMACHeader = (PS802_11Header)pbyBufferAddr; + PS802_11Header pMACHeader = (PS802_11Header)pbyBufferAddr; memset(pMACHeader, 0, (sizeof(S802_11Header))); //- sizeof(pMACHeader->dwIV))); @@ -1936,43 +1706,29 @@ s_vGenerateMACHeader ( * Out: * none * - * Return Value: CMD_STATUS_PENDING if MAC Tx resource available; otherwise FALSE + * Return Value: CMD_STATUS_PENDING if MAC Tx resource available; otherwise false * -*/ -CMD_STATUS csMgmt_xmit( - PSDevice pDevice, - PSTxMgmtPacket pPacket - ) +CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, + struct vnt_tx_mgmt *pPacket) { - BYTE byPktType; - PBYTE pbyTxBufferAddr; - void *pvRTS; - PSCTS pCTS; - void *pvTxDataHd; - unsigned int uDuration; - unsigned int cbReqCount; - PS802_11Header pMACHeader; - unsigned int cbHeaderSize; - unsigned int cbFrameBodySize; - BOOL bNeedACK; - BOOL bIsPSPOLL = FALSE; - PSTxBufHead pTxBufHead; - unsigned int cbFrameSize; - unsigned int cbIVlen = 0; - unsigned int cbICVlen = 0; - unsigned int cbMIClen = 0; - unsigned int cbFCSlen = 4; - unsigned int uPadding = 0; - WORD wTxBufSize; - unsigned int cbMacHdLen; - SEthernetHeader sEthHeader; - void *pvRrvTime; - void *pMICHDR; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - WORD wCurrentRate = RATE_1M; - PTX_BUFFER pTX_Buffer; - PUSB_SEND_CONTEXT pContext; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PTX_BUFFER pTX_Buffer; + PSTxBufHead pTxBufHead; + PUSB_SEND_CONTEXT pContext; + PS802_11Header pMACHeader; + PSCTS pCTS; + SEthernetHeader sEthHeader; + u8 byPktType, *pbyTxBufferAddr; + void *pvRTS, *pvTxDataHd, *pvRrvTime, *pMICHDR; + u32 uDuration, cbReqCount, cbHeaderSize, cbFrameBodySize, cbFrameSize; + int bNeedACK, bIsPSPOLL = false; + u32 cbIVlen = 0, cbICVlen = 0, cbMIClen = 0, cbFCSlen = 4; + u32 uPadding = 0; + u16 wTxBufSize; + u32 cbMacHdLen; + u16 wCurrentRate = RATE_1M; @@ -2028,10 +1784,10 @@ CMD_STATUS csMgmt_xmit( pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us); if (is_multicast_ether_addr(pPacket->p80211Header->sA3.abyAddr1)) { - bNeedACK = FALSE; + bNeedACK = false; } else { - bNeedACK = TRUE; + bNeedACK = true; pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; }; @@ -2043,7 +1799,7 @@ CMD_STATUS csMgmt_xmit( //pDevice->byPreambleType = PREAMBLE_LONG; // probe-response don't retry //if ((pPacket->p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_MGMT_PROBE_RSP) { - // bNeedACK = FALSE; + // bNeedACK = false; // pTxBufHead->wFIFOCtl &= (~FIFOCTL_NEEDACK); //} } @@ -2051,7 +1807,7 @@ CMD_STATUS csMgmt_xmit( pTxBufHead->wFIFOCtl |= (FIFOCTL_GENINT | FIFOCTL_ISDMA0); if ((pPacket->p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) { - bIsPSPOLL = TRUE; + bIsPSPOLL = true; cbMacHdLen = WLAN_HDR_ADDR2_LEN; } else { cbMacHdLen = WLAN_HDR_ADDR3_LEN; @@ -2063,7 +1819,7 @@ CMD_STATUS csMgmt_xmit( // Notes: // Although spec says MMPDU can be fragmented; In most case, // no one will send a MMPDU under fragmentation. With RTS may occur. - pDevice->bAES = FALSE; //Set FRAGCTL_WEPTYP + pDevice->bAES = false; //Set FRAGCTL_WEPTYP if (WLAN_GET_FC_ISWEP(pPacket->p80211Header->sA4.wFrameCtl) != 0) { if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) { @@ -2084,7 +1840,7 @@ CMD_STATUS csMgmt_xmit( cbIVlen = 8;//RSN Header cbICVlen = 8;//MIC pTxBufHead->wFragCtl |= FRAGCTL_AES; - pDevice->bAES = TRUE; + pDevice->bAES = true; } //MAC Header should be padding 0 to DW alignment. uPadding = 4 - (cbMacHdLen%4); @@ -2094,7 +1850,7 @@ CMD_STATUS csMgmt_xmit( cbFrameSize = cbMacHdLen + cbFrameBodySize + cbIVlen + cbMIClen + cbICVlen + cbFCSlen; //Set FIFOCTL_GrpAckPolicy - if (pDevice->bGrpAckPolicy == TRUE) {//0000 0100 0000 0000 + if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; } //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() @@ -2155,12 +1911,12 @@ CMD_STATUS csMgmt_xmit( pbyPayloadHead = (PBYTE)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding + cbIVlen); do { if ((pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) && - (pDevice->bLinkPass == TRUE)) { + (pDevice->bLinkPass == true)) { pbyBSSID = pDevice->abyBSSID; // get pairwise key - if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == FALSE) { + if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == false) { // get group key - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == TRUE) { + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); break; } @@ -2171,13 +1927,13 @@ CMD_STATUS csMgmt_xmit( } // get group key pbyBSSID = pDevice->abyBroadcastAddr; - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == FALSE) { + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { pTransmitKey = NULL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KEY is NULL. OP Mode[%d]\n", pDevice->eOPMode); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); } - } while(FALSE); + } while(false); //Fill TXKEY s_vFillTxKey(pDevice, (PBYTE)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, (PBYTE)pMACHeader, (WORD)cbFrameBodySize, NULL); @@ -2231,26 +1987,22 @@ CMD_STATUS csMgmt_xmit( } -CMD_STATUS -csBeacon_xmit( - PSDevice pDevice, - PSTxMgmtPacket pPacket - ) +CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, + struct vnt_tx_mgmt *pPacket) { - - unsigned int cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN; - unsigned int cbHeaderSize = 0; - WORD wTxBufSize = sizeof(STxShortBufHead); - PSTxShortBufHead pTxBufHead; - PS802_11Header pMACHeader; - PSTxDataHead_ab pTxDataHead; - WORD wCurrentRate; - unsigned int cbFrameBodySize; - unsigned int cbReqCount; - PBEACON_BUFFER pTX_Buffer; - PBYTE pbyTxBufferAddr; - PUSB_SEND_CONTEXT pContext; - CMD_STATUS status; + u32 cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN; + u32 cbHeaderSize = 0; + u16 wTxBufSize = sizeof(STxShortBufHead); + PSTxShortBufHead pTxBufHead; + PS802_11Header pMACHeader; + PSTxDataHead_ab pTxDataHead; + u16 wCurrentRate; + u32 cbFrameBodySize; + u32 cbReqCount; + PBEACON_BUFFER pTX_Buffer; + u8 *pbyTxBufferAddr; + PUSB_SEND_CONTEXT pContext; + CMD_STATUS status; pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice); @@ -2277,7 +2029,7 @@ csBeacon_xmit( ); //Get Duration and TimeStampOff pTxDataHead->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, PK_TYPE_11A, - wCurrentRate, FALSE, 0, 0, 1, AUTO_FB_NONE)); + wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE)); pTxDataHead->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab); } else { @@ -2290,7 +2042,7 @@ csBeacon_xmit( ); //Get Duration and TimeStampOff pTxDataHead->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, PK_TYPE_11B, - wCurrentRate, FALSE, 0, 0, 1, AUTO_FB_NONE)); + wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE)); pTxDataHead->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab); } @@ -2321,56 +2073,38 @@ csBeacon_xmit( } - - - -void -vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { - - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - BYTE byPktType; - PBYTE pbyTxBufferAddr; - void *pvRTS; - void *pvCTS; - void *pvTxDataHd; - unsigned int uDuration; - unsigned int cbReqCount; - PS802_11Header pMACHeader; - unsigned int cbHeaderSize; - unsigned int cbFrameBodySize; - BOOL bNeedACK; - BOOL bIsPSPOLL = FALSE; - PSTxBufHead pTxBufHead; - unsigned int cbFrameSize; - unsigned int cbIVlen = 0; - unsigned int cbICVlen = 0; - unsigned int cbMIClen = 0; - unsigned int cbFCSlen = 4; - unsigned int uPadding = 0; - unsigned int cbMICHDR = 0; - unsigned int uLength = 0; - DWORD dwMICKey0, dwMICKey1; - DWORD dwMIC_Priority; - PDWORD pdwMIC_L; - PDWORD pdwMIC_R; - WORD wTxBufSize; - unsigned int cbMacHdLen; - SEthernetHeader sEthHeader; - void *pvRrvTime; - void *pMICHDR; - WORD wCurrentRate = RATE_1M; - PUWLAN_80211HDR p80211Header; - unsigned int uNodeIndex = 0; - BOOL bNodeExist = FALSE; - SKeyItem STempKey; - PSKeyItem pTransmitKey = NULL; - PBYTE pbyIVHead; - PBYTE pbyPayloadHead; - PBYTE pbyMacHdr; - unsigned int cbExtSuppRate = 0; - PTX_BUFFER pTX_Buffer; - PUSB_SEND_CONTEXT pContext; -// PWLAN_IE pItem; +void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) +{ + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u8 byPktType; + u8 *pbyTxBufferAddr; + void *pvRTS, *pvCTS, *pvTxDataHd; + u32 uDuration, cbReqCount; + PS802_11Header pMACHeader; + u32 cbHeaderSize, cbFrameBodySize; + int bNeedACK, bIsPSPOLL = false; + PSTxBufHead pTxBufHead; + u32 cbFrameSize; + u32 cbIVlen = 0, cbICVlen = 0, cbMIClen = 0, cbFCSlen = 4; + u32 uPadding = 0; + u32 cbMICHDR = 0, uLength = 0; + u32 dwMICKey0, dwMICKey1; + u32 dwMIC_Priority; + u32 *pdwMIC_L, *pdwMIC_R; + u16 wTxBufSize; + u32 cbMacHdLen; + SEthernetHeader sEthHeader; + void *pvRrvTime, *pMICHDR; + u32 wCurrentRate = RATE_1M; + PUWLAN_80211HDR p80211Header; + u32 uNodeIndex = 0; + int bNodeExist = false; + SKeyItem STempKey; + PSKeyItem pTransmitKey = NULL; + u8 *pbyIVHead, *pbyPayloadHead, *pbyMacHdr; + u32 cbExtSuppRate = 0; + PTX_BUFFER pTX_Buffer; + PUSB_SEND_CONTEXT pContext; pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL; @@ -2435,18 +2169,18 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us); if (is_multicast_ether_addr(p80211Header->sA3.abyAddr1)) { - bNeedACK = FALSE; + bNeedACK = false; if (pDevice->bEnableHostWEP) { uNodeIndex = 0; - bNodeExist = TRUE; + bNodeExist = true; } } else { if (pDevice->bEnableHostWEP) { if (BSSbIsSTAInNodeDB(pDevice, (PBYTE)(p80211Header->sA3.abyAddr1), &uNodeIndex)) - bNodeExist = TRUE; + bNodeExist = true; } - bNeedACK = TRUE; + bNeedACK = true; pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; }; @@ -2459,7 +2193,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { // probe-response don't retry //if ((p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_MGMT_PROBE_RSP) { - // bNeedACK = FALSE; + // bNeedACK = false; // pTxBufHead->wFIFOCtl &= (~FIFOCTL_NEEDACK); //} } @@ -2467,7 +2201,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { pTxBufHead->wFIFOCtl |= (FIFOCTL_GENINT | FIFOCTL_ISDMA0); if ((p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) { - bIsPSPOLL = TRUE; + bIsPSPOLL = true; cbMacHdLen = WLAN_HDR_ADDR2_LEN; } else { cbMacHdLen = WLAN_HDR_ADDR3_LEN; @@ -2496,7 +2230,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { // Notes: // Although spec says MMPDU can be fragmented; In most case, // no one will send a MMPDU under fragmentation. With RTS may occur. - pDevice->bAES = FALSE; //Set FRAGCTL_WEPTYP + pDevice->bAES = false; //Set FRAGCTL_WEPTYP if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) { @@ -2519,7 +2253,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { cbICVlen = 8;//MIC cbMICHDR = sizeof(SMICHDRHead); pTxBufHead->wFragCtl |= FRAGCTL_AES; - pDevice->bAES = TRUE; + pDevice->bAES = true; } //MAC Header should be padding 0 to DW alignment. uPadding = 4 - (cbMacHdLen%4); @@ -2529,7 +2263,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { cbFrameSize = cbMacHdLen + cbFrameBodySize + cbIVlen + cbMIClen + cbICVlen + cbFCSlen + cbExtSuppRate; //Set FIFOCTL_GrpAckPolicy - if (pDevice->bGrpAckPolicy == TRUE) {//0000 0100 0000 0000 + if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; } //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() @@ -2646,10 +2380,10 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { MIC_vGetMIC(pdwMIC_L, pdwMIC_R); MIC_vUnInit(); - if (pDevice->bTxMICFail == TRUE) { + if (pDevice->bTxMICFail == true) { *pdwMIC_L = 0; *pdwMIC_R = 0; - pDevice->bTxMICFail = FALSE; + pDevice->bTxMICFail = false; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); @@ -2729,29 +2463,30 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { * Return Value: NULL */ -int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) +int nsDMA_tx_packet(struct vnt_private *pDevice, + u32 uDMAIdx, struct sk_buff *skb) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int BytesToWrite = 0, uHeaderLen = 0; - unsigned int uNodeIndex = 0; - BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; - WORD wAID; - BYTE byPktType; - BOOL bNeedEncryption = FALSE; - PSKeyItem pTransmitKey = NULL; - SKeyItem STempKey; - unsigned int ii; - BOOL bTKIP_UseGTK = FALSE; - BOOL bNeedDeAuth = FALSE; - PBYTE pbyBSSID; - BOOL bNodeExist = FALSE; - PUSB_SEND_CONTEXT pContext; - BOOL fConvertedPacket; - PTX_BUFFER pTX_Buffer; - unsigned int status; - WORD wKeepRate = pDevice->wCurrentRate; - struct net_device_stats* pStats = &pDevice->stats; - BOOL bTxeapol_key = FALSE; + struct net_device_stats *pStats = &pDevice->stats; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u32 BytesToWrite = 0, uHeaderLen = 0; + u32 uNodeIndex = 0; + u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; + u16 wAID; + u8 byPktType; + int bNeedEncryption = false; + PSKeyItem pTransmitKey = NULL; + SKeyItem STempKey; + int ii; + int bTKIP_UseGTK = false; + int bNeedDeAuth = false; + u8 *pbyBSSID; + int bNodeExist = false; + PUSB_SEND_CONTEXT pContext; + bool fConvertedPacket; + PTX_BUFFER pTX_Buffer; + u32 status; + u16 wKeepRate = pDevice->wCurrentRate; + int bTxeapol_key = false; if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { @@ -2763,7 +2498,7 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) if (is_multicast_ether_addr((PBYTE)(skb->data))) { uNodeIndex = 0; - bNodeExist = TRUE; + bNodeExist = true; if (pMgmt->sNodeDBTable[0].bPSEnable) { skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skb); @@ -2808,11 +2543,11 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) }else { pDevice->byPreambleType = PREAMBLE_LONG; } - bNodeExist = TRUE; + bNodeExist = true; } } - if (bNodeExist == FALSE) { + if (bNodeExist == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Unknown STA not found in node DB \n"); dev_kfree_skb_irq(skb); return 0; @@ -2844,22 +2579,22 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) /* 802.1x OR eapol-key challenge frame transfer */ if (((Protocol_Version == 1) || (Protocol_Version == 2)) && (Packet_Type == 3)) { - bTxeapol_key = TRUE; + bTxeapol_key = true; if(!(Key_info & BIT3) && //WPA or RSN group-key challenge (Key_info & BIT8) && (Key_info & BIT9)) { //send 2/2 key if(Descriptor_type==254) { - pDevice->fWPA_Authened = TRUE; + pDevice->fWPA_Authened = true; PRINT_K("WPA "); } else { - pDevice->fWPA_Authened = TRUE; + pDevice->fWPA_Authened = true; PRINT_K("WPA2(re-keying) "); } PRINT_K("Authentication completed!!\n"); } else if((Key_info & BIT3) && (Descriptor_type==2) && //RSN pairwise-key challenge (Key_info & BIT8) && (Key_info & BIT9)) { - pDevice->fWPA_Authened = TRUE; + pDevice->fWPA_Authened = true; PRINT_K("WPA2 Authentication completed!!\n"); } } @@ -2867,18 +2602,18 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) } //mike add:station mode check eapol-key challenge<--- - if (pDevice->bEncryptionEnable == TRUE) { - bNeedEncryption = TRUE; + if (pDevice->bEncryptionEnable == true) { + bNeedEncryption = true; // get Transmit key do { if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { pbyBSSID = pDevice->abyBSSID; // get pairwise key - if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == FALSE) { + if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == false) { // get group key - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == TRUE) { - bTKIP_UseGTK = TRUE; + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) { + bTKIP_UseGTK = true; DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); break; } @@ -2895,12 +2630,12 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"\n"); // get pairwise key - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == TRUE) + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) break; } // get group key pbyBSSID = pDevice->abyBroadcastAddr; - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == FALSE) { + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { pTransmitKey = NULL; if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS and KEY is NULL. [%d]\n", pMgmt->eCurrMode); @@ -2908,15 +2643,15 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) else DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"NOT IBSS and KEY is NULL. [%d]\n", pMgmt->eCurrMode); } else { - bTKIP_UseGTK = TRUE; + bTKIP_UseGTK = true; DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); } - } while(FALSE); + } while(false); } if (pDevice->bEnableHostWEP) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"acdma0: STA index %d\n", uNodeIndex); - if (pDevice->bEncryptionEnable == TRUE) { + if (pDevice->bEncryptionEnable == true) { pTransmitKey = &STempKey; pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; @@ -3015,23 +2750,23 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) byPktType = PK_TYPE_11B; } - if (bNeedEncryption == TRUE) { + if (bNeedEncryption == true) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType)); if ((pDevice->sTxEthHeader.wType) == cpu_to_be16(ETH_P_PAE)) { - bNeedEncryption = FALSE; + bNeedEncryption = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Pkt Type=%04x\n", (pDevice->sTxEthHeader.wType)); if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { if (pTransmitKey == NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Don't Find TX KEY\n"); } else { - if (bTKIP_UseGTK == TRUE) { + if (bTKIP_UseGTK == true) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"error: KEY is GTK!!~~\n"); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", pTransmitKey->dwKeyIndex); - bNeedEncryption = TRUE; + bNeedEncryption = true; } } } @@ -3041,7 +2776,7 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", pTransmitKey->dwKeyIndex); - bNeedEncryption = TRUE; + bNeedEncryption = true; } } } @@ -3049,7 +2784,7 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) if (pTransmitKey == NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"return no tx key\n"); - pContext->bBoolInUse = FALSE; + pContext->bBoolInUse = false; dev_kfree_skb_irq(skb); pStats->tx_dropped++; return STATUS_FAILURE; @@ -3065,18 +2800,18 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) &uHeaderLen, &BytesToWrite ); - if (fConvertedPacket == FALSE) { - pContext->bBoolInUse = FALSE; + if (fConvertedPacket == false) { + pContext->bBoolInUse = false; dev_kfree_skb_irq(skb); return STATUS_FAILURE; } - if ( pDevice->bEnablePSMode == TRUE ) { + if ( pDevice->bEnablePSMode == true ) { if ( !pDevice->bPSModeTxBurst ) { bScheduleCommand((void *) pDevice, WLAN_CMD_MAC_DISPOWERSAVING, NULL); - pDevice->bPSModeTxBurst = TRUE; + pDevice->bPSModeTxBurst = true; } } @@ -3092,14 +2827,14 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) status = PIPEnsSendBulkOut(pDevice,pContext); - if (bNeedDeAuth == TRUE) { + if (bNeedDeAuth == true) { WORD wReason = WLAN_MGMT_REASON_MIC_FAILURE; bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (PBYTE) &wReason); } if(status!=STATUS_PENDING) { - pContext->bBoolInUse = FALSE; + pContext->bBoolInUse = false; dev_kfree_skb_irq(skb); return STATUS_FAILURE; } @@ -3120,49 +2855,43 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) * pPacket - Pointer to rx packet * cbPacketSize - rx ethernet frame size * Out: - * TURE, FALSE + * TURE, false * - * Return Value: Return TRUE if packet is copy to dma1; otherwise FALSE + * Return Value: Return true if packet is copy to dma1; otherwise false */ - -BOOL -bRelayPacketSend ( - PSDevice pDevice, - PBYTE pbySkbData, - unsigned int uDataLen, - unsigned int uNodeIndex - ) +int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, + u32 uNodeIndex) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int BytesToWrite = 0, uHeaderLen = 0; - BYTE byPktType = PK_TYPE_11B; - BOOL bNeedEncryption = FALSE; - SKeyItem STempKey; - PSKeyItem pTransmitKey = NULL; - PBYTE pbyBSSID; - PUSB_SEND_CONTEXT pContext; - BYTE byPktTyp; - BOOL fConvertedPacket; - PTX_BUFFER pTX_Buffer; - unsigned int status; - WORD wKeepRate = pDevice->wCurrentRate; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u32 BytesToWrite = 0, uHeaderLen = 0; + u8 byPktType = PK_TYPE_11B; + int bNeedEncryption = false; + SKeyItem STempKey; + PSKeyItem pTransmitKey = NULL; + u8 *pbyBSSID; + PUSB_SEND_CONTEXT pContext; + u8 byPktTyp; + int fConvertedPacket; + PTX_BUFFER pTX_Buffer; + u32 status; + u16 wKeepRate = pDevice->wCurrentRate; pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice); if (NULL == pContext) { - return FALSE; + return false; } memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)pbySkbData, ETH_HLEN); - if (pDevice->bEncryptionEnable == TRUE) { - bNeedEncryption = TRUE; + if (pDevice->bEncryptionEnable == true) { + bNeedEncryption = true; // get group key pbyBSSID = pDevice->abyBroadcastAddr; - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == FALSE) { + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { pTransmitKey = NULL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"KEY is NULL. [%d]\n", pMgmt->eCurrMode); } else { @@ -3186,8 +2915,8 @@ bRelayPacketSend ( } if ( bNeedEncryption && (pTransmitKey == NULL) ) { - pContext->bBoolInUse = FALSE; - return FALSE; + pContext->bBoolInUse = false; + return false; } byPktTyp = (BYTE)pDevice->byPacketType; @@ -3235,9 +2964,9 @@ bRelayPacketSend ( &uHeaderLen, &BytesToWrite ); - if (fConvertedPacket == FALSE) { - pContext->bBoolInUse = FALSE; - return FALSE; + if (fConvertedPacket == false) { + pContext->bBoolInUse = false; + return false; } pTX_Buffer = (PTX_BUFFER)&(pContext->Data[0]); @@ -3252,6 +2981,6 @@ bRelayPacketSend ( status = PIPEnsSendBulkOut(pDevice,pContext); - return TRUE; + return true; } diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h index dd2198acc636..9f537022cdd1 100644 --- a/drivers/staging/vt6656/rxtx.h +++ b/drivers/staging/vt6656/rxtx.h @@ -665,30 +665,11 @@ typedef struct tagSBEACON_BUFFER /*--------------------- Export Functions --------------------------*/ -BOOL -bPacketToWirelessUsb( - PSDevice pDevice, - BYTE byPktType, - PBYTE usbPacketBuf, - BOOL bNeedEncrypt, - unsigned int cbPayloadSize, - unsigned int uDMAIdx, - PSEthernetHeader psEthHeader, - PBYTE pPacket, - PSKeyItem pTransmitKey, - unsigned int uNodeIndex, - WORD wCurrentRate, - unsigned int *pcbHeaderLen, - unsigned int *pcbTotalLen - ); - -void vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb); -int nsDMA_tx_packet(PSDevice pDevice, - unsigned int uDMAIdx, - struct sk_buff *skb); -CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket); -CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket); -BOOL bRelayPacketSend(PSDevice pDevice, PBYTE pbySkbData, - unsigned int uDataLen, unsigned int uNodeIndex); +void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb); +int nsDMA_tx_packet(struct vnt_private *, u32 uDMAIdx, struct sk_buff *skb); +CMD_STATUS csMgmt_xmit(struct vnt_private *, struct vnt_tx_mgmt *); +CMD_STATUS csBeacon_xmit(struct vnt_private *, struct vnt_tx_mgmt *); +int bRelayPacketSend(struct vnt_private *, u8 *pbySkbData, u32 uDataLen, + u32 uNodeIndex); #endif /* __RXTX_H__ */ diff --git a/drivers/staging/vt6656/tether.c b/drivers/staging/vt6656/tether.c index 083b2153a271..95286c4d5572 100644 --- a/drivers/staging/vt6656/tether.c +++ b/drivers/staging/vt6656/tether.c @@ -93,16 +93,16 @@ BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr) * Out: * none * - * Return Value: TRUE if ok; FALSE if error. + * Return Value: true if ok; false if error. * */ -BOOL ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, unsigned int cbFrameLength) +bool ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, unsigned int cbFrameLength) { DWORD dwCRC; dwCRC = CRCdwGetCrc32(pbyBuffer, cbFrameLength - 4); if (cpu_to_le32(*((PDWORD)(pbyBuffer + cbFrameLength - 4))) != dwCRC) - return FALSE; - return TRUE; + return false; + return true; } diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h index 8c1f5d253f88..2f8f4853fd9d 100644 --- a/drivers/staging/vt6656/tether.h +++ b/drivers/staging/vt6656/tether.h @@ -161,6 +161,6 @@ S802_11Header, *PS802_11Header; BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr); //BYTE ETHbyGetHashIndexByCrc(PBYTE pbyMultiAddr); -BOOL ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, unsigned int cbFrameLength); +bool ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, unsigned int cbFrameLength); #endif /* __TETHER_H__ */ diff --git a/drivers/staging/vt6656/ttype.h b/drivers/staging/vt6656/ttype.h index dfbf74713a80..d7b648945316 100644 --- a/drivers/staging/vt6656/ttype.h +++ b/drivers/staging/vt6656/ttype.h @@ -33,33 +33,12 @@ /******* Common definitions and typedefs ***********************************/ -typedef int BOOL; - -#if !defined(TRUE) -#define TRUE 1 -#endif -#if !defined(FALSE) -#define FALSE 0 -#endif - /****** Simple typedefs ***************************************************/ typedef u8 BYTE; typedef u16 WORD; typedef u32 DWORD; -// QWORD is for those situation that we want -// an 8-byte-aligned 8 byte long structure -// which is NOT really a floating point number. -typedef union tagUQuadWord { - struct { - u32 dwLowDword; - u32 dwHighDword; - } u; - double DoNotUseThisField; -} UQuadWord; -typedef UQuadWord QWORD; // 64-bit - /****** Common pointer types ***********************************************/ typedef u32 ULONG_PTR; @@ -73,6 +52,4 @@ typedef WORD * PWORD; typedef DWORD * PDWORD; -typedef QWORD * PQWORD; - #endif /* __TTYPE_H__ */ diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index fc68518526e0..00fd0f8a58c2 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -67,51 +67,18 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Variables --------------------------*/ /*--------------------- Static Functions --------------------------*/ -static -void -s_nsInterruptUsbIoCompleteRead( - struct urb *urb - ); - - -static -void -s_nsBulkInUsbIoCompleteRead( - struct urb *urb - ); - - -static -void -s_nsBulkOutIoCompleteWrite( - struct urb *urb - ); - - -static -void -s_nsControlInUsbIoCompleteRead( - struct urb *urb - ); - -static -void -s_nsControlInUsbIoCompleteWrite( - struct urb *urb - ); +static void s_nsInterruptUsbIoCompleteRead(struct urb *urb); +static void s_nsBulkInUsbIoCompleteRead(struct urb *urb); +static void s_nsBulkOutIoCompleteWrite(struct urb *urb); +static void s_nsControlInUsbIoCompleteRead(struct urb *urb); +static void s_nsControlInUsbIoCompleteWrite(struct urb *urb); /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -int PIPEnsControlOutAsyn( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ) +int PIPEnsControlOutAsyn(struct vnt_private *pDevice, u8 byRequest, + u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer) { int ntStatus; @@ -147,17 +114,11 @@ int PIPEnsControlOutAsyn( return ntStatus; } -int PIPEnsControlOut( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ) +int PIPEnsControlOut(struct vnt_private *pDevice, u8 byRequest, u16 wValue, + u16 wIndex, u16 wLength, u8 *pbyBuffer) { int ntStatus = 0; - int ii; + int ii; if (pDevice->Flags & fMP_DISCONNECTED) return STATUS_FAILURE; @@ -165,6 +126,11 @@ int PIPEnsControlOut( if (pDevice->Flags & fMP_CONTROL_WRITES) return STATUS_FAILURE; + if (pDevice->Flags & fMP_CONTROL_READS) + return STATUS_FAILURE; + + MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES); + pDevice->sUsbCtlRequest.bRequestType = 0x40; pDevice->sUsbCtlRequest.bRequest = byRequest; pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); @@ -179,12 +145,13 @@ int PIPEnsControlOut( ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); if (ntStatus != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control send request submission failed: %d\n", ntStatus); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "control send request submission failed: %d\n", + ntStatus); + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); return STATUS_FAILURE; } - else { - MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES); - } + spin_unlock_irq(&pDevice->lock); for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { @@ -206,17 +173,11 @@ int PIPEnsControlOut( return STATUS_SUCCESS; } -int PIPEnsControlIn( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ) +int PIPEnsControlIn(struct vnt_private *pDevice, u8 byRequest, u16 wValue, + u16 wIndex, u16 wLength, u8 *pbyBuffer) { int ntStatus = 0; - int ii; + int ii; if (pDevice->Flags & fMP_DISCONNECTED) return STATUS_FAILURE; @@ -224,6 +185,11 @@ int PIPEnsControlIn( if (pDevice->Flags & fMP_CONTROL_READS) return STATUS_FAILURE; + if (pDevice->Flags & fMP_CONTROL_WRITES) + return STATUS_FAILURE; + + MP_SET_FLAG(pDevice, fMP_CONTROL_READS); + pDevice->sUsbCtlRequest.bRequestType = 0xC0; pDevice->sUsbCtlRequest.bRequest = byRequest; pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); @@ -237,10 +203,11 @@ int PIPEnsControlIn( ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); if (ntStatus != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control request submission failed: %d\n", ntStatus); - }else { - MP_SET_FLAG(pDevice, fMP_CONTROL_READS); - } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "control request submission failed: %d\n", ntStatus); + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); + return STATUS_FAILURE; + } spin_unlock_irq(&pDevice->lock); for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { @@ -263,13 +230,9 @@ int PIPEnsControlIn( return ntStatus; } -static -void -s_nsControlInUsbIoCompleteWrite( - struct urb *urb - ) +static void s_nsControlInUsbIoCompleteWrite(struct urb *urb) { - PSDevice pDevice; + struct vnt_private *pDevice = (struct vnt_private *)urb->context; pDevice = urb->context; switch (urb->status) { @@ -304,15 +267,11 @@ s_nsControlInUsbIoCompleteWrite( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -static -void -s_nsControlInUsbIoCompleteRead( - struct urb *urb - ) + +static void s_nsControlInUsbIoCompleteRead(struct urb *urb) { - PSDevice pDevice; + struct vnt_private *pDevice = (struct vnt_private *)urb->context; - pDevice = urb->context; switch (urb->status) { case 0: break; @@ -345,17 +304,18 @@ s_nsControlInUsbIoCompleteRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -int PIPEnsInterruptRead(PSDevice pDevice) + +int PIPEnsInterruptRead(struct vnt_private *pDevice) { - int ntStatus = STATUS_FAILURE; + int ntStatus = STATUS_FAILURE; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartInterruptUsbRead()\n"); - if(pDevice->intBuf.bInUse == TRUE){ + if(pDevice->intBuf.bInUse == true){ return (STATUS_FAILURE); } - pDevice->intBuf.bInUse = TRUE; -// pDevice->bEventAvailable = FALSE; + pDevice->intBuf.bInUse = true; +// pDevice->bEventAvailable = false; pDevice->ulIntInPosted++; // @@ -396,21 +356,16 @@ usb_fill_bulk_urb(pDevice->pInterruptURB, * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -static -void -s_nsInterruptUsbIoCompleteRead( - struct urb *urb - ) +static void s_nsInterruptUsbIoCompleteRead(struct urb *urb) { - PSDevice pDevice; - int ntStatus; + struct vnt_private *pDevice = (struct vnt_private *)urb->context; + int ntStatus; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptUsbIoCompleteRead\n"); // // The context given to IoSetCompletionRoutine is the receive buffer object // - pDevice = (PSDevice)urb->context; // // We have a number of cases: @@ -428,7 +383,7 @@ s_nsInterruptUsbIoCompleteRead( // otherwise interrupt data handler will free int buffer after it handle it. if (( ntStatus != STATUS_SUCCESS )) { pDevice->ulBulkInError++; - pDevice->intBuf.bInUse = FALSE; + pDevice->intBuf.bInUse = false; // if (ntStatus == USBD_STATUS_CRC) { // pDevice->ulIntInContCRCError++; @@ -436,20 +391,20 @@ s_nsInterruptUsbIoCompleteRead( // if (ntStatus == STATUS_NOT_CONNECTED ) // { - pDevice->fKillEventPollingThread = TRUE; + pDevice->fKillEventPollingThread = true; // } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"IntUSBIoCompleteControl STATUS = %d\n", ntStatus ); } else { pDevice->ulIntInBytesRead += (unsigned long) urb->actual_length; pDevice->ulIntInContCRCError = 0; - pDevice->bEventAvailable = TRUE; + pDevice->bEventAvailable = true; INTnsProcessData(pDevice); } STAvUpdateUSBCounter(&pDevice->scStatistic.USB_InterruptStat, ntStatus); - if (pDevice->fKillEventPollingThread != TRUE) { + if (pDevice->fKillEventPollingThread != true) { usb_fill_bulk_urb(pDevice->pInterruptURB, pDevice->usb, usb_rcvbulkpipe(pDevice->usb, 1), @@ -483,10 +438,11 @@ s_nsInterruptUsbIoCompleteRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -int PIPEnsBulkInUsbRead(PSDevice pDevice, PRCB pRCB) + +int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB) { int ntStatus = 0; - struct urb *pUrb; + struct urb *pUrb; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartBulkInUsbRead\n"); @@ -521,7 +477,7 @@ int PIPEnsBulkInUsbRead(PSDevice pDevice, PRCB pRCB) return STATUS_FAILURE ; } pRCB->Ref = 1; - pRCB->bBoolInUse= TRUE; + pRCB->bBoolInUse= true; return ntStatus; } @@ -543,19 +499,15 @@ int PIPEnsBulkInUsbRead(PSDevice pDevice, PRCB pRCB) * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -static -void -s_nsBulkInUsbIoCompleteRead( - struct urb *urb - ) +static void s_nsBulkInUsbIoCompleteRead(struct urb *urb) { - PRCB pRCB = (PRCB)urb->context; - PSDevice pDevice = (PSDevice)pRCB->pDevice; - unsigned long bytesRead; - BOOL bIndicateReceive = FALSE; - BOOL bReAllocSkb = FALSE; - int status; + PRCB pRCB = (PRCB)urb->context; + struct vnt_private *pDevice = pRCB->pDevice; + unsigned long bytesRead; + int bIndicateReceive = false; + int bReAllocSkb = false; + int status; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkInUsbIoCompleteRead\n"); status = urb->status; @@ -576,7 +528,7 @@ s_nsBulkInUsbIoCompleteRead( // } } else { if (bytesRead) - bIndicateReceive = TRUE; + bIndicateReceive = true; pDevice->ulBulkInContCRCError = 0; pDevice->ulBulkInBytesRead += bytesRead; @@ -588,8 +540,8 @@ s_nsBulkInUsbIoCompleteRead( if (bIndicateReceive) { spin_lock(&pDevice->lock); - if (RXbBulkInProcessData(pDevice, pRCB, bytesRead) == TRUE) - bReAllocSkb = TRUE; + if (RXbBulkInProcessData(pDevice, pRCB, bytesRead) == true) + bReAllocSkb = true; spin_unlock(&pDevice->lock); } pRCB->Ref--; @@ -618,18 +570,15 @@ s_nsBulkInUsbIoCompleteRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -int -PIPEnsSendBulkOut( - PSDevice pDevice, - PUSB_SEND_CONTEXT pContext - ) + +int PIPEnsSendBulkOut(struct vnt_private *pDevice, PUSB_SEND_CONTEXT pContext) { - int status; - struct urb *pUrb; + int status; + struct urb *pUrb; - pDevice->bPWBitOn = FALSE; + pDevice->bPWBitOn = false; /* if (pDevice->pPendingBulkOutContext != NULL) { @@ -661,13 +610,13 @@ PIPEnsSendBulkOut( if (status != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Tx URB failed %d\n", status); - pContext->bBoolInUse = FALSE; + pContext->bBoolInUse = false; return STATUS_FAILURE; } return STATUS_PENDING; } else { - pContext->bBoolInUse = FALSE; + pContext->bBoolInUse = false; return STATUS_RESOURCES; } } @@ -699,17 +648,14 @@ PIPEnsSendBulkOut( * (IofCompleteRequest) to stop working on the irp. * */ -static -void -s_nsBulkOutIoCompleteWrite( - struct urb *urb - ) + +static void s_nsBulkOutIoCompleteWrite(struct urb *urb) { - PSDevice pDevice; - int status; - CONTEXT_TYPE ContextType; - unsigned long ulBufLen; - PUSB_SEND_CONTEXT pContext; + struct vnt_private *pDevice; + int status; + CONTEXT_TYPE ContextType; + unsigned long ulBufLen; + PUSB_SEND_CONTEXT pContext; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n"); @@ -769,11 +715,11 @@ s_nsBulkOutIoCompleteWrite( } } - if (pDevice->bLinkPass == TRUE) { + if (pDevice->bLinkPass == true) { if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); } - pContext->bBoolInUse = FALSE; + pContext->bBoolInUse = false; return; } diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h index b3673474a9e1..b3023559c15b 100644 --- a/drivers/staging/vt6656/usbpipe.h +++ b/drivers/staging/vt6656/usbpipe.h @@ -41,35 +41,15 @@ /*--------------------- Export Functions --------------------------*/ -int PIPEnsControlOut( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ); - -int PIPEnsControlOutAsyn( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ); - -int PIPEnsControlIn( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ); - -int PIPEnsInterruptRead(PSDevice pDevice); -int PIPEnsBulkInUsbRead(PSDevice pDevice, PRCB pRCB); -int PIPEnsSendBulkOut(PSDevice pDevice, PUSB_SEND_CONTEXT pContext); +int PIPEnsControlOut(struct vnt_private *, u8 byRequest, u16 wValue, + u16 wIndex, u16 wLength, u8 *pbyBuffer); +int PIPEnsControlOutAsyn(struct vnt_private *, u8 byRequest, + u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer); +int PIPEnsControlIn(struct vnt_private *, u8 byRequest, u16 wValue, + u16 wIndex, u16 wLength, u8 *pbyBuffer); + +int PIPEnsInterruptRead(struct vnt_private *); +int PIPEnsBulkInUsbRead(struct vnt_private *, PRCB pRCB); +int PIPEnsSendBulkOut(struct vnt_private *, PUSB_SEND_CONTEXT pContext); #endif /* __USBPIPE_H__ */ diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 22f6b41cfd19..4bb652bf7cf6 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -68,33 +68,17 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; /*--------------------- Static Functions --------------------------*/ -static -void -s_vProbeChannel( - PSDevice pDevice - ); +static void s_vProbeChannel(struct vnt_private *); +static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *, + struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -static -PSTxMgmtPacket -s_MgrMakeProbeRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pScanBSSID, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +static int s_bCommandComplete(struct vnt_private *); -static -BOOL -s_bCommandComplete ( - PSDevice pDevice - ); - -static BOOL s_bClearBSSID_SCAN(void *hDeviceContext); +static int s_bClearBSSID_SCAN(struct vnt_private *); /*--------------------- Export Variables --------------------------*/ @@ -114,13 +98,10 @@ static BOOL s_bClearBSSID_SCAN(void *hDeviceContext); * */ -static -void -vAdHocBeaconStop(PSDevice pDevice) +static void vAdHocBeaconStop(struct vnt_private *pDevice) { - - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - BOOL bStop; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int bStop; /* * temporarily stop Beacon packet for AdHoc Server @@ -133,18 +114,18 @@ vAdHocBeaconStop(PSDevice pDevice) * or * (3.2) AdHoc channel is in A mode */ - bStop = FALSE; + bStop = false; if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) && (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { - bStop = TRUE; + bStop = true; } if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) { - bStop = TRUE; + bStop = true; } } @@ -171,11 +152,9 @@ vAdHocBeaconStop(PSDevice pDevice) * Return Value: none * */ -static -void -vAdHocBeaconRestart(PSDevice pDevice) +static void vAdHocBeaconRestart(struct vnt_private *pDevice) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; /* * Restart Beacon packet for AdHoc Server @@ -204,22 +183,22 @@ vAdHocBeaconRestart(PSDevice pDevice) * -*/ -static -void -s_vProbeChannel( - PSDevice pDevice - ) +static void s_vProbeChannel(struct vnt_private *pDevice) { - //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M - BYTE abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; - BYTE abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60}; - //6M, 9M, 12M, 48M - BYTE abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; - BYTE abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16}; - PBYTE pbyRate; - PSTxMgmtPacket pTxPacket; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int ii; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_tx_mgmt *pTxPacket; + u8 abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, + 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; + /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M*/ + u8 abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, + 4, 0x0C, 0x12, 0x18, 0x60}; + /* 6M, 9M, 12M, 48M*/ + u8 abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, + 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; + u8 abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, + 4, 0x02, 0x04, 0x0B, 0x16}; + u8 *pbyRate; + int ii; if (pDevice->byBBType == BB_TYPE_11A) { @@ -268,24 +247,19 @@ s_vProbeChannel( -*/ -PSTxMgmtPacket -s_MgrMakeProbeRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pScanBSSID, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - - ) +struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_PROBEREQ sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_PROBEREQ sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBEREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_PROBEREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_PROBEREQ_FR_MAXLEN; vMgrEncodeProbeRequest(&sFrame); @@ -316,9 +290,8 @@ s_MgrMakeProbeRequest( return pTxPacket; } -void vCommandTimerWait(void *hDeviceContext, unsigned long MSecond) +void vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond) { - PSDevice pDevice = (PSDevice)hDeviceContext; init_timer(&pDevice->sTimerCommand); @@ -331,23 +304,22 @@ void vCommandTimerWait(void *hDeviceContext, unsigned long MSecond) return; } -void vRunCommand(void *hDeviceContext) +void vRunCommand(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PWLAN_IE_SSID pItemSSID; - PWLAN_IE_SSID pItemSSIDCurr; - CMD_STATUS Status; - unsigned int ii; - BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; - struct sk_buff *skb; - BYTE byData; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PWLAN_IE_SSID pItemSSID; + PWLAN_IE_SSID pItemSSIDCurr; + CMD_STATUS Status; + struct sk_buff *skb; union iwreq_data wrqu; + int ii; + u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; + u8 byData; if (pDevice->dwDiagRefCount != 0) return; - if (pDevice->bCmdRunning != TRUE) + if (pDevice->bCmdRunning != true) return; spin_lock_irq(&pDevice->lock); @@ -357,7 +329,7 @@ void vRunCommand(void *hDeviceContext) case WLAN_CMD_SCAN_START: pDevice->byReAssocCount = 0; - if (pDevice->bRadioOff == TRUE) { + if (pDevice->bRadioOff == true) { s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -385,7 +357,7 @@ void vRunCommand(void *hDeviceContext) if (pDevice->bUpdateBBVGA) { BBvSetShortSlotTime(pDevice); BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); - BBvUpdatePreEDThreshold(pDevice, FALSE); + BBvUpdatePreEDThreshold(pDevice, false); } // Set channel back vAdHocBeaconRestart(pDevice); @@ -397,7 +369,7 @@ void vRunCommand(void *hDeviceContext) pDevice->byRxMode |= RCR_BSSID; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); - pDevice->bStopDataPkt = FALSE; + pDevice->bStopDataPkt = false; s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -423,7 +395,7 @@ void vRunCommand(void *hDeviceContext) pDevice->bLinkPass); */ pMgmt->eScanState = WMAC_IS_SCANNING; pDevice->byScanBBType = pDevice->byBBType; //lucas - pDevice->bStopDataPkt = TRUE; + pDevice->bStopDataPkt = true; // Turn off RCR_BSSID filter every time MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_BSSID); pDevice->byRxMode &= ~RCR_BSSID; @@ -447,7 +419,7 @@ void vRunCommand(void *hDeviceContext) if (pDevice->bUpdateBBVGA) { BBvSetShortSlotTime(pDevice); BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]); - BBvUpdatePreEDThreshold(pDevice, TRUE); + BBvUpdatePreEDThreshold(pDevice, true); } pMgmt->uScanChannel++; @@ -461,7 +433,7 @@ void vRunCommand(void *hDeviceContext) pDevice->eCommandState = WLAN_CMD_SCAN_END; } - if ((pMgmt->b11hEnable == FALSE) || + if ((pMgmt->b11hEnable == false) || (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { s_vProbeChannel(pDevice); spin_unlock_irq(&pDevice->lock); @@ -488,7 +460,7 @@ void vRunCommand(void *hDeviceContext) if (pDevice->bUpdateBBVGA) { BBvSetShortSlotTime(pDevice); BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); - BBvUpdatePreEDThreshold(pDevice, FALSE); + BBvUpdatePreEDThreshold(pDevice, false); } // Set channel back @@ -502,7 +474,7 @@ void vRunCommand(void *hDeviceContext) } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); pMgmt->eScanState = WMAC_NO_SCANNING; - pDevice->bStopDataPkt = FALSE; + pDevice->bStopDataPkt = false; /*send scan event to wpa_Supplicant*/ PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); @@ -521,12 +493,12 @@ void vRunCommand(void *hDeviceContext) return; } else { - pDevice->bwextstep0 = FALSE; - pDevice->bwextstep1 = FALSE; - pDevice->bwextstep2 = FALSE; - pDevice->bwextstep3 = FALSE; - pDevice->bWPASuppWextEnabled = FALSE; - pDevice->fWPA_Authened = FALSE; + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = false; + pDevice->bWPASuppWextEnabled = false; + pDevice->fWPA_Authened = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); // reason = 8 : disassoc because sta has left @@ -535,18 +507,18 @@ void vRunCommand(void *hDeviceContext) pMgmt->abyCurrBSSID, (8), &Status); - pDevice->bLinkPass = FALSE; + pDevice->bLinkPass = false; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); // unlock command busy pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; pItemSSID->len = 0; memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); pMgmt->eCurrState = WMAC_STATE_IDLE; - pMgmt->sNodeDBTable[0].bActive = FALSE; -// pDevice->bBeaconBufReady = FALSE; + pMgmt->sNodeDBTable[0].bActive = false; +// pDevice->bBeaconBufReady = false; } netif_stop_queue(pDevice->dev); - if (pDevice->bNeedRadioOFF == TRUE) + if (pDevice->bNeedRadioOFF == true) CARDbRadioPowerOff(pDevice); s_bCommandComplete(pDevice); break; @@ -555,7 +527,7 @@ void vRunCommand(void *hDeviceContext) case WLAN_CMD_SSID_START: pDevice->byReAssocCount = 0; - if (pDevice->bRadioOff == TRUE) { + if (pDevice->bRadioOff == true) { s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -588,7 +560,7 @@ void vRunCommand(void *hDeviceContext) } } netif_stop_queue(pDevice->dev); - pDevice->bLinkPass = FALSE; + pDevice->bLinkPass = false; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); } // set initial state @@ -625,9 +597,9 @@ void vRunCommand(void *hDeviceContext) if (netif_queue_stopped(pDevice->dev)){ netif_wake_queue(pDevice->dev); } - pDevice->bLinkPass = TRUE; + pDevice->bLinkPass = true; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); - pMgmt->sNodeDBTable[0].bActive = TRUE; + pMgmt->sNodeDBTable[0].bActive = true; pMgmt->sNodeDBTable[0].uInActiveCount = 0; } else { @@ -658,7 +630,7 @@ void vRunCommand(void *hDeviceContext) BSSvAddMulticastNode(pDevice); s_bClearBSSID_SCAN(pDevice); /* - pDevice->bLinkPass = TRUE; + pDevice->bLinkPass = true; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); if (netif_queue_stopped(pDevice->dev)){ netif_wake_queue(pDevice->dev); @@ -668,7 +640,7 @@ void vRunCommand(void *hDeviceContext) } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); - // if(pDevice->bWPASuppWextEnabled == TRUE) + // if(pDevice->bWPASuppWextEnabled == true) { union iwreq_data wrqu; memset(&wrqu, 0, sizeof (wrqu)); @@ -726,7 +698,7 @@ void vRunCommand(void *hDeviceContext) */ pDevice->byLinkWaitCount = 0; pDevice->byReAssocCount = 0; - pDevice->bLinkPass = TRUE; + pDevice->bLinkPass = true; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); s_bClearBSSID_SCAN(pDevice); @@ -734,20 +706,20 @@ void vRunCommand(void *hDeviceContext) netif_wake_queue(pDevice->dev); } - if(pDevice->IsTxDataTrigger != FALSE) { //TxDataTimer is not triggered at the first time + if(pDevice->IsTxDataTrigger != false) { //TxDataTimer is not triggered at the first time // printk("Re-initial TxDataTimer****\n"); del_timer(&pDevice->sTimerTxData); init_timer(&pDevice->sTimerTxData); pDevice->sTimerTxData.data = (unsigned long) pDevice; pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData; pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback - pDevice->fTxDataInSleep = FALSE; + pDevice->fTxDataInSleep = false; pDevice->nTxDataTimeCout = 0; } else { // printk("mike:-->First time trigger TimerTxData InSleep\n"); } - pDevice->IsTxDataTrigger = TRUE; + pDevice->IsTxDataTrigger = true; add_timer(&pDevice->sTimerTxData); } @@ -773,15 +745,15 @@ void vRunCommand(void *hDeviceContext) del_timer(&pMgmt->sTimerSecondCallback); pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; - pDevice->bLinkPass = FALSE; + pDevice->bLinkPass = false; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); - if (pDevice->bEnableHostWEP == TRUE) + if (pDevice->bEnableHostWEP == true) BSSvClearNodeDBTable(pDevice, 1); else BSSvClearNodeDBTable(pDevice, 0); pDevice->uAssocCount = 0; pMgmt->eCurrState = WMAC_STATE_IDLE; - pDevice->bFixRate = FALSE; + pDevice->bFixRate = false; vMgrCreateOwnIBSS((void *) pDevice, &Status); if (Status != CMD_STATUS_SUCCESS) { @@ -796,7 +768,7 @@ void vRunCommand(void *hDeviceContext) if (netif_queue_stopped(pDevice->dev)){ netif_wake_queue(pDevice->dev); } - pDevice->bLinkPass = TRUE; + pDevice->bLinkPass = true; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); add_timer(&pMgmt->sTimerSecondCallback); } @@ -809,10 +781,10 @@ void vRunCommand(void *hDeviceContext) while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) { if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) { pMgmt->abyPSTxMap[0] &= ~byMask[0]; - pDevice->bMoreData = FALSE; + pDevice->bMoreData = false; } else { - pDevice->bMoreData = TRUE; + pDevice->bMoreData = true; } if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) { @@ -834,10 +806,10 @@ void vRunCommand(void *hDeviceContext) // clear tx map pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; - pDevice->bMoreData = FALSE; + pDevice->bMoreData = false; } else { - pDevice->bMoreData = TRUE; + pDevice->bMoreData = true; } if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) { @@ -856,7 +828,7 @@ void vRunCommand(void *hDeviceContext) ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear \n", ii); } - pMgmt->sNodeDBTable[ii].bRxPSPoll = FALSE; + pMgmt->sNodeDBTable[ii].bRxPSPoll = false; } } @@ -866,7 +838,7 @@ void vRunCommand(void *hDeviceContext) case WLAN_CMD_RADIO_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_RADIO_START\n"); - // if (pDevice->bRadioCmd == TRUE) + // if (pDevice->bRadioCmd == true) // CARDbRadioPowerOn(pDevice); // else // CARDbRadioPowerOff(pDevice); @@ -894,31 +866,31 @@ void vRunCommand(void *hDeviceContext) pDevice->cbFreeCmdQueue = CMD_Q_SIZE; pDevice->uCmdDequeueIdx = 0; pDevice->uCmdEnqueueIdx = 0; - //0415pDevice->bCmdRunning = FALSE; - pDevice->bCmdClear = TRUE; - pDevice->bStopTx0Pkt = FALSE; - pDevice->bStopDataPkt = TRUE; + //0415pDevice->bCmdRunning = false; + pDevice->bCmdClear = true; + pDevice->bStopTx0Pkt = false; + pDevice->bStopDataPkt = true; pDevice->byKeyIndex = 0; - pDevice->bTransmitKey = FALSE; + pDevice->bTransmitKey = false; spin_unlock_irq(&pDevice->lock); KeyvInitTable(pDevice,&pDevice->sKey); spin_lock_irq(&pDevice->lock); pMgmt->byCSSPK = KEY_CTL_NONE; pMgmt->byCSSGK = KEY_CTL_NONE; - if (pDevice->bLinkPass == TRUE) { + if (pDevice->bLinkPass == true) { // reason = 8 : disassoc because sta has left vMgrDisassocBeginSta((void *) pDevice, pMgmt, pMgmt->abyCurrBSSID, (8), &Status); - pDevice->bLinkPass = FALSE; + pDevice->bLinkPass = false; // unlock command busy pMgmt->eCurrState = WMAC_STATE_IDLE; - pMgmt->sNodeDBTable[0].bActive = FALSE; - // if(pDevice->bWPASuppWextEnabled == TRUE) + pMgmt->sNodeDBTable[0].bActive = false; + // if(pDevice->bWPASuppWextEnabled == true) { union iwreq_data wrqu; memset(&wrqu, 0, sizeof (wrqu)); @@ -927,11 +899,11 @@ void vRunCommand(void *hDeviceContext) wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } } - pDevice->bwextstep0 = FALSE; - pDevice->bwextstep1 = FALSE; - pDevice->bwextstep2 = FALSE; - pDevice->bwextstep3 = FALSE; - pDevice->bWPASuppWextEnabled = FALSE; + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = false; + pDevice->bWPASuppWextEnabled = false; //clear current SSID pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; pItemSSID->len = 0; @@ -945,10 +917,10 @@ void vRunCommand(void *hDeviceContext) CARDbRadioPowerOff(pDevice); MACvRegBitsOn(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_OFF); - pDevice->bHWRadioOff = TRUE; + pDevice->bHWRadioOff = true; } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_ON........................\n"); - pDevice->bHWRadioOff = FALSE; + pDevice->bHWRadioOff = false; CARDbRadioPowerOn(pDevice); MACvRegBitsOff(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_ON); @@ -961,11 +933,11 @@ void vRunCommand(void *hDeviceContext) case WLAN_CMD_CHANGE_BBSENSITIVITY_START: - pDevice->bStopDataPkt = TRUE; + pDevice->bStopDataPkt = true; pDevice->byBBVGACurrent = pDevice->byBBVGANew; BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change sensitivity pDevice->byBBVGACurrent = %x\n", pDevice->byBBVGACurrent); - pDevice->bStopDataPkt = FALSE; + pDevice->bStopDataPkt = false; s_bCommandComplete(pDevice); break; @@ -990,13 +962,13 @@ void vRunCommand(void *hDeviceContext) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change from Antenna%d to", (int)pDevice->dwRxAntennaSel); if ( pDevice->dwRxAntennaSel == 0) { pDevice->dwRxAntennaSel=1; - if (pDevice->bTxRxAntInv == TRUE) + if (pDevice->bTxRxAntInv == true) BBvSetAntennaMode(pDevice, ANT_RXA); else BBvSetAntennaMode(pDevice, ANT_RXB); } else { pDevice->dwRxAntennaSel=0; - if (pDevice->bTxRxAntInv == TRUE) + if (pDevice->bTxRxAntInv == true) BBvSetAntennaMode(pDevice, ANT_RXB); else BBvSetAntennaMode(pDevice, ANT_RXA); @@ -1027,9 +999,9 @@ void vRunCommand(void *hDeviceContext) case WLAN_CMD_11H_CHSW_START: CARDbSetMediaChannel(pDevice, pDevice->byNewChannel); - pDevice->bChannelSwitch = FALSE; + pDevice->bChannelSwitch = false; pMgmt->uCurrChannel = pDevice->byNewChannel; - pDevice->bStopDataPkt = FALSE; + pDevice->bStopDataPkt = false; s_bCommandComplete(pDevice); break; @@ -1043,24 +1015,19 @@ void vRunCommand(void *hDeviceContext) } -static -BOOL -s_bCommandComplete ( - PSDevice pDevice - ) +static int s_bCommandComplete(struct vnt_private *pDevice) { - PWLAN_IE_SSID pSSID; - BOOL bRadioCmd = FALSE; - //WORD wDeAuthenReason = 0; - BOOL bForceSCAN = TRUE; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PWLAN_IE_SSID pSSID; + int bRadioCmd = false; + int bForceSCAN = true; pDevice->eCommandState = WLAN_CMD_IDLE; if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { //Command Queue Empty - pDevice->bCmdRunning = FALSE; - return TRUE; + pDevice->bCmdRunning = false; + return true; } else { pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd; @@ -1069,7 +1036,7 @@ s_bCommandComplete ( bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN; ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue++; - pDevice->bCmdRunning = TRUE; + pDevice->bCmdRunning = true; switch ( pDevice->eCommand ) { case WLAN_CMD_BSSID_SCAN: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); @@ -1081,7 +1048,7 @@ s_bCommandComplete ( memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); } /* - if ((bForceSCAN == FALSE) && (pDevice->bLinkPass == TRUE)) { + if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { pDevice->eCommandState = WLAN_CMD_IDLE; @@ -1146,29 +1113,26 @@ s_bCommandComplete ( break; } - vCommandTimerWait((void *) pDevice, 0); + vCommandTimerWait(pDevice, 0); } - return TRUE; + return true; } -BOOL bScheduleCommand(void *hDeviceContext, - CMD_CODE eCommand, - PBYTE pbyItem0) +int bScheduleCommand(struct vnt_private *pDevice, + CMD_CODE eCommand, u8 *pbyItem0) { - PSDevice pDevice = (PSDevice)hDeviceContext; - if (pDevice->cbFreeCmdQueue == 0) { - return (FALSE); + return (false); } pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = TRUE; + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true; memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); if (pbyItem0 != NULL) { switch (eCommand) { case WLAN_CMD_BSSID_SCAN: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = FALSE; + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false; memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); break; @@ -1199,12 +1163,12 @@ BOOL bScheduleCommand(void *hDeviceContext, ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue--; - if (pDevice->bCmdRunning == FALSE) { + if (pDevice->bCmdRunning == false) { s_bCommandComplete(pDevice); } else { } - return (TRUE); + return (true); } @@ -1219,14 +1183,13 @@ BOOL bScheduleCommand(void *hDeviceContext, * Out: * none * - * Return Value: TRUE if success; otherwise FALSE + * Return Value: true if success; otherwise false * */ -static BOOL s_bClearBSSID_SCAN(void *hDeviceContext) +static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx; - unsigned int ii; + unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx; + unsigned int ii; if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) { for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii ++) { @@ -1237,14 +1200,13 @@ static BOOL s_bClearBSSID_SCAN(void *hDeviceContext) break; } } - return TRUE; + return true; } //mike add:reset command timer -void vResetCommandTimer(void *hDeviceContext) +void vResetCommandTimer(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; //delete timer del_timer(&pDevice->sTimerCommand); @@ -1257,14 +1219,13 @@ void vResetCommandTimer(void *hDeviceContext) pDevice->uCmdDequeueIdx = 0; pDevice->uCmdEnqueueIdx = 0; pDevice->eCommandState = WLAN_CMD_IDLE; - pDevice->bCmdRunning = FALSE; - pDevice->bCmdClear = FALSE; + pDevice->bCmdRunning = false; + pDevice->bCmdClear = false; } -void BSSvSecondTxData(void *hDeviceContext) +void BSSvSecondTxData(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; pDevice->nTxDataTimeCout++; @@ -1278,13 +1239,13 @@ void BSSvSecondTxData(void *hDeviceContext) spin_lock_irq(&pDevice->lock); //is wap_supplicant running successful OR only open && sharekey mode! - if (((pDevice->bLinkPass == TRUE) && + if (((pDevice->bLinkPass == true) && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking - (pDevice->fWPA_Authened == TRUE)) { //wpa linking + (pDevice->fWPA_Authened == true)) { //wpa linking // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__); - pDevice->fTxDataInSleep = TRUE; + pDevice->fTxDataInSleep = true; PSbSendNullPacket(pDevice); //send null packet - pDevice->fTxDataInSleep = FALSE; + pDevice->fTxDataInSleep = false; } spin_unlock_irq(&pDevice->lock); diff --git a/drivers/staging/vt6656/wcmd.h b/drivers/staging/vt6656/wcmd.h index d24a79dce61a..c40e6baa0b5d 100644 --- a/drivers/staging/vt6656/wcmd.h +++ b/drivers/staging/vt6656/wcmd.h @@ -28,7 +28,6 @@ #ifndef __WCMD_H__ #define __WCMD_H__ - #include "ttype.h" #include "80211hdr.h" #include "80211mgr.h" @@ -75,9 +74,9 @@ typedef enum tagCMD_STATUS { typedef struct tagCMD_ITEM { CMD_CODE eCmd; BYTE abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - BOOL bNeedRadioOFF; - BOOL bRadioCmd; - BOOL bForceSCAN; + bool bNeedRadioOFF; + bool bRadioCmd; + bool bForceSCAN; WORD wDeAuthenReason; } CMD_ITEM, *PCMD_ITEM; @@ -112,14 +111,13 @@ typedef enum tagCMD_STATE { /*--------------------- Export Types ------------------------------*/ /*--------------------- Export Functions --------------------------*/ +struct vnt_private; -void vResetCommandTimer(void *hDeviceContext); +void vResetCommandTimer(struct vnt_private *); -BOOL bScheduleCommand(void *hDeviceContext, - CMD_CODE eCommand, - PBYTE pbyItem0); +int bScheduleCommand(struct vnt_private *, CMD_CODE eCommand, u8 *pbyItem0); -void vRunCommand(void *hDeviceContext); +void vRunCommand(struct vnt_private *); /* void @@ -128,6 +126,6 @@ WCMDvCommandThread( ); */ -void BSSvSecondTxData(void *hDeviceContext); +void BSSvSecondTxData(struct vnt_private *); #endif /* __WCMD_H__ */ diff --git a/drivers/staging/vt6656/wctl.c b/drivers/staging/vt6656/wctl.c index 9249263b2da8..baa48a1f0d36 100644 --- a/drivers/staging/vt6656/wctl.c +++ b/drivers/staging/vt6656/wctl.c @@ -53,8 +53,8 @@ /* * Description: - * Scan Rx cache. Return TRUE if packet is duplicate, else - * inserts in receive cache and returns FALSE. + * Scan Rx cache. Return true if packet is duplicate, else + * inserts in receive cache and returns false. * * Parameters: * In: @@ -63,11 +63,11 @@ * Out: * none * - * Return Value: TRUE if packet duplicate; otherwise FALSE + * Return Value: true if packet duplicate; otherwise false * */ -BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) +bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) { unsigned int uIndex; unsigned int ii; @@ -84,7 +84,7 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) (LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->wFrameCtl)) ) { /* Duplicate match */ - return TRUE; + return true; } ADD_ONE_WITH_WRAP_AROUND(uIndex, DUPLICATE_RX_CACHE_LENGTH); } @@ -95,7 +95,7 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN); pCacheEntry->wFrameCtl = pMACHeader->wFrameCtl; ADD_ONE_WITH_WRAP_AROUND(pCache->uInPtr, DUPLICATE_RX_CACHE_LENGTH); - return FALSE; + return false; } /* @@ -113,12 +113,13 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) * */ -unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader) +unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, + PS802_11Header pMACHeader) { unsigned int ii; for (ii = 0; ii < pDevice->cbDFCB; ii++) { - if ((pDevice->sRxDFCB[ii].bInUse == TRUE) && + if ((pDevice->sRxDFCB[ii].bInUse == true) && (!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]), &(pMACHeader->abyAddr2[0])))) { return ii; @@ -141,17 +142,18 @@ unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader) * Return Value: index number in Defragment Database * */ -unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader) +unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, + PS802_11Header pMACHeader) { unsigned int ii; if (pDevice->cbFreeDFCB == 0) return(pDevice->cbDFCB); for (ii = 0; ii < pDevice->cbDFCB; ii++) { - if (pDevice->sRxDFCB[ii].bInUse == FALSE) { + if (pDevice->sRxDFCB[ii].bInUse == false) { pDevice->cbFreeDFCB--; pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime; - pDevice->sRxDFCB[ii].bInUse = TRUE; + pDevice->sRxDFCB[ii].bInUse = true; pDevice->sRxDFCB[ii].wSequence = (pMACHeader->wSeqCtl >> 4); pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F); memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), @@ -177,16 +179,16 @@ unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader) * Out: * none * - * Return Value: TRUE if it is valid fragment packet and we have resource to defragment; otherwise FALSE + * Return Value: true if it is valid fragment packet and we have resource to defragment; otherwise false * */ -BOOL WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, - unsigned int cbFrameLength, BOOL bWEP, BOOL bExtIV) +bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, + unsigned int cbFrameLength, bool bWEP, bool bExtIV) { -unsigned int uHeaderSize; + unsigned int uHeaderSize; - if (bWEP == TRUE) { + if (bWEP == true) { uHeaderSize = 28; if (bExtIV) // ExtIV @@ -207,7 +209,7 @@ unsigned int uHeaderSize; else { pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader); if (pDevice->uCurrentDFCBIdx == pDevice->cbDFCB) { - return(FALSE); + return(false); } } // reserve 8 byte to match MAC RX Buffer @@ -218,7 +220,7 @@ unsigned int uHeaderSize; pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer += cbFrameLength; pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum++; //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "First pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); - return(FALSE); + return(false); } else { pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, pMACHeader); @@ -236,21 +238,21 @@ unsigned int uHeaderSize; else { // seq error or frag # error flush DFCB pDevice->cbFreeDFCB++; - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = FALSE; - return(FALSE); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = false; + return(false); } } else { - return(FALSE); + return(false); } if (IS_LAST_FRAGMENT_PKT(pMACHeader)) { //enq defragcontrolblock pDevice->cbFreeDFCB++; - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = FALSE; + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = false; //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); - return(TRUE); + return(true); } - return(FALSE); + return(false); } } diff --git a/drivers/staging/vt6656/wctl.h b/drivers/staging/vt6656/wctl.h index 7270af68c89d..1b21e32e99e5 100644 --- a/drivers/staging/vt6656/wctl.h +++ b/drivers/staging/vt6656/wctl.h @@ -96,10 +96,10 @@ /*--------------------- Export Functions --------------------------*/ -BOOL WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); -BOOL WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, - unsigned int cbFrameLength, BOOL bWEP, BOOL bExtIV); -unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader); -unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader); +bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); +bool WCTLbHandleFragment(struct vnt_private *, PS802_11Header pMACHeader, + unsigned int cbFrameLength, bool bWEP, bool bExtIV); +unsigned int WCTLuSearchDFCB(struct vnt_private *, PS802_11Header pMACHeader); +unsigned int WCTLuInsertDFCB(struct vnt_private *, PS802_11Header pMACHeader); #endif /* __WCTL_H__ */ diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index 95ddc8303bb3..5dced0a43797 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -93,230 +93,101 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ -static BOOL ChannelExceedZoneType( - PSDevice pDevice, - BYTE byCurrChannel - ); +static int ChannelExceedZoneType(struct vnt_private *, u8 byCurrChannel); -// Association/diassociation functions -static -PSTxMgmtPacket -s_MgrMakeAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pDAddr, - WORD wCurrCapInfo, - WORD wListenInterval, - PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +/* Association/diassociation functions */ +static struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *, + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -static -void -s_vMgrRxAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - unsigned int uNodeIndex - ); +static void s_vMgrRxAssocRequest(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + u32 uNodeIndex); -static -PSTxMgmtPacket -s_MgrMakeReAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pDAddr, - WORD wCurrCapInfo, - WORD wListenInterval, - PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +static struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *, + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -static -void -s_vMgrRxAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - BOOL bReAssocType - ); +static void s_vMgrRxAssocResponse(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bReAssocType); -static -void -s_vMgrRxDisassociation( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +static void s_vMgrRxDisassociation(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -// Authentication/deauthen functions -static -void -s_vMgrRxAuthenSequence_1( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ); +/* Authentication/deauthen functions */ +static void s_vMgrRxAuthenSequence_1(struct vnt_private *, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); -static -void -s_vMgrRxAuthenSequence_2( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ); +static void s_vMgrRxAuthenSequence_2(struct vnt_private *, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); -static -void -s_vMgrRxAuthenSequence_3( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ); +static void s_vMgrRxAuthenSequence_3(struct vnt_private *, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); -static -void -s_vMgrRxAuthenSequence_4( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ); +static void s_vMgrRxAuthenSequence_4(struct vnt_private *, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); -static -void -s_vMgrRxAuthentication( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +static void s_vMgrRxAuthentication(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -static -void -s_vMgrRxDeauthentication( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +static void s_vMgrRxDeauthentication(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -// Scan functions -// probe request/response functions -static -void -s_vMgrRxProbeRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +/* Scan functions +* probe request/response functions */ -static -void -s_vMgrRxProbeResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +static void s_vMgrRxProbeRequest(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -// beacon functions -static -void -s_vMgrRxBeacon( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - BOOL bInScan - ); +static void s_vMgrRxProbeResponse(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -static -void -s_vMgrFormatTIM( - PSMgmtObject pMgmt, - PWLAN_IE_TIM pTIM - ); +/* beacon functions */ +static void s_vMgrRxBeacon(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bInScan); -static -PSTxMgmtPacket -s_MgrMakeBeacon( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wCurrBeaconPeriod, - unsigned int uCurrChannel, - WORD wCurrATIMWinodw, - PWLAN_IE_SSID pCurrSSID, - PBYTE pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM); +static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, PWLAN_IE_SSID pCurrSSID, + u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -// Association response -static -PSTxMgmtPacket -s_MgrMakeAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wAssocStatus, - WORD wAssocAID, - PBYTE pDstAddr, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); -// ReAssociation response -static -PSTxMgmtPacket -s_MgrMakeReAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wAssocStatus, - WORD wAssocAID, - PBYTE pDstAddr, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +/* Association response */ +static struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -// Probe response -static -PSTxMgmtPacket -s_MgrMakeProbeResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wCurrBeaconPeriod, - unsigned int uCurrChannel, - WORD wCurrATIMWinodw, - PBYTE pDstAddr, - PWLAN_IE_SSID pCurrSSID, - PBYTE pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates, - BYTE byPHYType - ); +/* ReAssociation response */ +static struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -// received status -static -void -s_vMgrLogStatus( - PSMgmtObject pMgmt, - WORD wStatus - ); +/* Probe response */ +static struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, + PWLAN_IE_SSID pCurrSSID, u8 *pCurrBSSID, + PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates, u8 byPHYType); +/* received status */ +static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus); -static -void -s_vMgrSynchBSS ( - PSDevice pDevice, - unsigned int uBSSMode, - PKnownBSS pCurr, - PCMD_STATUS pStatus - ); +static void s_vMgrSynchBSS(struct vnt_private *, u32 uBSSMode, + PKnownBSS pCurr, PCMD_STATUS pStatus); -static BOOL + +static bool s_bCipherMatch ( PKnownBSS pBSSNode, NDIS_802_11_ENCRYPTION_STATUS EncStatus, @@ -324,10 +195,7 @@ s_bCipherMatch ( PBYTE pbyCCSGK ); - static void Encyption_Rebuild( - PSDevice pDevice, - PKnownBSS pCurr - ); +static void Encyption_Rebuild(struct vnt_private *, PKnownBSS pCurr); /*--------------------- Export Variables --------------------------*/ @@ -343,11 +211,10 @@ s_bCipherMatch ( * -*/ -void vMgrObjectInit(void *hDeviceContext) +void vMgrObjectInit(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int ii; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0]; @@ -361,7 +228,7 @@ void vMgrObjectInit(void *hDeviceContext) pMgmt->byCSSPK = KEY_CTL_NONE; pMgmt->byCSSGK = KEY_CTL_NONE; pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI; - BSSvClearBSSList((void *) pDevice, FALSE); + BSSvClearBSSList((void *) pDevice, false); init_timer(&pMgmt->sTimerSecondCallback); pMgmt->sTimerSecondCallback.data = (unsigned long)pDevice; @@ -377,16 +244,16 @@ void vMgrObjectInit(void *hDeviceContext) pDevice->sTimerTxData.data = (unsigned long)pDevice; pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData; pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback - pDevice->fTxDataInSleep = FALSE; - pDevice->IsTxDataTrigger = FALSE; + pDevice->fTxDataInSleep = false; + pDevice->IsTxDataTrigger = false; pDevice->nTxDataTimeCout = 0; pDevice->cbFreeCmdQueue = CMD_Q_SIZE; pDevice->uCmdDequeueIdx = 0; pDevice->uCmdEnqueueIdx = 0; pDevice->eCommandState = WLAN_CMD_IDLE; - pDevice->bCmdRunning = FALSE; - pDevice->bCmdClear = FALSE; + pDevice->bCmdRunning = false; + pDevice->bCmdClear = false; return; } @@ -402,12 +269,10 @@ void vMgrObjectInit(void *hDeviceContext) * -*/ -void vMgrAssocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus) +void vMgrAssocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSTxMgmtPacket pTxPacket; + struct vnt_tx_mgmt *pTxPacket; pMgmt->wCurrCapInfo = 0; @@ -426,7 +291,7 @@ void vMgrAssocBeginSta(void *hDeviceContext, // ERP Phy (802.11g) should support short preamble. if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - if (pDevice->bShortSlotTime == TRUE) + if (pDevice->bShortSlotTime == true) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { @@ -434,7 +299,7 @@ void vMgrAssocBeginSta(void *hDeviceContext, pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); } } - if (pMgmt->b11hEnable == TRUE) + if (pMgmt->b11hEnable == true) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); // build an assocreq frame and send it @@ -475,14 +340,10 @@ void vMgrAssocBeginSta(void *hDeviceContext, * -*/ -void vMgrReAssocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus) +void vMgrReAssocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSTxMgmtPacket pTxPacket; - - + struct vnt_tx_mgmt *pTxPacket; pMgmt->wCurrCapInfo = 0; pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); @@ -502,7 +363,7 @@ void vMgrReAssocBeginSta(void *hDeviceContext, // ERP Phy (802.11g) should support short preamble. if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - if (pDevice->bShortSlotTime == TRUE) + if (pDevice->bShortSlotTime == true) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { @@ -510,7 +371,7 @@ void vMgrReAssocBeginSta(void *hDeviceContext, pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); } } - if (pMgmt->b11hEnable == TRUE) + if (pMgmt->b11hEnable == true) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); @@ -551,19 +412,18 @@ void vMgrReAssocBeginSta(void *hDeviceContext, * -*/ -void vMgrDisassocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PBYTE abyDestAddress, - WORD wReason, - PCMD_STATUS pStatus) +void vMgrDisassocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_DISASSOC sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_DISASSOC sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DISASSOC_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_DISASSOC_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; @@ -610,23 +470,18 @@ void vMgrDisassocBeginSta(void *hDeviceContext, * -*/ -static -void -s_vMgrRxAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - unsigned int uNodeIndex - ) +static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + u32 uNodeIndex) { - WLAN_FR_ASSOCREQ sFrame; - CMD_STATUS Status; - PSTxMgmtPacket pTxPacket; - WORD wAssocStatus = 0; - WORD wAssocAID = 0; - unsigned int uRateLen = WLAN_RATES_MAXLEN; - BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + WLAN_FR_ASSOCREQ sFrame; + CMD_STATUS Status; + struct vnt_tx_mgmt *pTxPacket; + u16 wAssocStatus = 0; + u16 wAssocAID = 0; + u32 uRateLen = WLAN_RATES_MAXLEN; + u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) @@ -650,7 +505,7 @@ s_vMgrRxAssocRequest( pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = cpu_to_le16(*sFrame.pwCapInfo); pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = cpu_to_le16(*sFrame.pwListenInterval); pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = - WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? TRUE : FALSE; + WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? true : false; // Todo: check sta basic rate, if ap can't support, set status code if (pDevice->byBBType == BB_TYPE_11B) { uRateLen = WLAN_RATES_MAXLEN_11B; @@ -672,7 +527,7 @@ s_vMgrRxAssocRequest( RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, - FALSE, // do not change our basic rate + false, // do not change our basic rate &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), @@ -693,15 +548,15 @@ s_vMgrRxAssocRequest( wAssocAID = (WORD)uNodeIndex; // check if ERP support if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) - pMgmt->sNodeDBTable[uNodeIndex].bERPExist = TRUE; + pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate <= RATE_11M) { // B only STA join - pDevice->bProtectMode = TRUE; - pDevice->bNonERPPresent = TRUE; + pDevice->bProtectMode = true; + pDevice->bNonERPPresent = true; } - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == FALSE) { - pDevice->bBarkerPreambleMd = TRUE; + if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { + pDevice->bBarkerPreambleMd = true; } DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Associate AID= %d \n", wAssocAID); @@ -766,23 +621,18 @@ s_vMgrRxAssocRequest( * -*/ -static -void -s_vMgrRxReAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - unsigned int uNodeIndex - ) +static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + u32 uNodeIndex) { - WLAN_FR_REASSOCREQ sFrame; - CMD_STATUS Status; - PSTxMgmtPacket pTxPacket; - WORD wAssocStatus = 0; - WORD wAssocAID = 0; - unsigned int uRateLen = WLAN_RATES_MAXLEN; - BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + WLAN_FR_REASSOCREQ sFrame; + CMD_STATUS Status; + struct vnt_tx_mgmt *pTxPacket; + u16 wAssocStatus = 0; + u16 wAssocAID = 0; + u32 uRateLen = WLAN_RATES_MAXLEN; + u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) return; @@ -801,7 +651,7 @@ s_vMgrRxReAssocRequest( pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = cpu_to_le16(*sFrame.pwCapInfo); pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = cpu_to_le16(*sFrame.pwListenInterval); pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = - WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? TRUE : FALSE; + WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? true : false; // Todo: check sta basic rate, if ap can't support, set status code if (pDevice->byBBType == BB_TYPE_11B) { @@ -825,7 +675,7 @@ s_vMgrRxReAssocRequest( RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, - FALSE, // do not change our basic rate + false, // do not change our basic rate &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), @@ -847,15 +697,15 @@ s_vMgrRxReAssocRequest( // if suppurt ERP if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) - pMgmt->sNodeDBTable[uNodeIndex].bERPExist = TRUE; + pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate <= RATE_11M) { // B only STA join - pDevice->bProtectMode = TRUE; - pDevice->bNonERPPresent = TRUE; + pDevice->bProtectMode = true; + pDevice->bNonERPPresent = true; } - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == FALSE) { - pDevice->bBarkerPreambleMd = TRUE; + if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { + pDevice->bBarkerPreambleMd = true; } DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Rx ReAssociate AID= %d \n", wAssocAID); @@ -913,18 +763,13 @@ s_vMgrRxReAssocRequest( * -*/ -static -void -s_vMgrRxAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - BOOL bReAssocType - ) +static void s_vMgrRxAssocResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bReAssocType) { - WLAN_FR_ASSOCRESP sFrame; - PWLAN_IE_SSID pItemSSID; - PBYTE pbyIEs; + WLAN_FR_ASSOCRESP sFrame; + PWLAN_IE_SSID pItemSSID; + u8 *pbyIEs; @@ -970,10 +815,10 @@ s_vMgrRxAssocResponse( sFrame.pExtSuppRates); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID); - pDevice->bLinkPass = TRUE; + pDevice->bLinkPass = true; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); - //if(pDevice->bWPASuppWextEnabled == TRUE) + //if(pDevice->bWPASuppWextEnabled == true) { BYTE buf[512]; size_t len; @@ -1027,11 +872,11 @@ s_vMgrRxAssocResponse( } //need clear flags related to Networkmanager - pDevice->bwextstep0 = FALSE; - pDevice->bwextstep1 = FALSE; - pDevice->bwextstep2 = FALSE; - pDevice->bwextstep3 = FALSE; - pDevice->bWPASuppWextEnabled = FALSE; + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = false; + pDevice->bWPASuppWextEnabled = false; if(pMgmt->eCurrState == WMAC_STATE_ASSOC) timer_expire(pDevice->sTimerCommand, 0); @@ -1050,17 +895,17 @@ if(pMgmt->eCurrState == WMAC_STATE_ASSOC) * -*/ -void vMgrAuthenBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus) +void vMgrAuthenBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - WLAN_FR_AUTHEN sFrame; - PSTxMgmtPacket pTxPacket = NULL; - - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + WLAN_FR_AUTHEN sFrame; + struct vnt_tx_mgmt *pTxPacket = + (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_AUTHEN_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; vMgrEncodeAuthen(&sFrame); @@ -1103,20 +948,18 @@ void vMgrAuthenBeginSta(void *hDeviceContext, * -*/ -void vMgrDeAuthenBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PBYTE abyDestAddress, - WORD wReason, - PCMD_STATUS pStatus) +void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - WLAN_FR_DEAUTHEN sFrame; - PSTxMgmtPacket pTxPacket = NULL; - - - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DEAUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + WLAN_FR_DEAUTHEN sFrame; + struct vnt_tx_mgmt *pTxPacket = + (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_DEAUTHEN_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_DEAUTHEN_FR_MAXLEN; vMgrEncodeDeauthen(&sFrame); @@ -1156,15 +999,10 @@ void vMgrDeAuthenBeginSta(void *hDeviceContext, * -*/ -static -void -s_vMgrRxAuthentication( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxAuthentication(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - WLAN_FR_AUTHEN sFrame; + WLAN_FR_AUTHEN sFrame; // we better be an AP or a STA in AUTHPENDING otherwise ignore if (!(pMgmt->eCurrMode == WMAC_MODE_ESS_AP || @@ -1214,25 +1052,21 @@ s_vMgrRxAuthentication( -*/ -static -void -s_vMgrRxAuthenSequence_1( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ) +static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { - PSTxMgmtPacket pTxPacket = NULL; - unsigned int uNodeIndex; - WLAN_FR_AUTHEN sFrame; - PSKeyItem pTransmitKey; - - // Insert a Node entry - if (!BSSbIsSTAInNodeDB(pDevice, pFrame->pHdr->sA3.abyAddr2, &uNodeIndex)) { - BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); - memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, pFrame->pHdr->sA3.abyAddr2, - WLAN_ADDR_LEN); - } + struct vnt_tx_mgmt *pTxPacket = NULL; + u32 uNodeIndex; + WLAN_FR_AUTHEN sFrame; + PSKeyItem pTransmitKey; + + /* Insert a Node entry */ + if (!BSSbIsSTAInNodeDB(pDevice, pFrame->pHdr->sA3.abyAddr2, + &uNodeIndex)) { + BSSvCreateOneNode(pDevice, &uNodeIndex); + memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, + pFrame->pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); + } if (pMgmt->bShareKeyAlgorithm) { pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_KNOWN; @@ -1243,9 +1077,11 @@ s_vMgrRxAuthenSequence_1( } // send auth reply - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_AUTHEN_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; // format buffer structure @@ -1285,7 +1121,7 @@ s_vMgrRxAuthenSequence_1( sFrame.pChallenge->len = WLAN_CHALLENGE_LEN; memset(pMgmt->abyChallenge, 0, WLAN_CHALLENGE_LEN); // get group key - if(KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, GROUP_KEY, &pTransmitKey) == TRUE) { + if(KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, GROUP_KEY, &pTransmitKey) == true) { rc4_init(&pDevice->SBox, pDevice->abyPRNG, pTransmitKey->uKeyLength+3); rc4_encrypt(&pDevice->SBox, pMgmt->abyChallenge, pMgmt->abyChallenge, WLAN_CHALLENGE_LEN); } @@ -1320,16 +1156,11 @@ s_vMgrRxAuthenSequence_1( * -*/ -static -void -s_vMgrRxAuthenSequence_2( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ) +static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { - WLAN_FR_AUTHEN sFrame; - PSTxMgmtPacket pTxPacket = NULL; + WLAN_FR_AUTHEN sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) @@ -1355,9 +1186,13 @@ s_vMgrRxAuthenSequence_2( case WLAN_AUTH_ALG_SHAREDKEY: if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) { - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *) + pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_AUTHEN_FR_MAXLEN); + pTxPacket->p80211Header + = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; // format buffer structure @@ -1421,18 +1256,13 @@ s_vMgrRxAuthenSequence_2( * -*/ -static -void -s_vMgrRxAuthenSequence_3( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ) +static void s_vMgrRxAuthenSequence_3(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { - PSTxMgmtPacket pTxPacket = NULL; - unsigned int uStatusCode = 0 ; - unsigned int uNodeIndex = 0; - WLAN_FR_AUTHEN sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + u32 uStatusCode = 0 ; + u32 uNodeIndex = 0; + WLAN_FR_AUTHEN sFrame; if (!WLAN_GET_FC_ISWEP(pFrame->pHdr->sA3.wFrameCtl)) { uStatusCode = WLAN_MGMT_STATUS_CHALLENGE_FAIL; @@ -1462,9 +1292,11 @@ s_vMgrRxAuthenSequence_3( reply: // send auth reply - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_AUTHEN_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; // format buffer structure @@ -1509,13 +1341,8 @@ reply: * None. * -*/ -static -void -s_vMgrRxAuthenSequence_4( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ) +static void s_vMgrRxAuthenSequence_4(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ @@ -1547,17 +1374,12 @@ s_vMgrRxAuthenSequence_4( * -*/ -static -void -s_vMgrRxDisassociation( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxDisassociation(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - WLAN_FR_DISASSOC sFrame; - unsigned int uNodeIndex = 0; - CMD_STATUS CmdStatus; + WLAN_FR_DISASSOC sFrame; + u32 uNodeIndex = 0; + CMD_STATUS CmdStatus; if ( pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){ // if is acting an AP.. @@ -1577,24 +1399,24 @@ s_vMgrRxDisassociation( vMgrDecodeDisassociation(&sFrame); DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason))); - pDevice->fWPA_Authened = FALSE; + pDevice->fWPA_Authened = false; //TODO: do something let upper layer know or //try to send associate packet again because of inactivity timeout if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { - pDevice->bLinkPass = FALSE; - pMgmt->sNodeDBTable[0].bActive = FALSE; + pDevice->bLinkPass = false; + pMgmt->sNodeDBTable[0].bActive = false; pDevice->byReAssocCount = 0; pMgmt->eCurrState = WMAC_STATE_AUTH; // jump back to the auth state! pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; - vMgrReAssocBeginSta((PSDevice)pDevice, pMgmt, &CmdStatus); + vMgrReAssocBeginSta(pDevice, pMgmt, &CmdStatus); if(CmdStatus == CMD_STATUS_PENDING) { pDevice->byReAssocCount ++; return; //mike add: you'll retry for many times, so it cann't be regarded as disconnected! } } - // if(pDevice->bWPASuppWextEnabled == TRUE) + // if(pDevice->bWPASuppWextEnabled == true) { union iwreq_data wrqu; memset(&wrqu, 0, sizeof (wrqu)); @@ -1620,16 +1442,11 @@ s_vMgrRxDisassociation( * -*/ -static -void -s_vMgrRxDeauthentication( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxDeauthentication(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - WLAN_FR_DEAUTHEN sFrame; - unsigned int uNodeIndex = 0; + WLAN_FR_DEAUTHEN sFrame; + u32 uNodeIndex = 0; if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){ @@ -1650,22 +1467,22 @@ s_vMgrRxDeauthentication( sFrame.len = pRxPacket->cbMPDULen; sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; vMgrDecodeDeauthen(&sFrame); - pDevice->fWPA_Authened = FALSE; + pDevice->fWPA_Authened = false; DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason)))); // TODO: update BSS list for specific BSSID if pre-authentication case if (!compare_ether_addr(sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID)) { if (pMgmt->eCurrState >= WMAC_STATE_AUTHPENDING) { - pMgmt->sNodeDBTable[0].bActive = FALSE; + pMgmt->sNodeDBTable[0].bActive = false; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pMgmt->eCurrState = WMAC_STATE_IDLE; netif_stop_queue(pDevice->dev); - pDevice->bLinkPass = FALSE; + pDevice->bLinkPass = false; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); } } - // if(pDevice->bWPASuppWextEnabled == TRUE) + // if(pDevice->bWPASuppWextEnabled == true) { union iwreq_data wrqu; memset(&wrqu, 0, sizeof (wrqu)); @@ -1692,23 +1509,19 @@ s_vMgrRxDeauthentication( * True:exceed; * False:normal case -*/ -static BOOL -ChannelExceedZoneType( - PSDevice pDevice, - BYTE byCurrChannel - ) +static int ChannelExceedZoneType(struct vnt_private *pDevice, u8 byCurrChannel) { - BOOL exceed=FALSE; + int exceed = false; switch(pDevice->byZoneType) { case 0x00: //USA:1~11 if((byCurrChannel<1) ||(byCurrChannel>11)) - exceed = TRUE; + exceed = true; break; case 0x01: //Japan:1~13 case 0x02: //Europe:1~13 if((byCurrChannel<1) ||(byCurrChannel>13)) - exceed = TRUE; + exceed = true; break; default: //reserve for other zonetype break; @@ -1728,39 +1541,33 @@ ChannelExceedZoneType( * -*/ -static -void -s_vMgrRxBeacon( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - BOOL bInScan - ) +static void s_vMgrRxBeacon(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bInScan) { - - PKnownBSS pBSSList; - WLAN_FR_BEACON sFrame; - QWORD qwTSFOffset; - BOOL bIsBSSIDEqual = FALSE; - BOOL bIsSSIDEqual = FALSE; - BOOL bTSFLargeDiff = FALSE; - BOOL bTSFOffsetPostive = FALSE; - BOOL bUpdateTSF = FALSE; - BOOL bIsAPBeacon = FALSE; - BOOL bIsChannelEqual = FALSE; - unsigned int uLocateByteIndex; - BYTE byTIMBitOn = 0; - WORD wAIDNumber = 0; - unsigned int uNodeIndex; - QWORD qwTimestamp, qwLocalTSF; - QWORD qwCurrTSF; - WORD wStartIndex = 0; - WORD wAIDIndex = 0; - BYTE byCurrChannel = pRxPacket->byRxChannel; - ERPObject sERP; - unsigned int uRateLen = WLAN_RATES_MAXLEN; - BOOL bChannelHit = FALSE; - BYTE byOldPreambleType; + PKnownBSS pBSSList; + WLAN_FR_BEACON sFrame; + u64 qwTSFOffset; + int bIsBSSIDEqual = false; + int bIsSSIDEqual = false; + int bTSFLargeDiff = false; + int bTSFOffsetPostive = false; + int bUpdateTSF = false; + int bIsAPBeacon = false; + int bIsChannelEqual = false; + u32 uLocateByteIndex; + u8 byTIMBitOn = 0; + u16 wAIDNumber = 0; + u32 uNodeIndex; + u64 qwTimestamp, qwLocalTSF; + u64 qwCurrTSF; + u16 wStartIndex = 0; + u16 wAIDIndex = 0; + u8 byCurrChannel = pRxPacket->byRxChannel; + ERPObject sERP; + u32 uRateLen = WLAN_RATES_MAXLEN; + int bChannelHit = false; + u8 byOldPreambleType; @@ -1787,31 +1594,31 @@ s_vMgrRxBeacon( { if (sFrame.pDSParms != NULL) { if (byCurrChannel == RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]) - bChannelHit = TRUE; + bChannelHit = true; byCurrChannel = RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]; } else { - bChannelHit = TRUE; + bChannelHit = true; } } else { if (sFrame.pDSParms != NULL) { if (byCurrChannel == sFrame.pDSParms->byCurrChannel) - bChannelHit = TRUE; + bChannelHit = true; byCurrChannel = sFrame.pDSParms->byCurrChannel; } else { - bChannelHit = TRUE; + bChannelHit = true; } } -if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) +if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) return; if (sFrame.pERP != NULL) { sERP.byERP = sFrame.pERP->byContext; - sERP.bERPExist = TRUE; + sERP.bERPExist = true; } else { - sERP.bERPExist = FALSE; + sERP.bERPExist = false; sERP.byERP = 0; } @@ -1866,7 +1673,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) } if(byCurrChannel == (BYTE)pMgmt->uCurrChannel) - bIsChannelEqual = TRUE; + bIsChannelEqual = true; if (bIsChannelEqual && (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { @@ -1895,7 +1702,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) pMgmt->abyCurrBSSID, WLAN_BSSID_LEN) == 0) { - bIsBSSIDEqual = TRUE; + bIsBSSIDEqual = true; pDevice->uCurrRSSI = pRxPacket->uRSSI; pDevice->byCurrSQ = pRxPacket->bySQ; if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) { @@ -1909,22 +1716,22 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, sFrame.pSSID->len ) == 0) { - bIsSSIDEqual = TRUE; + bIsSSIDEqual = true; } } - if ((WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)== TRUE) && - (bIsBSSIDEqual == TRUE) && - (bIsSSIDEqual == TRUE) && + if ((WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)== true) && + (bIsBSSIDEqual == true) && + (bIsSSIDEqual == true) && (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { // add state check to prevent reconnect fail since we'll receive Beacon - bIsAPBeacon = TRUE; + bIsAPBeacon = true; if (pBSSList != NULL) { // Sync ERP field - if ((pBSSList->sERP.bERPExist == TRUE) && (pDevice->byBBType == BB_TYPE_11G)) { + if ((pBSSList->sERP.bERPExist == true) && (pDevice->byBBType == BB_TYPE_11G)) { if ((pBSSList->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION) != pDevice->bProtectMode) {//0000 0010 pDevice->bProtectMode = (pBSSList->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION); if (pDevice->bProtectMode) { @@ -1949,16 +1756,16 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) } // Sync Short Slot Time if (WLAN_GET_CAP_INFO_SHORTSLOTTIME(pBSSList->wCapInfo) != pDevice->bShortSlotTime) { - BOOL bShortSlotTime; + bool bShortSlotTime; bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(pBSSList->wCapInfo); //DBG_PRN_WLAN05(("Set Short Slot Time: %d\n", pDevice->bShortSlotTime)); //Kyle check if it is OK to set G. if (pDevice->byBBType == BB_TYPE_11A) { - bShortSlotTime = TRUE; + bShortSlotTime = true; } else if (pDevice->byBBType == BB_TYPE_11B) { - bShortSlotTime = FALSE; + bShortSlotTime = false; } if (bShortSlotTime != pDevice->bShortSlotTime) { pDevice->bShortSlotTime = bShortSlotTime; @@ -1994,7 +1801,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, - TRUE, + true, &(pMgmt->sNodeDBTable[0].wMaxBasicRate), &(pMgmt->sNodeDBTable[0].wMaxSuppRate), &(pMgmt->sNodeDBTable[0].wSuppRate), @@ -2013,26 +1820,14 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) } } - HIDWORD(qwTimestamp) = cpu_to_le32(HIDWORD(*sFrame.pqwTimestamp)); - LODWORD(qwTimestamp) = cpu_to_le32(LODWORD(*sFrame.pqwTimestamp)); - HIDWORD(qwLocalTSF) = HIDWORD(pRxPacket->qwLocalTSF); - LODWORD(qwLocalTSF) = LODWORD(pRxPacket->qwLocalTSF); + qwTimestamp = cpu_to_le64(*sFrame.pqwTimestamp); + qwLocalTSF = pRxPacket->qwLocalTSF; // check if beacon TSF larger or small than our local TSF - if (HIDWORD(qwTimestamp) == HIDWORD(qwLocalTSF)) { - if (LODWORD(qwTimestamp) >= LODWORD(qwLocalTSF)) { - bTSFOffsetPostive = TRUE; - } - else { - bTSFOffsetPostive = FALSE; - } - } - else if (HIDWORD(qwTimestamp) > HIDWORD(qwLocalTSF)) { - bTSFOffsetPostive = TRUE; - } - else if (HIDWORD(qwTimestamp) < HIDWORD(qwLocalTSF)) { - bTSFOffsetPostive = FALSE; - } + if (qwTimestamp >= qwLocalTSF) + bTSFOffsetPostive = true; + else + bTSFOffsetPostive = false; if (bTSFOffsetPostive) { qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF)); @@ -2041,23 +1836,21 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp)); } - if (HIDWORD(qwTSFOffset) != 0 || - (LODWORD(qwTSFOffset) > TRIVIAL_SYNC_DIFFERENCE )) { - bTSFLargeDiff = TRUE; - } + if (qwTSFOffset > TRIVIAL_SYNC_DIFFERENCE) + bTSFLargeDiff = true; // if infra mode - if (bIsAPBeacon == TRUE) { + if (bIsAPBeacon == true) { // Infra mode: Local TSF always follow AP's TSF if Difference huge. if (bTSFLargeDiff) - bUpdateTSF = TRUE; + bUpdateTSF = true; - if ((pDevice->bEnablePSMode == TRUE) && (sFrame.pTIM)) { + if ((pDevice->bEnablePSMode == true) && (sFrame.pTIM)) { /* deal with DTIM, analysis TIM */ - pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? TRUE : FALSE ; + pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? true : false ; pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount; pMgmt->byDTIMPeriod = sFrame.pTIM->byDTIMPeriod; wAIDNumber = pMgmt->wCurrAID & ~(BIT14|BIT15); @@ -2072,36 +1865,33 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) // len = byDTIMCount + byDTIMPeriod + byDTIMPeriod + byVirtBitMap[0~250] if (sFrame.pTIM->len >= (uLocateByteIndex + 4)) { byTIMBitOn = (0x01) << ((wAIDNumber) % 8); - pMgmt->bInTIM = sFrame.pTIM->byVirtBitMap[uLocateByteIndex] & byTIMBitOn ? TRUE : FALSE; + pMgmt->bInTIM = sFrame.pTIM->byVirtBitMap[uLocateByteIndex] & byTIMBitOn ? true : false; } else { - pMgmt->bInTIM = FALSE; + pMgmt->bInTIM = false; }; } else { - pMgmt->bInTIM = FALSE; + pMgmt->bInTIM = false; }; if (pMgmt->bInTIM || (pMgmt->bMulticastTIM && (pMgmt->byDTIMCount == 0))) { - pMgmt->bInTIMWake = TRUE; - // send out ps-poll packet -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:In TIM\n"); - if (pMgmt->bInTIM) { - PSvSendPSPOLL((PSDevice)pDevice); -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:PS-POLL sent..\n"); - } + pMgmt->bInTIMWake = true; + /* send out ps-poll packet */ + if (pMgmt->bInTIM) + PSvSendPSPOLL(pDevice); } else { - pMgmt->bInTIMWake = FALSE; + pMgmt->bInTIMWake = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n"); - if (pDevice->bPWBitOn == FALSE) { + if (pDevice->bPWBitOn == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Send Null Packet\n"); if (PSbSendNullPacket(pDevice)) - pDevice->bPWBitOn = TRUE; + pDevice->bPWBitOn = true; } - if(PSbConsiderPowerDown(pDevice, FALSE, FALSE)) { + if(PSbConsiderPowerDown(pDevice, false, false)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Power down now...\n"); } } @@ -2119,7 +1909,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) // adhoc mode:TSF updated only when beacon larger then local TSF if (bTSFLargeDiff && bTSFOffsetPostive && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) - bUpdateTSF = TRUE; + bUpdateTSF = true; // During dpc, already in spinlocked. if (BSSbIsSTAInNodeDB(pDevice, sFrame.pHdr->sA3.abyAddr2, &uNodeIndex)) { @@ -2132,7 +1922,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, NULL, - TRUE, + true, &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), @@ -2144,8 +1934,8 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) pMgmt->sNodeDBTable[uNodeIndex].uInActiveCount = 0; } else { - // Todo, initial Node content - BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); + /* Todo, initial Node content */ + BSSvCreateOneNode(pDevice, &uNodeIndex); pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, @@ -2153,7 +1943,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, NULL, - TRUE, + true, &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), @@ -2167,7 +1957,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) /* pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) - pMgmt->sNodeDBTable[uNodeIndex].bERPExist = TRUE; + pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; */ } @@ -2175,12 +1965,12 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) if (pMgmt->eCurrState == WMAC_STATE_STARTED) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed] \n"); pMgmt->eCurrState = WMAC_STATE_JOINTED; - pDevice->bLinkPass = TRUE; + pDevice->bLinkPass = true; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); if (netif_queue_stopped(pDevice->dev)){ netif_wake_queue(pDevice->dev); } - pMgmt->sNodeDBTable[0].bActive = TRUE; + pMgmt->sNodeDBTable[0].bActive = true; pMgmt->sNodeDBTable[0].uInActiveCount = 0; } @@ -2256,26 +2046,22 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) * -*/ -void vMgrCreateOwnIBSS(void *hDeviceContext, - PCMD_STATUS pStatus) +void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - WORD wMaxBasicRate; - WORD wMaxSuppRate; - BYTE byTopCCKBasicRate; - BYTE byTopOFDMBasicRate; - QWORD qwCurrTSF; - unsigned int ii; - BYTE abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, 0x12, 0x18, 0x60}; - BYTE abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96}; - BYTE abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; - WORD wSuppRate; - + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u16 wMaxBasicRate; + u16 wMaxSuppRate; + u8 byTopCCKBasicRate; + u8 byTopOFDMBasicRate; + u64 qwCurrTSF = 0; + int ii; + u8 abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, + 0x12, 0x18, 0x60}; + u8 abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96}; + u8 abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; + u16 wSuppRate; - HIDWORD(qwCurrTSF) = 0; - LODWORD(qwCurrTSF) = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n"); @@ -2366,16 +2152,16 @@ void vMgrCreateOwnIBSS(void *hDeviceContext, RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, TRUE, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, true, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, &byTopCCKBasicRate, &byTopOFDMBasicRate); if (pDevice->byBBType == BB_TYPE_11A) { - pDevice->bShortSlotTime = TRUE; + pDevice->bShortSlotTime = true; } else { - pDevice->bShortSlotTime = FALSE; + pDevice->bShortSlotTime = false; } BBvSetShortSlotTime(pDevice); // vUpdateIFS() use pDevice->bShortSlotTime as parameter so it must be called @@ -2420,12 +2206,12 @@ void vMgrCreateOwnIBSS(void *hDeviceContext, if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { // BSSID selected must be randomized as spec 11.1.3 - pMgmt->abyCurrBSSID[5] = (BYTE) (LODWORD(qwCurrTSF)& 0x000000ff); - pMgmt->abyCurrBSSID[4] = (BYTE)((LODWORD(qwCurrTSF)& 0x0000ff00) >> 8); - pMgmt->abyCurrBSSID[3] = (BYTE)((LODWORD(qwCurrTSF)& 0x00ff0000) >> 16); - pMgmt->abyCurrBSSID[2] = (BYTE)((LODWORD(qwCurrTSF)& 0x00000ff0) >> 4); - pMgmt->abyCurrBSSID[1] = (BYTE)((LODWORD(qwCurrTSF)& 0x000ff000) >> 12); - pMgmt->abyCurrBSSID[0] = (BYTE)((LODWORD(qwCurrTSF)& 0x0ff00000) >> 20); + pMgmt->abyCurrBSSID[5] = (u8)(qwCurrTSF & 0x000000ff); + pMgmt->abyCurrBSSID[4] = (u8)((qwCurrTSF & 0x0000ff00) >> 8); + pMgmt->abyCurrBSSID[3] = (u8)((qwCurrTSF & 0x00ff0000) >> 16); + pMgmt->abyCurrBSSID[2] = (u8)((qwCurrTSF & 0x00000ff0) >> 4); + pMgmt->abyCurrBSSID[1] = (u8)((qwCurrTSF & 0x000ff000) >> 12); + pMgmt->abyCurrBSSID[0] = (u8)((qwCurrTSF & 0x0ff00000) >> 20); pMgmt->abyCurrBSSID[5] ^= pMgmt->abyMACAddr[0]; pMgmt->abyCurrBSSID[4] ^= pMgmt->abyMACAddr[1]; pMgmt->abyCurrBSSID[3] ^= pMgmt->abyMACAddr[2]; @@ -2446,7 +2232,7 @@ void vMgrCreateOwnIBSS(void *hDeviceContext, MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); pDevice->byRxMode |= RCR_BSSID; - pMgmt->bCurrBSSIDFilterOn = TRUE; + pMgmt->bCurrBSSIDFilterOn = true; // Set Capability Info pMgmt->wCurrCapInfo = 0; @@ -2511,26 +2297,25 @@ void vMgrCreateOwnIBSS(void *hDeviceContext, * -*/ -void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) +void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PKnownBSS pCurr = NULL; - unsigned int ii, uu; - PWLAN_IE_SUPP_RATES pItemRates = NULL; - PWLAN_IE_SUPP_RATES pItemExtRates = NULL; - PWLAN_IE_SSID pItemSSID; - unsigned int uRateLen = WLAN_RATES_MAXLEN; - WORD wMaxBasicRate = RATE_1M; - WORD wMaxSuppRate = RATE_1M; - WORD wSuppRate; - BYTE byTopCCKBasicRate = RATE_1M; - BYTE byTopOFDMBasicRate = RATE_1M; - BOOL bShortSlotTime = FALSE; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PKnownBSS pCurr = NULL; + int ii, uu; + PWLAN_IE_SUPP_RATES pItemRates = NULL; + PWLAN_IE_SUPP_RATES pItemExtRates = NULL; + PWLAN_IE_SSID pItemSSID; + u32 uRateLen = WLAN_RATES_MAXLEN; + u16 wMaxBasicRate = RATE_1M; + u16 wMaxSuppRate = RATE_1M; + u16 wSuppRate; + u8 byTopCCKBasicRate = RATE_1M; + u8 byTopOFDMBasicRate = RATE_1M; + u8 bShortSlotTime = false; for (ii = 0; ii < MAX_BSS_NUM; ii++) { - if (pMgmt->sBSSList[ii].bActive == TRUE) + if (pMgmt->sBSSList[ii].bActive == true) break; } @@ -2564,14 +2349,14 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) { /* if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { - if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == FALSE) { + if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; return; } } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { - if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == FALSE) { + if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; @@ -2581,7 +2366,7 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) */ } - //if(pDevice->bWPASuppWextEnabled == TRUE) + //if(pDevice->bWPASuppWextEnabled == true) Encyption_Rebuild(pDevice, pCurr); // Infrastructure BSS @@ -2637,7 +2422,7 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) } } - RATEvParseMaxRate((void *)pDevice, pItemRates, pItemExtRates, TRUE, + RATEvParseMaxRate((void *)pDevice, pItemRates, pItemExtRates, true, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, &byTopCCKBasicRate, &byTopOFDMBasicRate); vUpdateIFS(pDevice); @@ -2658,11 +2443,11 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) // Add current BSS to Candidate list // This should only work for WPA2 BSS, and WPA2 BSS check must be done before. if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { - BOOL bResult = bAdd_PMKID_Candidate((void *) pDevice, + 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 == FALSE) { + if (bResult == false) { vFlush_PMKID_Candidate((void *) pDevice); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFlush_PMKID_Candidate: 4\n"); @@ -2712,10 +2497,10 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) //DBG_PRN_WLAN05(("wCapInfo: %X\n", pCurr->wCapInfo)); if (WLAN_GET_CAP_INFO_SHORTSLOTTIME(pCurr->wCapInfo) != pDevice->bShortSlotTime) { if (pDevice->byBBType == BB_TYPE_11A) { - bShortSlotTime = TRUE; + bShortSlotTime = true; } else if (pDevice->byBBType == BB_TYPE_11B) { - bShortSlotTime = FALSE; + bShortSlotTime = false; } else { bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(pCurr->wCapInfo); @@ -2742,7 +2527,7 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { /* - if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == FALSE) { + if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) { // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; return; @@ -2750,7 +2535,7 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) */ } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { /* - if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == FALSE) { + if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) { // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; return; @@ -2783,7 +2568,7 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) // set basic rate RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - NULL, TRUE, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, + NULL, true, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, &byTopCCKBasicRate, &byTopOFDMBasicRate); vUpdateIFS(pDevice); pMgmt->wCurrCapInfo = pCurr->wCapInfo; @@ -2796,7 +2581,7 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) pMgmt->eCurrState = WMAC_STATE_STARTED; // Adopt BSS state in Adapter Device Object pDevice->eOPMode = OP_MODE_ADHOC; - pDevice->bLinkPass = TRUE; + pDevice->bLinkPass = true; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); @@ -2836,30 +2621,27 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) * PCM_STATUS * -*/ -static -void -s_vMgrSynchBSS ( - PSDevice pDevice, - unsigned int uBSSMode, - PKnownBSS pCurr, - PCMD_STATUS pStatus - ) +static void s_vMgrSynchBSS(struct vnt_private *pDevice, u32 uBSSMode, + PKnownBSS pCurr, PCMD_STATUS pStatus) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M - BYTE abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; - BYTE abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60}; - //6M, 9M, 12M, 48M - BYTE abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; - BYTE abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16}; - + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u8 abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, + 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; + /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M*/ + u8 abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, + 4, 0x0C, 0x12, 0x18, 0x60}; + /* 6M, 9M, 12M, 48M*/ + u8 abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, + 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; + u8 abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, + 4, 0x02, 0x04, 0x0B, 0x16}; *pStatus = CMD_STATUS_FAILURE; if (s_bCipherMatch(pCurr, pDevice->eEncryptionStatus, &(pMgmt->byCSSPK), - &(pMgmt->byCSSGK)) == FALSE) { + &(pMgmt->byCSSGK)) == false) { DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "s_bCipherMatch Fail .......\n"); return; } @@ -2872,12 +2654,12 @@ s_vMgrSynchBSS ( } // Init the BSS informations - pDevice->bCCK = TRUE; - pDevice->bProtectMode = FALSE; + pDevice->bCCK = true; + pDevice->bProtectMode = false; MACvDisableProtectMD(pDevice); - pDevice->bBarkerPreambleMd = FALSE; + pDevice->bBarkerPreambleMd = false; MACvDisableBarkerPreambleMd(pDevice); - pDevice->bNonERPPresent = FALSE; + pDevice->bNonERPPresent = false; pDevice->byPreambleType = 0; pDevice->wBasicRate = 0; // Set Basic Rate @@ -2907,7 +2689,7 @@ s_vMgrSynchBSS ( (pDevice->eConfigPHYMode == PHY_TYPE_AUTO)) { pDevice->byBBType = BB_TYPE_11A; pMgmt->eCurrentPHYMode = PHY_TYPE_11A; - pDevice->bShortSlotTime = TRUE; + pDevice->bShortSlotTime = true; BBvSetShortSlotTime(pDevice); CARDvSetBSSMode(pDevice); } else { @@ -2919,7 +2701,7 @@ s_vMgrSynchBSS ( (pDevice->eConfigPHYMode == PHY_TYPE_AUTO)) { pDevice->byBBType = BB_TYPE_11B; pMgmt->eCurrentPHYMode = PHY_TYPE_11B; - pDevice->bShortSlotTime = FALSE; + pDevice->bShortSlotTime = false; BBvSetShortSlotTime(pDevice); CARDvSetBSSMode(pDevice); } else { @@ -2930,12 +2712,12 @@ s_vMgrSynchBSS ( (pDevice->eConfigPHYMode == PHY_TYPE_AUTO)) { pDevice->byBBType = BB_TYPE_11G; pMgmt->eCurrentPHYMode = PHY_TYPE_11G; - pDevice->bShortSlotTime = TRUE; + pDevice->bShortSlotTime = true; BBvSetShortSlotTime(pDevice); CARDvSetBSSMode(pDevice); } else if (pDevice->eConfigPHYMode == PHY_TYPE_11B) { pDevice->byBBType = BB_TYPE_11B; - pDevice->bShortSlotTime = FALSE; + pDevice->bShortSlotTime = false; BBvSetShortSlotTime(pDevice); CARDvSetBSSMode(pDevice); } else { @@ -2947,7 +2729,7 @@ s_vMgrSynchBSS ( MACvRegBitsOff(pDevice, MAC_REG_HOSTCR, HOSTCR_ADHOC); MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); pDevice->byRxMode |= RCR_BSSID; - pMgmt->bCurrBSSIDFilterOn = TRUE; + pMgmt->bCurrBSSIDFilterOn = true; } // set channel and clear NAV @@ -2971,7 +2753,7 @@ s_vMgrSynchBSS ( MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_ADHOC); MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); pDevice->byRxMode |= RCR_BSSID; - pMgmt->bCurrBSSIDFilterOn = TRUE; + pMgmt->bCurrBSSIDFilterOn = true; } if (pDevice->byBBType == BB_TYPE_11A) { @@ -2991,21 +2773,13 @@ s_vMgrSynchBSS ( return; }; - -//mike add: fix NetworkManager 0.7.0 hidden ssid mode in WPA encryption -// ,need reset eAuthenMode and eEncryptionStatus - static void Encyption_Rebuild( - PSDevice pDevice, - PKnownBSS pCurr - ) +static void Encyption_Rebuild(struct vnt_private *pDevice, PKnownBSS pCurr) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - /* unsigned int ii, uSameBssidNum=0; */ + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - // if( uSameBssidNum>=2) { //we only check AP in hidden sssid mode - if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || //networkmanager 0.7.0 does not give the pairwise-key selsection, - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { // so we need re-selsect it according to real pairwise-key info. - if(pCurr->bWPAValid == TRUE) { //WPA-PSK + if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { + if (pCurr->bWPAValid == true) { /*WPA-PSK */ pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; if(pCurr->abyPKType[0] == WPA_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP @@ -3016,7 +2790,7 @@ s_vMgrSynchBSS ( PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n"); } } - else if(pCurr->bWPA2Valid == TRUE) { //WPA2-PSK + else if(pCurr->bWPA2Valid == true) { //WPA2-PSK pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; if(pCurr->abyCSSPK[0] == WLAN_11i_CSS_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP @@ -3044,20 +2818,15 @@ s_vMgrSynchBSS ( * -*/ -static -void -s_vMgrFormatTIM( - PSMgmtObject pMgmt, - PWLAN_IE_TIM pTIM - ) +static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) { - BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; - BYTE byMap; - unsigned int ii, jj; - BOOL bStartFound = FALSE; - BOOL bMulticast = FALSE; - WORD wStartIndex = 0; - WORD wEndIndex = 0; + u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; + u8 byMap; + int ii, jj; + int bStartFound = false; + int bMulticast = false; + u16 wStartIndex = 0; + u16 wEndIndex = 0; // Find size of partial virtual bitmap @@ -3067,13 +2836,13 @@ s_vMgrFormatTIM( // Mask out the broadcast bit which is indicated separately. bMulticast = (byMap & byMask[0]) != 0; if(bMulticast) { - pMgmt->sNodeDBTable[0].bRxPSPoll = TRUE; + pMgmt->sNodeDBTable[0].bRxPSPoll = true; } byMap = 0; } if (byMap) { if (!bStartFound) { - bStartFound = TRUE; + bStartFound = true; wStartIndex = (WORD)ii; } wEndIndex = (WORD)ii; @@ -3119,30 +2888,23 @@ s_vMgrFormatTIM( * -*/ -static -PSTxMgmtPacket -s_MgrMakeBeacon( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wCurrBeaconPeriod, - unsigned int uCurrChannel, - WORD wCurrATIMWinodw, - PWLAN_IE_SSID pCurrSSID, - PBYTE pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, PWLAN_IE_SSID pCurrSSID, + u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_BEACON sFrame; - BYTE abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_BEACON sFrame; + u8 abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - // prepare beacon frame - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_BEACON_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + /* prepare beacon frame */ + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_BEACON_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure. sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_BEACON_FR_MAXLEN; @@ -3243,11 +3005,11 @@ s_MgrMakeBeacon( sFrame.pERP->byElementID = WLAN_EID_ERP; sFrame.pERP->len = 1; sFrame.pERP->byContext = 0; - if (pDevice->bProtectMode == TRUE) + if (pDevice->bProtectMode == true) sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; - if (pDevice->bNonERPPresent == TRUE) + if (pDevice->bNonERPPresent == true) sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; - if (pDevice->bBarkerPreambleMd == TRUE) + if (pDevice->bBarkerPreambleMd == true) sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; } if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { @@ -3259,7 +3021,7 @@ s_MgrMakeBeacon( ); } // hostapd wpa/wpa2 IE - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == TRUE)) { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { if (pMgmt->wWPAIELen != 0) { sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); @@ -3294,30 +3056,22 @@ s_MgrMakeBeacon( -PSTxMgmtPacket -s_MgrMakeProbeResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wCurrBeaconPeriod, - unsigned int uCurrChannel, - WORD wCurrATIMWinodw, - PBYTE pDstAddr, - PWLAN_IE_SSID pCurrSSID, - PBYTE pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates, - BYTE byPHYType - ) +struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, + PWLAN_IE_SSID pCurrSSID, u8 *pCurrBSSID, + PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates, u8 byPHYType) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_PROBERESP sFrame; - + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_PROBERESP sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBERESP_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_PROBERESP_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure. sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_PROBERESP_FR_MAXLEN; @@ -3377,11 +3131,11 @@ s_MgrMakeProbeResponse( sFrame.pERP->byElementID = WLAN_EID_ERP; sFrame.pERP->len = 1; sFrame.pERP->byContext = 0; - if (pDevice->bProtectMode == TRUE) + if (pDevice->bProtectMode == true) sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; - if (pDevice->bNonERPPresent == TRUE) + if (pDevice->bNonERPPresent == true) sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; - if (pDevice->bBarkerPreambleMd == TRUE) + if (pDevice->bBarkerPreambleMd == true) sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; } @@ -3395,7 +3149,7 @@ s_MgrMakeProbeResponse( } // hostapd wpa/wpa2 IE - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == TRUE)) { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { if (pMgmt->wWPAIELen != 0) { sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); @@ -3426,27 +3180,24 @@ s_MgrMakeProbeResponse( -*/ -PSTxMgmtPacket -s_MgrMakeAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pDAddr, - WORD wCurrCapInfo, - WORD wListenInterval, - PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, + PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_ASSOCREQ sFrame; - PBYTE pbyIEs; - PBYTE pbyRSN; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_ASSOCREQ sFrame; + u8 *pbyIEs; + u8 *pbyRSN; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_ASSOCREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure. sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_ASSOCREQ_FR_MAXLEN; @@ -3625,7 +3376,7 @@ s_MgrMakeAssocRequest( sFrame.pRSN->len +=6; // RSN Capabilites - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == TRUE) { + if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { sFrame.pRSN->abyRSN[16] = 0; @@ -3633,7 +3384,7 @@ s_MgrMakeAssocRequest( } sFrame.pRSN->len +=2; - if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == TRUE) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { + if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pbyRSN = &sFrame.pRSN->abyRSN[18]; pwPMKID = (PWORD)pbyRSN; // Point to PMKID count @@ -3688,27 +3439,23 @@ s_MgrMakeAssocRequest( -*/ -PSTxMgmtPacket -s_MgrMakeReAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pDAddr, - WORD wCurrCapInfo, - WORD wListenInterval, - PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_REASSOCREQ sFrame; - PBYTE pbyIEs; - PBYTE pbyRSN; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_REASSOCREQ sFrame; + u8 *pbyIEs; + u8 *pbyRSN; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset( pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_REASSOCREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_REASSOCREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); /* Setup the sFrame structure. */ sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_REASSOCREQ_FR_MAXLEN; @@ -3885,7 +3632,7 @@ s_MgrMakeReAssocRequest( sFrame.pRSN->len +=6; // RSN Capabilites - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == TRUE) { + if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { sFrame.pRSN->abyRSN[16] = 0; @@ -3893,7 +3640,7 @@ s_MgrMakeReAssocRequest( } sFrame.pRSN->len +=2; - if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == TRUE) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { + if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pbyRSN = &sFrame.pRSN->abyRSN[18]; pwPMKID = (PWORD)pbyRSN; // Point to PMKID count @@ -3942,25 +3689,20 @@ s_MgrMakeReAssocRequest( * -*/ -PSTxMgmtPacket -s_MgrMakeAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wAssocStatus, - WORD wAssocAID, - PBYTE pDstAddr, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_ASSOCRESP sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_ASSOCRESP sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_ASSOCREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; @@ -4016,25 +3758,20 @@ s_MgrMakeAssocResponse( -*/ -PSTxMgmtPacket -s_MgrMakeReAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wAssocStatus, - WORD wAssocAID, - PBYTE pDstAddr, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_REASSOCRESP sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_REASSOCRESP sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_ASSOCREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; @@ -4089,19 +3826,14 @@ s_MgrMakeReAssocResponse( * -*/ -static -void -s_vMgrRxProbeResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxProbeResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - PKnownBSS pBSSList = NULL; - WLAN_FR_PROBERESP sFrame; - BYTE byCurrChannel = pRxPacket->byRxChannel; - ERPObject sERP; - BOOL bChannelHit = TRUE; + PKnownBSS pBSSList = NULL; + WLAN_FR_PROBERESP sFrame; + u8 byCurrChannel = pRxPacket->byRxChannel; + ERPObject sERP; + int bChannelHit = true; memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP)); @@ -4132,31 +3864,31 @@ s_vMgrRxProbeResponse( if (sFrame.pDSParms) { if (byCurrChannel == RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]) - bChannelHit = TRUE; + bChannelHit = true; byCurrChannel = RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]; } else { - bChannelHit = TRUE; + bChannelHit = true; } } else { if (sFrame.pDSParms) { if (byCurrChannel == sFrame.pDSParms->byCurrChannel) - bChannelHit = TRUE; + bChannelHit = true; byCurrChannel = sFrame.pDSParms->byCurrChannel; } else { - bChannelHit = TRUE; + bChannelHit = true; } } //RobertYu:20050201 -if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) +if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) return; if (sFrame.pERP) { sERP.byERP = sFrame.pERP->byContext; - sERP.bERPExist = TRUE; + sERP.bERPExist = true; } else { - sERP.bERPExist = FALSE; + sERP.bERPExist = false; sERP.byERP = 0; } @@ -4221,18 +3953,13 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) -*/ -static -void -s_vMgrRxProbeRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxProbeRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - WLAN_FR_PROBEREQ sFrame; - CMD_STATUS Status; - PSTxMgmtPacket pTxPacket; - BYTE byPHYType = BB_TYPE_11B; + WLAN_FR_PROBEREQ sFrame; + CMD_STATUS Status; + struct vnt_tx_mgmt *pTxPacket; + u8 byPHYType = BB_TYPE_11B; // STA in Ad-hoc mode: when latest TBTT beacon transmit success, // STA have to response this request. @@ -4307,15 +4034,13 @@ s_vMgrRxProbeRequest( * -*/ -void vMgrRxManagePacket(void *hDeviceContext, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket) +void vMgrRxManagePacket(struct vnt_private *pDevice, struct vnt_manager *pMgmt, + struct vnt_rx_mgmt *pRxPacket) { - PSDevice pDevice = (PSDevice)hDeviceContext; - BOOL bInScan = FALSE; - unsigned int uNodeIndex = 0; - NODE_STATE eNodeState = 0; - CMD_STATUS Status; + int bInScan = false; + u32 uNodeIndex = 0; + NODE_STATE eNodeState = 0; + CMD_STATUS Status; if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { @@ -4348,7 +4073,7 @@ void vMgrRxManagePacket(void *hDeviceContext, case WLAN_FSTYPE_ASSOCRESP: // Frame Clase = 2 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp1\n"); - s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, FALSE); + s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, false); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp2\n"); break; @@ -4375,7 +4100,7 @@ void vMgrRxManagePacket(void *hDeviceContext, case WLAN_FSTYPE_REASSOCRESP: // Frame Clase = 2 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocresp\n"); - s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, TRUE); + s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, true); break; case WLAN_FSTYPE_PROBEREQ: @@ -4395,7 +4120,7 @@ void vMgrRxManagePacket(void *hDeviceContext, // Frame Clase = 0 //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx beacon\n"); if (pMgmt->eScanState != WMAC_NO_SCANNING) { - bInScan = TRUE; + bInScan = true; } s_vMgrRxBeacon(pDevice, pMgmt, pRxPacket, bInScan); break; @@ -4450,15 +4175,15 @@ void vMgrRxManagePacket(void *hDeviceContext, * Prepare beacon to send * * Return Value: - * TRUE if success; FALSE if failed. + * true if success; false if failed. * -*/ -BOOL bMgrPrepareBeaconToSend(void *hDeviceContext, PSMgmtObject pMgmt) +int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, + struct vnt_manager *pMgmt) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSTxMgmtPacket pTxPacket; + struct vnt_tx_mgmt *pTxPacket; -// pDevice->bBeaconBufReady = FALSE; +// pDevice->bBeaconBufReady = false; if (pDevice->bEncryptionEnable || pDevice->bEnable8021x){ pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1); } @@ -4481,12 +4206,12 @@ BOOL bMgrPrepareBeaconToSend(void *hDeviceContext, PSMgmtObject pMgmt) if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->abyCurrBSSID[0] == 0)) - return FALSE; + return false; csBeacon_xmit(pDevice, pTxPacket); MACvRegBitsOn(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); - return TRUE; + return true; } @@ -4504,12 +4229,7 @@ BOOL bMgrPrepareBeaconToSend(void *hDeviceContext, PSMgmtObject pMgmt) * none. * -*/ -static -void -s_vMgrLogStatus( - PSMgmtObject pMgmt, - WORD wStatus - ) +static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus) { switch( wStatus ){ case WLAN_MGMT_STATUS_UNSPEC_FAILURE: @@ -4574,21 +4294,19 @@ s_vMgrLogStatus( * -*/ -BOOL bAdd_PMKID_Candidate(void *hDeviceContext, - PBYTE pbyBSSID, - PSRSNCapObject psRSNCapObj) +int bAdd_PMKID_Candidate(struct vnt_private *pDevice, u8 *pbyBSSID, + PSRSNCapObject psRSNCapObj) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PPMKID_CANDIDATE pCandidateList; - unsigned int ii = 0; + PPMKID_CANDIDATE pCandidateList; + int ii = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); if ((pDevice == NULL) || (pbyBSSID == NULL) || (psRSNCapObj == NULL)) - return FALSE; + return false; if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) - return FALSE; + return false; @@ -4596,7 +4314,7 @@ BOOL bAdd_PMKID_Candidate(void *hDeviceContext, for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) { - if ((psRSNCapObj->bRSNCapExist == TRUE) + if ((psRSNCapObj->bRSNCapExist == true) && (psRSNCapObj->wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; @@ -4604,13 +4322,13 @@ BOOL bAdd_PMKID_Candidate(void *hDeviceContext, pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); } - return TRUE; + return true; } } // New Candidate pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates]; - if ((psRSNCapObj->bRSNCapExist == TRUE) && (psRSNCapObj->wRSNCap & BIT0)) { + if ((psRSNCapObj->bRSNCapExist == true) && (psRSNCapObj->wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); @@ -4618,7 +4336,7 @@ BOOL bAdd_PMKID_Candidate(void *hDeviceContext, memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN); pDevice->gsPMKIDCandidate.NumCandidates++; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); - return TRUE; + return true; } /* @@ -4636,17 +4354,17 @@ BOOL bAdd_PMKID_Candidate(void *hDeviceContext, * -*/ -void vFlush_PMKID_Candidate(void *hDeviceContext) +void vFlush_PMKID_Candidate(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; + if (pDevice == NULL) + return; - if (pDevice == NULL) - return; + memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent)); - memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent)); + return; } -static BOOL +static bool s_bCipherMatch ( PKnownBSS pBSSNode, NDIS_802_11_ENCRYPTION_STATUS EncStatus, @@ -4659,7 +4377,7 @@ s_bCipherMatch ( int i; if (pBSSNode == NULL) - return FALSE; + return false; // check cap. of BSS if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && @@ -4669,7 +4387,7 @@ s_bCipherMatch ( } if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && - (pBSSNode->bWPA2Valid == TRUE) && + (pBSSNode->bWPA2Valid == true) && ((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) { @@ -4704,7 +4422,7 @@ s_bCipherMatch ( } } else if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && - (pBSSNode->bWPAValid == TRUE) && + (pBSSNode->bWPAValid == true) && ((EncStatus == Ndis802_11Encryption2Enabled) || (EncStatus == Ndis802_11Encryption3Enabled))) { //WPA // check Group Key Cipher @@ -4746,9 +4464,9 @@ s_bCipherMatch ( (byCipherMask == 0)) { *pbyCCSGK = KEY_CTL_WEP; *pbyCCSPK = KEY_CTL_NONE; - return TRUE; + return true; } else { - return FALSE; + return false; } } else if (EncStatus == Ndis802_11Encryption2Enabled) { @@ -4756,45 +4474,45 @@ s_bCipherMatch ( (byCipherMask == 0)) { *pbyCCSGK = KEY_CTL_TKIP; *pbyCCSPK = KEY_CTL_NONE; - return TRUE; + return true; } else if ((byMulticastCipher == KEY_CTL_WEP) && ((byCipherMask & 0x02) != 0)) { *pbyCCSGK = KEY_CTL_WEP; *pbyCCSPK = KEY_CTL_TKIP; - return TRUE; + return true; } else if ((byMulticastCipher == KEY_CTL_TKIP) && ((byCipherMask & 0x02) != 0)) { *pbyCCSGK = KEY_CTL_TKIP; *pbyCCSPK = KEY_CTL_TKIP; - return TRUE; + return true; } else { - return FALSE; + return false; } } else if (EncStatus == Ndis802_11Encryption3Enabled) { if ((byMulticastCipher == KEY_CTL_CCMP) && (byCipherMask == 0)) { // When CCMP is enable, "Use group cipher suite" shall not be a valid option. - return FALSE; + return false; } else if ((byMulticastCipher == KEY_CTL_WEP) && ((byCipherMask & 0x04) != 0)) { *pbyCCSGK = KEY_CTL_WEP; *pbyCCSPK = KEY_CTL_CCMP; - return TRUE; + return true; } else if ((byMulticastCipher == KEY_CTL_TKIP) && ((byCipherMask & 0x04) != 0)) { *pbyCCSGK = KEY_CTL_TKIP; *pbyCCSPK = KEY_CTL_CCMP; - return TRUE; + return true; } else if ((byMulticastCipher == KEY_CTL_CCMP) && ((byCipherMask & 0x04) != 0)) { *pbyCCSGK = KEY_CTL_CCMP; *pbyCCSPK = KEY_CTL_CCMP; - return TRUE; + return true; } else { - return FALSE; + return false; } } - return TRUE; + return true; } diff --git a/drivers/staging/vt6656/wmgr.h b/drivers/staging/vt6656/wmgr.h index 52b1b562b141..83aed45f68a3 100644 --- a/drivers/staging/vt6656/wmgr.h +++ b/drivers/staging/vt6656/wmgr.h @@ -218,216 +218,199 @@ typedef enum tagWMAC_POWER_MODE { -// Tx Management Packet descriptor -typedef struct tagSTxMgmtPacket { - - PUWLAN_80211HDR p80211Header; - unsigned int cbMPDULen; - unsigned int cbPayloadLen; - -} STxMgmtPacket, *PSTxMgmtPacket; - - -// Rx Management Packet descriptor -typedef struct tagSRxMgmtPacket { - - PUWLAN_80211HDR p80211Header; - QWORD qwLocalTSF; - unsigned int cbMPDULen; - unsigned int cbPayloadLen; - unsigned int uRSSI; - BYTE bySQ; - BYTE byRxRate; - BYTE byRxChannel; - -} SRxMgmtPacket, *PSRxMgmtPacket; - - - -typedef struct tagSMgmtObject -{ +/* Tx Management Packet descriptor */ +struct vnt_tx_mgmt { + PUWLAN_80211HDR p80211Header; + u32 cbMPDULen; + u32 cbPayloadLen; +}; + + +/* Rx Management Packet descriptor */ +struct vnt_rx_mgmt { + PUWLAN_80211HDR p80211Header; + u64 qwLocalTSF; + u32 cbMPDULen; + u32 cbPayloadLen; + u32 uRSSI; + u8 bySQ; + u8 byRxRate; + u8 byRxChannel; +}; + + +struct vnt_manager { void *pAdapter; - // MAC address - BYTE abyMACAddr[WLAN_ADDR_LEN]; - - // Configuration Mode - WMAC_CONFIG_MODE eConfigMode; // MAC pre-configed mode - - CARD_PHY_TYPE eCurrentPHYMode; - - - // Operation state variables - WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode - WMAC_BSS_STATE eCurrState; // MAC current BSS state - WMAC_BSS_STATE eLastState; // MAC last BSS state - - PKnownBSS pCurrBSS; - BYTE byCSSGK; - BYTE byCSSPK; - -// BYTE abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; -// BYTE abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; - BOOL bCurrBSSIDFilterOn; - - // Current state vars - unsigned int uCurrChannel; - BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - BYTE abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - BYTE abyCurrBSSID[WLAN_BSSID_LEN]; - WORD wCurrCapInfo; - WORD wCurrAID; - unsigned int uRSSITrigger; - WORD wCurrATIMWindow; - WORD wCurrBeaconPeriod; - BOOL bIsDS; - BYTE byERPContext; - - CMD_STATE eCommandState; - unsigned int uScanChannel; - - // Desire joinning BSS vars - BYTE abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - BYTE abyDesireBSSID[WLAN_BSSID_LEN]; - -//restore BSS info for Ad-Hoc mode - BYTE abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - - // Adhoc or AP configuration vars - WORD wIBSSBeaconPeriod; - WORD wIBSSATIMWindow; - unsigned int uIBSSChannel; - BYTE abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - BYTE byAPBBType; - BYTE abyWPAIE[MAX_WPA_IE_LEN]; - WORD wWPAIELen; - - unsigned int uAssocCount; - BOOL bMoreData; - - // Scan state vars - WMAC_SCAN_STATE eScanState; - WMAC_SCAN_TYPE eScanType; - unsigned int uScanStartCh; - unsigned int uScanEndCh; - WORD wScanSteps; - unsigned int uScanBSSType; - // Desire scannig vars - BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - BYTE abyScanBSSID[WLAN_BSSID_LEN]; - - // Privacy - WMAC_AUTHENTICATION_MODE eAuthenMode; - BOOL bShareKeyAlgorithm; - BYTE abyChallenge[WLAN_CHALLENGE_LEN]; - BOOL bPrivacyInvoked; - - // Received beacon state vars - BOOL bInTIM; - BOOL bMulticastTIM; - BYTE byDTIMCount; - BYTE byDTIMPeriod; - - // Power saving state vars - WMAC_POWER_MODE ePSMode; - WORD wListenInterval; - WORD wCountToWakeUp; - BOOL bInTIMWake; - PBYTE pbyPSPacketPool; - BYTE byPSPacketPool[sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN]; - BOOL bRxBeaconInTBTTWake; - BYTE abyPSTxMap[MAX_NODE_NUM + 1]; - - // management command related - unsigned int uCmdBusy; - unsigned int uCmdHostAPBusy; - - // management packet pool - PBYTE pbyMgmtPacketPool; - BYTE byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN]; - - - // One second callback timer - struct timer_list sTimerSecondCallback; - - // Temporarily Rx Mgmt Packet Descriptor - SRxMgmtPacket sRxPacket; - - // link list of known bss's (scan results) - KnownBSS sBSSList[MAX_BSS_NUM]; - /* link list of same bss's */ - KnownBSS pSameBSS[6] ; - BOOL Cisco_cckm ; - BYTE Roam_dbm; - - // table list of known node - // sNodeDBList[0] is reserved for AP under Infra mode - // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode - KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1]; - - - // WPA2 PMKID Cache - SPMKIDCache gsPMKIDCache; - BOOL bRoaming; - - // rate fall back vars - - - - // associate info - SAssocInfo sAssocInfo; - - - // for 802.11h - BOOL b11hEnable; - BOOL bSwitchChannel; - BYTE byNewChannel; - PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep; - unsigned int uLengthOfRepEIDs; - BYTE abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN]; - BYTE abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN]; - BYTE abyIECountry[WLAN_A3FR_MAXLEN]; - BYTE abyIBSSDFSOwner[6]; - BYTE byIBSSDFSRecovery; - - struct sk_buff skb; - -} SMgmtObject, *PSMgmtObject; + /* MAC address */ + u8 abyMACAddr[WLAN_ADDR_LEN]; + + /* Configuration Mode */ + WMAC_CONFIG_MODE eConfigMode; /* MAC pre-configed mode */ + + CARD_PHY_TYPE eCurrentPHYMode; + + /* Operation state variables */ + WMAC_CURRENT_MODE eCurrMode; /* MAC current connection mode */ + WMAC_BSS_STATE eCurrState; /* MAC current BSS state */ + WMAC_BSS_STATE eLastState; /* MAC last BSS state */ + + PKnownBSS pCurrBSS; + u8 byCSSGK; + u8 byCSSPK; + + int bCurrBSSIDFilterOn; + + /* Current state vars */ + u32 uCurrChannel; + u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + u8 abyCurrBSSID[WLAN_BSSID_LEN]; + u16 wCurrCapInfo; + u16 wCurrAID; + u32 uRSSITrigger; + u16 wCurrATIMWindow; + u16 wCurrBeaconPeriod; + int bIsDS; + u8 byERPContext; + + CMD_STATE eCommandState; + u32 uScanChannel; + + /* Desire joinning BSS vars */ + u8 abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + u8 abyDesireBSSID[WLAN_BSSID_LEN]; + + /*restore BSS info for Ad-Hoc mode */ + u8 abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + + /* Adhoc or AP configuration vars */ + u16 wIBSSBeaconPeriod; + u16 wIBSSATIMWindow; + u32 uIBSSChannel; + u8 abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 byAPBBType; + u8 abyWPAIE[MAX_WPA_IE_LEN]; + u16 wWPAIELen; + + u32 uAssocCount; + int bMoreData; + + /* Scan state vars */ + WMAC_SCAN_STATE eScanState; + WMAC_SCAN_TYPE eScanType; + u32 uScanStartCh; + u32 uScanEndCh; + u16 wScanSteps; + u32 uScanBSSType; + /* Desire scannig vars */ + u8 abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + u8 abyScanBSSID[WLAN_BSSID_LEN]; + + /* Privacy */ + WMAC_AUTHENTICATION_MODE eAuthenMode; + int bShareKeyAlgorithm; + u8 abyChallenge[WLAN_CHALLENGE_LEN]; + int bPrivacyInvoked; + + /* Received beacon state vars */ + int bInTIM; + int bMulticastTIM; + u8 byDTIMCount; + u8 byDTIMPeriod; + + /* Power saving state vars */ + WMAC_POWER_MODE ePSMode; + u16 wListenInterval; + u16 wCountToWakeUp; + int bInTIMWake; + u8 *pbyPSPacketPool; + u8 byPSPacketPool[sizeof(struct vnt_tx_mgmt) + + WLAN_NULLDATA_FR_MAXLEN]; + int bRxBeaconInTBTTWake; + u8 abyPSTxMap[MAX_NODE_NUM + 1]; + + /* management command related */ + u32 uCmdBusy; + u32 uCmdHostAPBusy; + + /* management packet pool */ + u8 *pbyMgmtPacketPool; + u8 byMgmtPacketPool[sizeof(struct vnt_tx_mgmt) + + WLAN_A3FR_MAXLEN]; + + + /* One second callback timer */ + struct timer_list sTimerSecondCallback; + + /* Temporarily Rx Mgmt Packet Descriptor */ + struct vnt_rx_mgmt sRxPacket; + + /* link list of known bss's (scan results) */ + KnownBSS sBSSList[MAX_BSS_NUM]; + /* link list of same bss's */ + KnownBSS pSameBSS[6]; + int Cisco_cckm; + u8 Roam_dbm; + + /* table list of known node */ + /* sNodeDBList[0] is reserved for AP under Infra mode */ + /* sNodeDBList[0] is reserved for Multicast under adhoc/AP mode */ + KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1]; + + /* WPA2 PMKID Cache */ + SPMKIDCache gsPMKIDCache; + int bRoaming; + + /* associate info */ + SAssocInfo sAssocInfo; + + /* for 802.11h */ + int b11hEnable; + int bSwitchChannel; + u8 byNewChannel; + PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep; + u32 uLengthOfRepEIDs; + u8 abyCurrentMSRReq[sizeof(struct vnt_tx_mgmt) + + WLAN_A3FR_MAXLEN]; + u8 abyCurrentMSRRep[sizeof(struct vnt_tx_mgmt) + + WLAN_A3FR_MAXLEN]; + u8 abyIECountry[WLAN_A3FR_MAXLEN]; + u8 abyIBSSDFSOwner[6]; + u8 byIBSSDFSRecovery; + + struct sk_buff skb; + +}; /*--------------------- Export Macros ------------------------------*/ /*--------------------- Export Functions --------------------------*/ -void vMgrObjectInit(void *hDeviceContext); +void vMgrObjectInit(struct vnt_private *pDevice); -void vMgrAssocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus); +void vMgrAssocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, PCMD_STATUS pStatus); -void vMgrReAssocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus); +void vMgrReAssocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, PCMD_STATUS pStatus); -void vMgrDisassocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PBYTE abyDestAddress, - WORD wReason, - PCMD_STATUS pStatus); +void vMgrDisassocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus); -void vMgrAuthenBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus); +void vMgrAuthenBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, PCMD_STATUS pStatus); -void vMgrCreateOwnIBSS(void *hDeviceContext, - PCMD_STATUS pStatus); +void vMgrCreateOwnIBSS(struct vnt_private *pDevice, + PCMD_STATUS pStatus); -void vMgrJoinBSSBegin(void *hDeviceContext, - PCMD_STATUS pStatus); +void vMgrJoinBSSBegin(struct vnt_private *pDevice, + PCMD_STATUS pStatus); -void vMgrRxManagePacket(void *hDeviceContext, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket); +void vMgrRxManagePacket(struct vnt_private *pDevice, + struct vnt_manager *, struct vnt_rx_mgmt *); /* void @@ -437,19 +420,16 @@ vMgrScanBegin( ); */ -void vMgrDeAuthenBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PBYTE abyDestAddress, - WORD wReason, - PCMD_STATUS pStatus); +void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus); -BOOL bMgrPrepareBeaconToSend(void *hDeviceContext, - PSMgmtObject pMgmt); +int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, + struct vnt_manager *); -BOOL bAdd_PMKID_Candidate(void *hDeviceContext, - PBYTE pbyBSSID, - PSRSNCapObject psRSNCapObj); +int bAdd_PMKID_Candidate(struct vnt_private *pDevice, + u8 *pbyBSSID, PSRSNCapObject psRSNCapObj); -void vFlush_PMKID_Candidate(void *hDeviceContext); +void vFlush_PMKID_Candidate(struct vnt_private *pDevice); #endif /* __WMGR_H__ */ diff --git a/drivers/staging/vt6656/wpa.c b/drivers/staging/vt6656/wpa.c index f6429a26ae0f..f037be3aa164 100644 --- a/drivers/staging/vt6656/wpa.c +++ b/drivers/staging/vt6656/wpa.c @@ -83,9 +83,9 @@ WPA_ClearRSN( pBSSList->wAuthCount = 0; pBSSList->byDefaultK_as_PK = 0; pBSSList->byReplayIdx = 0; - pBSSList->sRSNCapObj.bRSNCapExist = FALSE; + pBSSList->sRSNCapObj.bRSNCapExist = false; pBSSList->sRSNCapObj.wRSNCap = 0; - pBSSList->bWPAValid = FALSE; + pBSSList->bWPAValid = false; } @@ -212,14 +212,14 @@ WPA_ParseRSN( pbyCaps = (PBYTE)pIE_RSN_Auth->AuthKSList[n].abyOUI; pBSSList->byDefaultK_as_PK = (*pbyCaps) & WPA_GROUPFLAG; pBSSList->byReplayIdx = 2 << ((*pbyCaps >> WPA_REPLAYBITSSHIFT) & WPA_REPLAYBITS); - pBSSList->sRSNCapObj.bRSNCapExist = TRUE; + pBSSList->sRSNCapObj.bRSNCapExist = true; pBSSList->sRSNCapObj.wRSNCap = *(PWORD)pbyCaps; //DBG_PRN_GRP14(("pbyCaps: %X\n", *pbyCaps)); //DBG_PRN_GRP14(("byDefaultK_as_PK: %X\n", pBSSList->byDefaultK_as_PK)); //DBG_PRN_GRP14(("byReplayIdx: %X\n", pBSSList->byReplayIdx)); } } - pBSSList->bWPAValid = TRUE; + pBSSList->bWPAValid = true; } } @@ -239,7 +239,7 @@ WPA_ParseRSN( * Return Value: none. * -*/ -BOOL +bool WPA_SearchRSN( BYTE byCmd, BYTE byEncrypt, @@ -249,14 +249,14 @@ WPA_SearchRSN( int ii; BYTE byPKType = WPA_NONE; - if (pBSSList->bWPAValid == FALSE) - return FALSE; + if (pBSSList->bWPAValid == false) + return false; switch(byCmd) { case 0: if (byEncrypt != pBSSList->byGKType) - return FALSE; + return false; if (pBSSList->wPKCount > 0) { for (ii = 0; ii < pBSSList->wPKCount; ii ++) { @@ -270,9 +270,9 @@ WPA_SearchRSN( byPKType = WPA_WEP104; } if (byEncrypt != byPKType) - return FALSE; + return false; } - return TRUE; + return true; // if (pBSSList->wAuthCount > 0) // for (ii=0; ii < pBSSList->wAuthCount; ii ++) // if (byAuth == pBSSList->abyAuthType[ii]) @@ -282,7 +282,7 @@ WPA_SearchRSN( default: break; } - return FALSE; + return false; } /*+ @@ -299,20 +299,20 @@ WPA_SearchRSN( * Return Value: none. * -*/ -BOOL +bool WPAb_Is_RSN( PWLAN_IE_RSN_EXT pRSN ) { if (pRSN == NULL) - return FALSE; + return false; if ((pRSN->len >= 6) && // oui1(4)+ver(2) (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) && (pRSN->wVersion == 1)) { - return TRUE; + return true; } else - return FALSE; + return false; } diff --git a/drivers/staging/vt6656/wpa.h b/drivers/staging/vt6656/wpa.h index 889489adbb81..0369cbf32c49 100644 --- a/drivers/staging/vt6656/wpa.h +++ b/drivers/staging/vt6656/wpa.h @@ -69,14 +69,14 @@ WPA_ParseRSN( PWLAN_IE_RSN_EXT pRSN ); -BOOL +bool WPA_SearchRSN( BYTE byCmd, BYTE byEncrypt, PKnownBSS pBSSList ); -BOOL +bool WPAb_Is_RSN( PWLAN_IE_RSN_EXT pRSN ); diff --git a/drivers/staging/vt6656/wpa2.c b/drivers/staging/vt6656/wpa2.c index 616e24dcf42b..a89456a9137a 100644 --- a/drivers/staging/vt6656/wpa2.c +++ b/drivers/staging/vt6656/wpa2.c @@ -78,7 +78,7 @@ WPA2_ClearRSN ( { int ii; - pBSSNode->bWPA2Valid = FALSE; + pBSSNode->bWPA2Valid = false; pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP; for (ii=0; ii < 4; ii ++) @@ -87,7 +87,7 @@ WPA2_ClearRSN ( for (ii=0; ii < 4; ii ++) pBSSNode->abyAKMSSAuthType[ii] = WLAN_11i_AKMSS_802_1X; pBSSNode->wAKMSSAuthCount = 1; - pBSSNode->sRSNCapObj.bRSNCapExist = FALSE; + pBSSNode->sRSNCapObj.bRSNCapExist = false; pBSSNode->sRSNCapObj.wRSNCap = 0; } @@ -115,7 +115,7 @@ WPA2vParseRSN ( int i, j; WORD m = 0, n = 0; PBYTE pbyOUI; - BOOL bUseGK = FALSE; + bool bUseGK = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA2_ParseRSN: [%d]\n", pRSN->len); @@ -123,7 +123,7 @@ WPA2vParseRSN ( if (pRSN->len == 2) { // ver(2) if ((pRSN->byElementID == WLAN_EID_RSN) && (pRSN->wVersion == 1)) { - pBSSNode->bWPA2Valid = TRUE; + pBSSNode->bWPA2Valid = true; } return; } @@ -158,7 +158,7 @@ WPA2vParseRSN ( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"802.11i CSS: %X\n", pBSSNode->byCSSGK); if (pRSN->len == 6) { - pBSSNode->bWPA2Valid = TRUE; + pBSSNode->bWPA2Valid = true; return; } @@ -172,7 +172,7 @@ WPA2vParseRSN ( if (pRSN->len >= 8+i*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*i) if ( !memcmp(pbyOUI, abyOUIGK, 4)) { pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_USE_GROUP; - bUseGK = TRUE; + bUseGK = true; } else if ( !memcmp(pbyOUI, abyOUIWEP40, 4)) { // Invalid CSS, continue parsing } else if ( !memcmp(pbyOUI, abyOUITKIP, 4)) { @@ -194,7 +194,7 @@ WPA2vParseRSN ( break; } //for - if (bUseGK == TRUE) { + if (bUseGK == true) { if (j != 1) { // invalid CSS, This should be only PK CSS. return; @@ -236,12 +236,12 @@ WPA2vParseRSN ( n = *((PWORD) &(pRSN->abyRSN[6+4*m])); if (pRSN->len >= 12+4*m+4*n) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSSCnt(2)+AKMSS(4*n)+Cap(2) - pBSSNode->sRSNCapObj.bRSNCapExist = TRUE; + pBSSNode->sRSNCapObj.bRSNCapExist = true; pBSSNode->sRSNCapObj.wRSNCap = *((PWORD) &(pRSN->abyRSN[8+4*m+4*n])); } } //ignore PMKID lists bcs only (Re)Assocrequest has this field - pBSSNode->bWPA2Valid = TRUE; + pBSSNode->bWPA2Valid = true; } } @@ -260,19 +260,16 @@ WPA2vParseRSN ( * Return Value: length of IEs. * -*/ -unsigned int -WPA2uSetIEs(void *pMgmtHandle, - PWLAN_IE_RSN pRSNIEs - ) +unsigned int WPA2uSetIEs(void *pMgmtHandle, PWLAN_IE_RSN pRSNIEs) { - PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; - PBYTE pbyBuffer = NULL; - unsigned int ii = 0; - PWORD pwPMKID = NULL; + struct vnt_manager *pMgmt = (struct vnt_manager *)pMgmtHandle; + u8 *pbyBuffer = NULL; + int ii = 0; + u16 *pwPMKID = NULL; + + if (pRSNIEs == NULL) + return 0; - if (pRSNIEs == NULL) { - return(0); - } if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && (pMgmt->pCurrBSS != NULL)) { @@ -328,7 +325,7 @@ WPA2uSetIEs(void *pMgmtHandle, pRSNIEs->len +=6; // RSN Capabilites - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == TRUE) { + if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { memcpy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { pRSNIEs->abyRSN[16] = 0; @@ -337,7 +334,7 @@ WPA2uSetIEs(void *pMgmtHandle, pRSNIEs->len +=2; if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && - (pMgmt->bRoaming == TRUE) && + (pMgmt->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { /* RSN PMKID, pointer to PMKID count */ pwPMKID = (PWORD)(&pRSNIEs->abyRSN[18]); diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c index cc1d48bced2d..53629b26f24d 100644 --- a/drivers/staging/vt6656/wpactl.c +++ b/drivers/staging/vt6656/wpactl.c @@ -67,14 +67,14 @@ static int msglevel = MSG_LEVEL_INFO; * Return Value: * */ -int wpa_set_keys(PSDevice pDevice, void *ctx) +int wpa_set_keys(struct vnt_private *pDevice, void *ctx) { struct viawget_wpa_param *param = ctx; - PSMgmtObject pMgmt = &pDevice->sMgmtObj; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DWORD dwKeyIndex = 0; BYTE abyKey[MAX_KEY_LEN]; BYTE abySeq[MAX_KEY_LEN]; - QWORD KeyRSC; + u64 KeyRSC; BYTE byKeyDecMode = KEY_CTL_WEP; int ret = 0; int uu; @@ -87,9 +87,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) param->u.wpa_key.alg_name); if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; - pDevice->bEncryptionEnable = FALSE; + pDevice->bEncryptionEnable = false; pDevice->byKeyIndex = 0; - pDevice->bTransmitKey = FALSE; + pDevice->bTransmitKey = false; for (uu=0; uu<MAX_KEY_TABLE; uu++) { MACvDisableKeyEntry(pDevice, uu); } @@ -109,7 +109,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) } else { if (param->u.wpa_key.set_tx) { pDevice->byKeyIndex = (BYTE)dwKeyIndex; - pDevice->bTransmitKey = TRUE; + pDevice->bTransmitKey = true; dwKeyIndex |= (1 << 31); } KeybSetDefaultKey( pDevice, @@ -123,7 +123,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) } pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; - pDevice->bEncryptionEnable = TRUE; + pDevice->bEncryptionEnable = true; return ret; } @@ -136,9 +136,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) if (param->u.wpa_key.seq_len > 0) { for (ii = 0 ; ii < param->u.wpa_key.seq_len ; ii++) { if (ii < 4) - LODWORD(KeyRSC) |= (abySeq[ii] << (ii * 8)); + KeyRSC |= (abySeq[ii] << (ii * 8)); else - HIDWORD(KeyRSC) |= (abySeq[ii] << ((ii-4) * 8)); + KeyRSC |= (abySeq[ii] << ((ii-4) * 8)); } dwKeyIndex |= 1 << 29; } @@ -203,18 +203,18 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) if ((KeybSetAllGroupKey(pDevice, &(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, - (PQWORD) &(KeyRSC), + &KeyRSC, (PBYTE)abyKey, byKeyDecMode - ) == TRUE) && + ) == true) && (KeybSetDefaultKey(pDevice, &(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, - (PQWORD) &(KeyRSC), + &KeyRSC, (PBYTE)abyKey, byKeyDecMode - ) == TRUE) ) { + ) == true) ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n"); } else { return -EINVAL; @@ -234,8 +234,8 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) } if (KeybSetKey(pDevice, &(pDevice->sKey), ¶m->addr[0], dwKeyIndex, param->u.wpa_key.key_len, - (PQWORD) &(KeyRSC), (PBYTE)abyKey, byKeyDecMode - ) == TRUE) { + &KeyRSC, (PBYTE)abyKey, byKeyDecMode + ) == true) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); } else { // Key Table Full @@ -251,9 +251,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) } // BSSID not 0xffffffffffff if ((ret == 0) && ((param->u.wpa_key.set_tx) != 0)) { pDevice->byKeyIndex = (BYTE)param->u.wpa_key.key_index; - pDevice->bTransmitKey = TRUE; + pDevice->bTransmitKey = true; } - pDevice->bEncryptionEnable = TRUE; + pDevice->bEncryptionEnable = true; return ret; } diff --git a/drivers/staging/vt6656/wpactl.h b/drivers/staging/vt6656/wpactl.h index b4ec6b0e1c67..2235ee97012e 100644 --- a/drivers/staging/vt6656/wpactl.h +++ b/drivers/staging/vt6656/wpactl.h @@ -52,6 +52,6 @@ typedef unsigned long long NDIS_802_11_KEY_RSC; /*--------------------- Export Functions --------------------------*/ -int wpa_set_keys(PSDevice pDevice, void *ctx); +int wpa_set_keys(struct vnt_private *, void *ctx); #endif /* __WPACL_H__ */ |