diff options
Diffstat (limited to 'drivers/staging/vt6656')
75 files changed, 3529 insertions, 3879 deletions
diff --git a/drivers/staging/vt6656/80211hdr.h b/drivers/staging/vt6656/80211hdr.h index e5cee6fd0533..15c6ef1a635c 100644 --- a/drivers/staging/vt6656/80211hdr.h +++ b/drivers/staging/vt6656/80211hdr.h @@ -16,16 +16,13 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * * File: 80211hdr.h * * Purpose: 802.11 MAC headers related pre-defines and macros. * - * * Author: Lyndon Chen * * Date: Apr 8, 2002 - * */ #ifndef __80211HDR_H__ @@ -34,7 +31,8 @@ #include "ttype.h" /*--------------------- Export Definitions -------------------------*/ -// bit type + +/* bit type */ #define BIT0 0x00000001 #define BIT1 0x00000002 #define BIT2 0x00000004 @@ -68,7 +66,7 @@ #define BIT30 0x40000000 #define BIT31 0x80000000 -// 802.11 frame related, defined as 802.11 spec +/* 802.11 frame related, defined as 802.11 spec */ #define WLAN_ADDR_LEN 6 #define WLAN_CRC_LEN 4 #define WLAN_CRC32_LEN 4 @@ -80,13 +78,14 @@ #define WLAN_HDR_ADDR4_LEN 30 #define WLAN_IEHDR_LEN 2 #define WLAN_SSID_MAXLEN 32 -//#define WLAN_RATES_MAXLEN 255 +/* #define WLAN_RATES_MAXLEN 255 */ #define WLAN_RATES_MAXLEN 16 #define WLAN_RATES_MAXLEN_11B 4 #define WLAN_RSN_MAXLEN 32 #define WLAN_DATA_MAXLEN 2312 -#define WLAN_A3FR_MAXLEN (WLAN_HDR_ADDR3_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) - +#define WLAN_A3FR_MAXLEN (WLAN_HDR_ADDR3_LEN \ + + WLAN_DATA_MAXLEN \ + + WLAN_CRC_LEN) #define WLAN_BEACON_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0) @@ -101,12 +100,11 @@ #define WLAN_AUTHEN_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_DEAUTHEN_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 2) - #define WLAN_WEP_NKEYS 4 #define WLAN_WEP40_KEYLEN 5 #define WLAN_WEP104_KEYLEN 13 #define WLAN_WEP232_KEYLEN 29 -//#define WLAN_WEPMAX_KEYLEN 29 +/* #define WLAN_WEPMAX_KEYLEN 29 */ #define WLAN_WEPMAX_KEYLEN 32 #define WLAN_CHALLENGE_IE_MAXLEN 255 #define WLAN_CHALLENGE_IE_LEN 130 @@ -115,7 +113,7 @@ #define WLAN_WEP_ICV_LEN 4 #define WLAN_FRAGS_MAX 16 -// Frame Type +/* Frame Type */ #define WLAN_TYPE_MGR 0x00 #define WLAN_TYPE_CTL 0x01 #define WLAN_TYPE_DATA 0x02 @@ -124,8 +122,7 @@ #define WLAN_FTYPE_CTL 0x01 #define WLAN_FTYPE_DATA 0x02 - -// Frame Subtypes +/* Frame Subtypes */ #define WLAN_FSTYPE_ASSOCREQ 0x00 #define WLAN_FSTYPE_ASSOCRESP 0x01 #define WLAN_FSTYPE_REASSOCREQ 0x02 @@ -139,7 +136,7 @@ #define WLAN_FSTYPE_DEAUTHEN 0x0c #define WLAN_FSTYPE_ACTION 0x0d -// Control +/* Control */ #define WLAN_FSTYPE_PSPOLL 0x0a #define WLAN_FSTYPE_RTS 0x0b #define WLAN_FSTYPE_CTS 0x0c @@ -147,7 +144,7 @@ #define WLAN_FSTYPE_CFEND 0x0e #define WLAN_FSTYPE_CFENDCFACK 0x0f -// Data +/* Data */ #define WLAN_FSTYPE_DATAONLY 0x00 #define WLAN_FSTYPE_DATA_CFACK 0x01 #define WLAN_FSTYPE_DATA_CFPOLL 0x02 @@ -157,13 +154,13 @@ #define WLAN_FSTYPE_CFPOLL 0x06 #define WLAN_FSTYPE_CFACK_CFPOLL 0x07 - #ifdef __BIG_ENDIAN -// GET & SET Frame Control bit +/* GET & SET Frame Control bit */ #define WLAN_GET_FC_PRVER(n) ((((WORD)(n) >> 8) & (BIT0 | BIT1)) #define WLAN_GET_FC_FTYPE(n) ((((WORD)(n) >> 8) & (BIT2 | BIT3)) >> 2) -#define WLAN_GET_FC_FSTYPE(n) ((((WORD)(n) >> 8) & (BIT4|BIT5|BIT6|BIT7)) >> 4) +#define WLAN_GET_FC_FSTYPE(n) ((((WORD)(n) >> 8) \ + & (BIT4|BIT5|BIT6|BIT7)) >> 4) #define WLAN_GET_FC_TODS(n) ((((WORD)(n) << 8) & (BIT8)) >> 8) #define WLAN_GET_FC_FROMDS(n) ((((WORD)(n) << 8) & (BIT9)) >> 9) #define WLAN_GET_FC_MOREFRAG(n) ((((WORD)(n) << 8) & (BIT10)) >> 10) @@ -173,12 +170,12 @@ #define WLAN_GET_FC_ISWEP(n) ((((WORD)(n) << 8) & (BIT14)) >> 14) #define WLAN_GET_FC_ORDER(n) ((((WORD)(n) << 8) & (BIT15)) >> 15) -// Sequence Field bit +/* Sequence Field bit */ #define WLAN_GET_SEQ_FRGNUM(n) (((WORD)(n) >> 8) & (BIT0|BIT1|BIT2|BIT3)) -#define WLAN_GET_SEQ_SEQNUM(n) ((((WORD)(n) >> 8) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) - +#define WLAN_GET_SEQ_SEQNUM(n) ((((WORD)(n) >> 8) \ + & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) -// Capability Field bit +/* Capability Field bit */ #define WLAN_GET_CAP_INFO_ESS(n) (((n) >> 8) & BIT0) #define WLAN_GET_CAP_INFO_IBSS(n) ((((n) >> 8) & BIT1) >> 1) #define WLAN_GET_CAP_INFO_CFPOLLABLE(n) ((((n) >> 8) & BIT2) >> 2) @@ -192,10 +189,9 @@ #define WLAN_GET_CAP_INFO_DSSSOFDM(n) ((((n)) & BIT13) >> 13) #define WLAN_GET_CAP_INFO_GRPACK(n) ((((n)) & BIT14) >> 14) - #else -// GET & SET Frame Control bit +/* GET & SET Frame Control bit */ #define WLAN_GET_FC_PRVER(n) (((WORD)(n)) & (BIT0 | BIT1)) #define WLAN_GET_FC_FTYPE(n) ((((WORD)(n)) & (BIT2 | BIT3)) >> 2) #define WLAN_GET_FC_FSTYPE(n) ((((WORD)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4) @@ -208,13 +204,11 @@ #define WLAN_GET_FC_ISWEP(n) ((((WORD)(n)) & (BIT14)) >> 14) #define WLAN_GET_FC_ORDER(n) ((((WORD)(n)) & (BIT15)) >> 15) - -// Sequence Field bit +/* Sequence Field bit */ #define WLAN_GET_SEQ_FRGNUM(n) (((WORD)(n)) & (BIT0|BIT1|BIT2|BIT3)) #define WLAN_GET_SEQ_SEQNUM(n) ((((WORD)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) - -// Capability Field bit +/* Capability Field bit */ #define WLAN_GET_CAP_INFO_ESS(n) ((n) & BIT0) #define WLAN_GET_CAP_INFO_IBSS(n) (((n) & BIT1) >> 1) #define WLAN_GET_CAP_INFO_CFPOLLABLE(n) (((n) & BIT2) >> 2) @@ -228,9 +222,7 @@ #define WLAN_GET_CAP_INFO_DSSSOFDM(n) (((n) & BIT13) >> 13) #define WLAN_GET_CAP_INFO_GRPACK(n) (((n) & BIT14) >> 14) - -#endif //#ifdef __BIG_ENDIAN - +#endif /* #ifdef __BIG_ENDIAN */ #define WLAN_SET_CAP_INFO_ESS(n) (n) #define WLAN_SET_CAP_INFO_IBSS(n) ((n) << 1) @@ -245,7 +237,6 @@ #define WLAN_SET_CAP_INFO_DSSSOFDM(n) ((n) << 13) #define WLAN_SET_CAP_INFO_GRPACK(n) ((n) << 14) - #define WLAN_SET_FC_PRVER(n) ((WORD)(n)) #define WLAN_SET_FC_FTYPE(n) (((WORD)(n)) << 2) #define WLAN_SET_FC_FSTYPE(n) (((WORD)(n)) << 4) @@ -261,7 +252,7 @@ #define WLAN_SET_SEQ_FRGNUM(n) ((WORD)(n)) #define WLAN_SET_SEQ_SEQNUM(n) (((WORD)(n)) << 4) -// ERP Field bit +/* ERP Field bit */ #define WLAN_GET_ERP_NONERP_PRESENT(n) ((n) & BIT0) #define WLAN_GET_ERP_USE_PROTECTION(n) (((n) & BIT1) >> 1) @@ -271,21 +262,19 @@ #define WLAN_SET_ERP_USE_PROTECTION(n) ((n) << 1) #define WLAN_SET_ERP_BARKER_MODE(n) ((n) << 2) - - -// Support & Basic Rates field +/* Support & Basic Rates field */ #define WLAN_MGMT_IS_BASICRATE(b) ((b) & BIT7) #define WLAN_MGMT_GET_RATE(b) ((b) & ~BIT7) -// TIM field +/* TIM field */ #define WLAN_MGMT_IS_MULTICAST_TIM(b) ((b) & BIT0) #define WLAN_MGMT_GET_TIM_OFFSET(b) (((b) & ~BIT0) >> 1) -// 3-Addr & 4-Addr +/* 3-Addr & 4-Addr */ #define WLAN_HDR_A3_DATA_PTR(p) (((PBYTE)(p)) + WLAN_HDR_ADDR3_LEN) #define WLAN_HDR_A4_DATA_PTR(p) (((PBYTE)(p)) + WLAN_HDR_ADDR4_LEN) -// IEEE ADDR +/* IEEE ADDR */ #define IEEE_ADDR_UNIVERSAL 0x02 #define IEEE_ADDR_GROUP 0x01 @@ -293,7 +282,7 @@ typedef struct { BYTE abyAddr[6]; } IEEE_ADDR, *PIEEE_ADDR; -// 802.11 Header Format +/* 802.11 Header Format */ typedef struct tagWLAN_80211HDR_A2 { @@ -302,7 +291,7 @@ typedef struct tagWLAN_80211HDR_A2 { BYTE abyAddr1[WLAN_ADDR_LEN]; BYTE abyAddr2[WLAN_ADDR_LEN]; -}__attribute__ ((__packed__)) +} __attribute__ ((__packed__)) WLAN_80211HDR_A2, *PWLAN_80211HDR_A2; typedef struct tagWLAN_80211HDR_A3 { @@ -314,7 +303,7 @@ typedef struct tagWLAN_80211HDR_A3 { BYTE abyAddr3[WLAN_ADDR_LEN]; WORD wSeqCtl; -}__attribute__ ((__packed__)) +} __attribute__ ((__packed__)) WLAN_80211HDR_A3, *PWLAN_80211HDR_A3; typedef struct tagWLAN_80211HDR_A4 { @@ -327,10 +316,9 @@ typedef struct tagWLAN_80211HDR_A4 { WORD wSeqCtl; BYTE abyAddr4[WLAN_ADDR_LEN]; -}__attribute__ ((__packed__)) +} __attribute__ ((__packed__)) WLAN_80211HDR_A4, *PWLAN_80211HDR_A4; - typedef union tagUWLAN_80211HDR { WLAN_80211HDR_A2 sA2; @@ -339,15 +327,10 @@ typedef union tagUWLAN_80211HDR { } UWLAN_80211HDR, *PUWLAN_80211HDR; - /*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ - - -#endif // __80211HDR_H__ - - +#endif /* __80211HDR_H__ */ diff --git a/drivers/staging/vt6656/80211mgr.c b/drivers/staging/vt6656/80211mgr.c index 8fa1a8e5a21a..f24dc55e68f1 100644 --- a/drivers/staging/vt6656/80211mgr.c +++ b/drivers/staging/vt6656/80211mgr.c @@ -89,9 +89,9 @@ static int msglevel =MSG_LEVEL_INFO; * -*/ -VOID +void vMgrEncodeBeacon( - IN PWLAN_FR_BEACON pFrame + PWLAN_FR_BEACON pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -121,9 +121,9 @@ vMgrEncodeBeacon( -*/ -VOID +void vMgrDecodeBeacon( - IN PWLAN_FR_BEACON pFrame + PWLAN_FR_BEACON pFrame ) { PWLAN_IE pItem; @@ -242,9 +242,9 @@ vMgrDecodeBeacon( -*/ -VOID +void vMgrEncodeIBSSATIM( - IN PWLAN_FR_IBSSATIM pFrame + PWLAN_FR_IBSSATIM pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -265,9 +265,9 @@ vMgrEncodeIBSSATIM( * -*/ -VOID +void vMgrDecodeIBSSATIM( - IN PWLAN_FR_IBSSATIM pFrame + PWLAN_FR_IBSSATIM pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -287,9 +287,9 @@ vMgrDecodeIBSSATIM( * -*/ -VOID +void vMgrEncodeDisassociation( - IN PWLAN_FR_DISASSOC pFrame + PWLAN_FR_DISASSOC pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -315,9 +315,9 @@ vMgrEncodeDisassociation( * -*/ -VOID +void vMgrDecodeDisassociation( - IN PWLAN_FR_DISASSOC pFrame + PWLAN_FR_DISASSOC pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -341,9 +341,9 @@ vMgrDecodeDisassociation( -*/ -VOID +void vMgrEncodeAssocRequest( - IN PWLAN_FR_ASSOCREQ pFrame + PWLAN_FR_ASSOCREQ pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -368,9 +368,9 @@ vMgrEncodeAssocRequest( * -*/ -VOID +void vMgrDecodeAssocRequest( - IN PWLAN_FR_ASSOCREQ pFrame + PWLAN_FR_ASSOCREQ pFrame ) { PWLAN_IE pItem; @@ -434,9 +434,9 @@ vMgrDecodeAssocRequest( * -*/ -VOID +void vMgrEncodeAssocResponse( - IN PWLAN_FR_ASSOCRESP pFrame + PWLAN_FR_ASSOCRESP pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -466,9 +466,9 @@ vMgrEncodeAssocResponse( * -*/ -VOID +void vMgrDecodeAssocResponse( - IN PWLAN_FR_ASSOCRESP pFrame + PWLAN_FR_ASSOCRESP pFrame ) { PWLAN_IE pItem; @@ -512,9 +512,9 @@ vMgrDecodeAssocResponse( * -*/ -VOID +void vMgrEncodeReassocRequest( - IN PWLAN_FR_REASSOCREQ pFrame + PWLAN_FR_REASSOCREQ pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -544,9 +544,9 @@ vMgrEncodeReassocRequest( -*/ -VOID +void vMgrDecodeReassocRequest( - IN PWLAN_FR_REASSOCREQ pFrame + PWLAN_FR_REASSOCREQ pFrame ) { PWLAN_IE pItem; @@ -616,9 +616,9 @@ vMgrDecodeReassocRequest( -*/ -VOID +void vMgrEncodeProbeRequest( - IN PWLAN_FR_PROBEREQ pFrame + PWLAN_FR_PROBEREQ pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -637,9 +637,9 @@ vMgrEncodeProbeRequest( * -*/ -VOID +void vMgrDecodeProbeRequest( - IN PWLAN_FR_PROBEREQ pFrame + PWLAN_FR_PROBEREQ pFrame ) { PWLAN_IE pItem; @@ -690,9 +690,9 @@ vMgrDecodeProbeRequest( -*/ -VOID +void vMgrEncodeProbeResponse( - IN PWLAN_FR_PROBERESP pFrame + PWLAN_FR_PROBERESP pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -724,9 +724,9 @@ vMgrEncodeProbeResponse( * -*/ -VOID +void vMgrDecodeProbeResponse( - IN PWLAN_FR_PROBERESP pFrame + PWLAN_FR_PROBERESP pFrame ) { PWLAN_IE pItem; @@ -838,9 +838,9 @@ vMgrDecodeProbeResponse( * -*/ -VOID +void vMgrEncodeAuthen( - IN PWLAN_FR_AUTHEN pFrame + PWLAN_FR_AUTHEN pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -869,9 +869,9 @@ vMgrEncodeAuthen( * -*/ -VOID +void vMgrDecodeAuthen( - IN PWLAN_FR_AUTHEN pFrame + PWLAN_FR_AUTHEN pFrame ) { PWLAN_IE pItem; @@ -909,9 +909,9 @@ vMgrDecodeAuthen( * -*/ -VOID +void vMgrEncodeDeauthen( - IN PWLAN_FR_DEAUTHEN pFrame + PWLAN_FR_DEAUTHEN pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -936,9 +936,9 @@ vMgrEncodeDeauthen( * -*/ -VOID +void vMgrDecodeDeauthen( - IN PWLAN_FR_DEAUTHEN pFrame + PWLAN_FR_DEAUTHEN pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -962,9 +962,9 @@ vMgrDecodeDeauthen( * -*/ -VOID +void vMgrEncodeReassocResponse( - IN PWLAN_FR_REASSOCRESP pFrame + PWLAN_FR_REASSOCRESP pFrame ) { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -995,9 +995,9 @@ vMgrEncodeReassocResponse( -*/ -VOID +void vMgrDecodeReassocResponse( - IN PWLAN_FR_REASSOCRESP pFrame + PWLAN_FR_REASSOCRESP pFrame ) { PWLAN_IE pItem; diff --git a/drivers/staging/vt6656/80211mgr.h b/drivers/staging/vt6656/80211mgr.h index a4ea82492167..c140a957d9df 100644 --- a/drivers/staging/vt6656/80211mgr.h +++ b/drivers/staging/vt6656/80211mgr.h @@ -524,8 +524,8 @@ typedef struct _WLAN_IE_IBSS_DFS { // prototype structure, all mgmt frame types will start with these members typedef struct tagWLAN_FR_MGMT { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; @@ -534,8 +534,8 @@ typedef struct tagWLAN_FR_MGMT { // Beacon frame typedef struct tagWLAN_FR_BEACON { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; // fixed fields @@ -566,8 +566,8 @@ typedef struct tagWLAN_FR_BEACON { // IBSS ATIM frame typedef struct tagWLAN_FR_IBSSATIM { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; @@ -580,8 +580,8 @@ typedef struct tagWLAN_FR_IBSSATIM { // Disassociation typedef struct tagWLAN_FR_DISASSOC { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; /*-- fixed fields -----------*/ @@ -593,8 +593,8 @@ typedef struct tagWLAN_FR_DISASSOC { // Association Request typedef struct tagWLAN_FR_ASSOCREQ { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; /*-- fixed fields -----------*/ @@ -617,8 +617,8 @@ typedef struct tagWLAN_FR_ASSOCREQ { // Association Response typedef struct tagWLAN_FR_ASSOCRESP { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; /*-- fixed fields -----------*/ @@ -634,8 +634,8 @@ typedef struct tagWLAN_FR_ASSOCRESP { // Reassociation Request typedef struct tagWLAN_FR_REASSOCREQ { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; @@ -659,8 +659,8 @@ typedef struct tagWLAN_FR_REASSOCREQ { // Reassociation Response typedef struct tagWLAN_FR_REASSOCRESP { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; /*-- fixed fields -----------*/ @@ -676,8 +676,8 @@ typedef struct tagWLAN_FR_REASSOCRESP { // Probe Request typedef struct tagWLAN_FR_PROBEREQ { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; /*-- fixed fields -----------*/ @@ -691,8 +691,8 @@ typedef struct tagWLAN_FR_PROBEREQ { // Probe Response typedef struct tagWLAN_FR_PROBERESP { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; /*-- fixed fields -----------*/ @@ -720,8 +720,8 @@ typedef struct tagWLAN_FR_PROBERESP { // Authentication typedef struct tagWLAN_FR_AUTHEN { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; /*-- fixed fields -----------*/ @@ -736,8 +736,8 @@ typedef struct tagWLAN_FR_AUTHEN { // Deauthenication typedef struct tagWLAN_FR_DEAUTHEN { - UINT uType; - UINT len; + unsigned int uType; + unsigned int len; PBYTE pBuf; PUWLAN_80211HDR pHdr; /*-- fixed fields -----------*/ @@ -748,114 +748,114 @@ typedef struct tagWLAN_FR_DEAUTHEN { } WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN; /*--------------------- Export Functions --------------------------*/ -VOID +void vMgrEncodeBeacon( - IN PWLAN_FR_BEACON pFrame + PWLAN_FR_BEACON pFrame ); -VOID +void vMgrDecodeBeacon( - IN PWLAN_FR_BEACON pFrame + PWLAN_FR_BEACON pFrame ); -VOID +void vMgrEncodeIBSSATIM( - IN PWLAN_FR_IBSSATIM pFrame + PWLAN_FR_IBSSATIM pFrame ); -VOID +void vMgrDecodeIBSSATIM( - IN PWLAN_FR_IBSSATIM pFrame + PWLAN_FR_IBSSATIM pFrame ); -VOID +void vMgrEncodeDisassociation( - IN PWLAN_FR_DISASSOC pFrame + PWLAN_FR_DISASSOC pFrame ); -VOID +void vMgrDecodeDisassociation( - IN PWLAN_FR_DISASSOC pFrame + PWLAN_FR_DISASSOC pFrame ); -VOID +void vMgrEncodeAssocRequest( - IN PWLAN_FR_ASSOCREQ pFrame + PWLAN_FR_ASSOCREQ pFrame ); -VOID +void vMgrDecodeAssocRequest( - IN PWLAN_FR_ASSOCREQ pFrame + PWLAN_FR_ASSOCREQ pFrame ); -VOID +void vMgrEncodeAssocResponse( - IN PWLAN_FR_ASSOCRESP pFrame + PWLAN_FR_ASSOCRESP pFrame ); -VOID +void vMgrDecodeAssocResponse( - IN PWLAN_FR_ASSOCRESP pFrame + PWLAN_FR_ASSOCRESP pFrame ); -VOID +void vMgrEncodeReassocRequest( - IN PWLAN_FR_REASSOCREQ pFrame + PWLAN_FR_REASSOCREQ pFrame ); -VOID +void vMgrDecodeReassocRequest( - IN PWLAN_FR_REASSOCREQ pFrame + PWLAN_FR_REASSOCREQ pFrame ); -VOID +void vMgrEncodeProbeRequest( - IN PWLAN_FR_PROBEREQ pFrame + PWLAN_FR_PROBEREQ pFrame ); -VOID +void vMgrDecodeProbeRequest( - IN PWLAN_FR_PROBEREQ pFrame + PWLAN_FR_PROBEREQ pFrame ); -VOID +void vMgrEncodeProbeResponse( - IN PWLAN_FR_PROBERESP pFrame + PWLAN_FR_PROBERESP pFrame ); -VOID +void vMgrDecodeProbeResponse( - IN PWLAN_FR_PROBERESP pFrame + PWLAN_FR_PROBERESP pFrame ); -VOID +void vMgrEncodeAuthen( - IN PWLAN_FR_AUTHEN pFrame + PWLAN_FR_AUTHEN pFrame ); -VOID +void vMgrDecodeAuthen( - IN PWLAN_FR_AUTHEN pFrame + PWLAN_FR_AUTHEN pFrame ); -VOID +void vMgrEncodeDeauthen( - IN PWLAN_FR_DEAUTHEN pFrame + PWLAN_FR_DEAUTHEN pFrame ); -VOID +void vMgrDecodeDeauthen( - IN PWLAN_FR_DEAUTHEN pFrame + PWLAN_FR_DEAUTHEN pFrame ); -VOID +void vMgrEncodeReassocResponse( - IN PWLAN_FR_REASSOCRESP pFrame + PWLAN_FR_REASSOCRESP pFrame ); -VOID +void vMgrDecodeReassocResponse( - IN PWLAN_FR_REASSOCRESP pFrame + PWLAN_FR_REASSOCRESP pFrame ); #endif// __80211MGR_H__ diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c index 401a7d267c90..b3d367b9bdc6 100644 --- a/drivers/staging/vt6656/aes_ccmp.c +++ b/drivers/staging/vt6656/aes_ccmp.c @@ -16,7 +16,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * * File: aes_ccmp.c * * Purpose: AES_CCMP decryption @@ -28,9 +27,7 @@ * Functions: * AESbGenCCMP - Parsing RX-packet * - * * Revision History: - * */ #include "device.h" @@ -46,62 +43,61 @@ * SBOX Table */ -BYTE sbox_table[256] = -{ -0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, -0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, -0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, -0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, -0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, -0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, -0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, -0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, -0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, -0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, -0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, -0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, -0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, -0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, -0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, -0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 +BYTE sbox_table[256] = { + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; BYTE dot2_table[256] = { -0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, -0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, -0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, -0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, -0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, -0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, -0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, -0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe, -0x1b, 0x19, 0x1f, 0x1d, 0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05, -0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d, 0x23, 0x21, 0x27, 0x25, -0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55, 0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45, -0x7b, 0x79, 0x7f, 0x7d, 0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65, -0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d, 0x83, 0x81, 0x87, 0x85, -0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5, 0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5, -0xdb, 0xd9, 0xdf, 0xdd, 0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5, -0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5 + 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, + 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, + 0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, + 0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, + 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, + 0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, + 0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, + 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe, + 0x1b, 0x19, 0x1f, 0x1d, 0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05, + 0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d, 0x23, 0x21, 0x27, 0x25, + 0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55, 0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45, + 0x7b, 0x79, 0x7f, 0x7d, 0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65, + 0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d, 0x83, 0x81, 0x87, 0x85, + 0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5, 0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5, + 0xdb, 0xd9, 0xdf, 0xdd, 0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5, + 0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5 }; BYTE dot3_table[256] = { -0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11, -0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21, -0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71, -0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d, 0x44, 0x47, 0x42, 0x41, -0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9, 0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1, -0xf0, 0xf3, 0xf6, 0xf5, 0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1, -0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd, 0xb4, 0xb7, 0xb2, 0xb1, -0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99, 0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81, -0x9b, 0x98, 0x9d, 0x9e, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a, -0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6, 0xbf, 0xbc, 0xb9, 0xba, -0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2, 0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea, -0xcb, 0xc8, 0xcd, 0xce, 0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda, -0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4f, 0x4c, 0x49, 0x4a, -0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a, -0x3b, 0x38, 0x3d, 0x3e, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a, -0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a + 0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11, + 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21, + 0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71, + 0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d, 0x44, 0x47, 0x42, 0x41, + 0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9, 0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1, + 0xf0, 0xf3, 0xf6, 0xf5, 0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1, + 0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd, 0xb4, 0xb7, 0xb2, 0xb1, + 0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99, 0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81, + 0x9b, 0x98, 0x9d, 0x9e, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a, + 0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6, 0xbf, 0xbc, 0xb9, 0xba, + 0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2, 0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea, + 0xcb, 0xc8, 0xcd, 0xce, 0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda, + 0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4f, 0x4c, 0x49, 0x4a, + 0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a, + 0x3b, 0x38, 0x3d, 0x3e, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a, + 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a }; /*--------------------- Static Functions --------------------------*/ @@ -112,120 +108,111 @@ BYTE dot3_table[256] = { void xor_128(BYTE *a, BYTE *b, BYTE *out) { -PDWORD dwPtrA = (PDWORD) a; -PDWORD dwPtrB = (PDWORD) b; -PDWORD dwPtrOut =(PDWORD) out; - - (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); - (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); - (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); - (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); + PDWORD dwPtrA = (PDWORD) a; + PDWORD dwPtrB = (PDWORD) b; + PDWORD dwPtrOut = (PDWORD) out; + + (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); + (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); + (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); + (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); } void xor_32(BYTE *a, BYTE *b, BYTE *out) { -PDWORD dwPtrA = (PDWORD) a; -PDWORD dwPtrB = (PDWORD) b; -PDWORD dwPtrOut =(PDWORD) out; + PDWORD dwPtrA = (PDWORD) a; + PDWORD dwPtrB = (PDWORD) b; + PDWORD dwPtrOut = (PDWORD) out; - (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); + (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); } void AddRoundKey(BYTE *key, int round) { -BYTE sbox_key[4]; -BYTE rcon_table[10] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36}; + BYTE sbox_key[4]; + BYTE rcon_table[10] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36}; - sbox_key[0] = sbox_table[key[13]]; - sbox_key[1] = sbox_table[key[14]]; - sbox_key[2] = sbox_table[key[15]]; - sbox_key[3] = sbox_table[key[12]]; + sbox_key[0] = sbox_table[key[13]]; + sbox_key[1] = sbox_table[key[14]]; + sbox_key[2] = sbox_table[key[15]]; + sbox_key[3] = sbox_table[key[12]]; - key[0] = key[0] ^ rcon_table[round]; - xor_32(&key[0], sbox_key, &key[0]); + key[0] = key[0] ^ rcon_table[round]; + xor_32(&key[0], sbox_key, &key[0]); - xor_32(&key[4], &key[0], &key[4]); - xor_32(&key[8], &key[4], &key[8]); - xor_32(&key[12], &key[8], &key[12]); + xor_32(&key[4], &key[0], &key[4]); + xor_32(&key[8], &key[4], &key[8]); + xor_32(&key[12], &key[8], &key[12]); } void SubBytes(BYTE *in, BYTE *out) { -int i; + int i; - for (i=0; i< 16; i++) - { - out[i] = sbox_table[in[i]]; - } + for (i = 0; i < 16; i++) + out[i] = sbox_table[in[i]]; } void ShiftRows(BYTE *in, BYTE *out) { - out[0] = in[0]; - out[1] = in[5]; - out[2] = in[10]; - out[3] = in[15]; - out[4] = in[4]; - out[5] = in[9]; - out[6] = in[14]; - out[7] = in[3]; - out[8] = in[8]; - out[9] = in[13]; - out[10] = in[2]; - out[11] = in[7]; - out[12] = in[12]; - out[13] = in[1]; - out[14] = in[6]; - out[15] = in[11]; + out[0] = in[0]; + out[1] = in[5]; + out[2] = in[10]; + out[3] = in[15]; + out[4] = in[4]; + out[5] = in[9]; + out[6] = in[14]; + out[7] = in[3]; + out[8] = in[8]; + out[9] = in[13]; + out[10] = in[2]; + out[11] = in[7]; + out[12] = in[12]; + out[13] = in[1]; + out[14] = in[6]; + out[15] = in[11]; } void MixColumns(BYTE *in, BYTE *out) { - out[0] = dot2_table[in[0]] ^ dot3_table[in[1]] ^ in[2] ^ in[3]; - out[1] = in[0] ^ dot2_table[in[1]] ^ dot3_table[in[2]] ^ in[3]; - out[2] = in[0] ^ in[1] ^ dot2_table[in[2]] ^ dot3_table[in[3]]; - out[3] = dot3_table[in[0]] ^ in[1] ^ in[2] ^ dot2_table[in[3]]; + out[0] = dot2_table[in[0]] ^ dot3_table[in[1]] ^ in[2] ^ in[3]; + out[1] = in[0] ^ dot2_table[in[1]] ^ dot3_table[in[2]] ^ in[3]; + out[2] = in[0] ^ in[1] ^ dot2_table[in[2]] ^ dot3_table[in[3]]; + out[3] = dot3_table[in[0]] ^ in[1] ^ in[2] ^ dot2_table[in[3]]; } - void AESv128(BYTE *key, BYTE *data, BYTE *ciphertext) { -int i; -int round; -BYTE TmpdataA[16]; -BYTE TmpdataB[16]; -BYTE abyRoundKey[16]; - - for(i=0; i<16; i++) - abyRoundKey[i] = key[i]; - - for (round = 0; round < 11; round++) - { - if (round == 0) - { - xor_128(abyRoundKey, data, ciphertext); - AddRoundKey(abyRoundKey, round); - } - else if (round == 10) - { - SubBytes(ciphertext, TmpdataA); - ShiftRows(TmpdataA, TmpdataB); - xor_128(TmpdataB, abyRoundKey, ciphertext); - } - else // round 1 ~ 9 - { - SubBytes(ciphertext, TmpdataA); - ShiftRows(TmpdataA, TmpdataB); - MixColumns(&TmpdataB[0], &TmpdataA[0]); - MixColumns(&TmpdataB[4], &TmpdataA[4]); - MixColumns(&TmpdataB[8], &TmpdataA[8]); - MixColumns(&TmpdataB[12], &TmpdataA[12]); - xor_128(TmpdataA, abyRoundKey, ciphertext); - AddRoundKey(abyRoundKey, round); - } - } + int i; + int round; + BYTE TmpdataA[16]; + BYTE TmpdataB[16]; + BYTE abyRoundKey[16]; + + for (i = 0; i < 16; i++) + abyRoundKey[i] = key[i]; + + for (round = 0; round < 11; round++) { + if (round == 0) { + xor_128(abyRoundKey, data, ciphertext); + AddRoundKey(abyRoundKey, round); + } else if (round == 10) { + SubBytes(ciphertext, TmpdataA); + ShiftRows(TmpdataA, TmpdataB); + xor_128(TmpdataB, abyRoundKey, ciphertext); + } else { /* round 1 ~ 9 */ + SubBytes(ciphertext, TmpdataA); + ShiftRows(TmpdataA, TmpdataB); + MixColumns(&TmpdataB[0], &TmpdataA[0]); + MixColumns(&TmpdataB[4], &TmpdataA[4]); + MixColumns(&TmpdataB[8], &TmpdataA[8]); + MixColumns(&TmpdataB[12], &TmpdataA[12]); + xor_128(TmpdataA, abyRoundKey, ciphertext); + AddRoundKey(abyRoundKey, round); + } + } } @@ -243,160 +230,157 @@ BYTE abyRoundKey[16]; * Return Value: MIC compare result * */ + BOOL AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) { -BYTE abyNonce[13]; -BYTE MIC_IV[16]; -BYTE MIC_HDR1[16]; -BYTE MIC_HDR2[16]; -BYTE abyMIC[16]; -BYTE abyCTRPLD[16]; -BYTE abyTmp[16]; -BYTE abyPlainText[16]; -BYTE abyLastCipher[16]; - -PS802_11Header pMACHeader = (PS802_11Header) pbyFrame; -PBYTE pbyIV; -PBYTE pbyPayload; -WORD wHLen = 22; -WORD wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN;//8 is IV, 8 is MIC, 4 is CRC -BOOL bA4 = FALSE; -BYTE byTmp; -WORD wCnt; -int ii,jj,kk; - - - pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; - if ( WLAN_GET_FC_TODS(*(PWORD)pbyFrame) && - WLAN_GET_FC_FROMDS(*(PWORD)pbyFrame) ) { - bA4 = TRUE; - pbyIV += 6; // 6 is 802.11 address4 - wHLen += 6; - wPayloadSize -= 6; - } - pbyPayload = pbyIV + 8; //IV-length - - abyNonce[0] = 0x00; //now is 0, if Qos here will be priority - memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); - abyNonce[7] = pbyIV[7]; - abyNonce[8] = pbyIV[6]; - abyNonce[9] = pbyIV[5]; - abyNonce[10] = pbyIV[4]; - abyNonce[11] = pbyIV[1]; - abyNonce[12] = pbyIV[0]; - - //MIC_IV - MIC_IV[0] = 0x59; - memcpy(&(MIC_IV[1]), &(abyNonce[0]), 13); - MIC_IV[14] = (BYTE)(wPayloadSize >> 8); - MIC_IV[15] = (BYTE)(wPayloadSize & 0xff); - - //MIC_HDR1 - MIC_HDR1[0] = (BYTE)(wHLen >> 8); - MIC_HDR1[1] = (BYTE)(wHLen & 0xff); - byTmp = (BYTE)(pMACHeader->wFrameCtl & 0xff); - MIC_HDR1[2] = byTmp & 0x8f; - byTmp = (BYTE)(pMACHeader->wFrameCtl >> 8); - byTmp &= 0x87; - MIC_HDR1[3] = byTmp | 0x40; - memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, U_ETHER_ADDR_LEN); - memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); - - //MIC_HDR2 - memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, U_ETHER_ADDR_LEN); - byTmp = (BYTE)(pMACHeader->wSeqCtl & 0xff); - MIC_HDR2[6] = byTmp & 0x0f; - MIC_HDR2[7] = 0; - if ( bA4 ) { - memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, U_ETHER_ADDR_LEN); - } else { - MIC_HDR2[8] = 0x00; - MIC_HDR2[9] = 0x00; - MIC_HDR2[10] = 0x00; - MIC_HDR2[11] = 0x00; - MIC_HDR2[12] = 0x00; - MIC_HDR2[13] = 0x00; - } - MIC_HDR2[14] = 0x00; - MIC_HDR2[15] = 0x00; - - //CCMP - AESv128(pbyRxKey,MIC_IV,abyMIC); - for ( kk=0; kk<16; kk++ ) { - abyTmp[kk] = MIC_HDR1[kk] ^ abyMIC[kk]; - } - AESv128(pbyRxKey,abyTmp,abyMIC); - for ( kk=0; kk<16; kk++ ) { - abyTmp[kk] = MIC_HDR2[kk] ^ abyMIC[kk]; - } - AESv128(pbyRxKey,abyTmp,abyMIC); - - wCnt = 1; - abyCTRPLD[0] = 0x01; - memcpy(&(abyCTRPLD[1]), &(abyNonce[0]), 13); - - for(jj=wPayloadSize; jj>16; jj=jj-16) { - - abyCTRPLD[14] = (BYTE) (wCnt >> 8); - abyCTRPLD[15] = (BYTE) (wCnt & 0xff); - - AESv128(pbyRxKey,abyCTRPLD,abyTmp); - - for ( kk=0; kk<16; kk++ ) { - abyPlainText[kk] = abyTmp[kk] ^ pbyPayload[kk]; - } - for ( kk=0; kk<16; kk++ ) { - abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk]; - } - AESv128(pbyRxKey,abyTmp,abyMIC); - - memcpy(pbyPayload, abyPlainText, 16); - wCnt++; - pbyPayload += 16; - } //for wPayloadSize - - //last payload - memcpy(&(abyLastCipher[0]), pbyPayload, jj); - for ( ii=jj; ii<16; ii++ ) { - abyLastCipher[ii] = 0x00; - } - - abyCTRPLD[14] = (BYTE) (wCnt >> 8); - abyCTRPLD[15] = (BYTE) (wCnt & 0xff); - - AESv128(pbyRxKey,abyCTRPLD,abyTmp); - for ( kk=0; kk<16; kk++ ) { - abyPlainText[kk] = abyTmp[kk] ^ abyLastCipher[kk]; - } - memcpy(pbyPayload, abyPlainText, jj); - pbyPayload += jj; - - //for MIC calculation - for ( ii=jj; ii<16; ii++ ) { - abyPlainText[ii] = 0x00; - } - for ( kk=0; kk<16; kk++ ) { - abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk]; - } - AESv128(pbyRxKey,abyTmp,abyMIC); - - //=>above is the calculate MIC - //-------------------------------------------- - - wCnt = 0; - abyCTRPLD[14] = (BYTE) (wCnt >> 8); - abyCTRPLD[15] = (BYTE) (wCnt & 0xff); - AESv128(pbyRxKey,abyCTRPLD,abyTmp); - for ( kk=0; kk<8; kk++ ) { - abyTmp[kk] = abyTmp[kk] ^ pbyPayload[kk]; - } - //=>above is the dec-MIC from packet - //-------------------------------------------- - - if ( !memcmp(abyMIC,abyTmp,8) ) { - return TRUE; - } else { - return FALSE; - } - + BYTE abyNonce[13]; + BYTE MIC_IV[16]; + BYTE MIC_HDR1[16]; + BYTE MIC_HDR2[16]; + BYTE abyMIC[16]; + BYTE abyCTRPLD[16]; + BYTE abyTmp[16]; + BYTE abyPlainText[16]; + BYTE abyLastCipher[16]; + + PS802_11Header pMACHeader = (PS802_11Header) pbyFrame; + PBYTE pbyIV; + PBYTE pbyPayload; + 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; + BYTE byTmp; + WORD wCnt; + int ii, jj, kk; + + pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; + if (WLAN_GET_FC_TODS(*(PWORD) pbyFrame) && + WLAN_GET_FC_FROMDS(*(PWORD) pbyFrame)) { + bA4 = TRUE; + pbyIV += 6; /* 6 is 802.11 address4 */ + wHLen += 6; + wPayloadSize -= 6; + } + pbyPayload = pbyIV + 8; /* IV-length */ + + abyNonce[0] = 0x00; /* now is 0, if Qos here will be priority */ + memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN); + abyNonce[7] = pbyIV[7]; + abyNonce[8] = pbyIV[6]; + abyNonce[9] = pbyIV[5]; + abyNonce[10] = pbyIV[4]; + abyNonce[11] = pbyIV[1]; + abyNonce[12] = pbyIV[0]; + + /* MIC_IV */ + MIC_IV[0] = 0x59; + memcpy(&(MIC_IV[1]), &(abyNonce[0]), 13); + MIC_IV[14] = (BYTE)(wPayloadSize >> 8); + MIC_IV[15] = (BYTE)(wPayloadSize & 0xff); + + /* MIC_HDR1 */ + MIC_HDR1[0] = (BYTE)(wHLen >> 8); + MIC_HDR1[1] = (BYTE)(wHLen & 0xff); + byTmp = (BYTE)(pMACHeader->wFrameCtl & 0xff); + MIC_HDR1[2] = byTmp & 0x8f; + byTmp = (BYTE)(pMACHeader->wFrameCtl >> 8); + byTmp &= 0x87; + MIC_HDR1[3] = byTmp | 0x40; + memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN); + memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN); + + /* MIC_HDR2 */ + memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN); + byTmp = (BYTE)(pMACHeader->wSeqCtl & 0xff); + MIC_HDR2[6] = byTmp & 0x0f; + MIC_HDR2[7] = 0; + + if (bA4) { + memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, ETH_ALEN); + } else { + MIC_HDR2[8] = 0x00; + MIC_HDR2[9] = 0x00; + MIC_HDR2[10] = 0x00; + MIC_HDR2[11] = 0x00; + MIC_HDR2[12] = 0x00; + MIC_HDR2[13] = 0x00; + } + MIC_HDR2[14] = 0x00; + MIC_HDR2[15] = 0x00; + + /* CCMP */ + AESv128(pbyRxKey, MIC_IV, abyMIC); + for (kk = 0; kk < 16; kk++) + abyTmp[kk] = MIC_HDR1[kk] ^ abyMIC[kk]; + + AESv128(pbyRxKey, abyTmp, abyMIC); + for (kk = 0; kk < 16; kk++) + abyTmp[kk] = MIC_HDR2[kk] ^ abyMIC[kk]; + + AESv128(pbyRxKey, abyTmp, abyMIC); + + wCnt = 1; + abyCTRPLD[0] = 0x01; + memcpy(&(abyCTRPLD[1]), &(abyNonce[0]), 13); + + for (jj = wPayloadSize; jj > 16; jj = jj-16) { + + abyCTRPLD[14] = (BYTE) (wCnt >> 8); + abyCTRPLD[15] = (BYTE) (wCnt & 0xff); + + AESv128(pbyRxKey, abyCTRPLD, abyTmp); + + for (kk = 0; kk < 16; kk++) + abyPlainText[kk] = abyTmp[kk] ^ pbyPayload[kk]; + + for (kk = 0; kk < 16; kk++) + abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk]; + + AESv128(pbyRxKey, abyTmp, abyMIC); + + memcpy(pbyPayload, abyPlainText, 16); + wCnt++; + pbyPayload += 16; + } /* for wPayloadSize */ + + /* last payload */ + memcpy(&(abyLastCipher[0]), pbyPayload, jj); + for (ii = jj; ii < 16; ii++) + abyLastCipher[ii] = 0x00; + + abyCTRPLD[14] = (BYTE) (wCnt >> 8); + abyCTRPLD[15] = (BYTE) (wCnt & 0xff); + + AESv128(pbyRxKey, abyCTRPLD, abyTmp); + for (kk = 0; kk < 16; kk++) + abyPlainText[kk] = abyTmp[kk] ^ abyLastCipher[kk]; + + memcpy(pbyPayload, abyPlainText, jj); + pbyPayload += jj; + + /* for MIC calculation */ + for (ii = jj; ii < 16; ii++) + abyPlainText[ii] = 0x00; + for (kk = 0; kk < 16; kk++) + abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk]; + + AESv128(pbyRxKey, abyTmp, abyMIC); + + /* => above is the calculated MIC */ + + wCnt = 0; + abyCTRPLD[14] = (BYTE) (wCnt >> 8); + abyCTRPLD[15] = (BYTE) (wCnt & 0xff); + AESv128(pbyRxKey, abyCTRPLD, abyTmp); + + for (kk = 0; kk < 8; kk++) + abyTmp[kk] = abyTmp[kk] ^ pbyPayload[kk]; + + /* => above is the packet dec-MIC */ + + if (!memcmp(abyMIC, abyTmp, 8)) + return TRUE; + else + return FALSE; } diff --git a/drivers/staging/vt6656/aes_ccmp.h b/drivers/staging/vt6656/aes_ccmp.h index f2ba1d5aa1e5..353bd210a502 100644 --- a/drivers/staging/vt6656/aes_ccmp.h +++ b/drivers/staging/vt6656/aes_ccmp.h @@ -43,4 +43,4 @@ /*--------------------- Export Functions --------------------------*/ BOOL AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize); -#endif //__AES_H__ +#endif /* __AES_CCMP_H__ */ diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 7dc01dbfc6ff..d3de94f36c6e 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -662,11 +662,11 @@ const WORD awcFrameTime[MAX_RATE] = /* static -ULONG +unsigned long s_ulGetLowSQ3(PSDevice pDevice); static -ULONG +unsigned long s_ulGetRatio(PSDevice pDevice); static @@ -689,19 +689,19 @@ s_vClearSQ3Value(PSDevice pDevice); * Return Value: FrameTime * */ -UINT +unsigned int BBuGetFrameTime ( - IN BYTE byPreambleType, - IN BYTE byPktType, - IN UINT cbFrameLength, - IN WORD wRate + BYTE byPreambleType, + BYTE byPktType, + unsigned int cbFrameLength, + WORD wRate ) { - UINT uFrameTime; - UINT uPreamble; - UINT uTmp; - UINT uRateIdx = (UINT)wRate; - UINT uRate = 0; + unsigned int uFrameTime; + unsigned int uPreamble; + unsigned int uTmp; + unsigned int uRateIdx = (unsigned int)wRate; + unsigned int uRate = 0; if (uRateIdx > RATE_54M) { @@ -709,7 +709,7 @@ BBuGetFrameTime ( return 0; } - uRate = (UINT)awcFrameTime[uRateIdx]; + uRate = (unsigned int)awcFrameTime[uRateIdx]; if (uRateIdx <= 3) { //CCK mode @@ -756,20 +756,20 @@ BBuGetFrameTime ( * Return Value: none * */ -VOID +void BBvCaculateParameter ( - IN PSDevice pDevice, - IN UINT cbFrameLength, - IN WORD wRate, - IN BYTE byPacketType, - OUT PWORD pwPhyLen, - OUT PBYTE pbyPhySrv, - OUT PBYTE pbyPhySgn + PSDevice pDevice, + unsigned int cbFrameLength, + WORD wRate, + BYTE byPacketType, + PWORD pwPhyLen, + PBYTE pbyPhySrv, + PBYTE pbyPhySgn ) { - UINT cbBitCount; - UINT cbUsCount = 0; - UINT cbTmp; + unsigned int cbBitCount; + unsigned int cbUsCount = 0; + unsigned int cbTmp; BOOL bExtBit; BYTE byPreambleType = pDevice->byPreambleType; BOOL bCCK = pDevice->bCCK; @@ -929,7 +929,7 @@ BBvCaculateParameter ( * Return Value: none * */ -VOID +void BBvSetAntennaMode (PSDevice pDevice, BYTE byAntennaMode) { //{{ RobertYu: 20041124, ABG Mode, VC1/VC2 define, make the ANT_A, ANT_B inverted @@ -1274,7 +1274,7 @@ void BBvLoopbackOff (PSDevice pDevice) * Return Value: none * */ -VOID +void BBvSetShortSlotTime (PSDevice pDevice) { BYTE byBBVGA=0; @@ -1295,7 +1295,7 @@ BBvSetShortSlotTime (PSDevice pDevice) } -VOID BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData) +void BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData); @@ -1324,7 +1324,7 @@ VOID BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData) * Return Value: none * */ -VOID +void BBvSoftwareReset (PSDevice pDevice) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0x40); @@ -1345,14 +1345,14 @@ BBvSoftwareReset (PSDevice pDevice) * Return Value: none * */ -VOID +void BBvSetDeepSleep (PSDevice pDevice) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13 } -VOID +void BBvExitDeepSleep (PSDevice pDevice) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12 @@ -1360,13 +1360,11 @@ BBvExitDeepSleep (PSDevice pDevice) } -static -ULONG -s_ulGetLowSQ3(PSDevice pDevice) +static unsigned long s_ulGetLowSQ3(PSDevice pDevice) { -int ii; -ULONG ulSQ3 = 0; -ULONG ulMaxPacket; + int ii; + unsigned long ulSQ3 = 0; + unsigned long ulMaxPacket; ulMaxPacket = pDevice->aulPktNum[RATE_54M]; if ( pDevice->aulPktNum[RATE_54M] != 0 ) { @@ -1382,16 +1380,12 @@ ULONG ulMaxPacket; return ulSQ3; } - - -static -ULONG -s_ulGetRatio (PSDevice pDevice) +static unsigned long s_ulGetRatio(PSDevice pDevice) { -int ii,jj; -ULONG ulRatio = 0; -ULONG ulMaxPacket; -ULONG ulPacketNum; + int ii, jj; + unsigned long ulRatio = 0; + unsigned long ulMaxPacket; + unsigned long ulPacketNum; //This is a thousand-ratio ulMaxPacket = pDevice->aulPktNum[RATE_54M]; @@ -1445,7 +1439,7 @@ s_vClearSQ3Value (PSDevice pDevice) * */ -VOID +void BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) { @@ -1513,7 +1507,9 @@ BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) if ( pDevice->byTMax == 0 ) return; - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_CHANGE_ANTENNA, + NULL); pDevice->byAntennaState = 1; @@ -1543,7 +1539,9 @@ BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) ((pDevice->ulSQ3_State1 != 0) && (pDevice->ulSQ3_State0 != 0) && (pDevice->ulSQ3_State0 < pDevice->ulSQ3_State1)) ) { - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_CHANGE_ANTENNA, + NULL); pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ); @@ -1576,17 +1574,14 @@ BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) * -*/ -VOID -TimerSQ3CallBack ( - IN HANDLE hDeviceContext - ) +void TimerSQ3CallBack(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack..."); spin_lock_irq(&pDevice->lock); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); pDevice->byAntennaState = 0; s_vClearSQ3Value(pDevice); pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); @@ -1618,10 +1613,7 @@ TimerSQ3CallBack ( * -*/ -VOID -TimerSQ3Tmax3CallBack ( - IN HANDLE hDeviceContext - ) +void TimerSQ3Tmax3CallBack(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; @@ -1639,7 +1631,7 @@ TimerSQ3Tmax3CallBack ( return; } - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); pDevice->byAntennaState = 1; del_timer(&pDevice->TimerSQ3Tmax3); del_timer(&pDevice->TimerSQ3Tmax2); @@ -1650,10 +1642,10 @@ TimerSQ3Tmax3CallBack ( return; } -VOID +void BBvUpdatePreEDThreshold( - IN PSDevice pDevice, - IN BOOL bScanning) + PSDevice pDevice, + BOOL bScanning) { diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h index e991a7e68d4a..bc4633d5fead 100644 --- a/drivers/staging/vt6656/baseband.h +++ b/drivers/staging/vt6656/baseband.h @@ -96,51 +96,44 @@ /*--------------------- Export Functions --------------------------*/ -UINT +unsigned int BBuGetFrameTime( - IN BYTE byPreambleType, - IN BYTE byFreqType, - IN UINT cbFrameLength, - IN WORD wRate + BYTE byPreambleType, + BYTE byFreqType, + unsigned int cbFrameLength, + WORD wRate ); -VOID +void BBvCaculateParameter ( - IN PSDevice pDevice, - IN UINT cbFrameLength, - IN WORD wRate, - IN BYTE byPacketType, - OUT PWORD pwPhyLen, - OUT PBYTE pbyPhySrv, - OUT PBYTE pbyPhySgn + PSDevice pDevice, + unsigned int cbFrameLength, + WORD wRate, + BYTE byPacketType, + PWORD pwPhyLen, + PBYTE pbyPhySrv, + PBYTE pbyPhySgn ); // timer for antenna diversity -VOID -TimerSQ3CallBack ( - IN HANDLE hDeviceContext - ); - -VOID -TimerSQ3Tmax3CallBack ( - IN HANDLE hDeviceContext - ); +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 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 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( - IN PSDevice pDevice, - IN BOOL bScanning +void BBvSetDeepSleep(PSDevice pDevice); +void BBvExitDeepSleep(PSDevice pDevice); +void BBvUpdatePreEDThreshold( + PSDevice pDevice, + BOOL bScanning ); -#endif // __BASEBAND_H__ +#endif /* __BASEBAND_H__ */ diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index 6b1678bfd61a..36ed61b595ca 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -91,19 +91,13 @@ const WORD awHWRetry1[5][5] = { /*--------------------- Static Functions --------------------------*/ -VOID s_vCheckSensitivity( - IN HANDLE hDeviceContext - ); - -VOID s_vCheckPreEDThreshold( - IN HANDLE hDeviceContext - ); +void s_vCheckSensitivity(void *hDeviceContext); +void s_vCheckPreEDThreshold(void *hDeviceContext); #ifdef Calcu_LinkQual -VOID s_uCalculateLinkQual( - IN HANDLE hDeviceContext - ); +void s_uCalculateLinkQual(void *hDeviceContext); #endif + /*--------------------- Export Variables --------------------------*/ @@ -123,13 +117,10 @@ VOID s_uCalculateLinkQual( * -*/ -PKnownBSS -BSSpSearchBSSList( - IN HANDLE hDeviceContext, - IN PBYTE pbyDesireBSSID, - IN PBYTE pbyDesireSSID, - IN CARD_PHY_TYPE ePhyType - ) +PKnownBSS BSSpSearchBSSList(void *hDeviceContext, + PBYTE pbyDesireBSSID, + PBYTE pbyDesireSSID, + CARD_PHY_TYPE ePhyType) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -138,8 +129,8 @@ BSSpSearchBSSList( PKnownBSS pCurrBSS = NULL; PKnownBSS pSelect = NULL; BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; - UINT ii = 0; - UINT jj = 0; //DavidWang + unsigned int ii = 0; + unsigned int jj = 0; if (pbyDesireBSSID != NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSpSearchBSSList BSSID[%02X %02X %02X-%02X %02X %02X]\n", *pbyDesireBSSID,*(pbyDesireBSSID+1),*(pbyDesireBSSID+2), @@ -296,15 +287,11 @@ pDevice->bSameBSSMaxNum = jj; -*/ -VOID -BSSvClearBSSList( - IN HANDLE hDeviceContext, - IN BOOL bKeepCurrBSSID - ) +void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT ii; + unsigned int ii; for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (bKeepCurrBSSID) { @@ -342,17 +329,14 @@ BSSvClearBSSList( * TRUE if found. * -*/ -PKnownBSS -BSSpAddrIsInBSSList( - IN HANDLE hDeviceContext, - IN PBYTE abyBSSID, - IN PWLAN_IE_SSID pSSID - ) +PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext, + PBYTE abyBSSID, + PWLAN_IE_SSID pSSID) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PKnownBSS pBSSList = NULL; - UINT ii; + unsigned int ii; for (ii = 0; ii < MAX_BSS_NUM; ii++) { pBSSList = &(pMgmt->sBSSList[ii]); @@ -383,33 +367,30 @@ BSSpAddrIsInBSSList( * -*/ -BOOL -BSSbInsertToBSSList ( - IN HANDLE hDeviceContext, - IN PBYTE abyBSSIDAddr, - IN QWORD qwTimestamp, - IN WORD wBeaconInterval, - IN WORD wCapInfo, - IN BYTE byCurrChannel, - IN PWLAN_IE_SSID pSSID, - IN PWLAN_IE_SUPP_RATES pSuppRates, - IN PWLAN_IE_SUPP_RATES pExtSuppRates, - IN PERPObject psERP, - IN PWLAN_IE_RSN pRSN, - IN PWLAN_IE_RSN_EXT pRSNWPA, - IN PWLAN_IE_COUNTRY pIE_Country, - IN PWLAN_IE_QUIET pIE_Quiet, - IN UINT uIELength, - IN PBYTE pbyIEs, - IN HANDLE pRxPacketContext - ) +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) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext; PKnownBSS pBSSList = NULL; - UINT ii; + unsigned int ii; BOOL bParsingQuiet = FALSE; @@ -484,24 +465,27 @@ BSSbInsertToBSSList ( WPA_ClearRSN(pBSSList); if (pRSNWPA != NULL) { - UINT uLen = pRSNWPA->len + 2; - - if (uLen <= (uIELength - (UINT)(ULONG_PTR)((PBYTE)pRSNWPA - pbyIEs))) { - pBSSList->wWPALen = uLen; - memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); - WPA_ParseRSN(pBSSList, pRSNWPA); - } + unsigned int uLen = pRSNWPA->len + 2; + + if (uLen <= (uIELength - + (unsigned int) (ULONG_PTR) ((PBYTE) pRSNWPA - pbyIEs))) { + pBSSList->wWPALen = uLen; + memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); + WPA_ParseRSN(pBSSList, pRSNWPA); + } } WPA2_ClearRSN(pBSSList); if (pRSN != NULL) { - UINT uLen = pRSN->len + 2; - if (uLen <= (uIELength - (UINT)(ULONG_PTR)((PBYTE)pRSN - pbyIEs))) { - pBSSList->wRSNLen = uLen; - memcpy(pBSSList->byRSNIE, pRSN, uLen); - WPA2vParseRSN(pBSSList, pRSN); - } + unsigned int uLen = pRSN->len + 2; + + if (uLen <= (uIELength - + (unsigned int) (ULONG_PTR) ((PBYTE) pRSN - pbyIEs))) { + pBSSList->wRSNLen = uLen; + memcpy(pBSSList->byRSNIE, pRSN, uLen); + WPA2vParseRSN(pBSSList, pRSN); + } } if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == TRUE)) { @@ -518,7 +502,9 @@ BSSbInsertToBSSList ( 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((HANDLE)pDevice, pBSSList->abyBSSID, &pBSSList->sRSNCapObj); + 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) || @@ -602,33 +588,30 @@ BSSbInsertToBSSList ( -*/ // TODO: input structure modify -BOOL -BSSbUpdateToBSSList ( - IN HANDLE hDeviceContext, - IN QWORD qwTimestamp, - IN WORD wBeaconInterval, - IN WORD wCapInfo, - IN BYTE byCurrChannel, - IN BOOL bChannelHit, - IN PWLAN_IE_SSID pSSID, - IN PWLAN_IE_SUPP_RATES pSuppRates, - IN PWLAN_IE_SUPP_RATES pExtSuppRates, - IN PERPObject psERP, - IN PWLAN_IE_RSN pRSN, - IN PWLAN_IE_RSN_EXT pRSNWPA, - IN PWLAN_IE_COUNTRY pIE_Country, - IN PWLAN_IE_QUIET pIE_Quiet, - IN PKnownBSS pBSSList, - IN UINT uIELength, - IN PBYTE pbyIEs, - IN HANDLE 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) { int ii, jj; PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext; - LONG ldBm, ldBmSum; + signed long ldBm, ldBmSum; BOOL bParsingQuiet = FALSE; // BYTE abyTmpSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; @@ -687,24 +670,26 @@ BSSbUpdateToBSSList ( WPA_ClearRSN(pBSSList); //mike update - if (pRSNWPA != NULL) { - UINT uLen = pRSNWPA->len + 2; - if (uLen <= (uIELength - (UINT)(ULONG_PTR)((PBYTE)pRSNWPA - pbyIEs))) { - pBSSList->wWPALen = uLen; - memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); - WPA_ParseRSN(pBSSList, pRSNWPA); - } - } + if (pRSNWPA != NULL) { + unsigned int uLen = pRSNWPA->len + 2; + if (uLen <= (uIELength - + (unsigned int) (ULONG_PTR) ((PBYTE) pRSNWPA - pbyIEs))) { + pBSSList->wWPALen = uLen; + memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); + WPA_ParseRSN(pBSSList, pRSNWPA); + } + } WPA2_ClearRSN(pBSSList); //mike update if (pRSN != NULL) { - UINT uLen = pRSN->len + 2; - if (uLen <= (uIELength - (UINT)(ULONG_PTR)((PBYTE)pRSN - pbyIEs))) { - pBSSList->wRSNLen = uLen; - memcpy(pBSSList->byRSNIE, pRSN, uLen); - WPA2vParseRSN(pBSSList, pRSN); - } + unsigned int uLen = pRSN->len + 2; + if (uLen <= (uIELength - + (unsigned int) (ULONG_PTR) ((PBYTE) pRSN - pbyIEs))) { + pBSSList->wRSNLen = uLen; + memcpy(pBSSList->byRSNIE, pRSN, uLen); + WPA2vParseRSN(pBSSList, pRSN); + } } if (pRxPacket->uRSSI != 0) { @@ -768,16 +753,13 @@ BSSbUpdateToBSSList ( * -*/ -BOOL -BSSbIsSTAInNodeDB( - IN HANDLE hDeviceContext, - IN PBYTE abyDstAddr, - OUT PUINT puNodeIndex - ) +BOOL BSSbIsSTAInNodeDB(void *hDeviceContext, + PBYTE abyDstAddr, + PUINT puNodeIndex) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT ii; + unsigned int ii; // Index = 0 reserved for AP Node for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { @@ -804,18 +786,14 @@ BSSbIsSTAInNodeDB( * None * -*/ -VOID -BSSvCreateOneNode( - IN HANDLE hDeviceContext, - OUT PUINT puNodeIndex - ) +void BSSvCreateOneNode(void *hDeviceContext, PUINT puNodeIndex) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT ii; - UINT BigestCount = 0; - UINT SelectIndex; + 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) @@ -869,11 +847,8 @@ BSSvCreateOneNode( * None * -*/ -VOID -BSSvRemoveOneNode( - IN HANDLE hDeviceContext, - IN UINT uNodeIndex - ) + +void BSSvRemoveOneNode(void *hDeviceContext, unsigned int uNodeIndex) { PSDevice pDevice = (PSDevice)hDeviceContext; @@ -902,17 +877,14 @@ BSSvRemoveOneNode( * -*/ -VOID -BSSvUpdateAPNode( - IN HANDLE hDeviceContext, - IN PWORD pwCapInfo, - IN PWLAN_IE_SUPP_RATES pSuppRates, - IN PWLAN_IE_SUPP_RATES pExtSuppRates - ) +void BSSvUpdateAPNode(void *hDeviceContext, + PWORD pwCapInfo, + PWLAN_IE_SUPP_RATES pSuppRates, + PWLAN_IE_SUPP_RATES pExtSuppRates) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT uRateLen = WLAN_RATES_MAXLEN; + unsigned int uRateLen = WLAN_RATES_MAXLEN; memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); @@ -926,7 +898,7 @@ BSSvUpdateAPNode( pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pExtSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, uRateLen); - RATEvParseMaxRate((PVOID) pDevice, + RATEvParseMaxRate((void *) pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, TRUE, @@ -946,10 +918,6 @@ BSSvUpdateAPNode( }; - - - - /*+ * * Routine Description: @@ -961,11 +929,7 @@ BSSvUpdateAPNode( * -*/ - -VOID -BSSvAddMulticastNode( - IN HANDLE hDeviceContext - ) +void BSSvAddMulticastNode(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -976,7 +940,7 @@ BSSvAddMulticastNode( pMgmt->sNodeDBTable[0].bActive = TRUE; pMgmt->sNodeDBTable[0].bPSEnable = FALSE; skb_queue_head_init(&pMgmt->sNodeDBTable[0].sTxPSQueue); - RATEvParseMaxRate((PVOID) pDevice, + RATEvParseMaxRate((void *) pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, TRUE, @@ -991,10 +955,6 @@ BSSvAddMulticastNode( }; - - - - /*+ * * Routine Description: @@ -1008,19 +968,15 @@ BSSvAddMulticastNode( * -*/ - -VOID -BSSvSecondCallBack( - IN HANDLE hDeviceContext - ) +void BSSvSecondCallBack(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT ii; + unsigned int ii; PWLAN_IE_SSID pItemSSID, pCurrSSID; - UINT uSleepySTACnt = 0; - UINT uNonShortSlotSTACnt = 0; - UINT uLongPreambleSTACnt = 0; + unsigned int uSleepySTACnt = 0; + unsigned int uNonShortSlotSTACnt = 0; + unsigned int uLongPreambleSTACnt = 0; viawget_wpa_header *wpahdr; //DavidWang spin_lock_irq(&pDevice->lock); @@ -1080,7 +1036,7 @@ if((pMgmt->eCurrState!=WMAC_STATE_ASSOC) && #endif #ifdef Calcu_LinkQual - s_uCalculateLinkQual((HANDLE)pDevice); + s_uCalculateLinkQual((void *)pDevice); #endif for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { @@ -1131,12 +1087,14 @@ if((pMgmt->eCurrState!=WMAC_STATE_ASSOC) && */ if (ii > 0) { // ii = 0 for multicast node (AP & Adhoc) - RATEvTxRateFallBack((PVOID)pDevice, &(pMgmt->sNodeDBTable[ii])); + RATEvTxRateFallBack((void *)pDevice, + &(pMgmt->sNodeDBTable[ii])); } else { // ii = 0 reserved for unicast AP node (Infra STA) - if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) - RATEvTxRateFallBack((PVOID)pDevice, &(pMgmt->sNodeDBTable[ii])); + if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) + RATEvTxRateFallBack((void *)pDevice, + &(pMgmt->sNodeDBTable[ii])); } } @@ -1177,14 +1135,14 @@ if((pMgmt->eCurrState!=WMAC_STATE_ASSOC) && if (pDevice->bShortSlotTime) { pDevice->bShortSlotTime = FALSE; BBvSetShortSlotTime(pDevice); - vUpdateIFS((PVOID)pDevice); + vUpdateIFS((void *)pDevice); } } else { if (!pDevice->bShortSlotTime) { pDevice->bShortSlotTime = TRUE; BBvSetShortSlotTime(pDevice); - vUpdateIFS((PVOID)pDevice); + vUpdateIFS((void *)pDevice); } } @@ -1224,14 +1182,16 @@ if((pMgmt->eCurrState!=WMAC_STATE_ASSOC) && // DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Callback inactive Count = [%d]\n", pMgmt->sNodeDBTable[0].uInActiveCount); if (pDevice->bUpdateBBVGA) { - // s_vCheckSensitivity((HANDLE) pDevice); - s_vCheckPreEDThreshold((HANDLE)pDevice); + /* s_vCheckSensitivity((void *) pDevice); */ + s_vCheckPreEDThreshold((void *) pDevice); } if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) && (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) ) { pDevice->byBBVGANew = pDevice->abyBBVGA[0]; - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_BBSENSITIVITY, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_CHANGE_BBSENSITIVITY, + NULL); } if (pMgmt->sNodeDBTable[0].uInActiveCount >= LOST_BEACON_COUNT) { @@ -1279,9 +1239,13 @@ 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)){ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fast Roaming ...\n"); - BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); + BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, + pMgmt->abyDesireSSID); pDevice->uAutoReConnectTime = 0; pDevice->uIsroamingTime = 0; pDevice->bRoaming = FALSE; @@ -1324,10 +1288,14 @@ else { pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n"); - BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); - pMgmt->eScanType = WMAC_SCAN_ACTIVE; - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); + BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); + pMgmt->eScanType = WMAC_SCAN_ACTIVE; + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, + pMgmt->abyDesireSSID); pDevice->uAutoReConnectTime = 0; } } @@ -1343,17 +1311,17 @@ else { else { DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scaning ...\n"); pMgmt->eScanType = WMAC_SCAN_ACTIVE; - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, NULL); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL); pDevice->uAutoReConnectTime = 0; }; } if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { - if (pDevice->bUpdateBBVGA) { - //s_vCheckSensitivity((HANDLE) pDevice); - s_vCheckPreEDThreshold((HANDLE)pDevice); - } + if (pDevice->bUpdateBBVGA) { + /* s_vCheckSensitivity((void *) pDevice); */ + s_vCheckPreEDThreshold((void *) pDevice); + } if (pMgmt->sNodeDBTable[0].uInActiveCount >=ADHOC_LOST_BEACON_COUNT) { DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount); pMgmt->sNodeDBTable[0].uInActiveCount = 0; @@ -1377,9 +1345,6 @@ else { return; } - - - /*+ * * Routine Description: @@ -1393,30 +1358,23 @@ else { * -*/ - - -VOID -BSSvUpdateNodeTxCounter( - IN HANDLE hDeviceContext, - IN PSStatCounter pStatistic, - IN BYTE byTSR, - IN BYTE byPktNO - ) +void BSSvUpdateNodeTxCounter(void *hDeviceContext, + PSStatCounter pStatistic, + BYTE byTSR, + BYTE byPktNO) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT uNodeIndex = 0; + unsigned int uNodeIndex = 0; BYTE byTxRetry; WORD wRate; WORD wFallBackRate = RATE_1M; BYTE byFallBack; - UINT ii; + unsigned int ii; PBYTE pbyDestAddr; BYTE byPktNum; WORD wFIFOCtl; - - byPktNum = (byPktNO & 0x0F) >> 4; byTxRetry = (byTSR & 0xF0) >> 4; wRate = (WORD) (byPktNO & 0xF0) >> 4; @@ -1483,11 +1441,13 @@ BSSvUpdateNodeTxCounter( } }; - if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) || + if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) || (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { - if (BSSbIsSTAInNodeDB((HANDLE)pDevice, pbyDestAddr, &uNodeIndex)){ - pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1; + if (BSSbIsSTAInNodeDB((void *) pDevice, + pbyDestAddr, + &uNodeIndex)) { + pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1; if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) { // transmit success, TxAttempts at least plus one pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; @@ -1542,9 +1502,6 @@ BSSvUpdateNodeTxCounter( } - - - /*+ * * Routine Description: @@ -1563,18 +1520,13 @@ BSSvUpdateNodeTxCounter( * -*/ - -VOID -BSSvClearNodeDBTable( - IN HANDLE hDeviceContext, - IN UINT uStartIndex - ) - +void BSSvClearNodeDBTable(void *hDeviceContext, + unsigned int uStartIndex) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct sk_buff *skb; - UINT ii; + unsigned int ii; for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive) { @@ -1592,10 +1544,7 @@ BSSvClearNodeDBTable( return; }; - -VOID s_vCheckSensitivity( - IN HANDLE hDeviceContext - ) +void s_vCheckSensitivity(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PKnownBSS pBSSList = NULL; @@ -1606,9 +1555,9 @@ VOID s_vCheckSensitivity( ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID); if (pBSSList != NULL) { - // Updata BB Reg if RSSI is too strong. - LONG LocalldBmAverage = 0; - LONG uNumofdBm = 0; + /* Update BB register if RSSI is too strong */ + signed long LocalldBmAverage = 0; + signed long uNumofdBm = 0; for (ii = 0; ii < RSSI_STAT_COUNT; ii++) { if (pBSSList->ldBmAverage[ii] != 0) { uNumofdBm ++; @@ -1627,7 +1576,9 @@ VOID s_vCheckSensitivity( if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) { pDevice->uBBVGADiffCount++; if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD) - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_BBSENSITIVITY, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_CHANGE_BBSENSITIVITY, + NULL); } else { pDevice->uBBVGADiffCount = 0; } @@ -1637,14 +1588,12 @@ VOID s_vCheckSensitivity( } #ifdef Calcu_LinkQual -VOID s_uCalculateLinkQual( - IN HANDLE hDeviceContext - ) +void s_uCalculateLinkQual(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; - ULONG TxOkRatio, TxCnt; - ULONG RxOkRatio,RxCnt; - ULONG RssiRatio; + unsigned long TxOkRatio, TxCnt; + unsigned long RxOkRatio, RxCnt; + unsigned long RssiRatio; long ldBm; TxCnt = pDevice->scStatistic.TxNoRetryOkCount + @@ -1685,14 +1634,11 @@ else } #endif -VOID -BSSvClearAnyBSSJoinRecord ( - IN HANDLE hDeviceContext - ) +void BSSvClearAnyBSSJoinRecord(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT ii; + unsigned int ii; for (ii = 0; ii < MAX_BSS_NUM; ii++) { pMgmt->sBSSList[ii].bSelected = FALSE; @@ -1700,9 +1646,7 @@ BSSvClearAnyBSSJoinRecord ( return; } -VOID s_vCheckPreEDThreshold( - IN HANDLE hDeviceContext - ) +void s_vCheckPreEDThreshold(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PKnownBSS pBSSList = NULL; diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h index f365b6b8bf6a..9686d8600d63 100644 --- a/drivers/staging/vt6656/bssdb.h +++ b/drivers/staging/vt6656/bssdb.h @@ -97,10 +97,10 @@ typedef struct tagKnownBSS { // BSS info BOOL bActive; BYTE abyBSSID[WLAN_BSSID_LEN]; - UINT uChannel; + unsigned int uChannel; BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; BYTE abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - UINT uRSSI; + unsigned int uRSSI; BYTE bySQ; WORD wBeaconInterval; WORD wCapInfo; @@ -109,9 +109,9 @@ typedef struct tagKnownBSS { // WORD wATIMWindow; BYTE byRSSIStatCnt; - LONG ldBmMAX; - LONG ldBmAverage[RSSI_STAT_COUNT]; - LONG ldBmAverRange; + signed long ldBmMAX; + signed long ldBmAverage[RSSI_STAT_COUNT]; + signed long ldBmAverRange; //For any BSSID selection improvment BOOL bSelected; @@ -141,9 +141,9 @@ typedef struct tagKnownBSS { WORD wRSNLen; // Clear count - UINT uClearCount; + unsigned int uClearCount; // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN]; - UINT uIELength; + unsigned int uIELength; QWORD qwBSSTimestamp; QWORD qwLocalTSF; // local TSF timer @@ -178,7 +178,7 @@ typedef struct tagKnownNodeDB { BOOL bShortPreamble; BOOL bERPExist; BOOL bShortSlotTime; - UINT uInActiveCount; + 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. WORD wSuppRate; @@ -194,166 +194,114 @@ typedef struct tagKnownNodeDB { BOOL bPSEnable; BOOL bRxPSPoll; BYTE byAuthSequence; - ULONG ulLastRxJiffer; + unsigned long ulLastRxJiffer; BYTE bySuppRate; DWORD dwFlags; WORD wEnQueueCnt; BOOL bOnFly; - ULONGLONG KeyRSC; + unsigned long long KeyRSC; BYTE byKeyIndex; DWORD dwKeyIndex; BYTE byCipherSuite; DWORD dwTSC47_16; WORD wTSC15_0; - UINT uWepKeyLength; + unsigned int uWepKeyLength; BYTE abyWepKey[WLAN_WEPMAX_KEYLEN]; // // Auto rate fallback vars BOOL bIsInFallback; - UINT uAverageRSSI; - UINT uRateRecoveryTimeout; - UINT uRatePollTimeout; - UINT uTxFailures; - UINT uTxAttempts; - - UINT uTxRetry; - UINT uFailureRatio; - UINT uRetryRatio; - UINT uTxOk[MAX_RATE+1]; - UINT uTxFail[MAX_RATE+1]; - UINT uTimeCount; + unsigned int uAverageRSSI; + unsigned int uRateRecoveryTimeout; + unsigned int uRatePollTimeout; + unsigned int uTxFailures; + unsigned int uTxAttempts; + + unsigned int uTxRetry; + unsigned int uFailureRatio; + unsigned int uRetryRatio; + unsigned int uTxOk[MAX_RATE+1]; + unsigned int uTxFail[MAX_RATE+1]; + unsigned int uTimeCount; } KnownNodeDB, *PKnownNodeDB; - /*--------------------- Export Functions --------------------------*/ - - -PKnownBSS -BSSpSearchBSSList( - IN HANDLE hDeviceContext, - IN PBYTE pbyDesireBSSID, - IN PBYTE pbyDesireSSID, - IN CARD_PHY_TYPE ePhyType - ); - -PKnownBSS -BSSpAddrIsInBSSList( - IN HANDLE hDeviceContext, - IN PBYTE abyBSSID, - IN PWLAN_IE_SSID pSSID - ); - -VOID -BSSvClearBSSList( - IN HANDLE hDeviceContext, - IN BOOL bKeepCurrBSSID - ); - -BOOL -BSSbInsertToBSSList( - IN HANDLE hDeviceContext, - IN PBYTE abyBSSIDAddr, - IN QWORD qwTimestamp, - IN WORD wBeaconInterval, - IN WORD wCapInfo, - IN BYTE byCurrChannel, - IN PWLAN_IE_SSID pSSID, - IN PWLAN_IE_SUPP_RATES pSuppRates, - IN PWLAN_IE_SUPP_RATES pExtSuppRates, - IN PERPObject psERP, - IN PWLAN_IE_RSN pRSN, - IN PWLAN_IE_RSN_EXT pRSNWPA, - IN PWLAN_IE_COUNTRY pIE_Country, - IN PWLAN_IE_QUIET pIE_Quiet, - IN UINT uIELength, - IN PBYTE pbyIEs, - IN HANDLE pRxPacketContext - ); - - -BOOL -BSSbUpdateToBSSList( - IN HANDLE hDeviceContext, - IN QWORD qwTimestamp, - IN WORD wBeaconInterval, - IN WORD wCapInfo, - IN BYTE byCurrChannel, - IN BOOL bChannelHit, - IN PWLAN_IE_SSID pSSID, - IN PWLAN_IE_SUPP_RATES pSuppRates, - IN PWLAN_IE_SUPP_RATES pExtSuppRates, - IN PERPObject psERP, - IN PWLAN_IE_RSN pRSN, - IN PWLAN_IE_RSN_EXT pRSNWPA, - IN PWLAN_IE_COUNTRY pIE_Country, - IN PWLAN_IE_QUIET pIE_Quiet, - IN PKnownBSS pBSSList, - IN UINT uIELength, - IN PBYTE pbyIEs, - IN HANDLE pRxPacketContext - ); - - -BOOL -BSSbIsSTAInNodeDB( - IN HANDLE hDeviceContext, - IN PBYTE abyDstAddr, - OUT PUINT puNodeIndex - ); - -VOID -BSSvCreateOneNode( - IN HANDLE hDeviceContext, - OUT PUINT puNodeIndex - ); - -VOID -BSSvUpdateAPNode( - IN HANDLE hDeviceContext, - IN PWORD pwCapInfo, - IN PWLAN_IE_SUPP_RATES pItemRates, - IN PWLAN_IE_SUPP_RATES pExtSuppRates - ); - - -VOID -BSSvSecondCallBack( - IN HANDLE hDeviceContext - ); - - -VOID -BSSvUpdateNodeTxCounter( - IN HANDLE hDeviceContext, - IN PSStatCounter pStatistic, - IN BYTE byTSR, - IN BYTE byPktNO - ); - -VOID -BSSvRemoveOneNode( - IN HANDLE hDeviceContext, - IN UINT uNodeIndex - ); - -VOID -BSSvAddMulticastNode( - IN HANDLE hDeviceContext - ); - - -VOID -BSSvClearNodeDBTable( - IN HANDLE hDeviceContext, - IN UINT uStartIndex - ); - -VOID -BSSvClearAnyBSSJoinRecord( - IN HANDLE hDeviceContext - ); - -#endif //__BSSDB_H__ +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, + PUINT puNodeIndex); + +void BSSvCreateOneNode(void *hDeviceContext, PUINT 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); + +#endif /* __BSSDB_H__ */ diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index d73efeea2d5c..fe4ec913ffea 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -95,7 +95,7 @@ const WORD cwRXBCNTSFOff[MAX_RATE] = * Return Value: TRUE if succeeded; FALSE if failed. * */ -BOOL CARDbSetMediaChannel (PVOID pDeviceHandler, UINT uConnectionChannel) +BOOL CARDbSetMediaChannel(void *pDeviceHandler, unsigned int uConnectionChannel) { PSDevice pDevice = (PSDevice) pDeviceHandler; BOOL bResult = TRUE; @@ -156,11 +156,10 @@ BOOL bResult = TRUE; * Return Value: response Control frame rate * */ -static -WORD swGetCCKControlRate(PVOID pDeviceHandler, WORD wRateIdx) +static WORD swGetCCKControlRate(void *pDeviceHandler, WORD wRateIdx) { PSDevice pDevice = (PSDevice) pDeviceHandler; - UINT ui = (UINT)wRateIdx; + unsigned int ui = (unsigned int)wRateIdx; while (ui > RATE_1M) { if (pDevice->wBasicRate & ((WORD)1 << ui)) { return (WORD)ui; @@ -183,11 +182,10 @@ WORD swGetCCKControlRate(PVOID pDeviceHandler, WORD wRateIdx) * Return Value: response Control frame rate * */ -static -WORD swGetOFDMControlRate (PVOID pDeviceHandler, WORD wRateIdx) +static WORD swGetOFDMControlRate(void *pDeviceHandler, WORD wRateIdx) { PSDevice pDevice = (PSDevice) pDeviceHandler; - UINT ui = (UINT)wRateIdx; + unsigned int ui = (unsigned int)wRateIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n", pDevice->wBasicRate); @@ -222,12 +220,12 @@ WORD swGetOFDMControlRate (PVOID pDeviceHandler, WORD wRateIdx) * Return Value: none * */ -VOID +void CARDvCaculateOFDMRParameter ( - IN WORD wRate, - IN BYTE byBBType, - OUT PBYTE pbyTxRate, - OUT PBYTE pbyRsvTime + WORD wRate, + BYTE byBBType, + PBYTE pbyTxRate, + PBYTE pbyRsvTime ) { switch (wRate) { @@ -334,7 +332,7 @@ CARDvCaculateOFDMRParameter ( * Return Value: None. * */ -void CARDvSetRSPINF (PVOID pDeviceHandler, BYTE byBBType) +void CARDvSetRSPINF(void *pDeviceHandler, BYTE byBBType) { PSDevice pDevice = (PSDevice) pDeviceHandler; BYTE abyServ[4] = {0,0,0,0}; // For CCK @@ -486,7 +484,7 @@ void CARDvSetRSPINF (PVOID pDeviceHandler, BYTE byBBType) * Return Value: None. * */ -void vUpdateIFS (PVOID pDeviceHandler) +void vUpdateIFS(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; //Set SIFS, DIFS, EIFS, SlotTime, CwMin @@ -510,7 +508,7 @@ void vUpdateIFS (PVOID pDeviceHandler) else {// PK_TYPE_11GA & PK_TYPE_11GB BYTE byRate = 0; BOOL bOFDMRate = FALSE; - UINT ii = 0; + unsigned int ii = 0; PWLAN_IE_SUPP_RATES pItemRates = NULL; pDevice->uSIFS = C_SIFS_BG; @@ -571,7 +569,7 @@ void vUpdateIFS (PVOID pDeviceHandler) &byMaxMin); } -void CARDvUpdateBasicTopRate (PVOID pDeviceHandler) +void CARDvUpdateBasicTopRate(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; BYTE byTopOFDM = RATE_24M, byTopCCK = RATE_1M; @@ -610,7 +608,7 @@ BYTE ii; * Return Value: TRUE if succeeded; FALSE if failed. * */ -BOOL CARDbAddBasicRate (PVOID pDeviceHandler, WORD wRateIdx) +BOOL CARDbAddBasicRate(void *pDeviceHandler, WORD wRateIdx) { PSDevice pDevice = (PSDevice) pDeviceHandler; WORD wRate = (WORD)(1<<wRateIdx); @@ -623,7 +621,7 @@ WORD wRate = (WORD)(1<<wRateIdx); return(TRUE); } -BOOL CARDbIsOFDMinBasicRate (PVOID pDeviceHandler) +BOOL CARDbIsOFDMinBasicRate(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; int ii; @@ -635,7 +633,7 @@ int ii; return FALSE; } -BYTE CARDbyGetPktType (PVOID pDeviceHandler) +BYTE CARDbyGetPktType(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; @@ -707,7 +705,8 @@ QWORD CARDqGetTSFOffset (BYTE byRxRate, QWORD qwTSF1, QWORD qwTSF2) * Return Value: none * */ -void CARDvAdjustTSF (PVOID pDeviceHandler, BYTE byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF) +void CARDvAdjustTSF(void *pDeviceHandler, BYTE byRxRate, + QWORD qwBSSTimestamp, QWORD qwLocalTSF) { PSDevice pDevice = (PSDevice) pDeviceHandler; @@ -756,7 +755,7 @@ void CARDvAdjustTSF (PVOID pDeviceHandler, BYTE byRxRate, QWORD qwBSSTimestamp, * Return Value: TRUE if success; otherwise FALSE * */ -BOOL CARDbGetCurrentTSF (PVOID pDeviceHandler, PQWORD pqwCurrTSF) +BOOL CARDbGetCurrentTSF(void *pDeviceHandler, PQWORD pqwCurrTSF) { PSDevice pDevice = (PSDevice) pDeviceHandler; @@ -778,7 +777,7 @@ BOOL CARDbGetCurrentTSF (PVOID pDeviceHandler, PQWORD pqwCurrTSF) * Return Value: TRUE if success; otherwise FALSE * */ -BOOL CARDbClearCurrentTSF(PVOID pDeviceHandler) +BOOL CARDbClearCurrentTSF(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; @@ -807,9 +806,9 @@ BOOL CARDbClearCurrentTSF(PVOID pDeviceHandler) QWORD CARDqGetNextTBTT (QWORD qwTSF, WORD wBeaconInterval) { - UINT uLowNextTBTT; - UINT uHighRemain, uLowRemain; - UINT uBeaconInterval; + unsigned int uLowNextTBTT; + unsigned int uHighRemain, uLowRemain; + unsigned int uBeaconInterval; uBeaconInterval = wBeaconInterval * 1024; // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval @@ -844,7 +843,7 @@ QWORD CARDqGetNextTBTT (QWORD qwTSF, WORD wBeaconInterval) * Return Value: none * */ -void CARDvSetFirstNextTBTT (PVOID pDeviceHandler, WORD wBeaconInterval) +void CARDvSetFirstNextTBTT(void *pDeviceHandler, WORD wBeaconInterval) { PSDevice pDevice = (PSDevice) pDeviceHandler; @@ -898,7 +897,8 @@ void CARDvSetFirstNextTBTT (PVOID pDeviceHandler, WORD wBeaconInterval) * Return Value: none * */ -void CARDvUpdateNextTBTT (PVOID pDeviceHandler, QWORD qwTSF, WORD wBeaconInterval) +void CARDvUpdateNextTBTT(void *pDeviceHandler, QWORD qwTSF, + WORD wBeaconInterval) { PSDevice pDevice = (PSDevice) pDeviceHandler; DWORD dwLoTBTT,dwHiTBTT; @@ -945,7 +945,7 @@ void CARDvUpdateNextTBTT (PVOID pDeviceHandler, QWORD qwTSF, WORD wBeaconInterva * Return Value: TRUE if success; otherwise FALSE * */ -BOOL CARDbRadioPowerOff (PVOID pDeviceHandler) +BOOL CARDbRadioPowerOff(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; BOOL bResult = TRUE; @@ -986,7 +986,7 @@ BOOL bResult = TRUE; * Return Value: TRUE if success; otherwise FALSE * */ -BOOL CARDbRadioPowerOn (PVOID pDeviceHandler) +BOOL CARDbRadioPowerOn(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; BOOL bResult = TRUE; @@ -1019,7 +1019,7 @@ BOOL bResult = TRUE; return bResult; } -void CARDvSetBSSMode (PVOID pDeviceHandler) +void CARDvSetBSSMode(void *pDeviceHandler) { 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 @@ -1080,10 +1080,10 @@ void CARDvSetBSSMode (PVOID pDeviceHandler) -*/ BOOL CARDbChannelSwitch ( - IN PVOID pDeviceHandler, - IN BYTE byMode, - IN BYTE byNewChannel, - IN BYTE byCount + void *pDeviceHandler, + BYTE byMode, + BYTE byNewChannel, + BYTE byCount ) { PSDevice pDevice = (PSDevice) pDeviceHandler; diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index aa90c2cb4461..6c91343d0d14 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -33,63 +33,57 @@ /*--------------------- Export Definitions -------------------------*/ - /*--------------------- Export Classes ----------------------------*/ -// Init card type +/* init card type */ typedef enum _CARD_PHY_TYPE { - - PHY_TYPE_AUTO=0, + PHY_TYPE_AUTO = 0, PHY_TYPE_11B, PHY_TYPE_11G, PHY_TYPE_11A } CARD_PHY_TYPE, *PCARD_PHY_TYPE; typedef enum _CARD_OP_MODE { - - OP_MODE_INFRASTRUCTURE=0, + OP_MODE_INFRASTRUCTURE = 0, OP_MODE_ADHOC, OP_MODE_AP, OP_MODE_UNKNOWN } CARD_OP_MODE, *PCARD_OP_MODE; #define CB_MAX_CHANNEL_24G 14 -//#define CB_MAX_CHANNEL_5G 24 -#define CB_MAX_CHANNEL_5G 42 //[20050104] add channel9(5045MHz), 41==>42 +/* #define CB_MAX_CHANNEL_5G 24 */ +#define CB_MAX_CHANNEL_5G 42 /* add channel9(5045MHz), 41==>42 */ #define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G) /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -BOOL CARDbSetMediaChannel(PVOID pDeviceHandler, UINT uConnectionChannel); -void CARDvSetRSPINF(PVOID pDeviceHandler, BYTE byBBType); -void vUpdateIFS(PVOID pDeviceHandler); -void CARDvUpdateBasicTopRate(PVOID pDeviceHandler); -BOOL CARDbAddBasicRate(PVOID pDeviceHandler, WORD wRateIdx); -BOOL CARDbIsOFDMinBasicRate(PVOID pDeviceHandler); -void CARDvAdjustTSF(PVOID pDeviceHandler, BYTE byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF); -BOOL CARDbGetCurrentTSF (PVOID pDeviceHandler, PQWORD pqwCurrTSF); -BOOL CARDbClearCurrentTSF(PVOID pDeviceHandler); -void CARDvSetFirstNextTBTT(PVOID pDeviceHandler, WORD wBeaconInterval); -void CARDvUpdateNextTBTT(PVOID pDeviceHandler, QWORD qwTSF, WORD wBeaconInterval); +BOOL CARDbSetMediaChannel(void *pDeviceHandler, + unsigned int uConnectionChannel); +void CARDvSetRSPINF(void *pDeviceHandler, BYTE byBBType); +void vUpdateIFS(void *pDeviceHandler); +void CARDvUpdateBasicTopRate(void *pDeviceHandler); +BOOL 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, + WORD wBeaconInterval); QWORD CARDqGetNextTBTT(QWORD qwTSF, WORD wBeaconInterval); QWORD CARDqGetTSFOffset(BYTE byRxRate, QWORD qwTSF1, QWORD qwTSF2); -BOOL CARDbRadioPowerOff(PVOID pDeviceHandler); -BOOL CARDbRadioPowerOn(PVOID pDeviceHandler); -BYTE CARDbyGetPktType(PVOID pDeviceHandler); -void CARDvSetBSSMode(PVOID pDeviceHandler); - -BOOL -CARDbChannelSwitch ( - IN PVOID pDeviceHandler, - IN BYTE byMode, - IN BYTE byNewChannel, - IN BYTE byCount - ); - -#endif // __CARD_H__ - +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); +#endif /* __CARD_H__ */ diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index f7136b0073bb..f49b6e133394 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -116,7 +116,7 @@ static SChannelTblElement sChannelTbl[CB_MAX_CHANNEL+1] = static struct { BYTE byChannelCountryCode; /* The country code */ - CHAR chCountryCode[2]; + char chCountryCode[2]; BYTE bChannelIdxList[CB_MAX_CHANNEL]; /* Available channels Index */ BYTE byPower[CB_MAX_CHANNEL]; } ChannelRuleTab[] = @@ -389,7 +389,7 @@ static struct // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) ************************************************************************/ BOOL -ChannelValid(UINT CountryCode, UINT ChannelIndex) +ChannelValid(unsigned int CountryCode, unsigned int ChannelIndex) { BOOL bValid; @@ -425,8 +425,8 @@ exit: ************************************************************************/ BOOL CHvChannelGetList ( - IN UINT uCountryCodeIdx, - OUT PBYTE pbyChannelTable + unsigned int uCountryCodeIdx, + PBYTE pbyChannelTable ) { if (uCountryCodeIdx >= CCODE_MAX) { @@ -437,11 +437,11 @@ CHvChannelGetList ( } -VOID CHvInitChannelTable (PVOID pDeviceHandler) +void CHvInitChannelTable(void *pDeviceHandler) { PSDevice pDevice = (PSDevice) pDeviceHandler; BOOL bMultiBand = FALSE; - UINT ii; + unsigned int ii; for(ii=1;ii<=CB_MAX_CHANNEL;ii++) { sChannelTbl[ii].bValid = FALSE; diff --git a/drivers/staging/vt6656/channel.h b/drivers/staging/vt6656/channel.h index 2306b2025656..91c2ffc6f1f0 100644 --- a/drivers/staging/vt6656/channel.h +++ b/drivers/staging/vt6656/channel.h @@ -37,21 +37,21 @@ /*--------------------- Export Classes ----------------------------*/ typedef struct tagSChannelTblElement { BYTE byChannelNumber; - UINT uFrequency; + unsigned int uFrequency; BOOL bValid; }SChannelTblElement, *PSChannelTblElement; /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -BOOL ChannelValid(UINT CountryCode, UINT ChannelNum); -VOID CHvInitChannelTable (PVOID pDeviceHandler); +BOOL ChannelValid(unsigned int CountryCode, unsigned int ChannelNum); +void CHvInitChannelTable(void *pDeviceHandler); BYTE CHbyGetChannelMapping(BYTE byChannelNumber); BOOL CHvChannelGetList ( - IN UINT uCountryCodeIdx, - OUT PBYTE pbyChannelTable + unsigned int uCountryCodeIdx, + PBYTE pbyChannelTable ); #endif /* _REGULATE_H_ */ diff --git a/drivers/staging/vt6656/control.c b/drivers/staging/vt6656/control.c index 7dba7710e593..8aab6718ff47 100644 --- a/drivers/staging/vt6656/control.c +++ b/drivers/staging/vt6656/control.c @@ -30,11 +30,13 @@ * CONTROLnsRequestIn - Read variable length bytes from MEM/BB/MAC/EEPROM * ControlvWriteByte - Write one byte to MEM/BB/MAC/EEPROM * ControlvReadByte - Read one byte from MEM/BB/MAC/EEPROM - * ControlvMaskByte - Read one byte from MEM/BB/MAC/EEPROM and clear/set some bits in the same address + * ControlvMaskByte - Read one byte from MEM/BB/MAC/EEPROM and clear/set + * some bits in the same address * * Revision History: * 04-05-2004 Jerry Chen: Initial release - * 11-24-2004 Warren Hsu: Add ControlvWriteByte,ControlvReadByte,ControlvMaskByte + * 11-24-2004 Warren Hsu: Add ControlvWriteByte, ControlvReadByte, + * ControlvMaskByte * */ @@ -42,8 +44,8 @@ #include "rndis.h" /*--------------------- Static Definitions -------------------------*/ -//static int msglevel =MSG_LEVEL_INFO; -//static int msglevel =MSG_LEVEL_DEBUG; +/* static int msglevel =MSG_LEVEL_INFO; */ +/* static int msglevel =MSG_LEVEL_DEBUG; */ /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ @@ -54,56 +56,43 @@ /*--------------------- Export Functions --------------------------*/ - -void ControlvWriteByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, BYTE byData) +void ControlvWriteByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, + BYTE byData) { -BYTE byData1; - - byData1 = byData; - - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - byRegOfs, - byRegType, - 1, - &byData1 - ); - + BYTE byData1; + byData1 = byData; + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE, + byRegOfs, + byRegType, + 1, + &byData1); } - -void ControlvReadByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, PBYTE pbyData) +void ControlvReadByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, + PBYTE pbyData) { -NTSTATUS ntStatus; -BYTE byData1; - - - ntStatus = CONTROLnsRequestIn(pDevice, - MESSAGE_TYPE_READ, - byRegOfs, - byRegType, - 1, - &byData1); - - *pbyData = byData1; - + NTSTATUS ntStatus; + BYTE byData1; + ntStatus = CONTROLnsRequestIn(pDevice, + MESSAGE_TYPE_READ, + byRegOfs, + byRegType, + 1, + &byData1); + *pbyData = byData1; } - - -void ControlvMaskByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, BYTE byMask, BYTE byData) +void ControlvMaskByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, + BYTE byMask, BYTE byData) { -BYTE pbyData[2]; - - pbyData[0] = byData; - pbyData[1] = byMask; - - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - byRegOfs, - byRegType, - 2, - pbyData - ); - + BYTE pbyData[2]; + pbyData[0] = byData; + pbyData[1] = byMask; + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_MASK, + byRegOfs, + byRegType, + 2, + pbyData); } diff --git a/drivers/staging/vt6656/control.h b/drivers/staging/vt6656/control.h index 4d9a777a7064..146b450e13d0 100644 --- a/drivers/staging/vt6656/control.h +++ b/drivers/staging/vt6656/control.h @@ -54,30 +54,27 @@ /*--------------------- Export Functions --------------------------*/ void ControlvWriteByte( - IN PSDevice pDevice, - IN BYTE byRegType, - IN BYTE byRegOfs, - IN BYTE byData + PSDevice pDevice, + BYTE byRegType, + BYTE byRegOfs, + BYTE byData ); void ControlvReadByte( - IN PSDevice pDevice, - IN BYTE byRegType, - IN BYTE byRegOfs, - IN PBYTE pbyData + PSDevice pDevice, + BYTE byRegType, + BYTE byRegOfs, + PBYTE pbyData ); void ControlvMaskByte( - IN PSDevice pDevice, - IN BYTE byRegType, - IN BYTE byRegOfs, - IN BYTE byMask, - IN BYTE byData + PSDevice pDevice, + BYTE byRegType, + BYTE byRegOfs, + BYTE byMask, + BYTE byData ); -#endif // __RCV_H__ - - - +#endif /* __CONTROL_H__ */ diff --git a/drivers/staging/vt6656/datarate.c b/drivers/staging/vt6656/datarate.c index 968feb466b0c..2e183ddbfd0e 100644 --- a/drivers/staging/vt6656/datarate.c +++ b/drivers/staging/vt6656/datarate.c @@ -65,16 +65,9 @@ const BYTE acbyIERate[MAX_RATE] = /*--------------------- Static Functions --------------------------*/ -VOID s_vResetCounter ( - IN PKnownNodeDB psNodeDBTable - ); +void s_vResetCounter(PKnownNodeDB psNodeDBTable); - - -VOID -s_vResetCounter ( - IN PKnownNodeDB psNodeDBTable - ) +void s_vResetCounter(PKnownNodeDB psNodeDBTable) { BYTE ii; @@ -107,7 +100,7 @@ s_vResetCounter ( -*/ BYTE DATARATEbyGetRateIdx ( - IN BYTE byRate + BYTE byRate ) { BYTE ii; @@ -161,7 +154,7 @@ DATARATEbyGetRateIdx ( -*/ WORD RATEwGetRateIdx( - IN BYTE byRate + BYTE byRate ) { WORD ii; @@ -195,25 +188,24 @@ RATEwGetRateIdx( * Return Value: none * -*/ -VOID -RATEvParseMaxRate ( - IN PVOID pDeviceHandler, - IN PWLAN_IE_SUPP_RATES pItemRates, - IN PWLAN_IE_SUPP_RATES pItemExtRates, - IN BOOL bUpdateBasicRate, - OUT PWORD pwMaxBasicRate, - OUT PWORD pwMaxSuppRate, - OUT PWORD pwSuppRate, - OUT PBYTE pbyTopCCKRate, - OUT PBYTE pbyTopOFDMRate +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; -UINT ii; +unsigned int ii; BYTE byHighSuppRate = 0; BYTE byRate = 0; WORD wOldBasicRate = pDevice->wBasicRate; -UINT uRateLen; +unsigned int uRateLen; if (pItemRates == NULL) @@ -236,7 +228,7 @@ UINT uRateLen; if (WLAN_MGMT_IS_BASICRATE(byRate) && (bUpdateBasicRate == TRUE)) { // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate - CARDbAddBasicRate((PVOID)pDevice, RATEwGetRateIdx(byRate)); + CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", RATEwGetRateIdx(byRate)); } byRate = (BYTE)(pItemRates->abyRates[ii]&0x7F); @@ -249,7 +241,7 @@ UINT uRateLen; if ((pItemExtRates != NULL) && (pItemExtRates->byElementID == WLAN_EID_EXTSUPP_RATES) && (pDevice->byBBType != BB_TYPE_11B)) { - UINT uExtRateLen = pItemExtRates->len; + unsigned int uExtRateLen = pItemExtRates->len; if (uExtRateLen > WLAN_RATES_MAXLEN) uExtRateLen = WLAN_RATES_MAXLEN; @@ -259,7 +251,7 @@ UINT uRateLen; // select highest basic rate if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) { // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate - CARDbAddBasicRate((PVOID)pDevice, RATEwGetRateIdx(byRate)); + CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", RATEwGetRateIdx(byRate)); } byRate = (BYTE)(pItemExtRates->abyRates[ii]&0x7F); @@ -272,7 +264,8 @@ UINT uRateLen; } } //if(pItemExtRates != NULL) - if ((pDevice->byPacketType == PK_TYPE_11GB) && CARDbIsOFDMinBasicRate((PVOID)pDevice)) { + if ((pDevice->byPacketType == PK_TYPE_11GB) + && CARDbIsOFDMinBasicRate((void *)pDevice)) { pDevice->byPacketType = PK_TYPE_11GA; } @@ -284,7 +277,7 @@ UINT uRateLen; else *pwMaxBasicRate = pDevice->byTopOFDMBasicRate; if (wOldBasicRate != pDevice->wBasicRate) - CARDvSetRSPINF((PVOID)pDevice, pDevice->byBBType); + CARDvSetRSPINF((void *)pDevice, pDevice->byBBType); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Exit ParseMaxRate\n"); } @@ -308,17 +301,17 @@ UINT uRateLen; #define AUTORATE_TXCNT_THRESHOLD 20 #define AUTORATE_INC_THRESHOLD 30 -VOID -RATEvTxRateFallBack ( - IN PVOID pDeviceHandler, - IN PKnownNodeDB psNodeDBTable +void +RATEvTxRateFallBack( + void *pDeviceHandler, + PKnownNodeDB psNodeDBTable ) { PSDevice pDevice = (PSDevice) pDeviceHandler; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); #if 1 //mike fixed old: use packet lose ratio algorithm to control rate WORD wIdxDownRate = 0; -UINT ii; +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; @@ -399,7 +392,7 @@ DWORD dwTxDiff = 0; #else //mike fixed new: use differ-signal strength to control rate WORD wIdxUpRate = 0; BOOL bAutoRate[MAX_RATE] = {TRUE,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE}; -UINT ii; +unsigned int ii; long ldBm; if (pMgmt->eScanState != WMAC_NO_SCANNING) { @@ -473,12 +466,12 @@ if (wIdxUpRate == RATE_54M ) { //11a/g -*/ BYTE RATEuSetIE ( - IN PWLAN_IE_SUPP_RATES pSrcRates, - IN PWLAN_IE_SUPP_RATES pDstRates, - IN UINT uRateLen + PWLAN_IE_SUPP_RATES pSrcRates, + PWLAN_IE_SUPP_RATES pDstRates, + unsigned int uRateLen ) { - UINT ii, uu, uRateCnt = 0; + unsigned int ii, uu, uRateCnt = 0; if ((pSrcRates == NULL) || (pDstRates == NULL)) return 0; diff --git a/drivers/staging/vt6656/datarate.h b/drivers/staging/vt6656/datarate.h index 68f206e2707b..c6f5163ff9b8 100644 --- a/drivers/staging/vt6656/datarate.h +++ b/drivers/staging/vt6656/datarate.h @@ -69,42 +69,41 @@ -VOID +void RATEvParseMaxRate( - IN PVOID pDeviceHandler, - IN PWLAN_IE_SUPP_RATES pItemRates, - IN PWLAN_IE_SUPP_RATES pItemExtRates, - IN BOOL bUpdateBasicRate, - OUT PWORD pwMaxBasicRate, - OUT PWORD pwMaxSuppRate, - OUT PWORD pwSuppRate, - OUT PBYTE pbyTopCCKRate, - OUT PBYTE pbyTopOFDMRate + 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 +void RATEvTxRateFallBack( - IN PVOID pDeviceHandler, - IN PKnownNodeDB psNodeDBTable + void *pDeviceHandler, + PKnownNodeDB psNodeDBTable ); BYTE RATEuSetIE( - IN PWLAN_IE_SUPP_RATES pSrcRates, - IN PWLAN_IE_SUPP_RATES pDstRates, - IN UINT uRateLen + PWLAN_IE_SUPP_RATES pSrcRates, + PWLAN_IE_SUPP_RATES pDstRates, + unsigned int uRateLen ); WORD RATEwGetRateIdx( - IN BYTE byRate + BYTE byRate ); BYTE DATARATEbyGetRateIdx( - IN BYTE byRate + BYTE byRate ); - -#endif //__DATARATE_H__ +#endif /* __DATARATE_H__ */ diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h index f10530fcc99b..07f794ec6db2 100644 --- a/drivers/staging/vt6656/desc.h +++ b/drivers/staging/vt6656/desc.h @@ -206,8 +206,8 @@ typedef const SRrvTime_atim *PCSRrvTime_atim; typedef struct tagSRTSData { WORD wFrameControl; WORD wDurationID; - BYTE abyRA[U_ETHER_ADDR_LEN]; - BYTE abyTA[U_ETHER_ADDR_LEN]; + BYTE abyRA[ETH_ALEN]; + BYTE abyTA[ETH_ALEN]; }__attribute__ ((__packed__)) SRTSData, *PSRTSData; typedef const SRTSData *PCSRTSData; @@ -282,7 +282,7 @@ typedef const SRTS_a_FB *PCSRTS_a_FB; typedef struct tagSCTSData { WORD wFrameControl; WORD wDurationID; - BYTE abyRA[U_ETHER_ADDR_LEN]; + BYTE abyRA[ETH_ALEN]; WORD wReserved; }__attribute__ ((__packed__)) SCTSData, *PSCTSData; @@ -436,8 +436,4 @@ SKeyEntry; /*--------------------- Export Functions --------------------------*/ - - - -#endif // __DESC_H__ - +#endif /* __DESC_H__ */ diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 8b541d1d0e23..ef9fd97d3ca7 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -107,7 +107,7 @@ #define MAC_MAX_CONTEXT_REG (256+128) #define MAX_MULTICAST_ADDRESS_NUM 32 -#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * U_ETHER_ADDR_LEN) +#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN) //#define OP_MODE_INFRASTRUCTURE 0 @@ -209,9 +209,9 @@ typedef enum _CONTEXT_TYPE { // RCB (Receive Control Block) typedef struct _RCB { - PVOID Next; - LONG Ref; - PVOID pDevice; + void *Next; + signed long Ref; + void *pDevice; struct urb *pUrb; SRxMgmtPacket sMngPacket; struct sk_buff* skb; @@ -222,34 +222,33 @@ typedef struct _RCB // used to track bulk out irps typedef struct _USB_SEND_CONTEXT { - PVOID pDevice; + void *pDevice; struct sk_buff *pPacket; struct urb *pUrb; - UINT uBufLen; + unsigned int uBufLen; CONTEXT_TYPE Type; SEthernetHeader sEthHeader; - PVOID Next; + void *Next; BOOL bBoolInUse; - UCHAR Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS]; + unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS]; } USB_SEND_CONTEXT, *PUSB_SEND_CONTEXT; -//structure got from configuration file as user desired default setting. -typedef struct _DEFAULT_CONFIG{ - INT ZoneType; - INT eConfigMode; - INT eAuthenMode; //open/wep/wpa - INT bShareKeyAlgorithm; //open-open/open-sharekey/wep-sharekey - INT keyidx; //wepkey index - INT eEncryptionStatus; - -}DEFAULT_CONFIG,*PDEFAULT_CONFIG; +/* structure got from configuration file as user-desired default settings */ +typedef struct _DEFAULT_CONFIG { + signed int ZoneType; + signed int eConfigMode; + signed int eAuthenMode; /* open/wep/wpa */ + signed int bShareKeyAlgorithm; /* open-open/{open,wep}-sharekey */ + signed int keyidx; /* wepkey index */ + signed int eEncryptionStatus; +} DEFAULT_CONFIG, *PDEFAULT_CONFIG; // // Structure to keep track of usb interrupt packets // typedef struct { - UINT uDataLen; + unsigned int uDataLen; PBYTE pDataBuf; // struct urb *pUrb; BOOL bInUse; @@ -296,7 +295,7 @@ typedef enum __DEVICE_NDIS_STATUS { #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 // PMKID Structures -typedef UCHAR NDIS_802_11_PMKID_VALUE[16]; +typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; typedef enum _NDIS_802_11_WEP_STATUS @@ -328,7 +327,7 @@ typedef enum _NDIS_802_11_STATUS_TYPE //Added new types for PMKID Candidate lists. typedef struct _PMKID_CANDIDATE { NDIS_802_11_MAC_ADDRESS BSSID; - ULONG Flags; + unsigned long Flags; } PMKID_CANDIDATE, *PPMKID_CANDIDATE; @@ -339,15 +338,15 @@ typedef struct _BSSID_INFO } BSSID_INFO, *PBSSID_INFO; typedef struct tagSPMKID { - ULONG Length; - ULONG BSSIDInfoCount; + unsigned long Length; + unsigned long BSSIDInfoCount; BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID]; } SPMKID, *PSPMKID; typedef struct tagSPMKIDCandidateEvent { NDIS_802_11_STATUS_TYPE StatusType; - ULONG Version; // Version of the structure - ULONG NumCandidates; // No. of pmkid candidates + unsigned long Version; /* Version of the structure */ + unsigned long NumCandidates; /* No. of pmkid candidates */ PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; @@ -369,7 +368,7 @@ typedef struct tagSQuietControl { // The receive duplicate detection cache entry typedef struct tagSCacheEntry{ WORD wFmSequence; - BYTE abyAddr2[U_ETHER_ADDR_LEN]; + BYTE abyAddr2[ETH_ALEN]; WORD wFrameCtl; } SCacheEntry, *PSCacheEntry; @@ -377,7 +376,7 @@ typedef struct tagSCache{ /* The receive cache is updated circularly. The next entry to be written is * indexed by the "InPtr". */ - UINT uInPtr; // Place to use next + unsigned int uInPtr; /* Place to use next */ SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH]; } SCache, *PSCache; @@ -387,11 +386,11 @@ typedef struct tagSDeFragControlBlock { WORD wSequence; WORD wFragNum; - BYTE abyAddr2[U_ETHER_ADDR_LEN]; - UINT uLifetime; + BYTE abyAddr2[ETH_ALEN]; + unsigned int uLifetime; struct sk_buff* skb; PBYTE pbyRxBuffer; - UINT cbFrameLength; + unsigned int cbFrameLength; BOOL bInUse; } SDeFragControlBlock, *PSDeFragControlBlock; @@ -435,7 +434,7 @@ typedef struct __device_opt { int short_retry; int long_retry; int bbp_type; - U32 flags; + u32 flags; } OPTIONS, *POPTIONS; @@ -453,25 +452,25 @@ typedef struct __device_info { struct tasklet_struct ReadWorkItem; struct tasklet_struct RxMngWorkItem; - U32 rx_buf_sz; + u32 rx_buf_sz; int multicast_limit; BYTE byRxMode; spinlock_t lock; - U32 rx_bytes; + u32 rx_bytes; BYTE byRevId; - U32 flags; - ULONG Flags; + u32 flags; + unsigned long Flags; SCache sDupRxCache; SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG]; - UINT cbDFCB; - UINT cbFreeDFCB; - UINT uCurrentDFCBIdx; + unsigned int cbDFCB; + unsigned int cbFreeDFCB; + unsigned int uCurrentDFCBIdx; // +++USB @@ -479,29 +478,29 @@ typedef struct __device_info { struct urb *pInterruptURB; struct usb_ctrlrequest sUsbCtlRequest; - UINT int_interval; + unsigned int int_interval; // // Variables to track resources for the BULK In Pipe // PRCB pRCBMem; PRCB apRCB[CB_MAX_RX_DESC]; - UINT cbRD; + unsigned int cbRD; PRCB FirstRecvFreeList; PRCB LastRecvFreeList; - UINT NumRecvFreeList; + unsigned int NumRecvFreeList; PRCB FirstRecvMngList; PRCB LastRecvMngList; - UINT NumRecvMngList; + unsigned int NumRecvMngList; BOOL bIsRxWorkItemQueued; BOOL bIsRxMngWorkItemQueued; - ULONG ulRcvRefCount; // number of packets that have not been returned back + 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]; - UINT cbTD; + unsigned int cbTD; // // Variables to track resources for the Interript In Pipe @@ -518,20 +517,20 @@ typedef struct __device_info { // // Statistic for USB // protect with spinlock - ULONG ulBulkInPosted; - ULONG ulBulkInError; - ULONG ulBulkInContCRCError; - ULONG ulBulkInBytesRead; + unsigned long ulBulkInPosted; + unsigned long ulBulkInError; + unsigned long ulBulkInContCRCError; + unsigned long ulBulkInBytesRead; - ULONG ulBulkOutPosted; - ULONG ulBulkOutError; - ULONG ulBulkOutContCRCError; - ULONG ulBulkOutBytesWrite; + unsigned long ulBulkOutPosted; + unsigned long ulBulkOutError; + unsigned long ulBulkOutContCRCError; + unsigned long ulBulkOutBytesWrite; - ULONG ulIntInPosted; - ULONG ulIntInError; - ULONG ulIntInContCRCError; - ULONG ulIntInBytesRead; + unsigned long ulIntInPosted; + unsigned long ulIntInError; + unsigned long ulIntInContCRCError; + unsigned long ulIntInBytesRead; // Version control @@ -547,10 +546,10 @@ typedef struct __device_info { BYTE byOriginalZonetype; BOOL bLinkPass; // link status: OK or fail - BYTE abyCurrentNetAddr[U_ETHER_ADDR_LEN]; - BYTE abyPermanentNetAddr[U_ETHER_ADDR_LEN]; + BYTE abyCurrentNetAddr[ETH_ALEN]; + BYTE abyPermanentNetAddr[ETH_ALEN]; // SW network address -// BYTE abySoftwareNetAddr[U_ETHER_ADDR_LEN]; + /* u8 abySoftwareNetAddr[ETH_ALEN]; */ BOOL bExistSWNetAddr; // Adapter statistics @@ -561,24 +560,24 @@ typedef struct __device_info { // // Maintain statistical debug info. // - ULONG packetsReceived; - ULONG packetsReceivedDropped; - ULONG packetsReceivedOverflow; - ULONG packetsSent; - ULONG packetsSentDropped; - ULONG SendContextsInUse; - ULONG RcvBuffersInUse; + 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; - UINT cbBulkInMax; + unsigned int cbBulkInMax; BOOL bPSRxBeacon; // 802.11 MAC specific - UINT uCurrRSSI; + unsigned int uCurrRSSI; BYTE byCurrSQ; @@ -599,30 +598,31 @@ typedef struct __device_info { BOOL bDiversityRegCtlON; BOOL bDiversityEnable; - ULONG ulDiversityNValue; - ULONG ulDiversityMValue; + unsigned long ulDiversityNValue; + unsigned long ulDiversityMValue; BYTE byTMax; BYTE byTMax2; BYTE byTMax3; - ULONG ulSQ3TH; + unsigned long ulSQ3TH; - ULONG uDiversityCnt; + unsigned long uDiversityCnt; BYTE byAntennaState; - ULONG ulRatio_State0; - ULONG ulRatio_State1; - ULONG ulSQ3_State0; - ULONG ulSQ3_State1; - - ULONG aulSQ3Val[MAX_RATE]; - ULONG aulPktNum[MAX_RATE]; - - // IFS & Cw - UINT uSIFS; //Current SIFS - UINT uDIFS; //Current DIFS - UINT uEIFS; //Current EIFS - UINT uSlot; //Current SlotTime - UINT uCwMin; //Current CwMin - UINT uCwMax; //CwMax is fixed on 1023. + 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; @@ -647,7 +647,7 @@ typedef struct __device_info { BYTE byMinChannel; BYTE byMaxChannel; - UINT uConnectionRate; + unsigned int uConnectionRate; BYTE byPreambleType; BYTE byShortPreamble; @@ -671,8 +671,8 @@ typedef struct __device_info { CARD_OP_MODE eOPMode; BOOL bBSSIDFilter; WORD wMaxTransmitMSDULifetime; - BYTE abyBSSID[U_ETHER_ADDR_LEN]; - BYTE abyDesireBSSID[U_ETHER_ADDR_LEN]; + 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 @@ -701,7 +701,7 @@ typedef struct __device_info { WORD wListenInterval; BOOL bPWBitOn; WMAC_POWER_MODE ePSMode; - ULONG ulPSModeWaitTx; + unsigned long ulPSModeWaitTx; BOOL bPSModeTxBurst; // Beacon releated @@ -710,7 +710,7 @@ typedef struct __device_info { BOOL bBeaconSent; BOOL bFixRate; BYTE byCurrentCh; - UINT uScanTime; + unsigned int uScanTime; CMD_STATE eCommandState; @@ -721,15 +721,15 @@ typedef struct __device_info { BOOL bStopBeacon; BOOL bStopDataPkt; BOOL bStopTx0Pkt; - UINT uAutoReConnectTime; - UINT uIsroamingTime; + unsigned int uAutoReConnectTime; + unsigned int uIsroamingTime; // 802.11 counter CMD_ITEM eCmdQueue[CMD_Q_SIZE]; - UINT uCmdDequeueIdx; - UINT uCmdEnqueueIdx; - UINT cbFreeCmdQueue; + unsigned int uCmdDequeueIdx; + unsigned int uCmdEnqueueIdx; + unsigned int cbFreeCmdQueue; BOOL bCmdRunning; BOOL bCmdClear; BOOL bNeedRadioOFF; @@ -741,7 +741,7 @@ typedef struct __device_info { BYTE bSameBSSCurNum; //DavidWang BOOL bRoaming; BOOL b11hEable; - ULONG ulTxPower; + unsigned long ulTxPower; // Encryption NDIS_802_11_WEP_STATUS eEncryptionStatus; @@ -762,11 +762,11 @@ typedef struct __device_info { BOOL bAES; BYTE byCntMeasure; - UINT uKeyLength; + unsigned int uKeyLength; BYTE abyKey[WLAN_WEP232_KEYLEN]; // for AP mode - UINT uAssocCount; + unsigned int uAssocCount; BOOL bMoreData; // QoS @@ -781,11 +781,11 @@ typedef struct __device_info { // For Update BaseBand VGA Gain Offset BOOL bUpdateBBVGA; - UINT uBBVGADiffCount; + unsigned int uBBVGADiffCount; BYTE byBBVGANew; BYTE byBBVGACurrent; BYTE abyBBVGA[BB_VGA_LEVEL]; - LONG ldBmThreshold[BB_VGA_LEVEL]; + signed long ldBmThreshold[BB_VGA_LEVEL]; BYTE byBBPreEDRSSI; BYTE byBBPreEDIndex; @@ -813,7 +813,7 @@ typedef struct __device_info { //2007-0115-01<Add>by MikeLiu #ifdef TxInSleep struct timer_list sTimerTxData; - ULONG nTxDataTimeCout; + unsigned long nTxDataTimeCout; BOOL fTxDataInSleep; BOOL IsTxDataTrigger; #endif @@ -826,9 +826,9 @@ typedef struct __device_info { SEthernetHeader sTxEthHeader; SEthernetHeader sRxEthHeader; - BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN]; - BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN]; - BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN]; + BYTE abyBroadcastAddr[ETH_ALEN]; + BYTE abySNAP_RFC1042[ETH_ALEN]; + BYTE abySNAP_Bridgetunnel[ETH_ALEN]; // Pre-Authentication & PMK cache SPMKID gsPMKID; @@ -864,7 +864,7 @@ typedef struct __device_info { struct net_device *apdev; int (*tx_80211)(struct sk_buff *skb, struct net_device *dev); #endif - UINT uChannel; + unsigned int uChannel; struct iw_statistics wstats; // wireless stats BOOL bCommit; @@ -929,7 +929,9 @@ typedef struct __device_info { /*--------------------- Export Functions --------------------------*/ -//BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex); +/* BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, + * unsigned int uNodeIndex); + */ BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF); #endif diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index 835c6d6967bf..9afe76cacef5 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -74,70 +74,69 @@ const BYTE acbyRxRate[MAX_RATE] = /*--------------------- Static Functions --------------------------*/ -static BYTE s_byGetRateIdx(IN BYTE byRate); - +static BYTE s_byGetRateIdx(BYTE byRate); static -VOID +void s_vGetDASA( - IN PBYTE pbyRxBufferAddr, - OUT PUINT pcbHeaderSize, - OUT PSEthernetHeader psEthHeader + PBYTE pbyRxBufferAddr, + PUINT pcbHeaderSize, + PSEthernetHeader psEthHeader ); static -VOID +void s_vProcessRxMACHeader ( - IN PSDevice pDevice, - IN PBYTE pbyRxBufferAddr, - IN UINT cbPacketSize, - IN BOOL bIsWEP, - IN BOOL bExtIV, - OUT PUINT pcbHeadSize + PSDevice pDevice, + PBYTE pbyRxBufferAddr, + unsigned int cbPacketSize, + BOOL bIsWEP, + BOOL bExtIV, + PUINT pcbHeadSize ); static BOOL s_bAPModeRxCtl( - IN PSDevice pDevice, - IN PBYTE pbyFrame, - IN INT iSANodeIndex + PSDevice pDevice, + PBYTE pbyFrame, + signed int iSANodeIndex ); static BOOL s_bAPModeRxData ( - IN PSDevice pDevice, - IN struct sk_buff* skb, - IN UINT FrameSize, - IN UINT cbHeaderOffset, - IN INT iSANodeIndex, - IN INT iDANodeIndex + PSDevice pDevice, + struct sk_buff *skb, + unsigned int FrameSize, + unsigned int cbHeaderOffset, + signed int iSANodeIndex, + signed int iDANodeIndex ); static BOOL s_bHandleRxEncryption( - IN PSDevice pDevice, - IN PBYTE pbyFrame, - IN UINT FrameSize, - IN PBYTE pbyRsr, - OUT PBYTE pbyNewRsr, - OUT PSKeyItem *pKeyOut, + PSDevice pDevice, + PBYTE pbyFrame, + unsigned int FrameSize, + PBYTE pbyRsr, + PBYTE pbyNewRsr, + PSKeyItem * pKeyOut, int * pbExtIV, - OUT PWORD pwRxTSC15_0, - OUT PDWORD pdwRxTSC47_16 + PWORD pwRxTSC15_0, + PDWORD pdwRxTSC47_16 ); static BOOL s_bHostWepRxEncryption( - IN PSDevice pDevice, - IN PBYTE pbyFrame, - IN UINT FrameSize, - IN PBYTE pbyRsr, - IN BOOL bOnFly, - IN PSKeyItem pKey, - OUT PBYTE pbyNewRsr, + PSDevice pDevice, + PBYTE pbyFrame, + unsigned int FrameSize, + PBYTE pbyRsr, + BOOL bOnFly, + PSKeyItem pKey, + PBYTE pbyNewRsr, int * pbExtIV, - OUT PWORD pwRxTSC15_0, - OUT PDWORD pdwRxTSC47_16 + PWORD pwRxTSC15_0, + PDWORD pdwRxTSC47_16 ); @@ -161,18 +160,18 @@ static BOOL s_bHostWepRxEncryption( * -*/ static -VOID +void s_vProcessRxMACHeader ( - IN PSDevice pDevice, - IN PBYTE pbyRxBufferAddr, - IN UINT cbPacketSize, - IN BOOL bIsWEP, - IN BOOL bExtIV, - OUT PUINT pcbHeadSize + PSDevice pDevice, + PBYTE pbyRxBufferAddr, + unsigned int cbPacketSize, + BOOL bIsWEP, + BOOL bExtIV, + PUINT pcbHeadSize ) { PBYTE pbyRxBuffer; - UINT cbHeaderSize = 0; + unsigned int cbHeaderSize = 0; PWORD pwType; PS802_11Header pMACHeader; int ii; @@ -234,11 +233,11 @@ s_vProcessRxMACHeader ( } } - cbHeaderSize -= (U_ETHER_ADDR_LEN * 2); + cbHeaderSize -= (ETH_ALEN * 2); pbyRxBuffer = (PBYTE) (pbyRxBufferAddr + cbHeaderSize); - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) + for (ii = 0; ii < ETH_ALEN; ii++) *pbyRxBuffer++ = pDevice->sRxEthHeader.abyDstAddr[ii]; - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) + for (ii = 0; ii < ETH_ALEN; ii++) *pbyRxBuffer++ = pDevice->sRxEthHeader.abySrcAddr[ii]; *pcbHeadSize = cbHeaderSize; @@ -247,7 +246,7 @@ s_vProcessRxMACHeader ( -static BYTE s_byGetRateIdx (IN BYTE byRate) +static BYTE s_byGetRateIdx(BYTE byRate) { BYTE byRateIdx; @@ -260,50 +259,55 @@ static BYTE s_byGetRateIdx (IN BYTE byRate) static -VOID +void s_vGetDASA ( - IN PBYTE pbyRxBufferAddr, - OUT PUINT pcbHeaderSize, - OUT PSEthernetHeader psEthHeader + PBYTE pbyRxBufferAddr, + PUINT pcbHeaderSize, + PSEthernetHeader psEthHeader ) { - UINT cbHeaderSize = 0; - PS802_11Header pMACHeader; - int ii; - - pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); - - if ((pMACHeader->wFrameCtl & FC_TODS) == 0) { - if (pMACHeader->wFrameCtl & FC_FROMDS) { - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { - psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii]; - psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr3[ii]; - } - } - else { - // IBSS mode - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { - psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii]; - psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii]; - } - } - } - else { - // Is AP mode.. - if (pMACHeader->wFrameCtl & FC_FROMDS) { - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { - psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii]; - psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr4[ii]; - cbHeaderSize += 6; - } - } - else { - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { - psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii]; - psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii]; - } - } - }; + unsigned int cbHeaderSize = 0; + PS802_11Header pMACHeader; + int ii; + + pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); + + if ((pMACHeader->wFrameCtl & FC_TODS) == 0) { + if (pMACHeader->wFrameCtl & FC_FROMDS) { + for (ii = 0; ii < ETH_ALEN; ii++) { + psEthHeader->abyDstAddr[ii] = + pMACHeader->abyAddr1[ii]; + psEthHeader->abySrcAddr[ii] = + pMACHeader->abyAddr3[ii]; + } + } else { + /* IBSS mode */ + for (ii = 0; ii < ETH_ALEN; ii++) { + psEthHeader->abyDstAddr[ii] = + pMACHeader->abyAddr1[ii]; + psEthHeader->abySrcAddr[ii] = + pMACHeader->abyAddr2[ii]; + } + } + } else { + /* Is AP mode.. */ + if (pMACHeader->wFrameCtl & FC_FROMDS) { + for (ii = 0; ii < ETH_ALEN; ii++) { + psEthHeader->abyDstAddr[ii] = + pMACHeader->abyAddr3[ii]; + psEthHeader->abySrcAddr[ii] = + pMACHeader->abyAddr4[ii]; + cbHeaderSize += 6; + } + } else { + for (ii = 0; ii < ETH_ALEN; ii++) { + psEthHeader->abyDstAddr[ii] = + pMACHeader->abyAddr3[ii]; + psEthHeader->abySrcAddr[ii] = + pMACHeader->abyAddr2[ii]; + } + } + }; *pcbHeaderSize = cbHeaderSize; } @@ -312,9 +316,9 @@ s_vGetDASA ( BOOL RXbBulkInProcessData ( - IN PSDevice pDevice, - IN PRCB pRCB, - IN ULONG BytesToIndicate + PSDevice pDevice, + PRCB pRCB, + unsigned long BytesToIndicate ) { @@ -329,26 +333,26 @@ RXbBulkInProcessData ( PQWORD pqwTSFTime; PBYTE pbyFrame; BOOL bDeFragRx = FALSE; - UINT cbHeaderOffset; - UINT FrameSize; + unsigned int cbHeaderOffset; + unsigned int FrameSize; WORD wEtherType = 0; - INT iSANodeIndex = -1; - INT iDANodeIndex = -1; - UINT ii; - UINT cbIVOffset; + signed int iSANodeIndex = -1; + signed int iDANodeIndex = -1; + unsigned int ii; + unsigned int cbIVOffset; PBYTE pbyRxSts; PBYTE pbyRxRate; PBYTE pbySQ; #ifdef Calcu_LinkQual PBYTE pby3SQ; #endif - UINT cbHeaderSize; + unsigned int cbHeaderSize; PSKeyItem pKey = NULL; WORD wRxTSC15_0 = 0; DWORD dwRxTSC47_16 = 0; SKeyItem STempKey; // 802.11h RPI - //LONG ldBm = 0; + /* signed long ldBm = 0; */ BOOL bIsWEP = FALSE; BOOL bExtIV = FALSE; DWORD dwWbkStatus; @@ -368,7 +372,7 @@ RXbBulkInProcessData ( //[31:16]RcvByteCount ( not include 4-byte Status ) dwWbkStatus = *( (PDWORD)(skb->data) ); - FrameSize = (UINT)(dwWbkStatus >> 16); + FrameSize = (unsigned int)(dwWbkStatus >> 16); FrameSize += 4; if (BytesToIndicate != FrameSize) { @@ -930,9 +934,9 @@ RXbBulkInProcessData ( if (bIsWEP) { WORD wLocalTSC15_0 = 0; DWORD dwLocalTSC47_16 = 0; - ULONGLONG RSC = 0; + unsigned long long RSC = 0; // endian issues - RSC = *((ULONGLONG *) &(pKey->KeyRSC)); + RSC = *((unsigned long long *) &(pKey->KeyRSC)); wLocalTSC15_0 = (WORD) RSC; dwLocalTSC47_16 = (DWORD) (RSC>>16); @@ -1017,9 +1021,9 @@ RXbBulkInProcessData ( static BOOL s_bAPModeRxCtl ( - IN PSDevice pDevice, - IN PBYTE pbyFrame, - IN INT iSANodeIndex + PSDevice pDevice, + PBYTE pbyFrame, + signed int iSANodeIndex ) { PS802_11Header p802_11Header; @@ -1065,7 +1069,9 @@ static BOOL s_bAPModeRxCtl ( // delcare received ps-poll event if (IS_CTL_PSPOLL(pbyFrame)) { pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_RX_PSPOLL, + NULL); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n"); } else { @@ -1074,7 +1080,9 @@ static BOOL s_bAPModeRxCtl ( if (!IS_FC_POWERMGT(pbyFrame)) { pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = FALSE; pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_RX_PSPOLL, + NULL); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n"); } } @@ -1090,7 +1098,9 @@ static BOOL s_bAPModeRxCtl ( if (pMgmt->sNodeDBTable[iSANodeIndex].wEnQueueCnt > 0) { pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = FALSE; pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_RX_PSPOLL, + NULL); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 3\n"); } @@ -1139,18 +1149,18 @@ static BOOL s_bAPModeRxCtl ( } static BOOL s_bHandleRxEncryption ( - IN PSDevice pDevice, - IN PBYTE pbyFrame, - IN UINT FrameSize, - IN PBYTE pbyRsr, - OUT PBYTE pbyNewRsr, - OUT PSKeyItem *pKeyOut, + PSDevice pDevice, + PBYTE pbyFrame, + unsigned int FrameSize, + PBYTE pbyRsr, + PBYTE pbyNewRsr, + PSKeyItem * pKeyOut, int * pbExtIV, - OUT PWORD pwRxTSC15_0, - OUT PDWORD pdwRxTSC47_16 + PWORD pwRxTSC15_0, + PDWORD pdwRxTSC47_16 ) { - UINT PayloadLen = FrameSize; + unsigned int PayloadLen = FrameSize; PBYTE pbyIV; BYTE byKeyIdx; PSKeyItem pKey = NULL; @@ -1285,20 +1295,20 @@ static BOOL s_bHandleRxEncryption ( static BOOL s_bHostWepRxEncryption ( - IN PSDevice pDevice, - IN PBYTE pbyFrame, - IN UINT FrameSize, - IN PBYTE pbyRsr, - IN BOOL bOnFly, - IN PSKeyItem pKey, - OUT PBYTE pbyNewRsr, + PSDevice pDevice, + PBYTE pbyFrame, + unsigned int FrameSize, + PBYTE pbyRsr, + BOOL bOnFly, + PSKeyItem pKey, + PBYTE pbyNewRsr, int * pbExtIV, - OUT PWORD pwRxTSC15_0, - OUT PDWORD pdwRxTSC47_16 + PWORD pwRxTSC15_0, + PDWORD pdwRxTSC47_16 ) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT PayloadLen = FrameSize; + unsigned int PayloadLen = FrameSize; PBYTE pbyIV; BYTE byKeyIdx; BYTE byDecMode = KEY_CTL_WEP; @@ -1417,12 +1427,12 @@ static BOOL s_bHostWepRxEncryption ( static BOOL s_bAPModeRxData ( - IN PSDevice pDevice, - IN struct sk_buff* skb, - IN UINT FrameSize, - IN UINT cbHeaderOffset, - IN INT iSANodeIndex, - IN INT iDANodeIndex + PSDevice pDevice, + struct sk_buff *skb, + unsigned int FrameSize, + unsigned int cbHeaderOffset, + signed int iSANodeIndex, + signed int iDANodeIndex ) { @@ -1493,7 +1503,8 @@ static BOOL s_bAPModeRxData ( iDANodeIndex = 0; if ((pDevice->uAssocCount > 1) && (iDANodeIndex >= 0)) { - bRelayPacketSend(pDevice, (PBYTE)(skb->data + cbHeaderOffset), FrameSize, (UINT)iDANodeIndex); + bRelayPacketSend(pDevice, (PBYTE) (skb->data + cbHeaderOffset), + FrameSize, (unsigned int) iDANodeIndex); } if (bRelayOnly) @@ -1509,10 +1520,7 @@ static BOOL s_bAPModeRxData ( -VOID -RXvWorkItem( - PVOID Context - ) +void RXvWorkItem(void *Context) { PSDevice pDevice = (PSDevice) Context; NTSTATUS ntStatus; @@ -1535,10 +1543,10 @@ RXvWorkItem( } -VOID +void RXvFreeRCB( - IN PRCB pRCB, - IN BOOL bReAllocSkb + PRCB pRCB, + BOOL bReAllocSkb ) { PSDevice pDevice = (PSDevice)pRCB->pDevice; @@ -1575,10 +1583,7 @@ RXvFreeRCB( } -VOID -RXvMngWorkItem( - PVOID Context - ) +void RXvMngWorkItem(void *Context) { PSDevice pDevice = (PSDevice) Context; PRCB pRCB=NULL; @@ -1598,7 +1603,7 @@ RXvMngWorkItem( } ASSERT(pRCB);// cannot be NULL pRxPacket = &(pRCB->sMngPacket); - vMgrRxManagePacket((HANDLE)pDevice, &(pDevice->sMgmtObj), pRxPacket); + vMgrRxManagePacket((void *) pDevice, &(pDevice->sMgmtObj), pRxPacket); pRCB->Ref--; if(pRCB->Ref == 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RxvFreeMng %d %d\n",pDevice->NumRecvFreeList, pDevice->NumRecvMngList); diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h index df148b453966..d4fca43af4fe 100644 --- a/drivers/staging/vt6656/dpc.h +++ b/drivers/staging/vt6656/dpc.h @@ -41,30 +41,21 @@ /*--------------------- Export Functions --------------------------*/ -VOID -RXvWorkItem( - PVOID Context - ); +void RXvWorkItem(void *Context); -VOID -RXvMngWorkItem( - PVOID Context - ); +void RXvMngWorkItem(void *Context); -VOID +void RXvFreeRCB( - IN PRCB pRCB, - IN BOOL bReAllocSkb + PRCB pRCB, + BOOL bReAllocSkb ); BOOL RXbBulkInProcessData( - IN PSDevice pDevice, - IN PRCB pRCB, - IN ULONG BytesToIndicate + PSDevice pDevice, + PRCB pRCB, + unsigned long BytesToIndicate ); -#endif // __RXTX_H__ - - - +#endif /* __RXTX_H__ */ diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index 585b6b12c5ba..e1f96d7086f7 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -770,7 +770,7 @@ const BYTE abyFirmware[] = { BOOL FIRMWAREbDownload( - IN PSDevice pDevice + PSDevice pDevice ) { NDIS_STATUS NdisStatus; @@ -820,7 +820,7 @@ FIRMWAREbDownload( BOOL FIRMWAREbBrach2Sram( - IN PSDevice pDevice + PSDevice pDevice ) { NDIS_STATUS NdisStatus; @@ -845,7 +845,7 @@ FIRMWAREbBrach2Sram( BOOL FIRMWAREbCheckVersion( - IN PSDevice pDevice + PSDevice pDevice ) { NTSTATUS ntStatus; diff --git a/drivers/staging/vt6656/firmware.h b/drivers/staging/vt6656/firmware.h index 97f8559f2a55..b2f5b5818a93 100644 --- a/drivers/staging/vt6656/firmware.h +++ b/drivers/staging/vt6656/firmware.h @@ -43,18 +43,17 @@ BOOL FIRMWAREbDownload( - IN PSDevice pDevice + PSDevice pDevice ); BOOL FIRMWAREbBrach2Sram( - IN PSDevice pDevice + PSDevice pDevice ); BOOL FIRMWAREbCheckVersion( - IN PSDevice pDevice + PSDevice pDevice ); - -#endif // __FIRMWARE_H__ +#endif /* __FIRMWARE_H__ */ diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index 1078d616c497..f70e922a615b 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -91,10 +91,9 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name); - pDevice->apdev = (struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL); + pDevice->apdev = kzalloc(sizeof(struct net_device), GFP_KERNEL); if (pDevice->apdev == NULL) return -ENOMEM; - memset(pDevice->apdev, 0, sizeof(struct net_device)); apdev_priv = netdev_priv(pDevice->apdev); *apdev_priv = *pDevice; @@ -178,7 +177,7 @@ static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked) * */ -int hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked) +int vt6656_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked) { if (val < 0 || val > 1) return -EINVAL; @@ -211,7 +210,7 @@ int hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked) static int hostap_remove_sta(PSDevice pDevice, struct viawget_hostapd_param *param) { - UINT uNodeIndex; + unsigned int uNodeIndex; if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { @@ -240,7 +239,7 @@ static int hostap_add_sta(PSDevice pDevice, struct viawget_hostapd_param *param) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT uNodeIndex; + unsigned int uNodeIndex; if (!BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { @@ -300,7 +299,7 @@ static int hostap_get_info_sta(PSDevice pDevice, struct viawget_hostapd_param *param) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT uNodeIndex; + unsigned int uNodeIndex; if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { param->u.get_info_sta.inactive_sec = @@ -334,7 +333,7 @@ static int hostap_reset_txexc_sta(PSDevice pDevice, struct viawget_hostapd_param *param) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT uNodeIndex; + unsigned int uNodeIndex; if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0; @@ -364,13 +363,13 @@ static int hostap_set_flags_sta(PSDevice pDevice, struct viawget_hostapd_param *param) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT uNodeIndex; + unsigned int uNodeIndex; if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { pMgmt->sNodeDBTable[uNodeIndex].dwFlags |= param->u.set_flags_sta.flags_or; pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x \n", - (UINT)pMgmt->sNodeDBTable[uNodeIndex].dwFlags); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x\n", + (unsigned int) pMgmt->sNodeDBTable[uNodeIndex].dwFlags); } else { return -ENOENT; @@ -744,7 +743,7 @@ static int hostap_get_encryption(PSDevice pDevice, /* * Description: - * hostap_ioctl main function supported for hostap deamon. + * vt6656_hostap_ioctl main function supported for hostap deamon. * * Parameters: * In: @@ -756,7 +755,7 @@ static int hostap_get_encryption(PSDevice pDevice, * */ -int hostap_ioctl(PSDevice pDevice, struct iw_point *p) +int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p) { struct viawget_hostapd_param *param; int ret = 0; @@ -766,7 +765,7 @@ int hostap_ioctl(PSDevice pDevice, struct iw_point *p) p->length > VIAWGET_HOSTAPD_MAX_BUF_SIZE || !p->pointer) return -EINVAL; - param = (struct viawget_hostapd_param *) kmalloc((int)p->length, (int)GFP_KERNEL); + param = kmalloc((int)p->length, (int)GFP_KERNEL); if (param == NULL) return -ENOMEM; @@ -844,7 +843,7 @@ int hostap_ioctl(PSDevice pDevice, struct iw_point *p) return -EOPNOTSUPP; default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_ioctl: unknown cmd=%d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6656_hostap_ioctl: unknown cmd=%d\n", (int)param->cmd); return -EOPNOTSUPP; break; diff --git a/drivers/staging/vt6656/hostap.h b/drivers/staging/vt6656/hostap.h index 8fd667b542be..b660aee1ca0e 100644 --- a/drivers/staging/vt6656/hostap.h +++ b/drivers/staging/vt6656/hostap.h @@ -61,10 +61,7 @@ #define ARPHRD_IEEE80211 801 #endif -int hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked); -int hostap_ioctl(PSDevice pDevice, struct iw_point *p); - -#endif // __HOSTAP_H__ - - +int vt6656_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked); +int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p); +#endif /* __HOSTAP_H__ */ diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index 35053be6900d..89f5b18bdf1f 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -41,8 +41,8 @@ #include "usbpipe.h" /*--------------------- Static Definitions -------------------------*/ -//static int msglevel =MSG_LEVEL_DEBUG; -static int msglevel =MSG_LEVEL_INFO; +/* static int msglevel = MSG_LEVEL_DEBUG; */ +static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Classes ----------------------------*/ @@ -74,120 +74,151 @@ static int msglevel =MSG_LEVEL_INFO; * * Notes: * - * USB reads are by nature 'Blocking', and when in a read, the device looks like it's - * in a 'stall' condition, so we deliberately time out every second if we've gotten no data + * USB reads are by nature 'Blocking', and when in a read, the device looks + * like it's in a 'stall' condition, so we deliberately time out every second + * if we've gotten no data * -*/ -VOID -INTvWorkItem( - PVOID Context - ) +void INTvWorkItem(void *Context) { - PSDevice pDevice = (PSDevice) Context; - NTSTATUS ntStatus; + PSDevice pDevice = (PSDevice) Context; + NTSTATUS ntStatus; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n"); - - spin_lock_irq(&pDevice->lock); - if (pDevice->fKillEventPollingThread != TRUE) { - ntStatus = PIPEnsInterruptRead(pDevice); - } - spin_unlock_irq(&pDevice->lock); - - } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n"); + spin_lock_irq(&pDevice->lock); + if (pDevice->fKillEventPollingThread != TRUE) + ntStatus = PIPEnsInterruptRead(pDevice); + spin_unlock_irq(&pDevice->lock); +} NTSTATUS -INTnsProcessData( - IN PSDevice pDevice - ) +INTnsProcessData(PSDevice pDevice) { - NTSTATUS status = STATUS_SUCCESS; - PSINTData pINTData; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - struct net_device_stats* pStats = &pDevice->stats; - - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n"); - - pINTData = (PSINTData) pDevice->intBuf.pDataBuf; - if (pINTData->byTSR0 & TSR_VALID) { - STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt0 & 0x0F), (BYTE) (pINTData->byPkt0>>4), pINTData->byTSR0); - BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR0, pINTData->byPkt0); - //DBG_PRN_GRP01(("TSR0 %02x\n", pINTData->byTSR0)); - } - if (pINTData->byTSR1 & TSR_VALID) { - STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt1 & 0x0F), (BYTE) (pINTData->byPkt1>>4), pINTData->byTSR1); - BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR1, pINTData->byPkt1); - //DBG_PRN_GRP01(("TSR1 %02x\n", pINTData->byTSR1)); - } - if (pINTData->byTSR2 & TSR_VALID) { - STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt2 & 0x0F), (BYTE) (pINTData->byPkt2>>4), pINTData->byTSR2); - BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR2, pINTData->byPkt2); - //DBG_PRN_GRP01(("TSR2 %02x\n", pINTData->byTSR2)); - } - if (pINTData->byTSR3 & TSR_VALID) { - STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt3 & 0x0F), (BYTE) (pINTData->byPkt3>>4), pINTData->byTSR3); - BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR3, pINTData->byPkt3); - //DBG_PRN_GRP01(("TSR3 %02x\n", pINTData->byTSR3)); - } - if ( pINTData->byISR0 != 0 ) { - if (pINTData->byISR0 & ISR_BNTX) { - - if (pDevice->eOPMode == OP_MODE_AP) { - if(pMgmt->byDTIMCount > 0) { - pMgmt->byDTIMCount --; - pMgmt->sNodeDBTable[0].bRxPSPoll = FALSE; - } else if(pMgmt->byDTIMCount == 0) { - // check if mutltcast tx bufferring - pMgmt->byDTIMCount = pMgmt->byDTIMPeriod - 1; - pMgmt->sNodeDBTable[0].bRxPSPoll = TRUE; - if (pMgmt->sNodeDBTable[0].bPSEnable) { - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - } - } - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_BECON_SEND, NULL); - } // if (pDevice->eOPMode == OP_MODE_AP) - - pDevice->bBeaconSent = TRUE; - } else { - pDevice->bBeaconSent = FALSE; - } - if (pINTData->byISR0 & ISR_TBTT) { - if ( pDevice->bEnablePSMode ) { - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_TBTT_WAKEUP, NULL); - } - if ( pDevice->bChannelSwitch ) { - pDevice->byChannelSwitchCount--; - if ( pDevice->byChannelSwitchCount == 0 ) { - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_11H_CHSW, NULL); - } - } - } - LODWORD(pDevice->qwCurrTSF) = pINTData->dwLoTSF; - HIDWORD(pDevice->qwCurrTSF) = pINTData->dwHiTSF; - //DBG_PRN_GRP01(("ISR0 = %02x ,LoTsf = %08x,HiTsf = %08x\n", pINTData->byISR0, pINTData->dwLoTSF,pINTData->dwHiTSF)); - - STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic, pINTData->byRTSSuccess, - pINTData->byRTSFail, pINTData->byACKFail, pINTData->byFCSErr ); - STAvUpdateIsrStatCounter(&pDevice->scStatistic, pINTData->byISR0, pINTData->byISR1); - - } - - if ( pINTData->byISR1 != 0 ) { - if (pINTData->byISR1 & ISR_GPIO3) { - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_RADIO, NULL); - } - } - pDevice->intBuf.uDataLen = 0; - pDevice->intBuf.bInUse = FALSE; - - pStats->tx_packets = pDevice->scStatistic.ullTsrOK; - pStats->tx_bytes = pDevice->scStatistic.ullTxDirectedBytes + - pDevice->scStatistic.ullTxMulticastBytes + - pDevice->scStatistic.ullTxBroadcastBytes; - pStats->tx_errors = pDevice->scStatistic.dwTsrErr; - pStats->tx_dropped = pDevice->scStatistic.dwTsrErr; - - return status; + NTSTATUS status = STATUS_SUCCESS; + PSINTData pINTData; + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct net_device_stats *pStats = &pDevice->stats; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n"); + + pINTData = (PSINTData) pDevice->intBuf.pDataBuf; + if (pINTData->byTSR0 & TSR_VALID) { + STAvUpdateTDStatCounter(&(pDevice->scStatistic), + (BYTE) (pINTData->byPkt0 & 0x0F), + (BYTE) (pINTData->byPkt0>>4), + pINTData->byTSR0); + BSSvUpdateNodeTxCounter(pDevice, + &(pDevice->scStatistic), + pINTData->byTSR0, + pINTData->byPkt0); + /*DBG_PRN_GRP01(("TSR0 %02x\n", pINTData->byTSR0));*/ + } + if (pINTData->byTSR1 & TSR_VALID) { + STAvUpdateTDStatCounter(&(pDevice->scStatistic), + (BYTE) (pINTData->byPkt1 & 0x0F), + (BYTE) (pINTData->byPkt1>>4), + pINTData->byTSR1); + BSSvUpdateNodeTxCounter(pDevice, + &(pDevice->scStatistic), + pINTData->byTSR1, + pINTData->byPkt1); + /*DBG_PRN_GRP01(("TSR1 %02x\n", pINTData->byTSR1));*/ + } + if (pINTData->byTSR2 & TSR_VALID) { + STAvUpdateTDStatCounter(&(pDevice->scStatistic), + (BYTE) (pINTData->byPkt2 & 0x0F), + (BYTE) (pINTData->byPkt2>>4), + pINTData->byTSR2); + BSSvUpdateNodeTxCounter(pDevice, + &(pDevice->scStatistic), + pINTData->byTSR2, + pINTData->byPkt2); + /*DBG_PRN_GRP01(("TSR2 %02x\n", pINTData->byTSR2));*/ + } + if (pINTData->byTSR3 & TSR_VALID) { + STAvUpdateTDStatCounter(&(pDevice->scStatistic), + (BYTE) (pINTData->byPkt3 & 0x0F), + (BYTE) (pINTData->byPkt3>>4), + pINTData->byTSR3); + BSSvUpdateNodeTxCounter(pDevice, + &(pDevice->scStatistic), + pINTData->byTSR3, + pINTData->byPkt3); + /*DBG_PRN_GRP01(("TSR3 %02x\n", pINTData->byTSR3));*/ + } + if (pINTData->byISR0 != 0) { + if (pINTData->byISR0 & ISR_BNTX) { + if (pDevice->eOPMode == OP_MODE_AP) { + if (pMgmt->byDTIMCount > 0) { + pMgmt->byDTIMCount--; + pMgmt->sNodeDBTable[0].bRxPSPoll = + FALSE; + } else if (pMgmt->byDTIMCount == 0) { + /* check if mutltcast tx bufferring */ + pMgmt->byDTIMCount = + pMgmt->byDTIMPeriod-1; + pMgmt->sNodeDBTable[0].bRxPSPoll = TRUE; + if (pMgmt->sNodeDBTable[0].bPSEnable) + bScheduleCommand((void *) pDevice, + WLAN_CMD_RX_PSPOLL, + NULL); + } + bScheduleCommand((void *) pDevice, + WLAN_CMD_BECON_SEND, + NULL); + } /* if (pDevice->eOPMode == OP_MODE_AP) */ + pDevice->bBeaconSent = TRUE; + } else { + pDevice->bBeaconSent = FALSE; + } + if (pINTData->byISR0 & ISR_TBTT) { + if (pDevice->bEnablePSMode) + bScheduleCommand((void *) pDevice, + WLAN_CMD_TBTT_WAKEUP, + NULL); + if (pDevice->bChannelSwitch) { + pDevice->byChannelSwitchCount--; + if (pDevice->byChannelSwitchCount == 0) + bScheduleCommand((void *) pDevice, + WLAN_CMD_11H_CHSW, + NULL); + } + } + LODWORD(pDevice->qwCurrTSF) = pINTData->dwLoTSF; + HIDWORD(pDevice->qwCurrTSF) = pINTData->dwHiTSF; + /*DBG_PRN_GRP01(("ISR0 = %02x , + LoTsf = %08x, + HiTsf = %08x\n", + pINTData->byISR0, + pINTData->dwLoTSF, + pINTData->dwHiTSF)); */ + + STAvUpdate802_11Counter(&pDevice->s802_11Counter, + &pDevice->scStatistic, + pINTData->byRTSSuccess, + pINTData->byRTSFail, + pINTData->byACKFail, + pINTData->byFCSErr); + STAvUpdateIsrStatCounter(&pDevice->scStatistic, + pINTData->byISR0, + pINTData->byISR1); + } + + if (pINTData->byISR1 != 0) + if (pINTData->byISR1 & ISR_GPIO3) + bScheduleCommand((void *) pDevice, + WLAN_CMD_RADIO, + NULL); + pDevice->intBuf.uDataLen = 0; + pDevice->intBuf.bInUse = FALSE; + + pStats->tx_packets = pDevice->scStatistic.ullTsrOK; + pStats->tx_bytes = pDevice->scStatistic.ullTxDirectedBytes + + pDevice->scStatistic.ullTxMulticastBytes + + pDevice->scStatistic.ullTxBroadcastBytes; + pStats->tx_errors = pDevice->scStatistic.dwTsrErr; + pStats->tx_dropped = pDevice->scStatistic.dwTsrErr; + + return status; } diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h index 15e815a35967..cdf355130de7 100644 --- a/drivers/staging/vt6656/int.h +++ b/drivers/staging/vt6656/int.h @@ -67,17 +67,11 @@ SINTData, *PSINTData; /*--------------------- Export Functions --------------------------*/ -VOID -INTvWorkItem( - PVOID Context - ); +void INTvWorkItem(void *Context); NTSTATUS INTnsProcessData( - IN PSDevice pDevice + PSDevice pDevice ); -#endif // __INT_H__ - - - +#endif /* __INT_H__ */ diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h index 49bfe15f1335..fbba1d53e49d 100644 --- a/drivers/staging/vt6656/iocmd.h +++ b/drivers/staging/vt6656/iocmd.h @@ -37,12 +37,6 @@ #define DEF #endif -//typedef int BOOL; -//typedef uint32_t u32; -//typedef uint16_t u16; -//typedef uint8_t u8; - - // ioctl Command code #define MAGIC_CODE 0x3142 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0) @@ -50,7 +44,6 @@ #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2) #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3) - typedef enum tagWMAC_CMD { WLAN_CMD_BSS_SCAN, @@ -90,7 +83,6 @@ typedef enum tagWZONETYPE { #define ADHOC_STARTED 1 #define ADHOC_JOINTED 2 - #define PHY80211a 0 #define PHY80211b 1 #define PHY80211g 2 @@ -109,10 +101,10 @@ typedef enum tagWZONETYPE { // #pragma pack(1) typedef struct tagSCmdRequest { - U8 name[16]; + u8 name[16]; void *data; - U16 wResult; - U16 wCmdCode; + u16 wResult; + u16 wCmdCode; } SCmdRequest, *PSCmdRequest; // @@ -121,21 +113,20 @@ typedef struct tagSCmdRequest { typedef struct tagSCmdScan { - U8 ssid[SSID_MAXLEN + 2]; + u8 ssid[SSID_MAXLEN + 2]; } SCmdScan, *PSCmdScan; - // // BSS Join // typedef struct tagSCmdBSSJoin { - U16 wBSSType; - U16 wBBPType; - U8 ssid[SSID_MAXLEN + 2]; - U32 uChannel; + u16 wBSSType; + u16 wBBPType; + u8 ssid[SSID_MAXLEN + 2]; + u32 uChannel; BOOL bPSEnable; BOOL bShareKeyAuth; @@ -155,83 +146,80 @@ typedef struct tagSCmdZoneTypeSet { #ifdef WPA_SM_Transtatus typedef struct tagSWPAResult { char ifname[100]; - U8 proto; - U8 key_mgmt; - U8 eap_type; + u8 proto; + u8 key_mgmt; + u8 eap_type; BOOL authenticated; } SWPAResult, *PSWPAResult; #endif typedef struct tagSCmdStartAP { - U16 wBSSType; - U16 wBBPType; - U8 ssid[SSID_MAXLEN + 2]; - U32 uChannel; - U32 uBeaconInt; + u16 wBSSType; + u16 wBBPType; + u8 ssid[SSID_MAXLEN + 2]; + u32 uChannel; + u32 uBeaconInt; BOOL bShareKeyAuth; - U8 byBasicRate; + u8 byBasicRate; } SCmdStartAP, *PSCmdStartAP; - typedef struct tagSCmdSetWEP { BOOL bEnableWep; - U8 byKeyIndex; - U8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN]; + u8 byKeyIndex; + u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN]; BOOL bWepKeyAvailable[WEP_NKEYS]; - U32 auWepKeyLength[WEP_NKEYS]; + u32 auWepKeyLength[WEP_NKEYS]; } SCmdSetWEP, *PSCmdSetWEP; - - typedef struct tagSBSSIDItem { - U32 uChannel; - U8 abyBSSID[BSSID_LEN]; - U8 abySSID[SSID_MAXLEN + 1]; - U16 wBeaconInterval; - U16 wCapInfo; - U8 byNetType; + u32 uChannel; + u8 abyBSSID[BSSID_LEN]; + u8 abySSID[SSID_MAXLEN + 1]; + u16 wBeaconInterval; + u16 wCapInfo; + u8 byNetType; BOOL bWEPOn; - U32 uRSSI; + u32 uRSSI; } SBSSIDItem; typedef struct tagSBSSIDList { - U32 uItem; + u32 uItem; SBSSIDItem sBSSIDList[0]; } SBSSIDList, *PSBSSIDList; typedef struct tagSNodeItem { // STA info - U16 wAID; - U8 abyMACAddr[6]; - U16 wTxDataRate; - U16 wInActiveCount; - U16 wEnQueueCnt; - U16 wFlags; + u16 wAID; + u8 abyMACAddr[6]; + u16 wTxDataRate; + u16 wInActiveCount; + u16 wEnQueueCnt; + u16 wFlags; BOOL bPWBitOn; - U8 byKeyIndex; - U16 wWepKeyLength; - U8 abyWepKey[WEP_KEYMAXLEN]; + u8 byKeyIndex; + u16 wWepKeyLength; + u8 abyWepKey[WEP_KEYMAXLEN]; // Auto rate fallback vars BOOL bIsInFallback; - U32 uTxFailures; - U32 uTxAttempts; - U16 wFailureRatio; + u32 uTxFailures; + u32 uTxAttempts; + u16 wFailureRatio; } SNodeItem; typedef struct tagSNodeList { - U32 uItem; + u32 uItem; SNodeItem sNodeList[0]; } SNodeList, *PSNodeList; @@ -240,12 +228,12 @@ typedef struct tagSNodeList { typedef struct tagSCmdLinkStatus { BOOL bLink; - U16 wBSSType; - U8 byState; - U8 abyBSSID[BSSID_LEN]; - U8 abySSID[SSID_MAXLEN + 2]; - U32 uChannel; - U32 uLinkRate; + u16 wBSSType; + u8 byState; + u8 abyBSSID[BSSID_LEN]; + u8 abySSID[SSID_MAXLEN + 2]; + u32 uChannel; + u32 uLinkRate; } SCmdLinkStatus, *PSCmdLinkStatus; @@ -253,18 +241,18 @@ typedef struct tagSCmdLinkStatus { // 802.11 counter // typedef struct tagSDot11MIBCount { - U32 TransmittedFragmentCount; - U32 MulticastTransmittedFrameCount; - U32 FailedCount; - U32 RetryCount; - U32 MultipleRetryCount; - U32 RTSSuccessCount; - U32 RTSFailureCount; - U32 ACKFailureCount; - U32 FrameDuplicateCount; - U32 ReceivedFragmentCount; - U32 MulticastReceivedFrameCount; - U32 FCSErrorCount; + u32 TransmittedFragmentCount; + u32 MulticastTransmittedFrameCount; + u32 FailedCount; + u32 RetryCount; + u32 MultipleRetryCount; + u32 RTSSuccessCount; + u32 RTSFailureCount; + u32 ACKFailureCount; + u32 FrameDuplicateCount; + u32 ReceivedFragmentCount; + u32 MulticastReceivedFrameCount; + u32 FCSErrorCount; } SDot11MIBCount, *PSDot11MIBCount; @@ -276,119 +264,115 @@ typedef struct tagSStatMIBCount { // // ISR status count // - U32 dwIsrTx0OK; - U32 dwIsrTx1OK; - U32 dwIsrBeaconTxOK; - U32 dwIsrRxOK; - U32 dwIsrTBTTInt; - U32 dwIsrSTIMERInt; - U32 dwIsrUnrecoverableError; - U32 dwIsrSoftInterrupt; - U32 dwIsrRxNoBuf; + u32 dwIsrTx0OK; + u32 dwIsrTx1OK; + u32 dwIsrBeaconTxOK; + u32 dwIsrRxOK; + u32 dwIsrTBTTInt; + u32 dwIsrSTIMERInt; + u32 dwIsrUnrecoverableError; + u32 dwIsrSoftInterrupt; + u32 dwIsrRxNoBuf; ///////////////////////////////////// - U32 dwIsrUnknown; // unknown interrupt count + u32 dwIsrUnknown; /* unknown interrupt count */ // RSR status count // - U32 dwRsrFrmAlgnErr; - U32 dwRsrErr; - U32 dwRsrCRCErr; - U32 dwRsrCRCOk; - U32 dwRsrBSSIDOk; - U32 dwRsrADDROk; - U32 dwRsrICVOk; - U32 dwNewRsrShortPreamble; - U32 dwRsrLong; - U32 dwRsrRunt; - - U32 dwRsrRxControl; - U32 dwRsrRxData; - U32 dwRsrRxManage; - - U32 dwRsrRxPacket; - U32 dwRsrRxOctet; - U32 dwRsrBroadcast; - U32 dwRsrMulticast; - U32 dwRsrDirected; + u32 dwRsrFrmAlgnErr; + u32 dwRsrErr; + u32 dwRsrCRCErr; + u32 dwRsrCRCOk; + u32 dwRsrBSSIDOk; + u32 dwRsrADDROk; + u32 dwRsrICVOk; + u32 dwNewRsrShortPreamble; + u32 dwRsrLong; + u32 dwRsrRunt; + + u32 dwRsrRxControl; + u32 dwRsrRxData; + u32 dwRsrRxManage; + + u32 dwRsrRxPacket; + u32 dwRsrRxOctet; + u32 dwRsrBroadcast; + u32 dwRsrMulticast; + u32 dwRsrDirected; // 64-bit OID - U32 ullRsrOK; + u32 ullRsrOK; // for some optional OIDs (64 bits) and DMI support - U32 ullRxBroadcastBytes; - U32 ullRxMulticastBytes; - U32 ullRxDirectedBytes; - U32 ullRxBroadcastFrames; - U32 ullRxMulticastFrames; - U32 ullRxDirectedFrames; - - U32 dwRsrRxFragment; - U32 dwRsrRxFrmLen64; - U32 dwRsrRxFrmLen65_127; - U32 dwRsrRxFrmLen128_255; - U32 dwRsrRxFrmLen256_511; - U32 dwRsrRxFrmLen512_1023; - U32 dwRsrRxFrmLen1024_1518; + u32 ullRxBroadcastBytes; + u32 ullRxMulticastBytes; + u32 ullRxDirectedBytes; + u32 ullRxBroadcastFrames; + u32 ullRxMulticastFrames; + u32 ullRxDirectedFrames; + + u32 dwRsrRxFragment; + u32 dwRsrRxFrmLen64; + u32 dwRsrRxFrmLen65_127; + u32 dwRsrRxFrmLen128_255; + u32 dwRsrRxFrmLen256_511; + u32 dwRsrRxFrmLen512_1023; + u32 dwRsrRxFrmLen1024_1518; // TSR0,1 status count // - U32 dwTsrTotalRetry[2]; // total collision retry count - U32 dwTsrOnceRetry[2]; // this packet only occur one collision - U32 dwTsrMoreThanOnceRetry[2]; // this packet occur more than one collision - U32 dwTsrRetry[2]; // this packet has ever occur collision, - // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0) - U32 dwTsrACKData[2]; - U32 dwTsrErr[2]; - U32 dwAllTsrOK[2]; - U32 dwTsrRetryTimeout[2]; - U32 dwTsrTransmitTimeout[2]; - - U32 dwTsrTxPacket[2]; - U32 dwTsrTxOctet[2]; - U32 dwTsrBroadcast[2]; - U32 dwTsrMulticast[2]; - U32 dwTsrDirected[2]; + u32 dwTsrTotalRetry[2]; /* total collision retry count */ + u32 dwTsrOnceRetry[2]; /* this packet had one collision */ + u32 dwTsrMoreThanOnceRetry[2]; /* this packet had many collisions */ + u32 dwTsrRetry[2]; /* this packet has ever occur collision, + * that is (dwTsrOnceCollision0 plus + * dwTsrMoreThanOnceCollision0) */ + u32 dwTsrACKData[2]; + u32 dwTsrErr[2]; + u32 dwAllTsrOK[2]; + u32 dwTsrRetryTimeout[2]; + u32 dwTsrTransmitTimeout[2]; + + u32 dwTsrTxPacket[2]; + u32 dwTsrTxOctet[2]; + u32 dwTsrBroadcast[2]; + u32 dwTsrMulticast[2]; + u32 dwTsrDirected[2]; // RD/TD count - U32 dwCntRxFrmLength; - U32 dwCntTxBufLength; + u32 dwCntRxFrmLength; + u32 dwCntTxBufLength; - U8 abyCntRxPattern[16]; - U8 abyCntTxPattern[16]; + u8 abyCntRxPattern[16]; + u8 abyCntTxPattern[16]; - // Software check.... - U32 dwCntRxDataErr; // rx buffer data software compare CRC err count - U32 dwCntDecryptErr; // rx buffer data software compare CRC err count - U32 dwCntRxICVErr; // rx buffer data software compare CRC err count - U32 idxRxErrorDesc; // index for rx data error RD + /* Software check.... */ + u32 dwCntRxDataErr; /* rx buffer data CRC err count */ + u32 dwCntDecryptErr; /* rx buffer data CRC err count */ + u32 dwCntRxICVErr; /* rx buffer data CRC err count */ + u32 idxRxErrorDesc; /* index for rx data error RD */ - // 64-bit OID - U32 ullTsrOK[2]; + /* 64-bit OID */ + u32 ullTsrOK[2]; // for some optional OIDs (64 bits) and DMI support - U32 ullTxBroadcastFrames[2]; - U32 ullTxMulticastFrames[2]; - U32 ullTxDirectedFrames[2]; - U32 ullTxBroadcastBytes[2]; - U32 ullTxMulticastBytes[2]; - U32 ullTxDirectedBytes[2]; + u32 ullTxBroadcastFrames[2]; + u32 ullTxMulticastFrames[2]; + u32 ullTxDirectedFrames[2]; + u32 ullTxBroadcastBytes[2]; + u32 ullTxMulticastBytes[2]; + u32 ullTxDirectedBytes[2]; } SStatMIBCount, *PSStatMIBCount; - - - typedef struct tagSCmdValue { - U32 dwValue; + u32 dwValue; } SCmdValue, *PSCmdValue; - // // hostapd & viawget ioctl related // - // VIAGWET_IOCTL_HOSTAPD ioctl() cmd: enum { VIAWGET_HOSTAPD_FLUSH = 1, @@ -405,71 +389,62 @@ enum { VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12, }; - #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \ ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data)) // Maximum length for algorithm names (-1 for nul termination) used in ioctl() - - struct viawget_hostapd_param { - U32 cmd; - U8 sta_addr[6]; + u32 cmd; + u8 sta_addr[6]; union { struct { - U16 aid; - U16 capability; - U8 tx_supp_rates; + u16 aid; + u16 capability; + u8 tx_supp_rates; } add_sta; struct { - U32 inactive_sec; + u32 inactive_sec; } get_info_sta; struct { - U8 alg; - U32 flags; - U32 err; - U8 idx; - U8 seq[8]; - U16 key_len; - U8 key[0]; + u8 alg; + u32 flags; + u32 err; + u8 idx; + u8 seq[8]; + u16 key_len; + u8 key[0]; } crypt; struct { - U32 flags_and; - U32 flags_or; + u32 flags_and; + u32 flags_or; } set_flags_sta; struct { - U16 rid; - U16 len; - U8 data[0]; + u16 rid; + u16 len; + u8 data[0]; } rid; struct { - U8 len; - U8 data[0]; + u8 len; + u8 data[0]; } generic_elem; struct { - U16 cmd; - U16 reason_code; + u16 cmd; + u16 reason_code; } mlme; struct { - U8 ssid_len; - U8 ssid[32]; + u8 ssid_len; + u8 ssid[32]; } scan_req; } u; }; - - /*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Variables --------------------------*/ - /*--------------------- Export Types ------------------------------*/ - /*--------------------- Export Functions --------------------------*/ - - -#endif //__IOCMD_H__ +#endif /* __IOCMD_H__ */ diff --git a/drivers/staging/vt6656/ioctl.c b/drivers/staging/vt6656/ioctl.c index 6f33005a615f..19a84b66b097 100644 --- a/drivers/staging/vt6656/ioctl.c +++ b/drivers/staging/vt6656/ioctl.c @@ -72,16 +72,16 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { SNodeList sNodeList; PSBSSIDList pList; PSNodeList pNodeList; - UINT cbListCount; + unsigned int cbListCount; PKnownBSS pBSS; PKnownNodeDB pNode; - UINT ii, jj; + unsigned int ii, jj; SCmdLinkStatus sLinkStatus; BYTE abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16}; BYTE abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; DWORD dwKeyIndex= 0; BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - LONG ldBm; + signed long ldBm; pReq->wResult = 0; @@ -100,16 +100,21 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { memcpy(abyScanSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); } spin_lock_irq(&pDevice->lock); - if (memcmp(pMgmt->abyCurrBSSID, &abyNullAddr[0], 6) == 0) - BSSvClearBSSList((HANDLE)pDevice, FALSE); - else - BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin \n"); - if (pItemSSID->len != 0) - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); - else - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, NULL); + if (memcmp(pMgmt->abyCurrBSSID, &abyNullAddr[0], 6) == 0) + BSSvClearBSSList((void *) pDevice, FALSE); + else + BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin\n"); + + if (pItemSSID->len != 0) + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + abyScanSSID); + else + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); + spin_unlock_irq(&pDevice->lock); break; @@ -207,8 +212,10 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { netif_stop_queue(pDevice->dev); spin_lock_irq(&pDevice->lock); pMgmt->eCurrState = WMAC_STATE_IDLE; - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL); spin_unlock_irq(&pDevice->lock); break; @@ -330,7 +337,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { pList->sBSSIDList[ii].wBeaconInterval = pBSS->wBeaconInterval; pList->sBSSIDList[ii].wCapInfo = pBSS->wCapInfo; RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm); - pList->sBSSIDList[ii].uRSSI = (UINT)ldBm; + pList->sBSSIDList[ii].uRSSI = (unsigned int) ldBm; // pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN); pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; @@ -412,7 +419,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { break; }; if (sValue.dwValue == 1) { - if (hostap_set_hostapd(pDevice, 1, 1) == 0){ + if (vt6656_hostap_set_hostapd(pDevice, 1, 1) == 0){ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n"); } else { @@ -421,7 +428,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { } } else { - hostap_set_hostapd(pDevice, 0, 1); + vt6656_hostap_set_hostapd(pDevice, 0, 1); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n"); } @@ -480,7 +487,9 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { }; if (sValue.dwValue == 1) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); - memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr, U_ETHER_ADDR_LEN); + memcpy(pDevice->wpadev->dev_addr, + pDevice->dev->dev_addr, + ETH_ALEN); pDevice->bWPADEVUp = TRUE; } else { @@ -574,7 +583,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { netif_stop_queue(pDevice->dev); spin_lock_irq(&pDevice->lock); - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RUN_AP, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_RUN_AP, NULL); spin_unlock_irq(&pDevice->lock); break; diff --git a/drivers/staging/vt6656/ioctl.h b/drivers/staging/vt6656/ioctl.h index 07d228399c3c..caa4ac963d93 100644 --- a/drivers/staging/vt6656/ioctl.h +++ b/drivers/staging/vt6656/ioctl.h @@ -43,15 +43,12 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq); /* -VOID vConfigWEPKey ( - IN PSDevice pDevice, - IN DWORD dwKeyIndex, - IN PBYTE pbyKey, - IN ULONG uKeyLength +void vConfigWEPKey ( + PSDevice pDevice, + DWORD dwKeyIndex, + PBYTE pbyKey, + unsigned long uKeyLength ); */ -#endif // __IOCTL_H__ - - - +#endif /* __IOCTL_H__ */ diff --git a/drivers/staging/vt6656/iowpa.h b/drivers/staging/vt6656/iowpa.h index 5750b5b548e8..da03edcbacb0 100644 --- a/drivers/staging/vt6656/iowpa.h +++ b/drivers/staging/vt6656/iowpa.h @@ -153,6 +153,4 @@ struct viawget_scan_result { /*--------------------- Export Functions --------------------------*/ - - -#endif //__IOWPA_H__ +#endif /* __IOWPA_H__ */ diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index b7c6a22fe321..fa40522d4a9a 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -209,9 +209,9 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! spin_lock_irq(&pDevice->lock); - #ifdef update_BssList - BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); - #endif +#ifdef update_BssList + BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); +#endif //mike add: active scan OR passive scan OR desire_ssid scan if(wrq->length == sizeof(struct iw_scan_req)) { @@ -229,7 +229,7 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! pMgmt->eScanType = WMAC_SCAN_PASSIVE; PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID, ((PWLAN_IE_SSID)abyScanSSID)->len); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); spin_unlock_irq(&pDevice->lock); return 0; @@ -244,7 +244,7 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! pMgmt->eScanType = WMAC_SCAN_PASSIVE; //printk("SIOCSIWSCAN:WLAN_CMD_BSSID_SCAN\n"); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); spin_unlock_irq(&pDevice->lock); return 0; @@ -758,7 +758,6 @@ int iwctl_siwap(struct net_device *dev, if (wrq->sa_family != ARPHRD_ETHER) rc = -EINVAL; else { - memset(pMgmt->abyDesireBSSID, 0xFF, 6); memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6); //mike :add @@ -770,7 +769,7 @@ int iwctl_siwap(struct net_device *dev, //mike add: if desired AP is hidden ssid(there are two same BSSID in list), // then ignore,because you don't known which one to be connect with?? { - UINT ii , uSameBssidNum=0; + unsigned int ii, uSameBssidNum = 0; for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && IS_ETH_ADDRESS_EQUAL(pMgmt->sBSSList[ii].abyBSSID,pMgmt->abyDesireBSSID)) { @@ -934,9 +933,8 @@ int iwctl_siwessid(struct net_device *dev, { PKnownBSS pCurr = NULL; BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - UINT ii , uSameBssidNum=0; + unsigned int ii, uSameBssidNum = 0; - memset(abyTmpDesireSSID,0,sizeof(abyTmpDesireSSID)); memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID)); pCurr = BSSpSearchBSSList(pDevice, NULL, @@ -946,10 +944,14 @@ int iwctl_siwessid(struct net_device *dev, if (pCurr == NULL){ PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); - vResetCommandTimer((HANDLE) pDevice); + vResetCommandTimer((void *) pDevice); pMgmt->eScanType = WMAC_SCAN_ACTIVE; - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, + pMgmt->abyDesireSSID); } else { //mike:to find out if that desired SSID is a hidden-ssid AP , // by means of judging if there are two same BSSID exist in list ? @@ -961,10 +963,14 @@ int iwctl_siwessid(struct net_device *dev, } if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n"); - vResetCommandTimer((HANDLE) pDevice); + vResetCommandTimer((void *) pDevice); pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, + pMgmt->abyDesireSSID); } } } @@ -1434,7 +1440,7 @@ int iwctl_giwencode(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; char abyKey[WLAN_WEP232_KEYLEN]; - UINT index = (UINT)(wrq->flags & IW_ENCODE_INDEX); + unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX); PSKeyItem pKey = NULL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); @@ -1480,7 +1486,7 @@ int iwctl_giwencode(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); char abyKey[WLAN_WEP232_KEYLEN]; - UINT index = (UINT)(wrq->flags & IW_ENCODE_INDEX); + unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX); PSKeyItem pKey = NULL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); @@ -1556,11 +1562,11 @@ int iwctl_siwpower(struct net_device *dev, } if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { pDevice->ePSMode = WMAC_POWER_FAST; - PSvEnablePowerSaving((HANDLE)pDevice, pMgmt->wListenInterval); + PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval); } else if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { pDevice->ePSMode = WMAC_POWER_FAST; - PSvEnablePowerSaving((HANDLE)pDevice, pMgmt->wListenInterval); + PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval); } switch (wrq->flags & IW_POWER_MODE) { case IW_POWER_UNICAST_R: @@ -2009,12 +2015,16 @@ int iwctl_siwmlme(struct net_device *dev, case IW_MLME_DEAUTH: //this command seems to be not complete,please test it --einsnliu //printk("iwctl_siwmlme--->send DEAUTH\n"); - //bScheduleCommand((HANDLE) pDevice, WLAN_CMD_DEAUTH, (PBYTE)&reason); + /* bScheduleCommand((void *) pDevice, + WLAN_CMD_DEAUTH, + (PBYTE)&reason); */ //break; case IW_MLME_DISASSOC: if(pDevice->bLinkPass == TRUE){ PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n"); - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_DISASSOCIATE, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_DISASSOCIATE, + NULL); } break; default: diff --git a/drivers/staging/vt6656/iwctl.h b/drivers/staging/vt6656/iwctl.h index 3096de0ba1bd..df9a4cf3baac 100644 --- a/drivers/staging/vt6656/iwctl.h +++ b/drivers/staging/vt6656/iwctl.h @@ -223,7 +223,4 @@ int iwctl_siwmlme(struct net_device *dev, extern const struct iw_handler_def iwctl_handler_def; extern const struct iw_priv_args iwctl_private_args; -#endif // __IWCTL_H__ - - - +#endif /* __IWCTL_H__ */ diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 13fc69a1a084..b0890c181e7d 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -60,8 +60,8 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Variables --------------------------*/ /*--------------------- Static Functions --------------------------*/ -static VOID -s_vCheckKeyTableValid (PVOID pDeviceHandler, PSKeyManagement pTable) +static void s_vCheckKeyTableValid(void *pDeviceHandler, + PSKeyManagement pTable) { PSDevice pDevice = (PSDevice) pDeviceHandler; int i; @@ -112,7 +112,7 @@ s_vCheckKeyTableValid (PVOID pDeviceHandler, PSKeyManagement pTable) * Return Value: none * */ -VOID KeyvInitTable(PVOID pDeviceHandler, PSKeyManagement pTable) +void KeyvInitTable(void *pDeviceHandler, PSKeyManagement pTable) { PSDevice pDevice = (PSDevice) pDeviceHandler; int i; @@ -123,10 +123,12 @@ VOID KeyvInitTable(PVOID pDeviceHandler, PSKeyManagement pTable) for (i=0;i<MAX_KEY_TABLE;i++) { pTable->KeyTable[i].bInUse = FALSE; pTable->KeyTable[i].PairwiseKey.bKeyValid = FALSE; - pTable->KeyTable[i].PairwiseKey.pvKeyTable = (PVOID)&pTable->KeyTable[i]; + 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].pvKeyTable = (PVOID) &(pTable->KeyTable[i]); + pTable->KeyTable[i].GroupKey[jj].pvKeyTable = + (void *) &(pTable->KeyTable[i]); } pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].dwGTKeyIndex = 0; @@ -162,12 +164,8 @@ VOID KeyvInitTable(PVOID pDeviceHandler, PSKeyManagement pTable) * Return Value: TRUE if found otherwise FALSE * */ -BOOL KeybGetKey ( - IN PSKeyManagement pTable, - IN PBYTE pbyBSSID, - IN DWORD dwKeyIndex, - OUT PSKeyItem *pKey - ) +BOOL KeybGetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, + PSKeyItem *pKey) { int i; @@ -220,12 +218,12 @@ BOOL KeybGetKey ( * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybSetKey ( - PVOID pDeviceHandler, +BOOL KeybSetKey( + void *pDeviceHandler, PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, - ULONG uKeyLength, + unsigned long uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode @@ -233,9 +231,9 @@ BOOL KeybSetKey ( { PSDevice pDevice = (PSDevice) pDeviceHandler; int i,j; - UINT ii; + unsigned int ii; PSKeyItem pKey; - UINT uKeyIdx; + unsigned int uKeyIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetKey: %lX\n", dwKeyIndex); @@ -312,7 +310,7 @@ BOOL KeybSetKey ( } } if (j < (MAX_KEY_TABLE-1)) { - memcpy(pTable->KeyTable[j].abyBSSID,pbyBSSID,U_ETHER_ADDR_LEN); + memcpy(pTable->KeyTable[j].abyBSSID, pbyBSSID, ETH_ALEN); pTable->KeyTable[j].bInUse = TRUE; if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key @@ -393,8 +391,8 @@ BOOL KeybSetKey ( * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybRemoveKey ( - PVOID pDeviceHandler, +BOOL KeybRemoveKey( + void *pDeviceHandler, PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex @@ -474,8 +472,8 @@ BOOL KeybRemoveKey ( * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybRemoveAllKey ( - PVOID pDeviceHandler, +BOOL KeybRemoveAllKey( + void *pDeviceHandler, PSKeyManagement pTable, PBYTE pbyBSSID ) @@ -510,8 +508,8 @@ BOOL KeybRemoveAllKey ( * Return Value: TRUE if success otherwise FALSE * */ -VOID KeyvRemoveWEPKey ( - PVOID pDeviceHandler, +void KeyvRemoveWEPKey( + void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex ) @@ -533,8 +531,8 @@ VOID KeyvRemoveWEPKey ( return; } -VOID KeyvRemoveAllWEPKey ( - PVOID pDeviceHandler, +void KeyvRemoveAllWEPKey( + void *pDeviceHandler, PSKeyManagement pTable ) { @@ -561,12 +559,8 @@ VOID KeyvRemoveAllWEPKey ( * Return Value: TRUE if found otherwise FALSE * */ -BOOL KeybGetTransmitKey ( - IN PSKeyManagement pTable, - IN PBYTE pbyBSSID, - IN DWORD dwKeyType, - OUT PSKeyItem *pKey - ) +BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, + PSKeyItem *pKey) { int i, ii; @@ -641,10 +635,7 @@ BOOL KeybGetTransmitKey ( * Return Value: TRUE if found otherwise FALSE * */ -BOOL KeybCheckPairewiseKey ( - IN PSKeyManagement pTable, - OUT PSKeyItem *pKey - ) +BOOL KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) { int i; @@ -675,23 +666,23 @@ BOOL KeybCheckPairewiseKey ( * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybSetDefaultKey ( - PVOID pDeviceHandler, +BOOL KeybSetDefaultKey( + void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex, - ULONG uKeyLength, + unsigned long uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode ) { PSDevice pDevice = (PSDevice) pDeviceHandler; - UINT ii; + unsigned int ii; PSKeyItem pKey; - UINT uKeyIdx; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetDefaultKey: %1x, %d \n", (int)dwKeyIndex, (int)uKeyLength); + unsigned int 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); @@ -700,7 +691,7 @@ BOOL KeybSetDefaultKey ( } pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) + for (ii = 0; ii < ETH_ALEN; ii++) pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; // Group key @@ -783,11 +774,11 @@ BOOL KeybSetDefaultKey ( * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybSetAllGroupKey ( - PVOID pDeviceHandler, +BOOL KeybSetAllGroupKey( + void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex, - ULONG uKeyLength, + unsigned long uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode @@ -795,9 +786,9 @@ BOOL KeybSetAllGroupKey ( { PSDevice pDevice = (PSDevice) pDeviceHandler; int i; - UINT ii; + unsigned int ii; PSKeyItem pKey; - UINT uKeyIdx; + unsigned int uKeyIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex); diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h index b15a64cb3868..f749c7a027d3 100644 --- a/drivers/staging/vt6656/key.h +++ b/drivers/staging/vt6656/key.h @@ -58,7 +58,7 @@ typedef struct tagSKeyItem { BOOL bKeyValid; - ULONG uKeyLength; + unsigned long uKeyLength; BYTE abyKey[MAX_KEY_LEN]; QWORD KeyRSC; DWORD dwTSC47_16; @@ -66,12 +66,12 @@ typedef struct tagSKeyItem BYTE byCipherSuite; BYTE byReserved0; DWORD dwKeyIndex; - PVOID pvKeyTable; + void *pvKeyTable; } SKeyItem, *PSKeyItem; //64 typedef struct tagSKeyTable { - BYTE abyBSSID[U_ETHER_ADDR_LEN]; //6 + BYTE abyBSSID[ETH_ALEN]; /* 6 */ BYTE byReserved0[2]; //8 SKeyItem PairwiseKey; SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328 @@ -97,81 +97,69 @@ typedef struct tagSKeyManagement /*--------------------- Export Functions --------------------------*/ -VOID KeyvInitTable(PVOID pDeviceHandler, PSKeyManagement pTable); +void KeyvInitTable(void *pDeviceHandler, PSKeyManagement pTable); -BOOL KeybGetKey( - IN PSKeyManagement pTable, - IN PBYTE pbyBSSID, - IN DWORD dwKeyIndex, - OUT PSKeyItem *pKey - ); +BOOL KeybGetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, + PSKeyItem *pKey); BOOL KeybSetKey( - PVOID pDeviceHandler, + void *pDeviceHandler, PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, - ULONG uKeyLength, + unsigned long uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode ); BOOL KeybRemoveKey( - PVOID pDeviceHandler, + void *pDeviceHandler, PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex ); -BOOL KeybRemoveAllKey ( - PVOID pDeviceHandler, +BOOL KeybRemoveAllKey( + void *pDeviceHandler, PSKeyManagement pTable, PBYTE pbyBSSID ); -VOID KeyvRemoveWEPKey( - PVOID pDeviceHandler, +void KeyvRemoveWEPKey( + void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex ); -VOID KeyvRemoveAllWEPKey( - PVOID pDeviceHandler, +void KeyvRemoveAllWEPKey( + void *pDeviceHandler, PSKeyManagement pTable ); -BOOL KeybGetTransmitKey( - IN PSKeyManagement pTable, - IN PBYTE pbyBSSID, - IN DWORD dwKeyType, - OUT PSKeyItem *pKey - ); +BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, + PSKeyItem *pKey); -BOOL KeybCheckPairewiseKey( - IN PSKeyManagement pTable, - OUT PSKeyItem *pKey - ); +BOOL KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey); -BOOL KeybSetDefaultKey ( - PVOID pDeviceHandler, +BOOL KeybSetDefaultKey( + void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex, - ULONG uKeyLength, + unsigned long uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode ); -BOOL KeybSetAllGroupKey ( - PVOID pDeviceHandler, +BOOL KeybSetAllGroupKey( + void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex, - ULONG uKeyLength, + unsigned long uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode ); -#endif // __KEY_H__ - +#endif /* __KEY_H__ */ diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 55a798668fa5..0ab3db025f33 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -70,7 +70,7 @@ static int msglevel =MSG_LEVEL_INFO; */ void MACvSetMultiAddrByHash (PSDevice pDevice, BYTE byHashIdx) { - UINT uByteIdx; + unsigned int uByteIdx; BYTE byBitMask; BYTE pbyData[2]; @@ -110,7 +110,7 @@ void MACvSetMultiAddrByHash (PSDevice pDevice, BYTE byHashIdx) * Return Value: none * */ -VOID MACvWriteMultiAddr (PSDevice pDevice, UINT uByteIdx, BYTE byData) +void MACvWriteMultiAddr(PSDevice pDevice, unsigned int uByteIdx, BYTE byData) { BYTE byData1; @@ -199,7 +199,7 @@ BYTE pbyData[4]; * Return Value: none * */ -void MACvDisableKeyEntry (PSDevice pDevice, UINT uEntryIdx) +void MACvDisableKeyEntry(PSDevice pDevice, unsigned int uEntryIdx) { WORD wOffset; BYTE byData; @@ -239,7 +239,9 @@ BYTE byData; * Return Value: none * */ -void MACvSetKeyEntry (PSDevice pDevice, WORD wKeyCtl, UINT uEntryIdx, UINT uKeyIdx, PBYTE pbyAddr, PDWORD pdwKey) +void MACvSetKeyEntry(PSDevice pDevice, WORD wKeyCtl, + unsigned int uEntryIdx, unsigned int uKeyIdx, + PBYTE pbyAddr, PDWORD pdwKey) { PBYTE pbyKey; WORD wOffset; @@ -247,10 +249,6 @@ DWORD dwData1,dwData2; int ii; BYTE pbyData[24]; - - - - if ( pDevice->byLocalID <= MAC_REVISION_A1 ) { if ( pDevice->sMgmtObj.byCSSPK == KEY_CTL_CCMP ) return; diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h index fe99e3df2a51..775c70928ec7 100644 --- a/drivers/staging/vt6656/mac.h +++ b/drivers/staging/vt6656/mac.h @@ -421,12 +421,13 @@ /*--------------------- Export Functions --------------------------*/ void MACvSetMultiAddrByHash (PSDevice pDevice, BYTE byHashIdx); -VOID MACvWriteMultiAddr (PSDevice pDevice, UINT uByteIdx, BYTE byData); +void MACvWriteMultiAddr(PSDevice pDevice, unsigned int uByteIdx, BYTE byData); BOOL MACbShutdown(PSDevice pDevice);; void MACvSetBBType(PSDevice pDevice,BYTE byType); void MACvSetMISCFifo (PSDevice pDevice, WORD wOffset, DWORD dwData); -void MACvDisableKeyEntry(PSDevice pDevice, UINT uEntryIdx); -void MACvSetKeyEntry(PSDevice pDevice, WORD wKeyCtl, UINT uEntryIdx, UINT uKeyIdx, PBYTE pbyAddr, PDWORD pdwKey); +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); @@ -439,4 +440,4 @@ void MACvEnableBarkerPreambleMd(PSDevice pDevice); void MACvDisableBarkerPreambleMd(PSDevice pDevice); void MACvWriteBeaconInterval(PSDevice pDevice, WORD wInterval); -#endif // __MAC_H__ +#endif /* __MAC_H__ */ diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 49270db98fbb..098b0455e325 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -26,7 +26,7 @@ * * Functions: * - * vntwusb_found1 - module initial (insmod) driver entry + * vt6656_probe - module initial (insmod) driver entry * device_remove1 - module remove entry * device_open - allocate dma/descripter resource & initial mac/bbp function * device_xmit - asynchrous data tx function @@ -222,15 +222,11 @@ DEVICE_PARAM(b80211hEnable, "802.11h mode"); // Static vars definitions // - - -static struct usb_device_id vntwusb_table[] = { +static struct usb_device_id vt6656_table[] __devinitdata = { {USB_DEVICE(VNT_USB_VENDOR_ID, VNT_USB_PRODUCT_ID)}, {} }; - - // Frequency list (map channels to frequencies) /* static const long frequency_list[] = { @@ -250,15 +246,17 @@ static const long frequency_list[] = { static const struct iw_handler_def iwctl_handler_def; */ +/*--------------------- Static Functions --------------------------*/ +static int vt6656_probe(struct usb_interface *intf, + const struct usb_device_id *id); +static void vt6656_disconnect(struct usb_interface *intf); -/*--------------------- Static Functions --------------------------*/ -static int vntwusb_found1(struct usb_interface *intf, const struct usb_device_id *id); -static void vntwusb_disconnect(struct usb_interface *intf); #ifdef CONFIG_PM /* Minimal support for suspend and resume */ -static int vntwusb_suspend(struct usb_interface *intf, pm_message_t message); -static int vntwusb_resume(struct usb_interface *intf); -#endif +static int vt6656_suspend(struct usb_interface *intf, pm_message_t message); +static int vt6656_resume(struct usb_interface *intf); +#endif /* CONFIG_PM */ + static struct net_device_stats *device_get_stats(struct net_device *dev); static int device_open(struct net_device *dev); static int device_xmit(struct sk_buff *skb, struct net_device *dev); @@ -279,8 +277,10 @@ static void device_free_frag_bufs(PSDevice pDevice); static BOOL device_alloc_bufs(PSDevice pDevice); static int Read_config_file(PSDevice pDevice); -static UCHAR *Config_FileOperation(PSDevice pDevice); -static int Config_FileGetParameter(UCHAR *string, UCHAR *dest,UCHAR *source); +static unsigned char *Config_FileOperation(PSDevice pDevice); +static int Config_FileGetParameter(unsigned char *string, + unsigned char *dest, + unsigned char *source); //2008-0714<Add>by Mike Liu static BOOL device_release_WPADEV(PSDevice pDevice); @@ -297,14 +297,13 @@ static void usb_device_reset(PSDevice pDevice); static void device_set_options(PSDevice pDevice) { - BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; - BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; - + BYTE abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + BYTE abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; + u8 abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; - memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, U_ETHER_ADDR_LEN); - memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, U_ETHER_ADDR_LEN); - memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, U_ETHER_ADDR_LEN); + memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN); + memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); + memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN); pDevice->cbTD = TX_DESC_DEF0; pDevice->cbRD = RX_DESC_DEF0; @@ -334,20 +333,20 @@ device_set_options(PSDevice pDevice) { } -static VOID device_init_diversity_timer(PSDevice pDevice) { - +static void device_init_diversity_timer(PSDevice pDevice) +{ init_timer(&pDevice->TimerSQ3Tmax1); - pDevice->TimerSQ3Tmax1.data = (ULONG)pDevice; + pDevice->TimerSQ3Tmax1.data = (unsigned long)pDevice; pDevice->TimerSQ3Tmax1.function = (TimerFunction)TimerSQ3CallBack; pDevice->TimerSQ3Tmax1.expires = RUN_AT(HZ); init_timer(&pDevice->TimerSQ3Tmax2); - pDevice->TimerSQ3Tmax2.data = (ULONG)pDevice; + pDevice->TimerSQ3Tmax2.data = (unsigned long)pDevice; pDevice->TimerSQ3Tmax2.function = (TimerFunction)TimerSQ3CallBack; pDevice->TimerSQ3Tmax2.expires = RUN_AT(HZ); init_timer(&pDevice->TimerSQ3Tmax3); - pDevice->TimerSQ3Tmax3.data = (ULONG)pDevice; + pDevice->TimerSQ3Tmax3.data = (unsigned long)pDevice; pDevice->TimerSQ3Tmax3.function = (TimerFunction)TimerSQ3Tmax3CallBack; pDevice->TimerSQ3Tmax3.expires = RUN_AT(HZ); @@ -361,11 +360,11 @@ static VOID device_init_diversity_timer(PSDevice pDevice) { static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) { - BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; - BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; + 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; - UINT ii; + unsigned int ii; CMD_CARD_INIT sInitCmd; NTSTATUS ntStatus = STATUS_SUCCESS; RSP_CARD_INIT sInitRsp; @@ -377,10 +376,12 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", InitType, pDevice->byPacketType); spin_lock_irq(&pDevice->lock); - if (InitType == DEVICE_INIT_COLD) { - memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, U_ETHER_ADDR_LEN); - memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, U_ETHER_ADDR_LEN); - memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, U_ETHER_ADDR_LEN); + if (InitType == DEVICE_INIT_COLD) { + memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN); + memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); + memcpy(pDevice->abySNAP_Bridgetunnel, + abySNAP_Bridgetunnel, + ETH_ALEN); if ( !FIRMWAREbCheckVersion(pDevice) ) { if (FIRMWAREbDownload(pDevice) == TRUE) { @@ -605,7 +606,9 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) // get Permanent network address memcpy(pDevice->abyPermanentNetAddr,&(sInitRsp.byNetAddr[0]),6); - memcpy(pDevice->abyCurrentNetAddr, pDevice->abyPermanentNetAddr, U_ETHER_ADDR_LEN); + memcpy(pDevice->abyCurrentNetAddr, + pDevice->abyPermanentNetAddr, + ETH_ALEN); // if exist SW network address, use SW network address. @@ -712,7 +715,8 @@ static BOOL device_release_WPADEV(PSDevice pDevice) } #ifdef CONFIG_PM /* Minimal support for suspend and resume */ -static int vntwusb_suspend(struct usb_interface *intf, pm_message_t message) + +static int vt6656_suspend(struct usb_interface *intf, pm_message_t message) { PSDevice pDevice = usb_get_intfdata(intf); struct net_device *dev = pDevice->dev; @@ -727,7 +731,7 @@ if(dev != NULL) { return 0; } -static int vntwusb_resume(struct usb_interface *intf) +static int vt6656_resume(struct usb_interface *intf) { PSDevice pDevice = usb_get_intfdata(intf); struct net_device *dev = pDevice->dev; @@ -742,8 +746,8 @@ static int vntwusb_resume(struct usb_interface *intf) } return 0; } -#endif +#endif /* CONFIG_PM */ static const struct net_device_ops device_netdev_ops = { .ndo_open = device_open, @@ -755,10 +759,10 @@ static const struct net_device_ops device_netdev_ops = { }; -static int -vntwusb_found1(struct usb_interface *intf, const struct usb_device_id *id) +static int __devinit +vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) { - BYTE fake_mac[U_ETHER_ADDR_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01};//fake MAC address + u8 fake_mac[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; struct usb_device *udev = interface_to_usbdev(intf); int rc = 0; struct net_device *netdev = NULL; @@ -789,7 +793,7 @@ vntwusb_found1(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 = (PVOID)pDevice; + pDevice->sMgmtObj.pAdapter = (void *)pDevice; netdev->netdev_ops = &device_netdev_ops; @@ -799,7 +803,7 @@ vntwusb_found1(struct usb_interface *intf, const struct usb_device_id *id) //2007-0821-01<Add>by MikeLiu usb_set_intfdata(intf, pDevice); SET_NETDEV_DEV(netdev, &intf->dev); - memcpy(pDevice->dev->dev_addr, fake_mac, U_ETHER_ADDR_LEN); //use fake mac address + memcpy(pDevice->dev->dev_addr, fake_mac, ETH_ALEN); rc = register_netdev(netdev); if (rc != 0) { printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n"); @@ -841,7 +845,8 @@ err_nomem: } -static VOID device_free_tx_bufs(PSDevice pDevice) { +static void device_free_tx_bufs(PSDevice pDevice) +{ PUSB_SEND_CONTEXT pTxContext; int ii; @@ -860,7 +865,8 @@ static VOID device_free_tx_bufs(PSDevice pDevice) { } -static VOID device_free_rx_bufs(PSDevice pDevice) { +static void device_free_rx_bufs(PSDevice pDevice) +{ PRCB pRCB; int ii; @@ -892,8 +898,8 @@ static void usb_device_reset(PSDevice pDevice) return ; } -static VOID device_free_int_bufs(PSDevice pDevice) { - +static void device_free_int_bufs(PSDevice pDevice) +{ if (pDevice->intBuf.pDataBuf != NULL) kfree(pDevice->intBuf.pDataBuf); return; @@ -915,7 +921,7 @@ static BOOL device_alloc_bufs(PSDevice pDevice) { goto free_tx; } pDevice->apTD[ii] = pTxContext; - pTxContext->pDevice = (PVOID) pDevice; + pTxContext->pDevice = (void *) pDevice; //allocate URBs pTxContext->pUrb = usb_alloc_urb(0, GFP_ATOMIC); if (pTxContext->pUrb == NULL) { @@ -944,7 +950,7 @@ static BOOL device_alloc_bufs(PSDevice pDevice) { for (ii = 0; ii < pDevice->cbRD; ii++) { pDevice->apRCB[ii] = pRCB; - pRCB->pDevice = (PVOID) pDevice; + pRCB->pDevice = (void *) pDevice; //allocate URBs pRCB->pUrb = usb_alloc_urb(0, GFP_ATOMIC); @@ -1102,8 +1108,8 @@ static int device_open(struct net_device *dev) { // Init for Key Management KeyvInitTable(pDevice,&pDevice->sKey); - memcpy(pDevice->sMgmtObj.abyMACAddr, pDevice->abyCurrentNetAddr, U_ETHER_ADDR_LEN); - memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, U_ETHER_ADDR_LEN); + memcpy(pDevice->sMgmtObj.abyMACAddr, pDevice->abyCurrentNetAddr, ETH_ALEN); + memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, ETH_ALEN); pDevice->bStopTx0Pkt = FALSE; pDevice->bStopDataPkt = FALSE; pDevice->bRoaming = FALSE; //DavidWang @@ -1154,12 +1160,12 @@ static int device_open(struct net_device *dev) { } if (pDevice->sMgmtObj.eConfigMode == WMAC_CONFIG_AP) { - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RUN_AP, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_RUN_AP, NULL); } else { //mike:mark@2008-11-10 - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_BSSID_SCAN, NULL); - //bScheduleCommand((HANDLE)pDevice, WLAN_CMD_SSID, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); + /* bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL); */ } @@ -1216,7 +1222,7 @@ static int device_close(struct net_device *dev) { //2007-1121-02<Add>by EinsnLiu if (pDevice->bLinkPass) { - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_DISASSOCIATE, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL); mdelay(30); } //End Add @@ -1285,8 +1291,7 @@ device_release_WPADEV(pDevice); } -static void vntwusb_disconnect(struct usb_interface *intf) - +static void __devexit vt6656_disconnect(struct usb_interface *intf) { PSDevice pDevice = usb_get_intfdata(intf); @@ -1333,7 +1338,7 @@ device_release_WPADEV(pDevice); static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { PSDevice pDevice=netdev_priv(dev); PBYTE pbMPDU; - UINT cbMPDULen = 0; + unsigned int cbMPDULen = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211\n"); @@ -1408,24 +1413,27 @@ static inline u32 ether_crc(int length, unsigned char *data) } //find out the start position of str2 from str1 -static UCHAR *kstrstr(const UCHAR *str1,const UCHAR *str2) { - int str1_len=strlen(str1); - int str2_len=strlen(str2); +static unsigned char *kstrstr(const unsigned char *str1, + const unsigned char *str2) { + int str1_len = strlen(str1); + int str2_len = strlen(str2); while (str1_len >= str2_len) { str1_len--; if(memcmp(str1,str2,str2_len)==0) - return (UCHAR *)str1; + return (unsigned char *) str1; str1++; } return NULL; } -static int Config_FileGetParameter(UCHAR *string, UCHAR *dest,UCHAR *source) +static int Config_FileGetParameter(unsigned char *string, + unsigned char *dest, + unsigned char *source) { - UCHAR buf1[100]; - UCHAR buf2[100]; - UCHAR *start_p=NULL,*end_p=NULL,*tmp_p=NULL; + unsigned char buf1[100]; + unsigned char buf2[100]; + unsigned char *start_p = NULL, *end_p = NULL, *tmp_p = NULL; int ii; memset(buf1,0,100); @@ -1434,7 +1442,8 @@ static int Config_FileGetParameter(UCHAR *string, UCHAR *dest,UCHAR *source) source+=strlen(buf1); //find target string start point - if((start_p = kstrstr(source,buf1))==NULL) + start_p = kstrstr(source,buf1); + if (start_p == NULL) return FALSE; //check if current config line is marked by "#" ?? @@ -1446,7 +1455,8 @@ for(ii=1;;ii++) { } //find target string end point - if((end_p = kstrstr(start_p,"\n"))==NULL) { //cann't find "\n",but don't care + 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" } @@ -1455,7 +1465,8 @@ for(ii=1;;ii++) { buf2[end_p-start_p]='\0'; //find value - if((start_p = kstrstr(buf2,"="))==NULL) + start_p = kstrstr(buf2,"="); + if (start_p == NULL) return FALSE; memset(buf1,0,100); strcpy(buf1,start_p+1); @@ -1474,13 +1485,14 @@ for(ii=1;;ii++) { } //if read fail,return NULL,or return data pointer; -static UCHAR *Config_FileOperation(PSDevice pDevice) { - UCHAR *config_path=CONFIG_PATH; - UCHAR *buffer=NULL; +static unsigned char *Config_FileOperation(PSDevice 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; + int result = 0; set_fs (KERNEL_DS); /* Can't do this anymore, so we rely on correct filesystem permissions: @@ -1505,7 +1517,7 @@ static UCHAR *Config_FileOperation(PSDevice pDevice) { goto error1; } - buffer = (UCHAR *)kmalloc(1024, GFP_KERNEL); + buffer = kmalloc(1024, GFP_KERNEL); if(buffer==NULL) { printk("alllocate mem for file fail?\n"); result = -1; @@ -1539,16 +1551,17 @@ if(result!=0) { //return --->-1:fail; >=0:successful static int Read_config_file(PSDevice pDevice) { - int result=0; - UCHAR tmpbuffer[100]; - UCHAR *buffer=NULL; + int result = 0; + unsigned char tmpbuffer[100]; + unsigned char *buffer = NULL; //init config setting pDevice->config_file.ZoneType = -1; pDevice->config_file.eAuthenMode = -1; pDevice->config_file.eEncryptionStatus = -1; - if((buffer=Config_FileOperation(pDevice)) ==NULL) { + buffer = Config_FileOperation(pDevice); + if (buffer == NULL) { result =-1; return result; } @@ -2064,7 +2077,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { rc = 0; } - rc = hostap_ioctl(pDevice, &wrq->u.data); + rc = vt6656_hostap_ioctl(pDevice, &wrq->u.data); break; case IOCTL_CMD_WPA: @@ -2094,16 +2107,16 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { netif_stop_queue(pDevice->dev); spin_lock_irq(&pDevice->lock); - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RUN_AP, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_RUN_AP, NULL); spin_unlock_irq(&pDevice->lock); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n"); spin_lock_irq(&pDevice->lock); //2007-1121-01<Modify>by EinsnLiu - if (pDevice->bLinkPass&& + if (pDevice->bLinkPass && memcmp(pMgmt->abyCurrSSID,pMgmt->abyDesireSSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN)) { - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_DISASSOCIATE, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL); } else { pDevice->bLinkPass = FALSE; pMgmt->eCurrState = WMAC_STATE_IDLE; @@ -2114,10 +2127,14 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { netif_stop_queue(pDevice->dev); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT pMgmt->eScanType = WMAC_SCAN_ACTIVE; - if(pDevice->bWPASuppWextEnabled !=TRUE) + if (!pDevice->bWPASuppWextEnabled) #endif - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, + NULL); spin_unlock_irq(&pDevice->lock); } pDevice->bCommit = FALSE; @@ -2153,35 +2170,29 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr) /*------------------------------------------------------------------*/ +MODULE_DEVICE_TABLE(usb, vt6656_table); -MODULE_DEVICE_TABLE(usb, vntwusb_table); - - -static struct usb_driver vntwusb_driver = { - .name = DEVICE_NAME, - .probe = vntwusb_found1, - .disconnect = vntwusb_disconnect, - .id_table = vntwusb_table, - -//2008-0920-01<Add>by MikeLiu -//for supporting S3 & S4 function +static struct usb_driver vt6656_driver = { + .name = DEVICE_NAME, + .probe = vt6656_probe, + .disconnect = vt6656_disconnect, + .id_table = vt6656_table, #ifdef CONFIG_PM - .suspend = vntwusb_suspend, - .resume = vntwusb_resume, -#endif + .suspend = vt6656_suspend, + .resume = vt6656_resume, +#endif /* CONFIG_PM */ }; -static int __init vntwusb_init_module(void) +static int __init vt6656_init_module(void) { printk(KERN_NOTICE DEVICE_FULL_DRV_NAM " " DEVICE_VERSION); - return usb_register(&vntwusb_driver); + return usb_register(&vt6656_driver); } -static void __exit vntwusb_cleanup_module(void) +static void __exit vt6656_cleanup_module(void) { - usb_deregister(&vntwusb_driver); + usb_deregister(&vt6656_driver); } -module_init(vntwusb_init_module); -module_exit(vntwusb_cleanup_module); - +module_init(vt6656_init_module); +module_exit(vt6656_cleanup_module); diff --git a/drivers/staging/vt6656/mib.c b/drivers/staging/vt6656/mib.c index 910e610b7cc0..b694fc86d740 100644 --- a/drivers/staging/vt6656/mib.c +++ b/drivers/staging/vt6656/mib.c @@ -152,33 +152,36 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, BYTE byIsr0, BYTE byIsr * Return Value: none * */ -void STAvUpdateRDStatCounter (PSStatCounter pStatistic, - BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, BYTE byRxRate, - PBYTE pbyBuffer, UINT cbFrameLength) +void STAvUpdateRDStatCounter(PSStatCounter pStatistic, + BYTE byRSR, BYTE byNewRSR, + BYTE byRxSts, BYTE byRxRate, + PBYTE pbyBuffer, unsigned int cbFrameLength) { - //need change - PS802_11Header pHeader = (PS802_11Header)pbyBuffer; + /* need change */ + PS802_11Header pHeader = (PS802_11Header)pbyBuffer; - if (byRSR & RSR_ADDROK) - pStatistic->dwRsrADDROk++; - if (byRSR & RSR_CRCOK) { - pStatistic->dwRsrCRCOk++; + if (byRSR & RSR_ADDROK) + pStatistic->dwRsrADDROk++; + if (byRSR & RSR_CRCOK) { + pStatistic->dwRsrCRCOk++; + pStatistic->ullRsrOK++; - pStatistic->ullRsrOK++; - - if (cbFrameLength >= U_ETHER_ADDR_LEN) { - // update counters in case that successful transmit + if (cbFrameLength >= ETH_ALEN) { + /* update counters in case of successful transmission */ if (byRSR & RSR_ADDRBROAD) { pStatistic->ullRxBroadcastFrames++; - pStatistic->ullRxBroadcastBytes += (ULONGLONG)cbFrameLength; + pStatistic->ullRxBroadcastBytes += + (unsigned long long) cbFrameLength; } else if (byRSR & RSR_ADDRMULTI) { pStatistic->ullRxMulticastFrames++; - pStatistic->ullRxMulticastBytes += (ULONGLONG)cbFrameLength; + pStatistic->ullRxMulticastBytes += + (unsigned long long) cbFrameLength; } else { pStatistic->ullRxDirectedFrames++; - pStatistic->ullRxDirectedBytes += (ULONGLONG)cbFrameLength; + pStatistic->ullRxDirectedBytes += + (unsigned long long) cbFrameLength; } } } @@ -188,87 +191,114 @@ void STAvUpdateRDStatCounter (PSStatCounter pStatistic, if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr11MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"11M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr11M, (INT)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "11M: ALL[%d], OK[%d]:[%02x]\n", + (signed int) pStatistic->CustomStat.ullRsr11M, + (signed int) pStatistic->CustomStat.ullRsr11MCRCOk, byRSR); } else if(byRxRate==11) { pStatistic->CustomStat.ullRsr5M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr5MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 5M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr5M, (INT)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 5M: ALL[%d], OK[%d]:[%02x]\n", + (signed int) pStatistic->CustomStat.ullRsr5M, + (signed int) pStatistic->CustomStat.ullRsr5MCRCOk, byRSR); } else if(byRxRate==4) { pStatistic->CustomStat.ullRsr2M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr2MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 2M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr2M, (INT)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 2M: ALL[%d], OK[%d]:[%02x]\n", + (signed int) pStatistic->CustomStat.ullRsr2M, + (signed int) pStatistic->CustomStat.ullRsr2MCRCOk, byRSR); } else if(byRxRate==2){ pStatistic->CustomStat.ullRsr1M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr1MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 1M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr1M, (INT)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 1M: ALL[%d], OK[%d]:[%02x]\n", + (signed int) pStatistic->CustomStat.ullRsr1M, + (signed int) pStatistic->CustomStat.ullRsr1MCRCOk, byRSR); } else if(byRxRate==12){ pStatistic->CustomStat.ullRsr6M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr6MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 6M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr6M, (INT)pStatistic->CustomStat.ullRsr6MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 6M: ALL[%d], OK[%d]\n", + (signed int) pStatistic->CustomStat.ullRsr6M, + (signed int) pStatistic->CustomStat.ullRsr6MCRCOk); } else if(byRxRate==18){ pStatistic->CustomStat.ullRsr9M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr9MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 9M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr9M, (INT)pStatistic->CustomStat.ullRsr9MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 9M: ALL[%d], OK[%d]\n", + (signed int) pStatistic->CustomStat.ullRsr9M, + (signed int) pStatistic->CustomStat.ullRsr9MCRCOk); } else if(byRxRate==24){ pStatistic->CustomStat.ullRsr12M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr12MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"12M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr12M, (INT)pStatistic->CustomStat.ullRsr12MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "12M: ALL[%d], OK[%d]\n", + (signed int) pStatistic->CustomStat.ullRsr12M, + (signed int) pStatistic->CustomStat.ullRsr12MCRCOk); } else if(byRxRate==36){ pStatistic->CustomStat.ullRsr18M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr18MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"18M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr18M, (INT)pStatistic->CustomStat.ullRsr18MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "18M: ALL[%d], OK[%d]\n", + (signed int) pStatistic->CustomStat.ullRsr18M, + (signed int) pStatistic->CustomStat.ullRsr18MCRCOk); } else if(byRxRate==48){ pStatistic->CustomStat.ullRsr24M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr24MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"24M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr24M, (INT)pStatistic->CustomStat.ullRsr24MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "24M: ALL[%d], OK[%d]\n", + (signed int) pStatistic->CustomStat.ullRsr24M, + (signed int) pStatistic->CustomStat.ullRsr24MCRCOk); } else if(byRxRate==72){ pStatistic->CustomStat.ullRsr36M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr36MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"36M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr36M, (INT)pStatistic->CustomStat.ullRsr36MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "36M: ALL[%d], OK[%d]\n", + (signed int) pStatistic->CustomStat.ullRsr36M, + (signed int) pStatistic->CustomStat.ullRsr36MCRCOk); } else if(byRxRate==96){ pStatistic->CustomStat.ullRsr48M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr48MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"48M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr48M, (INT)pStatistic->CustomStat.ullRsr48MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "48M: ALL[%d], OK[%d]\n", + (signed int) pStatistic->CustomStat.ullRsr48M, + (signed int) pStatistic->CustomStat.ullRsr48MCRCOk); } else if(byRxRate==108){ pStatistic->CustomStat.ullRsr54M++; if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr54MCRCOk++; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"54M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr54M, (INT)pStatistic->CustomStat.ullRsr54MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "54M: ALL[%d], OK[%d]\n", + (signed int) pStatistic->CustomStat.ullRsr54M, + (signed int) pStatistic->CustomStat.ullRsr54MCRCOk); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown: Total[%d], CRCOK[%d]\n", (INT)pStatistic->dwRsrRxPacket+1, (INT)pStatistic->dwRsrCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "Unknown: Total[%d], CRCOK[%d]\n", + (signed int) pStatistic->dwRsrRxPacket+1, + (signed int)pStatistic->dwRsrCRCOk); } if (byRSR & RSR_BSSIDOK) @@ -370,7 +400,7 @@ STAvUpdateRDStatCounterEx ( BYTE byRxSts, BYTE byRxRate, PBYTE pbyBuffer, - UINT cbFrameLength + unsigned int cbFrameLength ) { STAvUpdateRDStatCounter( @@ -510,19 +540,22 @@ STAvUpdate802_11Counter( ) { //p802_11Counter->TransmittedFragmentCount - p802_11Counter->MulticastTransmittedFrameCount = (ULONGLONG) (pStatistic->dwTsrBroadcast + - pStatistic->dwTsrMulticast); - p802_11Counter->FailedCount = (ULONGLONG) (pStatistic->dwTsrErr); - p802_11Counter->RetryCount = (ULONGLONG) (pStatistic->dwTsrRetry); - p802_11Counter->MultipleRetryCount = (ULONGLONG) (pStatistic->dwTsrMoreThanOnceRetry); + p802_11Counter->MulticastTransmittedFrameCount = + (unsigned long long) (pStatistic->dwTsrBroadcast + + pStatistic->dwTsrMulticast); + p802_11Counter->FailedCount = (unsigned long long) (pStatistic->dwTsrErr); + p802_11Counter->RetryCount = (unsigned long long) (pStatistic->dwTsrRetry); + p802_11Counter->MultipleRetryCount = + (unsigned long long) (pStatistic->dwTsrMoreThanOnceRetry); //p802_11Counter->FrameDuplicateCount - p802_11Counter->RTSSuccessCount += (ULONGLONG) byRTSSuccess; - p802_11Counter->RTSFailureCount += (ULONGLONG) byRTSFail; - p802_11Counter->ACKFailureCount += (ULONGLONG) byACKFail; - p802_11Counter->FCSErrorCount += (ULONGLONG) byFCSErr; + p802_11Counter->RTSSuccessCount += (unsigned long long) byRTSSuccess; + p802_11Counter->RTSFailureCount += (unsigned long long) byRTSFail; + p802_11Counter->ACKFailureCount += (unsigned long long) byACKFail; + p802_11Counter->FCSErrorCount += (unsigned long long) byFCSErr; //p802_11Counter->ReceivedFragmentCount - p802_11Counter->MulticastReceivedFrameCount = (ULONGLONG) (pStatistic->dwRsrBroadcast + - pStatistic->dwRsrMulticast); + p802_11Counter->MulticastReceivedFrameCount = + (unsigned long long) (pStatistic->dwRsrBroadcast + + pStatistic->dwRsrMulticast); } /* diff --git a/drivers/staging/vt6656/mib.h b/drivers/staging/vt6656/mib.h index ac996d2cd911..0455ec9d327d 100644 --- a/drivers/staging/vt6656/mib.h +++ b/drivers/staging/vt6656/mib.h @@ -52,32 +52,34 @@ typedef struct tagSUSBCounter { typedef struct tagSDot11Counters { -// ULONG Length; // Length of structure - ULONGLONG TransmittedFragmentCount; - ULONGLONG MulticastTransmittedFrameCount; - ULONGLONG FailedCount; - ULONGLONG RetryCount; - ULONGLONG MultipleRetryCount; - ULONGLONG RTSSuccessCount; - ULONGLONG RTSFailureCount; - ULONGLONG ACKFailureCount; - ULONGLONG FrameDuplicateCount; - ULONGLONG ReceivedFragmentCount; - ULONGLONG MulticastReceivedFrameCount; - ULONGLONG FCSErrorCount; - ULONGLONG TKIPLocalMICFailures; - ULONGLONG TKIPRemoteMICFailures; - ULONGLONG TKIPICVErrors; - ULONGLONG TKIPCounterMeasuresInvoked; - ULONGLONG TKIPReplays; - ULONGLONG CCMPFormatErrors; - ULONGLONG CCMPReplays; - ULONGLONG CCMPDecryptErrors; - ULONGLONG FourWayHandshakeFailures; -// ULONGLONG WEPUndecryptableCount; -// ULONGLONG WEPICVErrorCount; -// ULONGLONG DecryptSuccessCount; -// ULONGLONG DecryptFailureCount; + /* unsigned long Length; // Length of structure */ + unsigned long long TransmittedFragmentCount; + unsigned long long MulticastTransmittedFrameCount; + unsigned long long FailedCount; + unsigned long long RetryCount; + unsigned long long MultipleRetryCount; + unsigned long long RTSSuccessCount; + unsigned long long RTSFailureCount; + unsigned long long ACKFailureCount; + unsigned long long FrameDuplicateCount; + unsigned long long ReceivedFragmentCount; + unsigned long long MulticastReceivedFrameCount; + unsigned long long FCSErrorCount; + unsigned long long TKIPLocalMICFailures; + unsigned long long TKIPRemoteMICFailures; + unsigned long long TKIPICVErrors; + unsigned long long TKIPCounterMeasuresInvoked; + unsigned long long TKIPReplays; + unsigned long long CCMPFormatErrors; + unsigned long long CCMPReplays; + unsigned long long CCMPDecryptErrors; + unsigned long long FourWayHandshakeFailures; + /* + * unsigned long long WEPUndecryptableCount; + * unsigned long long WEPICVErrorCount; + * unsigned long long DecryptSuccessCount; + * unsigned long long DecryptFailureCount; + */ } SDot11Counters, *PSDot11Counters; @@ -85,15 +87,15 @@ typedef struct tagSDot11Counters { // MIB2 counter // typedef struct tagSMib2Counter { - LONG ifIndex; + signed long ifIndex; char ifDescr[256]; // max size 255 plus zero ending // e.g. "interface 1" - LONG ifType; - LONG ifMtu; + signed long ifType; + signed long ifMtu; DWORD ifSpeed; - BYTE ifPhysAddress[U_ETHER_ADDR_LEN]; - LONG ifAdminStatus; - LONG ifOperStatus; + BYTE ifPhysAddress[ETH_ALEN]; + signed long ifAdminStatus; + signed long ifOperStatus; DWORD ifLastChange; DWORD ifInOctets; DWORD ifInUcastPkts; @@ -124,7 +126,7 @@ typedef struct tagSMib2Counter { // RMON counter // typedef struct tagSRmonCounter { - LONG etherStatsIndex; + signed long etherStatsIndex; DWORD etherStatsDataSource; DWORD etherStatsDropEvents; DWORD etherStatsOctets; @@ -151,37 +153,37 @@ typedef struct tagSRmonCounter { // Custom counter // typedef struct tagSCustomCounters { - ULONG Length; - - ULONGLONG ullTsrAllOK; - - ULONGLONG ullRsr11M; - ULONGLONG ullRsr5M; - ULONGLONG ullRsr2M; - ULONGLONG ullRsr1M; - - ULONGLONG ullRsr11MCRCOk; - ULONGLONG ullRsr5MCRCOk; - ULONGLONG ullRsr2MCRCOk; - ULONGLONG ullRsr1MCRCOk; - - ULONGLONG ullRsr54M; - ULONGLONG ullRsr48M; - ULONGLONG ullRsr36M; - ULONGLONG ullRsr24M; - ULONGLONG ullRsr18M; - ULONGLONG ullRsr12M; - ULONGLONG ullRsr9M; - ULONGLONG ullRsr6M; - - ULONGLONG ullRsr54MCRCOk; - ULONGLONG ullRsr48MCRCOk; - ULONGLONG ullRsr36MCRCOk; - ULONGLONG ullRsr24MCRCOk; - ULONGLONG ullRsr18MCRCOk; - ULONGLONG ullRsr12MCRCOk; - ULONGLONG ullRsr9MCRCOk; - ULONGLONG ullRsr6MCRCOk; + unsigned long Length; + + unsigned long long ullTsrAllOK; + + unsigned long long ullRsr11M; + unsigned long long ullRsr5M; + unsigned long long ullRsr2M; + unsigned long long ullRsr1M; + + unsigned long long ullRsr11MCRCOk; + unsigned long long ullRsr5MCRCOk; + unsigned long long ullRsr2MCRCOk; + unsigned long long ullRsr1MCRCOk; + + unsigned long long ullRsr54M; + unsigned long long ullRsr48M; + unsigned long long ullRsr36M; + unsigned long long ullRsr24M; + unsigned long long ullRsr18M; + unsigned long long ullRsr12M; + unsigned long long ullRsr9M; + unsigned long long ullRsr6M; + + unsigned long long ullRsr54MCRCOk; + unsigned long long ullRsr48MCRCOk; + unsigned long long ullRsr36MCRCOk; + unsigned long long ullRsr24MCRCOk; + unsigned long long ullRsr18MCRCOk; + unsigned long long ullRsr12MCRCOk; + unsigned long long ullRsr9MCRCOk; + unsigned long long ullRsr6MCRCOk; } SCustomCounters, *PSCustomCounters; @@ -190,7 +192,7 @@ typedef struct tagSCustomCounters { // Custom counter // typedef struct tagSISRCounters { - ULONG Length; + unsigned long Length; DWORD dwIsrTx0OK; DWORD dwIsrAC0TxOK; @@ -231,7 +233,7 @@ typedef struct tagSTxPktInfo { BYTE byBroadMultiUni; WORD wLength; WORD wFIFOCtl; - BYTE abyDestAddr[U_ETHER_ADDR_LEN]; + BYTE abyDestAddr[ETH_ALEN]; } STxPktInfo, *PSTxPktInfo; @@ -277,15 +279,15 @@ typedef struct tagSStatCounter { DWORD dwRsrMulticast; DWORD dwRsrDirected; // 64-bit OID - ULONGLONG ullRsrOK; + unsigned long long ullRsrOK; // for some optional OIDs (64 bits) and DMI support - ULONGLONG ullRxBroadcastBytes; - ULONGLONG ullRxMulticastBytes; - ULONGLONG ullRxDirectedBytes; - ULONGLONG ullRxBroadcastFrames; - ULONGLONG ullRxMulticastFrames; - ULONGLONG ullRxDirectedFrames; + unsigned long long ullRxBroadcastBytes; + unsigned long long ullRxMulticastBytes; + unsigned long long ullRxDirectedBytes; + unsigned long long ullRxBroadcastFrames; + unsigned long long ullRxMulticastFrames; + unsigned long long ullRxDirectedFrames; DWORD dwRsrRxFragment; DWORD dwRsrRxFrmLen64; @@ -330,15 +332,15 @@ typedef struct tagSStatCounter { // 64-bit OID - ULONGLONG ullTsrOK; + unsigned long long ullTsrOK; // for some optional OIDs (64 bits) and DMI support - ULONGLONG ullTxBroadcastFrames; - ULONGLONG ullTxMulticastFrames; - ULONGLONG ullTxDirectedFrames; - ULONGLONG ullTxBroadcastBytes; - ULONGLONG ullTxMulticastBytes; - ULONGLONG ullTxDirectedBytes; + unsigned long long ullTxBroadcastFrames; + unsigned long long ullTxMulticastFrames; + unsigned long long ullTxDirectedFrames; + unsigned long long ullTxBroadcastBytes; + unsigned long long ullTxMulticastBytes; + unsigned long long ullTxDirectedBytes; // for autorate DWORD dwTxOk[MAX_RATE+1]; @@ -356,15 +358,15 @@ typedef struct tagSStatCounter { #ifdef Calcu_LinkQual //Tx count: - ULONG TxNoRetryOkCount; //success tx no retry ! - ULONG TxRetryOkCount; //success tx but retry ! - ULONG TxFailCount; //fail tx ? + unsigned long TxNoRetryOkCount; /* success tx no retry ! */ + unsigned long TxRetryOkCount; /* success tx but retry ! */ + unsigned long TxFailCount; /* fail tx ? */ //Rx count: - ULONG RxOkCnt; //success rx ! - ULONG RxFcsErrCnt; //fail rx ? + unsigned long RxOkCnt; /* success rx ! */ + unsigned long RxFcsErrCnt; /* fail rx ? */ //statistic - ULONG SignalStren; - ULONG LinkQuality; + unsigned long SignalStren; + unsigned long LinkQuality; #endif } SStatCounter, *PSStatCounter; @@ -382,13 +384,14 @@ void STAvClearAllCounter(PSStatCounter pStatistic); void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, BYTE byIsr0, BYTE byIsr1); void STAvUpdateRDStatCounter(PSStatCounter pStatistic, - BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, BYTE byRxRate, - PBYTE pbyBuffer, UINT cbFrameLength); + BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, + BYTE byRxRate, PBYTE pbyBuffer, + unsigned int cbFrameLength); void STAvUpdateRDStatCounterEx(PSStatCounter pStatistic, - BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, BYTE byRxRate, - PBYTE pbyBuffer, UINT cbFrameLength); - + BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, + BYTE byRxRate, PBYTE pbyBuffer, + unsigned int cbFrameLength); void STAvUpdateTDStatCounter ( @@ -417,7 +420,4 @@ STAvUpdateUSBCounter( NTSTATUS ntStatus ); -#endif // __MIB_H__ - - - +#endif /* __MIB_H__ */ diff --git a/drivers/staging/vt6656/michael.c b/drivers/staging/vt6656/michael.c index c930e0cdb853..671a8cf33e23 100644 --- a/drivers/staging/vt6656/michael.c +++ b/drivers/staging/vt6656/michael.c @@ -48,20 +48,23 @@ /*--------------------- Static Functions --------------------------*/ /* -static DWORD s_dwGetUINT32(BYTE * p); // Get DWORD from 4 bytes LSByte first -static VOID s_vPutUINT32(BYTE* p, DWORD val); // Put DWORD into 4 bytes LSByte first -*/ -static VOID s_vClear(void); // Clear the internal message, - // resets the object to the state just after construction. -static VOID s_vSetKey(DWORD dwK0, DWORD dwK1); -static VOID s_vAppendByte(BYTE b); // Add a single byte to the internal message + * static DWORD s_dwGetUINT32(BYTE * p); Get DWORD from + * 4 bytes LSByte first + * static void s_vPutUINT32(BYTE* p, DWORD val); Put DWORD into + * 4 bytes LSByte first + */ +static void s_vClear(void); /* Clear the internal message, + * resets the object to the + * state just after construction. */ +static void s_vSetKey(DWORD dwK0, DWORD dwK1); +static void s_vAppendByte(BYTE b); /* Add a single byte to the internal + * message */ /*--------------------- Export Variables --------------------------*/ -static DWORD L, R; // Current state - -static DWORD K0, K1; // Key -static DWORD M; // Message accumulator (single word) -static UINT nBytesInM; // # bytes in M +static DWORD L, R; /* Current state */ +static DWORD K0, K1; /* Key */ +static DWORD M; /* Message accumulator (single word) */ +static unsigned int nBytesInM; /* # bytes in M */ /*--------------------- Export Functions --------------------------*/ @@ -69,113 +72,105 @@ static UINT nBytesInM; // # bytes in M static DWORD s_dwGetUINT32 (BYTE * p) // Convert from BYTE[] to DWORD in a portable way { - DWORD res = 0; - UINT i; - for(i=0; i<4; i++ ) - { - res |= (*p++) << (8*i); - } - return res; + DWORD res = 0; + unsigned int i; + for(i=0; i<4; i++ ) + res |= (*p++) << (8*i); + return res; } -static VOID s_vPutUINT32 (BYTE* p, DWORD val) +static void s_vPutUINT32(BYTE *p, DWORD val) // Convert from DWORD to BYTE[] in a portable way { - UINT i; - for(i=0; i<4; i++ ) - { - *p++ = (BYTE) (val & 0xff); - val >>= 8; - } + unsigned int i; + for(i=0; i<4; i++ ) { + *p++ = (BYTE) (val & 0xff); + val >>= 8; + } } */ -static VOID s_vClear (void) +static void s_vClear(void) { - // Reset the state to the empty message. - L = K0; - R = K1; - nBytesInM = 0; - M = 0; + /* Reset the state to the empty message. */ + L = K0; + R = K1; + nBytesInM = 0; + M = 0; } -static VOID s_vSetKey (DWORD dwK0, DWORD dwK1) +static void s_vSetKey(DWORD dwK0, DWORD dwK1) { - // Set the key - K0 = dwK0; - K1 = dwK1; - // and reset the message - s_vClear(); + /* Set the key */ + K0 = dwK0; + K1 = dwK1; + /* and reset the message */ + s_vClear(); } -static VOID s_vAppendByte (BYTE b) +static void s_vAppendByte(BYTE b) { - // Append the byte to our word-sized buffer - M |= b << (8*nBytesInM); - nBytesInM++; - // Process the word if it is full. - if( nBytesInM >= 4 ) - { - L ^= M; - R ^= ROL32( L, 17 ); - L += R; - R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8); - L += R; - R ^= ROL32( L, 3 ); - L += R; - R ^= ROR32( L, 2 ); - L += R; - // Clear the buffer - M = 0; - nBytesInM = 0; - } + /* Append the byte to our word-sized buffer */ + M |= b << (8*nBytesInM); + nBytesInM++; + /* Process the word if it is full. */ + if (nBytesInM >= 4) { + L ^= M; + R ^= ROL32(L, 17); + L += R; + R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8); + L += R; + R ^= ROL32(L, 3); + L += R; + R ^= ROR32(L, 2); + L += R; + /* Clear the buffer */ + M = 0; + nBytesInM = 0; + } } -VOID MIC_vInit (DWORD dwK0, DWORD dwK1) +void MIC_vInit(DWORD dwK0, DWORD dwK1) { - // Set the key - s_vSetKey(dwK0, dwK1); + /* Set the key */ + s_vSetKey(dwK0, dwK1); } -VOID MIC_vUnInit (void) +void MIC_vUnInit(void) { - // Wipe the key material - K0 = 0; - K1 = 0; + /* Wipe the key material */ + K0 = 0; + K1 = 0; - // And the other fields as well. - //Note that this sets (L,R) to (K0,K1) which is just fine. - s_vClear(); + /* And the other fields as well. */ + /* Note that this sets (L,R) to (K0,K1) which is just fine. */ + s_vClear(); } -VOID MIC_vAppend (PBYTE src, UINT nBytes) +void MIC_vAppend(PBYTE src, unsigned int nBytes) { - // This is simple - while (nBytes > 0) - { - s_vAppendByte(*src++); - nBytes--; - } + /* This is simple */ + while (nBytes > 0) { + s_vAppendByte(*src++); + nBytes--; + } } -VOID MIC_vGetMIC (PDWORD pdwL, PDWORD pdwR) +void MIC_vGetMIC(PDWORD pdwL, PDWORD pdwR) { - // Append the minimum padding - s_vAppendByte(0x5a); - s_vAppendByte(0); - s_vAppendByte(0); - s_vAppendByte(0); - s_vAppendByte(0); - // and then zeroes until the length is a multiple of 4 - while( nBytesInM != 0 ) - { - s_vAppendByte(0); - } - // The s_vAppendByte function has already computed the result. - *pdwL = L; - *pdwR = R; - // Reset to the empty message. - s_vClear(); + /* Append the minimum padding */ + s_vAppendByte(0x5a); + s_vAppendByte(0); + s_vAppendByte(0); + s_vAppendByte(0); + s_vAppendByte(0); + /* and then zeroes until the length is a multiple of 4 */ + while (nBytesInM != 0) + s_vAppendByte(0); + /* The s_vAppendByte function has already computed the result. */ + *pdwL = L; + *pdwR = R; + /* Reset to the empty message. */ + s_vClear(); } - diff --git a/drivers/staging/vt6656/michael.h b/drivers/staging/vt6656/michael.h index 3f79b52832d1..3ab60928ef35 100644 --- a/drivers/staging/vt6656/michael.h +++ b/drivers/staging/vt6656/michael.h @@ -35,16 +35,16 @@ /*--------------------- Export Types ------------------------------*/ -VOID MIC_vInit(DWORD dwK0, DWORD dwK1); +void MIC_vInit(DWORD dwK0, DWORD dwK1); -VOID MIC_vUnInit(void); +void MIC_vUnInit(void); // Append bytes to the message to be MICed -VOID MIC_vAppend(PBYTE src, UINT nBytes); +void MIC_vAppend(PBYTE src, unsigned int nBytes); // Get the MIC result. Destination should accept 8 bytes of result. // This also resets the message to empty. -VOID MIC_vGetMIC(PDWORD pdwL, PDWORD pdwR); +void MIC_vGetMIC(PDWORD pdwL, PDWORD pdwR); /*--------------------- Export Macros ------------------------------*/ @@ -53,6 +53,4 @@ VOID MIC_vGetMIC(PDWORD pdwL, PDWORD pdwR); ( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) ) #define ROR32( A, n ) ROL32( (A), 32-(n) ) -#endif //__MICHAEL_H__ - - +#endif /* __MICHAEL_H__ */ diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c index b5702b098e18..766c5be6fd22 100644 --- a/drivers/staging/vt6656/power.c +++ b/drivers/staging/vt6656/power.c @@ -50,19 +50,14 @@ /*--------------------- Static Definitions -------------------------*/ - - - /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ - /*--------------------- Export Variables --------------------------*/ - /*--------------------- Export Functions --------------------------*/ /*+ @@ -75,12 +70,8 @@ static int msglevel =MSG_LEVEL_INFO; * -*/ - -VOID -PSvEnablePowerSaving( - IN HANDLE hDeviceContext, - IN WORD wListenInterval - ) +void PSvEnablePowerSaving(void *hDeviceContext, + WORD wListenInterval) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -128,7 +119,7 @@ PSvEnablePowerSaving( pDevice->bEnablePSMode = TRUE; if (pDevice->eOPMode == OP_MODE_ADHOC) { -// bMgrPrepareBeaconToSend((HANDLE)pDevice, pMgmt); + /* bMgrPrepareBeaconToSend((void *) pDevice, pMgmt); */ } // We don't send null pkt in ad hoc mode since beacon will handle this. else if (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) { @@ -139,11 +130,6 @@ PSvEnablePowerSaving( return; } - - - - - /*+ * * Routine Description: @@ -154,10 +140,7 @@ PSvEnablePowerSaving( * -*/ -VOID -PSvDisablePowerSaving( - IN HANDLE hDeviceContext - ) +void PSvDisablePowerSaving(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; // PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -187,7 +170,6 @@ PSvDisablePowerSaving( return; } - /*+ * * Routine Description: @@ -198,13 +180,9 @@ PSvDisablePowerSaving( * FALSE, if fail -*/ - -BOOL -PSbConsiderPowerDown( - IN HANDLE hDeviceContext, - IN BOOL bCheckRxDMA, - IN BOOL bCheckCountToWakeUp - ) +BOOL PSbConsiderPowerDown(void *hDeviceContext, + BOOL bCheckRxDMA, + BOOL bCheckCountToWakeUp) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -248,8 +226,6 @@ PSbConsiderPowerDown( return TRUE; } - - /*+ * * Routine Description: @@ -260,12 +236,7 @@ PSbConsiderPowerDown( * -*/ - - -VOID -PSvSendPSPOLL( - IN HANDLE hDeviceContext - ) +void PSvSendPSPOLL(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -297,8 +268,6 @@ PSvSendPSPOLL( return; } - - /*+ * * Routine Description: @@ -308,10 +277,8 @@ PSvSendPSPOLL( * None. * -*/ -BOOL -PSbSendNullPacket( - IN HANDLE hDeviceContext - ) + +BOOL PSbSendNullPacket(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PSTxMgmtPacket pTxPacket = NULL; @@ -388,10 +355,7 @@ PSbSendNullPacket( * -*/ -BOOL -PSbIsNextTBTTWakeUp( - IN HANDLE hDeviceContext - ) +BOOL PSbIsNextTBTTWakeUp(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; diff --git a/drivers/staging/vt6656/power.h b/drivers/staging/vt6656/power.h index c33c93a86f5e..50792bb8c978 100644 --- a/drivers/staging/vt6656/power.h +++ b/drivers/staging/vt6656/power.h @@ -45,40 +45,17 @@ /*--------------------- Export Functions --------------------------*/ -// IN PSDevice pDevice -// IN PSDevice hDeviceContext +/* PSDevice pDevice */ +/* PSDevice hDeviceContext */ -BOOL -PSbConsiderPowerDown( - IN HANDLE hDeviceContext, - IN BOOL bCheckRxDMA, - IN BOOL bCheckCountToWakeUp - ); +BOOL PSbConsiderPowerDown(void *hDeviceContext, + BOOL bCheckRxDMA, + BOOL bCheckCountToWakeUp); -VOID -PSvDisablePowerSaving( - IN HANDLE hDeviceContext - ); +void PSvDisablePowerSaving(void *hDeviceContext); +void PSvEnablePowerSaving(void *hDeviceContext, WORD wListenInterval); +void PSvSendPSPOLL(void *hDeviceContext); +BOOL PSbSendNullPacket(void *hDeviceContext); +BOOL PSbIsNextTBTTWakeUp(void *hDeviceContext); -VOID -PSvEnablePowerSaving( - IN HANDLE hDeviceContext, - IN WORD wListenInterval - ); - -VOID -PSvSendPSPOLL( - IN HANDLE hDeviceContext - ); - -BOOL -PSbSendNullPacket( - IN HANDLE hDeviceContext - ); - -BOOL -PSbIsNextTBTTWakeUp( - IN HANDLE hDeviceContext - ); - -#endif //__POWER_H__ +#endif /* __POWER_H__ */ diff --git a/drivers/staging/vt6656/rc4.c b/drivers/staging/vt6656/rc4.c index e6c61312fd28..5c3c2d0552b4 100644 --- a/drivers/staging/vt6656/rc4.c +++ b/drivers/staging/vt6656/rc4.c @@ -32,56 +32,56 @@ #include "rc4.h" -VOID rc4_init(PRC4Ext pRC4, PBYTE pbyKey, UINT cbKey_len) +void rc4_init(PRC4Ext pRC4, PBYTE pbyKey, unsigned int cbKey_len) { - UINT ust1, ust2; - UINT keyindex; - UINT stateindex; - PBYTE pbyst; - UINT idx; + unsigned int ust1, ust2; + unsigned int keyindex; + unsigned int stateindex; + PBYTE pbyst; + unsigned int idx; - pbyst = pRC4->abystate; - pRC4->ux = 0; - pRC4->uy = 0; - for (idx = 0; idx < 256; idx++) - pbyst[idx] = (BYTE)idx; - keyindex = 0; - stateindex = 0; - for (idx = 0; idx < 256; idx++) { - ust1 = pbyst[idx]; - stateindex = (stateindex + pbyKey[keyindex] + ust1) & 0xff; - ust2 = pbyst[stateindex]; - pbyst[stateindex] = (BYTE)ust1; - pbyst[idx] = (BYTE)ust2; - if (++keyindex >= cbKey_len) - keyindex = 0; - } + pbyst = pRC4->abystate; + pRC4->ux = 0; + pRC4->uy = 0; + for (idx = 0; idx < 256; idx++) + pbyst[idx] = (BYTE)idx; + keyindex = 0; + stateindex = 0; + for (idx = 0; idx < 256; idx++) { + ust1 = pbyst[idx]; + stateindex = (stateindex + pbyKey[keyindex] + ust1) & 0xff; + ust2 = pbyst[stateindex]; + pbyst[stateindex] = (BYTE)ust1; + pbyst[idx] = (BYTE)ust2; + if (++keyindex >= cbKey_len) + keyindex = 0; + } } -UINT rc4_byte(PRC4Ext pRC4) +unsigned int rc4_byte(PRC4Ext pRC4) { - UINT ux; - UINT uy; - UINT ustx, usty; - PBYTE pbyst; + unsigned int ux; + unsigned int uy; + unsigned int ustx, usty; + PBYTE pbyst; - pbyst = pRC4->abystate; - ux = (pRC4->ux + 1) & 0xff; - ustx = pbyst[ux]; - uy = (ustx + pRC4->uy) & 0xff; - usty = pbyst[uy]; - pRC4->ux = ux; - pRC4->uy = uy; - pbyst[uy] = (BYTE)ustx; - pbyst[ux] = (BYTE)usty; + pbyst = pRC4->abystate; + ux = (pRC4->ux + 1) & 0xff; + ustx = pbyst[ux]; + uy = (ustx + pRC4->uy) & 0xff; + usty = pbyst[uy]; + pRC4->ux = ux; + pRC4->uy = uy; + pbyst[uy] = (BYTE)ustx; + pbyst[ux] = (BYTE)usty; - return pbyst[(ustx + usty) & 0xff]; + return pbyst[(ustx + usty) & 0xff]; } -VOID rc4_encrypt(PRC4Ext pRC4, PBYTE pbyDest, - PBYTE pbySrc, UINT cbData_len) +void rc4_encrypt(PRC4Ext pRC4, PBYTE pbyDest, + PBYTE pbySrc, unsigned int cbData_len) { - UINT ii; - for (ii = 0; ii < cbData_len; ii++) - pbyDest[ii] = (BYTE)(pbySrc[ii] ^ rc4_byte(pRC4)); + unsigned int ii; + for (ii = 0; ii < cbData_len; ii++) + pbyDest[ii] = (BYTE)(pbySrc[ii] ^ rc4_byte(pRC4)); } diff --git a/drivers/staging/vt6656/rc4.h b/drivers/staging/vt6656/rc4.h index bf607c9d446a..d447879c8f99 100644 --- a/drivers/staging/vt6656/rc4.h +++ b/drivers/staging/vt6656/rc4.h @@ -35,13 +35,14 @@ /*--------------------- Export Definitions -------------------------*/ /*--------------------- Export Types ------------------------------*/ typedef struct { - UINT ux; - UINT uy; + unsigned int ux; + unsigned int uy; BYTE abystate[256]; } RC4Ext, *PRC4Ext; -VOID rc4_init(PRC4Ext pRC4, PBYTE pbyKey, UINT cbKey_len); -UINT rc4_byte(PRC4Ext pRC4); -void rc4_encrypt(PRC4Ext pRC4, PBYTE pbyDest, PBYTE pbySrc, UINT cbData_len); +void rc4_init(PRC4Ext pRC4, PBYTE pbyKey, unsigned int cbKey_len); +unsigned int rc4_byte(PRC4Ext pRC4); +void rc4_encrypt(PRC4Ext pRC4, PBYTE pbyDest, PBYTE pbySrc, + unsigned int cbData_len); -#endif //__RC4_H__ +#endif /* __RC4_H__ */ diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index 405c4f71b5fd..3fd0478a9a54 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -757,9 +757,9 @@ BOOL IFRFbWriteEmbeded (PSDevice pDevice, DWORD dwData) * */ BOOL RFbSetPower ( - IN PSDevice pDevice, - IN UINT uRATE, - IN UINT uCH + PSDevice pDevice, + unsigned int uRATE, + unsigned int uCH ) { BOOL bResult = TRUE; @@ -811,9 +811,9 @@ BYTE byPwr = pDevice->byCCKPwr; * */ BOOL RFbRawSetPower ( - IN PSDevice pDevice, - IN BYTE byPwr, - IN UINT uRATE + PSDevice pDevice, + BYTE byPwr, + unsigned int uRATE ) { BOOL bResult = TRUE; @@ -954,16 +954,16 @@ BOOL bResult = TRUE; * Return Value: none * -*/ -VOID +void RFvRSSITodBm ( - IN PSDevice pDevice, - IN BYTE byCurrRSSI, + PSDevice pDevice, + BYTE byCurrRSSI, long * pldBm ) { BYTE byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03); - LONG b = (byCurrRSSI & 0x3F); - LONG a = 0; + signed long b = (byCurrRSSI & 0x3F); + signed long a = 0; BYTE abyAIROHARF[4] = {0, 18, 0, 40}; switch (pDevice->byRFType) { @@ -984,9 +984,9 @@ RFvRSSITodBm ( -VOID +void RFbRFTableDownload ( - IN PSDevice pDevice + PSDevice pDevice ) { WORD wLength1 = 0,wLength2 = 0 ,wLength3 = 0; @@ -1133,9 +1133,9 @@ BYTE abyArray[256]; // RobertYu:20060412, TWIF1.11 adjust LO Current for 11b mode BOOL s_bVT3226D0_11bLoCurrentAdjust( - IN PSDevice pDevice, - IN BYTE byChannel, - IN BOOL b11bMode ) + PSDevice pDevice, + BYTE byChannel, + BOOL b11bMode) { BOOL bResult; diff --git a/drivers/staging/vt6656/rf.h b/drivers/staging/vt6656/rf.h index 55d882f78f20..d4f8b94132b9 100644 --- a/drivers/staging/vt6656/rf.h +++ b/drivers/staging/vt6656/rf.h @@ -65,36 +65,33 @@ extern const BYTE RFaby11aChannelIndex[200]; BOOL IFRFbWriteEmbeded(PSDevice pDevice, DWORD dwData); BOOL RFbSetPower ( - IN PSDevice pDevice, - IN UINT uRATE, - IN UINT uCH + PSDevice pDevice, + unsigned int uRATE, + unsigned int uCH ); BOOL RFbRawSetPower( - IN PSDevice pDevice, - IN BYTE byPwr, - IN UINT uRATE + PSDevice pDevice, + BYTE byPwr, + unsigned int uRATE ); -VOID +void RFvRSSITodBm ( - IN PSDevice pDevice, - IN BYTE byCurrRSSI, + PSDevice pDevice, + BYTE byCurrRSSI, long * pldBm ); -VOID +void RFbRFTableDownload ( - IN PSDevice pDevice + PSDevice pDevice ); BOOL s_bVT3226D0_11bLoCurrentAdjust( - IN PSDevice pDevice, - IN BYTE byChannel, - IN BOOL b11bMode + PSDevice pDevice, + BYTE byChannel, + BOOL b11bMode ); -#endif // __RF_H__ - - - +#endif /* __RF_H__ */ diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h index 1d32d81079b6..ac842dd13a68 100644 --- a/drivers/staging/vt6656/rndis.h +++ b/drivers/staging/vt6656/rndis.h @@ -158,5 +158,4 @@ typedef struct _CMD_CHANGE_BBTYPE /*--------------------- Export Functions --------------------------*/ - -#endif // _RNDIS_H_ +#endif /* _RNDIS_H_ */ diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index a2ce6fad8ee5..3e7e56649a5f 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -113,181 +113,173 @@ const WORD wFB_Opt1[2][5] = { /*--------------------- Static Functions --------------------------*/ static -VOID +void s_vSaveTxPktInfo( - IN PSDevice pDevice, - IN BYTE byPktNum, - IN PBYTE pbyDestAddr, - IN WORD wPktLength, - IN WORD wFIFOCtl + PSDevice pDevice, + BYTE byPktNum, + PBYTE pbyDestAddr, + WORD wPktLength, + WORD wFIFOCtl ); static -PVOID +void * s_vGetFreeContext( PSDevice pDevice ); static -VOID +void s_vGenerateTxParameter( - IN PSDevice pDevice, - IN BYTE byPktType, - IN WORD wCurrentRate, - IN PVOID pTxBufHead, - IN PVOID pvRrvTime, - IN PVOID pvRTS, - IN PVOID pvCTS, - IN UINT cbFrameSize, - IN BOOL bNeedACK, - IN UINT uDMAIdx, - IN PSEthernetHeader psEthHeader + 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 -UINT -s_uFillDataHead ( - IN PSDevice pDevice, - IN BYTE byPktType, - IN WORD wCurrentRate, - IN PVOID pTxDataHead, - IN UINT cbFrameLength, - IN UINT uDMAIdx, - IN BOOL bNeedAck, - IN UINT uFragIdx, - IN UINT cbLastFragmentSize, - IN UINT uMACfragNum, - IN BYTE byFBOption +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 +void s_vGenerateMACHeader ( - IN PSDevice pDevice, - IN PBYTE pbyBufferAddr, - IN WORD wDuration, - IN PSEthernetHeader psEthHeader, - IN BOOL bNeedEncrypt, - IN WORD wFragType, - IN UINT uDMAIdx, - IN UINT uFragIdx + PSDevice pDevice, + PBYTE pbyBufferAddr, + WORD wDuration, + PSEthernetHeader psEthHeader, + BOOL bNeedEncrypt, + WORD wFragType, + unsigned int uDMAIdx, + unsigned int uFragIdx ); static -VOID +void s_vFillTxKey( - IN PSDevice pDevice, - IN PBYTE pbyBuf, - IN PBYTE pbyIVHead, - IN PSKeyItem pTransmitKey, - IN PBYTE pbyHdrBuf, - IN WORD wPayloadLen, - OUT PBYTE pMICHDR + PSDevice pDevice, + PBYTE pbyBuf, + PBYTE pbyIVHead, + PSKeyItem pTransmitKey, + PBYTE pbyHdrBuf, + WORD wPayloadLen, + PBYTE pMICHDR ); static -VOID +void s_vSWencryption ( - IN PSDevice pDevice, - IN PSKeyItem pTransmitKey, - IN PBYTE pbyPayloadHead, - IN WORD wPayloadSize + PSDevice pDevice, + PSKeyItem pTransmitKey, + PBYTE pbyPayloadHead, + WORD wPayloadSize ); -static -UINT -s_uGetTxRsvTime ( - IN PSDevice pDevice, - IN BYTE byPktType, - IN UINT cbFrameLength, - IN WORD wRate, - IN BOOL bNeedAck +static unsigned int s_uGetTxRsvTime( + PSDevice pDevice, + BYTE byPktType, + unsigned int cbFrameLength, + WORD wRate, + BOOL bNeedAck ); -static -UINT -s_uGetRTSCTSRsvTime ( - IN PSDevice pDevice, - IN BYTE byRTSRsvType, - IN BYTE byPktType, - IN UINT cbFrameLength, - IN WORD wCurrentRate +static unsigned int s_uGetRTSCTSRsvTime( + PSDevice pDevice, + BYTE byRTSRsvType, + BYTE byPktType, + unsigned int cbFrameLength, + WORD wCurrentRate ); static -VOID +void s_vFillCTSHead ( - IN PSDevice pDevice, - IN UINT uDMAIdx, - IN BYTE byPktType, - IN PVOID pvCTS, - IN UINT cbFrameLength, - IN BOOL bNeedAck, - IN BOOL bDisCRC, - IN WORD wCurrentRate, - IN BYTE byFBOption + PSDevice pDevice, + unsigned int uDMAIdx, + BYTE byPktType, + void *pvCTS, + unsigned int cbFrameLength, + BOOL bNeedAck, + BOOL bDisCRC, + WORD wCurrentRate, + BYTE byFBOption ); static -VOID +void s_vFillRTSHead( - IN PSDevice pDevice, - IN BYTE byPktType, - IN PVOID pvRTS, - IN UINT cbFrameLength, - IN BOOL bNeedAck, - IN BOOL bDisCRC, - IN PSEthernetHeader psEthHeader, - IN WORD wCurrentRate, - IN BYTE byFBOption + PSDevice pDevice, + BYTE byPktType, + void *pvRTS, + unsigned int cbFrameLength, + BOOL bNeedAck, + BOOL bDisCRC, + PSEthernetHeader psEthHeader, + WORD wCurrentRate, + BYTE byFBOption ); -static -UINT -s_uGetDataDuration ( - IN PSDevice pDevice, - IN BYTE byDurType, - IN UINT cbFrameLength, - IN BYTE byPktType, - IN WORD wRate, - IN BOOL bNeedAck, - IN UINT uFragIdx, - IN UINT cbLastFragmentSize, - IN UINT uMACfragNum, - IN 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 -UINT +unsigned int s_uGetRTSCTSDuration ( - IN PSDevice pDevice, - IN BYTE byDurType, - IN UINT cbFrameLength, - IN BYTE byPktType, - IN WORD wRate, - IN BOOL bNeedAck, - IN BYTE byFBOption + PSDevice pDevice, + BYTE byDurType, + unsigned int cbFrameLength, + BYTE byPktType, + WORD wRate, + BOOL bNeedAck, + BYTE byFBOption ); /*--------------------- Export Variables --------------------------*/ static -PVOID +void * s_vGetFreeContext( PSDevice pDevice ) { PUSB_SEND_CONTEXT pContext = NULL; PUSB_SEND_CONTEXT pReturnContext = NULL; - UINT ii; + unsigned int ii; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GetFreeContext()\n"); @@ -302,12 +294,12 @@ s_vGetFreeContext( if ( ii == pDevice->cbTD ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No Free Tx Context\n"); } - return ((PVOID) pReturnContext); + return (void *) pReturnContext; } static -VOID +void s_vSaveTxPktInfo(PSDevice pDevice, BYTE byPktNum, PBYTE pbyDestAddr, WORD wPktLength, WORD wFIFOCtl) { PSStatCounter pStatistic=&(pDevice->scStatistic); @@ -322,22 +314,24 @@ s_vSaveTxPktInfo(PSDevice pDevice, BYTE byPktNum, PBYTE pbyDestAddr, WORD wPktLe pStatistic->abyTxPktInfo[byPktNum].wLength = wPktLength; pStatistic->abyTxPktInfo[byPktNum].wFIFOCtl = wFIFOCtl; - memcpy(pStatistic->abyTxPktInfo[byPktNum].abyDestAddr, pbyDestAddr, U_ETHER_ADDR_LEN); + memcpy(pStatistic->abyTxPktInfo[byPktNum].abyDestAddr, + pbyDestAddr, + ETH_ALEN); } static -VOID +void s_vFillTxKey ( - IN PSDevice pDevice, - IN PBYTE pbyBuf, - IN PBYTE pbyIVHead, - IN PSKeyItem pTransmitKey, - IN PBYTE pbyHdrBuf, - IN WORD wPayloadLen, - OUT PBYTE pMICHDR + PSDevice pDevice, + PBYTE pbyBuf, + PBYTE pbyIVHead, + PSKeyItem pTransmitKey, + PBYTE pbyHdrBuf, + WORD wPayloadLen, + PBYTE pMICHDR ) { PDWORD pdwIV = (PDWORD) pbyIVHead; @@ -446,15 +440,15 @@ s_vFillTxKey ( static -VOID +void s_vSWencryption ( - IN PSDevice pDevice, - IN PSKeyItem pTransmitKey, - IN PBYTE pbyPayloadHead, - IN WORD wPayloadSize + PSDevice pDevice, + PSKeyItem pTransmitKey, + PBYTE pbyPayloadHead, + WORD wPayloadSize ) { - UINT cbICVlen = 4; + unsigned int cbICVlen = 4; DWORD dwICV = 0xFFFFFFFFL; PDWORD pdwICV; @@ -495,16 +489,16 @@ s_vSWencryption ( PK_TYPE_11GA 3 */ static -UINT +unsigned int s_uGetTxRsvTime ( - IN PSDevice pDevice, - IN BYTE byPktType, - IN UINT cbFrameLength, - IN WORD wRate, - IN BOOL bNeedAck + PSDevice pDevice, + BYTE byPktType, + unsigned int cbFrameLength, + WORD wRate, + BOOL bNeedAck ) { - UINT uDataTime, uAckTime; + unsigned int uDataTime, uAckTime; uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wRate); if (byPktType == PK_TYPE_11B) {//llb,CCK mode @@ -523,16 +517,16 @@ s_uGetTxRsvTime ( //byFreqType: 0=>5GHZ 1=>2.4GHZ static -UINT +unsigned int s_uGetRTSCTSRsvTime ( - IN PSDevice pDevice, - IN BYTE byRTSRsvType, - IN BYTE byPktType, - IN UINT cbFrameLength, - IN WORD wCurrentRate + PSDevice pDevice, + BYTE byRTSRsvType, + BYTE byPktType, + unsigned int cbFrameLength, + WORD wCurrentRate ) { - UINT uRrvTime , uRTSTime, uCTSTime, uAckTime, uDataTime; + unsigned int uRrvTime , uRTSTime, uCTSTime, uAckTime, uDataTime; uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0; @@ -565,23 +559,22 @@ s_uGetRTSCTSRsvTime ( //byFreqType 0: 5GHz, 1:2.4Ghz static -UINT +unsigned int s_uGetDataDuration ( - IN PSDevice pDevice, - IN BYTE byDurType, - IN UINT cbFrameLength, - IN BYTE byPktType, - IN WORD wRate, - IN BOOL bNeedAck, - IN UINT uFragIdx, - IN UINT cbLastFragmentSize, - IN UINT uMACfragNum, - IN BYTE byFBOption + PSDevice pDevice, + BYTE byDurType, + unsigned int cbFrameLength, + BYTE byPktType, + WORD wRate, + BOOL bNeedAck, + unsigned int uFragIdx, + unsigned int cbLastFragmentSize, + unsigned int uMACfragNum, + BYTE byFBOption ) { BOOL bLastFrag = 0; - UINT uAckTime =0, uNextPktTime = 0; - + unsigned int uAckTime = 0, uNextPktTime = 0; if (uFragIdx == (uMACfragNum-1)) { bLastFrag = 1; @@ -735,18 +728,18 @@ s_uGetDataDuration ( //byFreqType: 0=>5GHZ 1=>2.4GHZ static -UINT +unsigned int s_uGetRTSCTSDuration ( - IN PSDevice pDevice, - IN BYTE byDurType, - IN UINT cbFrameLength, - IN BYTE byPktType, - IN WORD wRate, - IN BOOL bNeedAck, - IN BYTE byFBOption + PSDevice pDevice, + BYTE byDurType, + unsigned int cbFrameLength, + BYTE byPktType, + WORD wRate, + BOOL bNeedAck, + BYTE byFBOption ) { - UINT uCTSTime = 0, uDurTime = 0; + unsigned int uCTSTime = 0, uDurTime = 0; switch (byDurType) { @@ -834,19 +827,19 @@ s_uGetRTSCTSDuration ( static -UINT +unsigned int s_uFillDataHead ( - IN PSDevice pDevice, - IN BYTE byPktType, - IN WORD wCurrentRate, - IN PVOID pTxDataHead, - IN UINT cbFrameLength, - IN UINT uDMAIdx, - IN BOOL bNeedAck, - IN UINT uFragIdx, - IN UINT cbLastFragmentSize, - IN UINT uMACfragNum, - IN BYTE byFBOption + 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 ) { @@ -979,20 +972,20 @@ s_uFillDataHead ( static -VOID +void s_vFillRTSHead ( - IN PSDevice pDevice, - IN BYTE byPktType, - IN PVOID pvRTS, - IN UINT cbFrameLength, - IN BOOL bNeedAck, - IN BOOL bDisCRC, - IN PSEthernetHeader psEthHeader, - IN WORD wCurrentRate, - IN BYTE byFBOption + PSDevice pDevice, + BYTE byPktType, + void *pvRTS, + unsigned int cbFrameLength, + BOOL bNeedAck, + BOOL bDisCRC, + PSEthernetHeader psEthHeader, + WORD wCurrentRate, + BYTE byFBOption ) { - UINT uRTSFrameLen = 20; + unsigned int uRTSFrameLen = 20; WORD wLen = 0x0000; if (pvRTS == NULL) @@ -1026,18 +1019,27 @@ s_vFillRTSHead ( pBuf->Data.wDurationID = pBuf->wDuration_aa; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - } + + if ((pDevice->eOPMode == OP_MODE_ADHOC) || + (pDevice->eOPMode == OP_MODE_AP)) { + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } + if (pDevice->eOPMode == OP_MODE_AP) { + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); } } else { @@ -1063,19 +1065,27 @@ s_vFillRTSHead ( //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - } + if ((pDevice->eOPMode == OP_MODE_ADHOC) || + (pDevice->eOPMode == OP_MODE_AP)) { + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); } - if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } + if (pDevice->eOPMode == OP_MODE_AP) { + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); } } // if (byFBOption == AUTO_FB_NONE) @@ -1094,20 +1104,26 @@ s_vFillRTSHead ( //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - - if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - } + if ((pDevice->eOPMode == OP_MODE_ADHOC) || + (pDevice->eOPMode == OP_MODE_AP)) { + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } + + if (pDevice->eOPMode == OP_MODE_AP) { + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); + } } else { @@ -1125,19 +1141,25 @@ s_vFillRTSHead ( //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - } + if ((pDevice->eOPMode == OP_MODE_ADHOC) || + (pDevice->eOPMode == OP_MODE_AP)) { + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } + if (pDevice->eOPMode == OP_MODE_AP) { + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); + } } } else if (byPktType == PK_TYPE_11B) { @@ -1153,39 +1175,45 @@ s_vFillRTSHead ( //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - - if ((pDevice->eOPMode == OP_MODE_ADHOC) || + if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); } if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); } } } static -VOID +void s_vFillCTSHead ( - IN PSDevice pDevice, - IN UINT uDMAIdx, - IN BYTE byPktType, - IN PVOID pvCTS, - IN UINT cbFrameLength, - IN BOOL bNeedAck, - IN BOOL bDisCRC, - IN WORD wCurrentRate, - IN BYTE byFBOption + PSDevice pDevice, + unsigned int uDMAIdx, + BYTE byPktType, + void *pvCTS, + unsigned int cbFrameLength, + BOOL bNeedAck, + BOOL bDisCRC, + WORD wCurrentRate, + BYTE byFBOption ) { - UINT uCTSFrameLen = 14; + unsigned int uCTSFrameLen = 14; WORD wLen = 0x0000; if (pvCTS == NULL) { @@ -1222,7 +1250,9 @@ s_vFillCTSHead ( pBuf->Data.wDurationID = pBuf->wDuration_ba; pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4 pBuf->Data.wReserved = 0x0000; - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyCurrentNetAddr[0]), + ETH_ALEN); } else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) PSCTS pBuf = (PSCTS)pvCTS; //Get SignalField,ServiceField,Length @@ -1239,16 +1269,13 @@ s_vFillCTSHead ( pBuf->Data.wDurationID = pBuf->wDuration_ba; pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4 pBuf->Data.wReserved = 0x0000; - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyCurrentNetAddr[0]), + ETH_ALEN); } } } - - - - - /*+ * * Description: @@ -1271,24 +1298,24 @@ s_vFillCTSHead ( * Return Value: none * -*/ -// UINT cbFrameSize,//Hdr+Payload+FCS + static -VOID +void s_vGenerateTxParameter ( - IN PSDevice pDevice, - IN BYTE byPktType, - IN WORD wCurrentRate, - IN PVOID pTxBufHead, - IN PVOID pvRrvTime, - IN PVOID pvRTS, - IN PVOID pvCTS, - IN UINT cbFrameSize, - IN BOOL bNeedACK, - IN UINT uDMAIdx, - IN PSEthernetHeader psEthHeader + PSDevice pDevice, + BYTE byPktType, + WORD wCurrentRate, + void *pTxBufHead, + void *pvRrvTime, + void *pvRTS, + void *pvCTS, + unsigned int cbFrameSize, + BOOL bNeedACK, + unsigned int uDMAIdx, + PSEthernetHeader psEthHeader ) { - UINT cbMACHdLen = WLAN_HDR_ADDR3_LEN; //24 + unsigned int cbMACHdLen = WLAN_HDR_ADDR3_LEN; /* 24 */ WORD wFifoCtl; BOOL bDisCRC = FALSE; BYTE byFBOption = AUTO_FB_NONE; @@ -1386,44 +1413,45 @@ s_vGenerateTxParameter ( /* PBYTE pbyBuffer,//point to pTxBufHead WORD wFragType,//00:Non-Frag, 01:Start, 02:Mid, 03:Last - UINT cbFragmentSize,//Hdr+payoad+FCS + unsigned int cbFragmentSize,//Hdr+payoad+FCS */ BOOL s_bPacketToWirelessUsb( - IN PSDevice pDevice, - IN BYTE byPktType, - IN PBYTE usbPacketBuf, - IN BOOL bNeedEncryption, - IN UINT uSkbPacketLen, - IN UINT uDMAIdx, - IN PSEthernetHeader psEthHeader, - IN PBYTE pPacket, - IN PSKeyItem pTransmitKey, - IN UINT uNodeIndex, - IN WORD wCurrentRate, - OUT UINT *pcbHeaderLen, - OUT UINT *pcbTotalLen + 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 ) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT cbFrameSize,cbFrameBodySize; + unsigned int cbFrameSize, cbFrameBodySize; PTX_BUFFER pTxBufHead; - UINT cb802_1_H_len; - UINT cbIVlen=0,cbICVlen=0,cbMIClen=0,cbMACHdLen=0,cbFCSlen=4; - UINT cbMICHDR = 0; + 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[6] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; - BYTE abySNAP_Bridgetunnel[6] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; - UINT uDuration; - UINT cbHeaderLength= 0,uPadding = 0; - PVOID pvRrvTime; + 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; - PVOID pvRTS; - PVOID pvCTS; - PVOID pvTxDataHd; + void *pvRTS; + void *pvCTS; + void *pvTxDataHd; BYTE byFBOption = AUTO_FB_NONE,byFragType; WORD wTxBufSize; DWORD dwMICKey0,dwMICKey1,dwMIC_Priority,dwCRC; @@ -1455,7 +1483,7 @@ s_bPacketToWirelessUsb( cb802_1_H_len = 0; } - cbFrameBodySize = uSkbPacketLen - U_HEADER_LEN + cb802_1_H_len; + cbFrameBodySize = uSkbPacketLen - ETH_HLEN + cb802_1_H_len; //Set packet type pTxBufHead->wFIFOCtl |= (WORD)(byPktType<<8); @@ -1658,7 +1686,8 @@ s_bPacketToWirelessUsb( //Fill FIFO,RrvTime,RTS,and CTS - s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, (PVOID)pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS, + s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, + (void *)pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS, cbFrameSize, bNeedACK, uDMAIdx, psEthHeader); //Fill DataHead uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK, @@ -1700,13 +1729,13 @@ s_bPacketToWirelessUsb( if (pPacket != NULL) { // Copy the Packet into a tx Buffer memcpy((pbyPayloadHead + cb802_1_H_len), - (pPacket + U_HEADER_LEN), - uSkbPacketLen - U_HEADER_LEN + (pPacket + ETH_HLEN), + uSkbPacketLen - ETH_HLEN ); } else { // while bRelayPacketSend psEthHeader is point to header+payload - memcpy((pbyPayloadHead + cb802_1_H_len), ((PBYTE)psEthHeader)+U_HEADER_LEN, uSkbPacketLen - U_HEADER_LEN); + memcpy((pbyPayloadHead + cb802_1_H_len), ((PBYTE)psEthHeader) + ETH_HLEN, uSkbPacketLen - ETH_HLEN); } ASSERT(uLength == cbNdisBodySize); @@ -1772,7 +1801,7 @@ s_bPacketToWirelessUsb( } if (pDevice->bSoftwareGenCrcErr == TRUE) { - UINT cbLen; + unsigned int cbLen; PDWORD pdwCRC; dwCRC = 0xFFFFFFFFL; @@ -1820,16 +1849,16 @@ s_bPacketToWirelessUsb( * -*/ -VOID +void s_vGenerateMACHeader ( - IN PSDevice pDevice, - IN PBYTE pbyBufferAddr, - IN WORD wDuration, - IN PSEthernetHeader psEthHeader, - IN BOOL bNeedEncrypt, - IN WORD wFragType, - IN UINT uDMAIdx, - IN UINT uFragIdx + PSDevice pDevice, + PBYTE pbyBufferAddr, + WORD wDuration, + PSEthernetHeader psEthHeader, + BOOL bNeedEncrypt, + WORD wFragType, + unsigned int uDMAIdx, + unsigned int uFragIdx ) { PS802_11Header pMACHeader = (PS802_11Header)pbyBufferAddr; @@ -1843,21 +1872,35 @@ s_vGenerateMACHeader ( } if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr1[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + memcpy(&(pMACHeader->abyAddr3[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); pMACHeader->wFrameCtl |= FC_FROMDS; - } - else { - if (pDevice->eOPMode == OP_MODE_ADHOC) { - memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr3[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr1[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + } else { + if (pDevice->eOPMode == OP_MODE_ADHOC) { + memcpy(&(pMACHeader->abyAddr1[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr2[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr3[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { + memcpy(&(pMACHeader->abyAddr3[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr2[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr1[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); pMACHeader->wFrameCtl |= FC_TODS; } } @@ -1908,34 +1951,34 @@ s_vGenerateMACHeader ( -*/ CMD_STATUS csMgmt_xmit( - IN PSDevice pDevice, - IN PSTxMgmtPacket pPacket + PSDevice pDevice, + PSTxMgmtPacket pPacket ) { BYTE byPktType; PBYTE pbyTxBufferAddr; - PVOID pvRTS; + void *pvRTS; PSCTS pCTS; - PVOID pvTxDataHd; - UINT uDuration; - UINT cbReqCount; + void *pvTxDataHd; + unsigned int uDuration; + unsigned int cbReqCount; PS802_11Header pMACHeader; - UINT cbHeaderSize; - UINT cbFrameBodySize; + unsigned int cbHeaderSize; + unsigned int cbFrameBodySize; BOOL bNeedACK; BOOL bIsPSPOLL = FALSE; PSTxBufHead pTxBufHead; - UINT cbFrameSize; - UINT cbIVlen = 0; - UINT cbICVlen = 0; - UINT cbMIClen = 0; - UINT cbFCSlen = 4; - UINT uPadding = 0; + 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; - UINT cbMacHdLen; + unsigned int cbMacHdLen; SEthernetHeader sEthHeader; - PVOID pvRrvTime; - PVOID pMICHDR; + void *pvRrvTime; + void *pMICHDR; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); WORD wCurrentRate = RATE_1M; PTX_BUFFER pTX_Buffer; @@ -2087,10 +2130,15 @@ CMD_STATUS csMgmt_xmit( cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + sizeof(STxDataHead_ab); } - memset((PVOID)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize)); + memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, + (cbHeaderSize - wTxBufSize)); - memcpy(&(sEthHeader.abyDstAddr[0]), &(pPacket->p80211Header->sA3.abyAddr1[0]), U_ETHER_ADDR_LEN); - memcpy(&(sEthHeader.abySrcAddr[0]), &(pPacket->p80211Header->sA3.abyAddr2[0]), U_ETHER_ADDR_LEN); + memcpy(&(sEthHeader.abyDstAddr[0]), + &(pPacket->p80211Header->sA3.abyAddr1[0]), + ETH_ALEN); + memcpy(&(sEthHeader.abySrcAddr[0]), + &(pPacket->p80211Header->sA3.abyAddr2[0]), + ETH_ALEN); //========================= // No Fragmentation //========================= @@ -2197,20 +2245,20 @@ CMD_STATUS csMgmt_xmit( CMD_STATUS csBeacon_xmit( - IN PSDevice pDevice, - IN PSTxMgmtPacket pPacket + PSDevice pDevice, + PSTxMgmtPacket pPacket ) { - UINT cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN; - UINT cbHeaderSize = 0; + 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; - UINT cbFrameBodySize; - UINT cbReqCount; + unsigned int cbFrameBodySize; + unsigned int cbReqCount; PBEACON_BUFFER pTX_Buffer; PBYTE pbyTxBufferAddr; PUSB_SEND_CONTEXT pContext; @@ -2288,50 +2336,50 @@ csBeacon_xmit( -VOID +void vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); BYTE byPktType; PBYTE pbyTxBufferAddr; - PVOID pvRTS; - PVOID pvCTS; - PVOID pvTxDataHd; - UINT uDuration; - UINT cbReqCount; + void *pvRTS; + void *pvCTS; + void *pvTxDataHd; + unsigned int uDuration; + unsigned int cbReqCount; PS802_11Header pMACHeader; - UINT cbHeaderSize; - UINT cbFrameBodySize; + unsigned int cbHeaderSize; + unsigned int cbFrameBodySize; BOOL bNeedACK; BOOL bIsPSPOLL = FALSE; PSTxBufHead pTxBufHead; - UINT cbFrameSize; - UINT cbIVlen = 0; - UINT cbICVlen = 0; - UINT cbMIClen = 0; - UINT cbFCSlen = 4; - UINT uPadding = 0; - UINT cbMICHDR = 0; - UINT uLength = 0; + 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; - UINT cbMacHdLen; + unsigned int cbMacHdLen; SEthernetHeader sEthHeader; - PVOID pvRrvTime; - PVOID pMICHDR; + void *pvRrvTime; + void *pMICHDR; WORD wCurrentRate = RATE_1M; PUWLAN_80211HDR p80211Header; - UINT uNodeIndex = 0; + unsigned int uNodeIndex = 0; BOOL bNodeExist = FALSE; SKeyItem STempKey; PSKeyItem pTransmitKey = NULL; PBYTE pbyIVHead; PBYTE pbyPayloadHead; PBYTE pbyMacHdr; - UINT cbExtSuppRate = 0; + unsigned int cbExtSuppRate = 0; PTX_BUFFER pTX_Buffer; PUSB_SEND_CONTEXT pContext; // PWLAN_IE pItem; @@ -2520,9 +2568,14 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR); cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab); } - memset((PVOID)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize)); - memcpy(&(sEthHeader.abyDstAddr[0]), &(p80211Header->sA3.abyAddr1[0]), U_ETHER_ADDR_LEN); - memcpy(&(sEthHeader.abySrcAddr[0]), &(p80211Header->sA3.abyAddr2[0]), U_ETHER_ADDR_LEN); + memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, + (cbHeaderSize - wTxBufSize)); + memcpy(&(sEthHeader.abyDstAddr[0]), + &(p80211Header->sA3.abyAddr1[0]), + ETH_ALEN); + memcpy(&(sEthHeader.abySrcAddr[0]), + &(p80211Header->sA3.abyAddr2[0]), + ETH_ALEN); //========================= // No Fragmentation //========================= @@ -2692,21 +2745,21 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { NTSTATUS nsDMA_tx_packet( - IN PSDevice pDevice, - IN UINT uDMAIdx, - IN struct sk_buff *skb + PSDevice pDevice, + unsigned int uDMAIdx, + struct sk_buff *skb ) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT BytesToWrite =0,uHeaderLen = 0; - UINT uNodeIndex = 0; + 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; - UINT ii; + unsigned int ii; BOOL bTKIP_UseGTK = FALSE; BOOL bNeedDeAuth = FALSE; PBYTE pbyBSSID; @@ -2714,7 +2767,7 @@ nsDMA_tx_packet( PUSB_SEND_CONTEXT pContext; BOOL fConvertedPacket; PTX_BUFFER pTX_Buffer; - UINT status; + unsigned int status; WORD wKeepRate = pDevice->wCurrentRate; struct net_device_stats* pStats = &pDevice->stats; //#ifdef WPA_SM_Transtatus @@ -2796,7 +2849,7 @@ nsDMA_tx_packet( return STATUS_RESOURCES; } - memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(skb->data), U_HEADER_LEN); + memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(skb->data), ETH_HLEN); //mike add:station mode check eapol-key challenge---> { @@ -2805,10 +2858,10 @@ nsDMA_tx_packet( BYTE Descriptor_type; WORD Key_info; - Protocol_Version = skb->data[U_HEADER_LEN]; - Packet_Type = skb->data[U_HEADER_LEN+1]; - Descriptor_type = skb->data[U_HEADER_LEN+1+1+2]; - Key_info = (skb->data[U_HEADER_LEN+1+1+2+1] << 8)|(skb->data[U_HEADER_LEN+1+1+2+2]); + Protocol_Version = skb->data[ETH_HLEN]; + Packet_Type = skb->data[ETH_HLEN+1]; + Descriptor_type = skb->data[ETH_HLEN+1+1+2]; + Key_info = (skb->data[ETH_HLEN+1+1+2+1] << 8)|(skb->data[ETH_HLEN+1+1+2+2]); if (pDevice->sTxEthHeader.wType == TYPE_PKT_802_1x) { if(((Protocol_Version==1) ||(Protocol_Version==2)) && (Packet_Type==3)) { //802.1x OR eapol-key challenge frame transfer @@ -2971,10 +3024,12 @@ nsDMA_tx_packet( } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma_tx: pDevice->wCurrentRate = %d \n", pDevice->wCurrentRate); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "dma_tx: pDevice->wCurrentRate = %d\n", + pDevice->wCurrentRate); if (wKeepRate != pDevice->wCurrentRate) { - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_SETPOWER, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_SETPOWER, NULL); } if (pDevice->wCurrentRate <= RATE_11M) { @@ -3057,7 +3112,9 @@ nsDMA_tx_packet( if ( pDevice->bEnablePSMode == TRUE ) { if ( !pDevice->bPSModeTxBurst ) { - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_MAC_DISPOWERSAVING, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_MAC_DISPOWERSAVING, + NULL); pDevice->bPSModeTxBurst = TRUE; } } @@ -3077,7 +3134,7 @@ nsDMA_tx_packet( if (bNeedDeAuth == TRUE) { WORD wReason = WLAN_MGMT_REASON_MIC_FAILURE; - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_DEAUTH, (PBYTE)&wReason); + bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (PBYTE) &wReason); } if(status!=STATUS_PENDING) { @@ -3110,14 +3167,14 @@ nsDMA_tx_packet( BOOL bRelayPacketSend ( - IN PSDevice pDevice, - IN PBYTE pbySkbData, - IN UINT uDataLen, - IN UINT uNodeIndex + PSDevice pDevice, + PBYTE pbySkbData, + unsigned int uDataLen, + unsigned int uNodeIndex ) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT BytesToWrite =0,uHeaderLen = 0; + unsigned int BytesToWrite = 0, uHeaderLen = 0; BYTE byPktType = PK_TYPE_11B; BOOL bNeedEncryption = FALSE; SKeyItem STempKey; @@ -3127,7 +3184,7 @@ bRelayPacketSend ( BYTE byPktTyp; BOOL fConvertedPacket; PTX_BUFFER pTX_Buffer; - UINT status; + unsigned int status; WORD wKeepRate = pDevice->wCurrentRate; @@ -3138,7 +3195,7 @@ bRelayPacketSend ( return FALSE; } - memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)pbySkbData, U_HEADER_LEN); + memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)pbySkbData, ETH_HLEN); if (pDevice->bEncryptionEnable == TRUE) { bNeedEncryption = TRUE; @@ -3197,9 +3254,8 @@ bRelayPacketSend ( pDevice->wCurrentRate = pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate; } - if (wKeepRate != pDevice->wCurrentRate) { - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SETPOWER, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_SETPOWER, NULL); } if (pDevice->wCurrentRate <= RATE_11M) diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h index 6bc22d371c1e..f90de42d7abe 100644 --- a/drivers/staging/vt6656/rxtx.h +++ b/drivers/staging/vt6656/rxtx.h @@ -43,8 +43,8 @@ typedef struct tagSRTSDataF { WORD wFrameControl; WORD wDurationID; - BYTE abyRA[U_ETHER_ADDR_LEN]; - BYTE abyTA[U_ETHER_ADDR_LEN]; + BYTE abyRA[ETH_ALEN]; + BYTE abyTA[ETH_ALEN]; } SRTSDataF, *PSRTSDataF; // @@ -53,7 +53,7 @@ typedef struct tagSRTSDataF { typedef struct tagSCTSDataF { WORD wFrameControl; WORD wDurationID; - BYTE abyRA[U_ETHER_ADDR_LEN]; + BYTE abyRA[ETH_ALEN]; WORD wReserved; } SCTSDataF, *PSCTSDataF; @@ -667,28 +667,28 @@ typedef struct tagSBEACON_BUFFER BOOL bPacketToWirelessUsb( - IN PSDevice pDevice, - IN BYTE byPktType, - IN PBYTE usbPacketBuf, - IN BOOL bNeedEncrypt, - IN UINT cbPayloadSize, - IN UINT uDMAIdx, - IN PSEthernetHeader psEthHeader, - IN PBYTE pPacket, - IN PSKeyItem pTransmitKey, - IN UINT uNodeIndex, - IN WORD wCurrentRate, - OUT UINT *pcbHeaderLen, - OUT UINT *pcbTotalLen + 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); -NTSTATUS nsDMA_tx_packet(PSDevice pDevice, UINT uDMAIdx, struct sk_buff *skb); +void vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb); +NTSTATUS 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, UINT uDataLen, UINT uNodeIndex); - -#endif // __RXTX_H__ - - +BOOL bRelayPacketSend(PSDevice pDevice, PBYTE pbySkbData, + unsigned int uDataLen, unsigned int uNodeIndex); +#endif /* __RXTX_H__ */ diff --git a/drivers/staging/vt6656/srom.h b/drivers/staging/vt6656/srom.h index 4c89e7ad6b4c..dba21a54414b 100644 --- a/drivers/staging/vt6656/srom.h +++ b/drivers/staging/vt6656/srom.h @@ -124,4 +124,4 @@ typedef struct tagSSromReg { /*--------------------- Export Functions --------------------------*/ -#endif // __EEPROM_H__ +#endif /* __EEPROM_H__ */ diff --git a/drivers/staging/vt6656/tcrc.c b/drivers/staging/vt6656/tcrc.c index 5f0c74763f87..e25021e850a0 100644 --- a/drivers/staging/vt6656/tcrc.c +++ b/drivers/staging/vt6656/tcrc.c @@ -41,7 +41,7 @@ /*--------------------- Static Variables --------------------------*/ -// 32-bit CRC table +/* 32-bit CRC table */ static const DWORD s_adwCrc32Table[256] = { 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, @@ -132,17 +132,18 @@ static const DWORD s_adwCrc32Table[256] = { * Return Value: CRC-32 * -*/ -DWORD CRCdwCrc32 (PBYTE pbyData, UINT cbByte, DWORD dwCrcSeed) +DWORD CRCdwCrc32(PBYTE pbyData, unsigned int cbByte, DWORD dwCrcSeed) { - DWORD dwCrc; + DWORD dwCrc; - dwCrc = dwCrcSeed; - while (cbByte--) { - dwCrc = s_adwCrc32Table[(BYTE)((dwCrc ^ (*pbyData)) & 0xFF)] ^ (dwCrc >> 8); - pbyData++; - } + dwCrc = dwCrcSeed; + while (cbByte--) { + dwCrc = s_adwCrc32Table[(BYTE)((dwCrc ^ (*pbyData)) & 0xFF)] ^ + (dwCrc >> 8); + pbyData++; + } - return dwCrc; + return dwCrc; } @@ -164,7 +165,7 @@ DWORD CRCdwCrc32 (PBYTE pbyData, UINT cbByte, DWORD dwCrcSeed) * Return Value: CRC-32 * -*/ -DWORD CRCdwGetCrc32 (PBYTE pbyData, UINT cbByte) +DWORD CRCdwGetCrc32(PBYTE pbyData, unsigned int cbByte) { return ~CRCdwCrc32(pbyData, cbByte, 0xFFFFFFFFL); } @@ -190,7 +191,7 @@ DWORD CRCdwGetCrc32 (PBYTE pbyData, UINT cbByte) * Return Value: CRC-32 * -*/ -DWORD CRCdwGetCrc32Ex(PBYTE pbyData, UINT cbByte, DWORD dwPreCRC) +DWORD CRCdwGetCrc32Ex(PBYTE pbyData, unsigned int cbByte, DWORD dwPreCRC) { return CRCdwCrc32(pbyData, cbByte, dwPreCRC); } diff --git a/drivers/staging/vt6656/tcrc.h b/drivers/staging/vt6656/tcrc.h index 5faa48b0a748..4dfd01e477a4 100644 --- a/drivers/staging/vt6656/tcrc.h +++ b/drivers/staging/vt6656/tcrc.h @@ -43,11 +43,8 @@ /*--------------------- Export Functions --------------------------*/ -DWORD CRCdwCrc32(PBYTE pbyData, UINT cbByte, DWORD dwCrcSeed); -DWORD CRCdwGetCrc32(PBYTE pbyData, UINT cbByte); -DWORD CRCdwGetCrc32Ex(PBYTE pbyData, UINT cbByte, DWORD dwPreCRC); - -#endif // __TCRC_H__ - - +DWORD CRCdwCrc32(PBYTE pbyData, unsigned int cbByte, DWORD dwCrcSeed); +DWORD CRCdwGetCrc32(PBYTE pbyData, unsigned int cbByte); +DWORD CRCdwGetCrc32Ex(PBYTE pbyData, unsigned int cbByte, DWORD dwPreCRC); +#endif /* __TCRC_H__ */ diff --git a/drivers/staging/vt6656/tether.c b/drivers/staging/vt6656/tether.c index c90b469ad545..4f368f174b21 100644 --- a/drivers/staging/vt6656/tether.c +++ b/drivers/staging/vt6656/tether.c @@ -61,25 +61,25 @@ * Return Value: Hash value * */ -BYTE ETHbyGetHashIndexByCrc32 (PBYTE pbyMultiAddr) +BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr) { - int ii; - BYTE byTmpHash; - BYTE byHash = 0; + int ii; + BYTE byTmpHash; + BYTE byHash = 0; - // get the least 6-bits from CRC generator - byTmpHash = (BYTE)(CRCdwCrc32(pbyMultiAddr, U_ETHER_ADDR_LEN, - 0xFFFFFFFFL) & 0x3F); - // reverse most bit to least bit - for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) { - byHash <<= 1; - if (byTmpHash & 0x01) - byHash |= 1; - byTmpHash >>= 1; - } + /* get the least 6-bits from CRC generator */ + byTmpHash = (BYTE)(CRCdwCrc32(pbyMultiAddr, ETH_ALEN, + 0xFFFFFFFFL) & 0x3F); + /* reverse most bit to least bit */ + for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) { + byHash <<= 1; + if (byTmpHash & 0x01) + byHash |= 1; + byTmpHash >>= 1; + } - // adjust 6-bits to the right most - return (byHash >> 2); + /* adjust 6-bits to the right most */ + return byHash >> 2; } @@ -96,14 +96,13 @@ BYTE ETHbyGetHashIndexByCrc32 (PBYTE pbyMultiAddr) * Return Value: TRUE if ok; FALSE if error. * */ -BOOL ETHbIsBufferCrc32Ok (PBYTE pbyBuffer, UINT cbFrameLength) +BOOL ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, unsigned int cbFrameLength) { - DWORD dwCRC; + DWORD dwCRC; - dwCRC = CRCdwGetCrc32(pbyBuffer, cbFrameLength - 4); - if (cpu_to_le32(*((PDWORD)(pbyBuffer + cbFrameLength - 4))) != dwCRC) { - return FALSE; - } - return TRUE; + dwCRC = CRCdwGetCrc32(pbyBuffer, cbFrameLength - 4); + if (cpu_to_le32(*((PDWORD)(pbyBuffer + cbFrameLength - 4))) != dwCRC) + return FALSE; + return TRUE; } diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h index 5a3c326436c6..d63586d5cdb2 100644 --- a/drivers/staging/vt6656/tether.h +++ b/drivers/staging/vt6656/tether.h @@ -29,26 +29,24 @@ #ifndef __TETHER_H__ #define __TETHER_H__ +#include <linux/if_ether.h> #include "ttype.h" /*--------------------- Export Definitions -------------------------*/ // // constants // -#define U_ETHER_ADDR_LEN 6 // Ethernet address length -#define U_TYPE_LEN 2 // #define U_CRC_LEN 4 // -#define U_HEADER_LEN (U_ETHER_ADDR_LEN * 2 + U_TYPE_LEN) -#define U_ETHER_ADDR_STR_LEN (U_ETHER_ADDR_LEN * 2 + 1) +#define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1) // Ethernet address string length #define MIN_DATA_LEN 46 // min data length #define MAX_DATA_LEN 1500 // max data length -#define MIN_PACKET_LEN (MIN_DATA_LEN + U_HEADER_LEN) +#define MIN_PACKET_LEN (MIN_DATA_LEN + ETH_HLEN) // 60 // min total packet length (tx) -#define MAX_PACKET_LEN (MAX_DATA_LEN + U_HEADER_LEN) +#define MAX_PACKET_LEN (MAX_DATA_LEN + ETH_HLEN) // 1514 // max total packet length (tx) @@ -167,8 +165,8 @@ // Ethernet packet // typedef struct tagSEthernetHeader { - BYTE abyDstAddr[U_ETHER_ADDR_LEN]; - BYTE abySrcAddr[U_ETHER_ADDR_LEN]; + BYTE abyDstAddr[ETH_ALEN]; + BYTE abySrcAddr[ETH_ALEN]; WORD wType; }__attribute__ ((__packed__)) SEthernetHeader, *PSEthernetHeader; @@ -178,8 +176,8 @@ SEthernetHeader, *PSEthernetHeader; // 802_3 packet // typedef struct tagS802_3Header { - BYTE abyDstAddr[U_ETHER_ADDR_LEN]; - BYTE abySrcAddr[U_ETHER_ADDR_LEN]; + BYTE abyDstAddr[ETH_ALEN]; + BYTE abySrcAddr[ETH_ALEN]; WORD wLen; }__attribute__ ((__packed__)) S802_3Header, *PS802_3Header; @@ -190,11 +188,11 @@ S802_3Header, *PS802_3Header; typedef struct tagS802_11Header { WORD wFrameCtl; WORD wDurationID; - BYTE abyAddr1[U_ETHER_ADDR_LEN]; - BYTE abyAddr2[U_ETHER_ADDR_LEN]; - BYTE abyAddr3[U_ETHER_ADDR_LEN]; + BYTE abyAddr1[ETH_ALEN]; + BYTE abyAddr2[ETH_ALEN]; + BYTE abyAddr3[ETH_ALEN]; WORD wSeqCtl; - BYTE abyAddr4[U_ETHER_ADDR_LEN]; + BYTE abyAddr4[ETH_ALEN]; }__attribute__ ((__packed__)) S802_11Header, *PS802_11Header; @@ -228,9 +226,6 @@ S802_11Header, *PS802_11Header; BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr); //BYTE ETHbyGetHashIndexByCrc(PBYTE pbyMultiAddr); -BOOL ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, UINT cbFrameLength); - -#endif // __TETHER_H__ - - +BOOL ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, unsigned int cbFrameLength); +#endif /* __TETHER_H__ */ diff --git a/drivers/staging/vt6656/tkip.c b/drivers/staging/vt6656/tkip.c index 8ca154080e98..f83af5913aa6 100644 --- a/drivers/staging/vt6656/tkip.c +++ b/drivers/staging/vt6656/tkip.c @@ -183,7 +183,7 @@ unsigned int rotr1(unsigned int a) * Return Value: none * */ -VOID TKIPvMixKey( +void TKIPvMixKey( PBYTE pbyTKey, PBYTE pbyTA, WORD wTSC15_0, diff --git a/drivers/staging/vt6656/tkip.h b/drivers/staging/vt6656/tkip.h index 847ecdf97ee8..47c3a853b92a 100644 --- a/drivers/staging/vt6656/tkip.h +++ b/drivers/staging/vt6656/tkip.h @@ -46,7 +46,7 @@ /*--------------------- Export Functions --------------------------*/ -VOID TKIPvMixKey( +void TKIPvMixKey( PBYTE pbyTKey, PBYTE pbyTA, WORD wTSC15_0, @@ -54,7 +54,4 @@ VOID TKIPvMixKey( PBYTE pbyRC4Key ); -#endif // __TKIP_H__ - - - +#endif /* __TKIP_H__ */ diff --git a/drivers/staging/vt6656/tmacro.h b/drivers/staging/vt6656/tmacro.h index e96c140de052..3c81e2b0791d 100644 --- a/drivers/staging/vt6656/tmacro.h +++ b/drivers/staging/vt6656/tmacro.h @@ -57,6 +57,4 @@ #define MAKEDWORD(lw, hw) ((DWORD)(((WORD)(lw)) | (((DWORD)((WORD)(hw))) << 16))) #endif -#endif // __TMACRO_H__ - - +#endif /* __TMACRO_H__ */ diff --git a/drivers/staging/vt6656/ttype.h b/drivers/staging/vt6656/ttype.h index 9ee3f436fc3d..c27f9858e2e9 100644 --- a/drivers/staging/vt6656/ttype.h +++ b/drivers/staging/vt6656/ttype.h @@ -26,25 +26,11 @@ * */ - #ifndef __TTYPE_H__ #define __TTYPE_H__ - /******* Common definitions and typedefs ***********************************/ -#ifndef VOID -#define VOID void -#endif - -#ifndef IN -#define IN -#endif - -#ifndef OUT -#define OUT -#endif - //2007-0115-05<Add>by MikeLiu #ifndef TxInSleep #define TxInSleep @@ -52,7 +38,6 @@ //DavidWang - //2007-0814-01<Add>by MikeLiu #ifndef Safe_Close #define Safe_Close @@ -72,11 +57,6 @@ typedef int BOOL; #define FALSE 0 #endif - -#if !defined(SUCCESS) -#define SUCCESS 0 -#endif - //2007-0809-01<Add>by MikeLiu #ifndef update_BssList #define update_BssList @@ -92,31 +72,6 @@ typedef int BOOL; /****** Simple typedefs ***************************************************/ -/* These lines assume that your compiler's longs are 32 bits and - * shorts are 16 bits. It is already assumed that chars are 8 bits, - * but it doesn't matter if they're signed or unsigned. - */ - -typedef signed char I8; /* 8-bit signed integer */ - -typedef unsigned char U8; /* 8-bit unsigned integer */ -typedef unsigned short U16; /* 16-bit unsigned integer */ -typedef unsigned long U32; /* 32-bit unsigned integer */ - - -typedef char CHAR; -typedef signed short SHORT; -typedef signed int INT; -typedef signed long LONG; - -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef unsigned int UINT; -typedef unsigned long ULONG; -typedef unsigned long long ULONGLONG; //64 bit - - - typedef unsigned char BYTE; // 8-bit typedef unsigned short WORD; // 16-bit typedef unsigned long DWORD; // 32-bit @@ -133,7 +88,6 @@ typedef union tagUQuadWord { } UQuadWord; typedef UQuadWord QWORD; // 64-bit - /****** Common pointer types ***********************************************/ typedef unsigned long ULONG_PTR; // 32-bit @@ -150,13 +104,4 @@ typedef DWORD * PDWORD; typedef QWORD * PQWORD; -typedef void * PVOID; - -// handle declaration -#ifdef STRICT -typedef void *HANDLE; -#else -typedef PVOID HANDLE; -#endif - -#endif // __TTYPE_H__ +#endif /* __TTYPE_H__ */ diff --git a/drivers/staging/vt6656/upc.h b/drivers/staging/vt6656/upc.h index acd1b661490d..b33aba4b12c9 100644 --- a/drivers/staging/vt6656/upc.h +++ b/drivers/staging/vt6656/upc.h @@ -141,7 +141,7 @@ #define PCAvDelayByIO(uDelayUnit) { \ BYTE byData; \ - ULONG ii; \ + unsigned long ii; \ \ if (uDelayUnit <= 50) { \ udelay(uDelayUnit); \ @@ -159,8 +159,4 @@ /*--------------------- Export Functions --------------------------*/ - - - -#endif // __UPC_H__ - +#endif /* __UPC_H__ */ diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index 65e91a332a66..fd2355e34fb0 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -71,36 +71,36 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ static -VOID +void s_nsInterruptUsbIoCompleteRead( - IN struct urb *urb + struct urb *urb ); static -VOID +void s_nsBulkInUsbIoCompleteRead( - IN struct urb *urb + struct urb *urb ); static -VOID +void s_nsBulkOutIoCompleteWrite( - IN struct urb *urb + struct urb *urb ); static -VOID +void s_nsControlInUsbIoCompleteRead( - IN struct urb *urb + struct urb *urb ); static -VOID +void s_nsControlInUsbIoCompleteWrite( - IN struct urb *urb + struct urb *urb ); /*--------------------- Export Variables --------------------------*/ @@ -111,12 +111,12 @@ s_nsControlInUsbIoCompleteWrite( NTSTATUS PIPEnsControlOutAsyn( - IN PSDevice pDevice, - IN BYTE byRequest, - IN WORD wValue, - IN WORD wIndex, - IN WORD wLength, - IN PBYTE pbyBuffer + PSDevice pDevice, + BYTE byRequest, + WORD wValue, + WORD wIndex, + WORD wLength, + PBYTE pbyBuffer ) { NTSTATUS ntStatus; @@ -142,7 +142,7 @@ PIPEnsControlOutAsyn( 0x40, // RequestType wValue, wIndex, - (PVOID) pbyBuffer, + (void *) pbyBuffer, wLength, HZ ); @@ -162,12 +162,12 @@ PIPEnsControlOutAsyn( NTSTATUS PIPEnsControlOut( - IN PSDevice pDevice, - IN BYTE byRequest, - IN WORD wValue, - IN WORD wIndex, - IN WORD wLength, - IN PBYTE pbyBuffer + PSDevice pDevice, + BYTE byRequest, + WORD wValue, + WORD wIndex, + WORD wLength, + PBYTE pbyBuffer ) { NTSTATUS ntStatus = 0; @@ -193,7 +193,8 @@ PIPEnsControlOut( usb_sndctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, pbyBuffer, wLength, s_nsControlInUsbIoCompleteWrite, pDevice); - if ((ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC)) != 0) { + 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); return STATUS_FAILURE; } @@ -223,12 +224,12 @@ PIPEnsControlOut( NTSTATUS PIPEnsControlIn( - IN PSDevice pDevice, - IN BYTE byRequest, - IN WORD wValue, - IN WORD wIndex, - IN WORD wLength, - IN OUT PBYTE pbyBuffer + PSDevice pDevice, + BYTE byRequest, + WORD wValue, + WORD wIndex, + WORD wLength, + PBYTE pbyBuffer ) { NTSTATUS ntStatus = 0; @@ -251,7 +252,8 @@ PIPEnsControlIn( usb_rcvctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, pbyBuffer, wLength, s_nsControlInUsbIoCompleteRead, pDevice); - if ((ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC)) != 0) { + 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); @@ -277,9 +279,9 @@ PIPEnsControlIn( } static -VOID +void s_nsControlInUsbIoCompleteWrite( - IN struct urb *urb + struct urb *urb ) { PSDevice pDevice; @@ -318,9 +320,9 @@ s_nsControlInUsbIoCompleteWrite( * */ static -VOID +void s_nsControlInUsbIoCompleteRead( - IN struct urb *urb + struct urb *urb ) { PSDevice pDevice; @@ -360,7 +362,7 @@ s_nsControlInUsbIoCompleteRead( */ NTSTATUS PIPEnsInterruptRead( - IN PSDevice pDevice + PSDevice pDevice ) { NTSTATUS ntStatus = STATUS_FAILURE; @@ -383,7 +385,7 @@ PIPEnsInterruptRead( usb_fill_int_urb(pDevice->pInterruptURB, pDevice->usb, usb_rcvintpipe(pDevice->usb, 1), - (PVOID) pDevice->intBuf.pDataBuf, + (void *) pDevice->intBuf.pDataBuf, MAX_INTERRUPT_SIZE, s_nsInterruptUsbIoCompleteRead, pDevice, @@ -394,7 +396,7 @@ PIPEnsInterruptRead( usb_fill_int_urb(pDevice->pInterruptURB, pDevice->usb, usb_rcvintpipe(pDevice->usb, 1), - (PVOID) pDevice->intBuf.pDataBuf, + (void *) pDevice->intBuf.pDataBuf, MAX_INTERRUPT_SIZE, s_nsInterruptUsbIoCompleteRead, pDevice, @@ -407,14 +409,15 @@ PIPEnsInterruptRead( usb_fill_bulk_urb(pDevice->pInterruptURB, pDevice->usb, usb_rcvbulkpipe(pDevice->usb, 1), - (PVOID) pDevice->intBuf.pDataBuf, + (void *) pDevice->intBuf.pDataBuf, MAX_INTERRUPT_SIZE, s_nsInterruptUsbIoCompleteRead, pDevice); #endif #endif - if ((ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC)) != 0) { + ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC); + if (ntStatus != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); } @@ -438,9 +441,9 @@ usb_fill_bulk_urb(pDevice->pInterruptURB, * */ static -VOID +void s_nsInterruptUsbIoCompleteRead( - IN struct urb *urb + struct urb *urb ) { @@ -481,12 +484,11 @@ s_nsInterruptUsbIoCompleteRead( pDevice->fKillEventPollingThread = TRUE; // } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"IntUSBIoCompleteControl STATUS = %d\n", ntStatus ); - } - else { - pDevice->ulIntInBytesRead += (ULONG)urb->actual_length; - pDevice->ulIntInContCRCError = 0; - pDevice->bEventAvailable = TRUE; - INTnsProcessData(pDevice); + } else { + pDevice->ulIntInBytesRead += (unsigned long) urb->actual_length; + pDevice->ulIntInContCRCError = 0; + pDevice->bEventAvailable = TRUE; + INTnsProcessData(pDevice); } STAvUpdateUSBCounter(&pDevice->scStatistic.USB_InterruptStat, ntStatus); @@ -494,7 +496,8 @@ s_nsInterruptUsbIoCompleteRead( if (pDevice->fKillEventPollingThread != TRUE) { #if 0 //reserve int URB submit - if ((ntStatus = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { + ntStatus = usb_submit_urb(urb, GFP_ATOMIC); + if (ntStatus != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Re-Submit int URB failed %d\n", ntStatus); } #else //replace int URB submit by bulk transfer @@ -502,12 +505,13 @@ s_nsInterruptUsbIoCompleteRead( usb_fill_bulk_urb(pDevice->pInterruptURB, pDevice->usb, usb_rcvbulkpipe(pDevice->usb, 1), - (PVOID) pDevice->intBuf.pDataBuf, + (void *) pDevice->intBuf.pDataBuf, MAX_INTERRUPT_SIZE, s_nsInterruptUsbIoCompleteRead, pDevice); - if ((ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC)) != 0) { + ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC); + if (ntStatus != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); } @@ -538,8 +542,8 @@ s_nsInterruptUsbIoCompleteRead( */ NTSTATUS PIPEnsBulkInUsbRead( - IN PSDevice pDevice, - IN PRCB pRCB + PSDevice pDevice, + PRCB pRCB ) { NTSTATUS ntStatus= 0; @@ -567,12 +571,13 @@ PIPEnsBulkInUsbRead( usb_fill_bulk_urb(pUrb, pDevice->usb, usb_rcvbulkpipe(pDevice->usb, 2), - (PVOID) (pRCB->skb->data), + (void *) (pRCB->skb->data), MAX_TOTAL_SIZE_WITH_ALL_HEADERS, s_nsBulkInUsbIoCompleteRead, pRCB); - if((ntStatus = usb_submit_urb(pUrb, GFP_ATOMIC)) != 0){ + ntStatus = usb_submit_urb(pUrb, GFP_ATOMIC); + if (ntStatus != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Rx URB failed %d\n", ntStatus); return STATUS_FAILURE ; } @@ -600,15 +605,15 @@ PIPEnsBulkInUsbRead( * */ static -VOID +void s_nsBulkInUsbIoCompleteRead( - IN struct urb *urb + struct urb *urb ) { PRCB pRCB = (PRCB)urb->context; PSDevice pDevice = (PSDevice)pRCB->pDevice; - ULONG bytesRead; + unsigned long bytesRead; BOOL bIndicateReceive = FALSE; BOOL bReAllocSkb = FALSE; NTSTATUS status; @@ -681,8 +686,8 @@ s_nsBulkInUsbIoCompleteRead( */ NDIS_STATUS PIPEnsSendBulkOut( - IN PSDevice pDevice, - IN PUSB_SEND_CONTEXT pContext + PSDevice pDevice, + PUSB_SEND_CONTEXT pContext ) { NTSTATUS status; @@ -712,13 +717,14 @@ PIPEnsSendBulkOut( usb_fill_bulk_urb( pUrb, pDevice->usb, - usb_sndbulkpipe(pDevice->usb, 3), - (PVOID) &(pContext->Data[0]), + usb_sndbulkpipe(pDevice->usb, 3), + (void *) &(pContext->Data[0]), pContext->uBufLen, s_nsBulkOutIoCompleteWrite, pContext); - if((status = usb_submit_urb(pUrb, GFP_ATOMIC))!=0) + status = usb_submit_urb(pUrb, GFP_ATOMIC); + if (status != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Tx URB failed %d\n", status); return STATUS_FAILURE; @@ -759,15 +765,15 @@ PIPEnsSendBulkOut( * */ static -VOID +void s_nsBulkOutIoCompleteWrite( - IN struct urb *urb + struct urb *urb ) { PSDevice pDevice; NTSTATUS status; CONTEXT_TYPE ContextType; - ULONG ulBufLen; + unsigned long ulBufLen; PUSB_SEND_CONTEXT pContext; diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h index c422d1d08730..f852b39027a5 100644 --- a/drivers/staging/vt6656/usbpipe.h +++ b/drivers/staging/vt6656/usbpipe.h @@ -43,34 +43,34 @@ NTSTATUS PIPEnsControlOut( - IN PSDevice pDevice, - IN BYTE byRequest, - IN WORD wValue, - IN WORD wIndex, - IN WORD wLength, - IN PBYTE pbyBuffer + PSDevice pDevice, + BYTE byRequest, + WORD wValue, + WORD wIndex, + WORD wLength, + PBYTE pbyBuffer ); NTSTATUS PIPEnsControlOutAsyn( - IN PSDevice pDevice, - IN BYTE byRequest, - IN WORD wValue, - IN WORD wIndex, - IN WORD wLength, - IN PBYTE pbyBuffer + PSDevice pDevice, + BYTE byRequest, + WORD wValue, + WORD wIndex, + WORD wLength, + PBYTE pbyBuffer ); NTSTATUS PIPEnsControlIn( - IN PSDevice pDevice, - IN BYTE byRequest, - IN WORD wValue, - IN WORD wIndex, - IN WORD wLength, - IN OUT PBYTE pbyBuffer + PSDevice pDevice, + BYTE byRequest, + WORD wValue, + WORD wIndex, + WORD wLength, + PBYTE pbyBuffer ); @@ -78,22 +78,19 @@ PIPEnsControlIn( NTSTATUS PIPEnsInterruptRead( - IN PSDevice pDevice + PSDevice pDevice ); NTSTATUS PIPEnsBulkInUsbRead( - IN PSDevice pDevice, - IN PRCB pRCB + PSDevice pDevice, + PRCB pRCB ); NTSTATUS PIPEnsSendBulkOut( - IN PSDevice pDevice, - IN PUSB_SEND_CONTEXT pContext + PSDevice pDevice, + PUSB_SEND_CONTEXT pContext ); -#endif // __USBPIPE_H__ - - - +#endif /* __USBPIPE_H__ */ diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 51b2dcfbab91..72e21b6f0e88 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -69,21 +69,21 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ static -VOID +void s_vProbeChannel( - IN PSDevice pDevice + PSDevice pDevice ); static PSTxMgmtPacket s_MgrMakeProbeRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PBYTE pScanBSSID, - IN PWLAN_IE_SSID pSSID, - IN PWLAN_IE_SUPP_RATES pCurrRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + PSDevice pDevice, + PSMgmtObject pMgmt, + PBYTE pScanBSSID, + PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates ); @@ -94,18 +94,12 @@ s_bCommandComplete ( ); -static -BOOL s_bClearBSSID_SCAN ( - IN HANDLE hDeviceContext - ); +static BOOL s_bClearBSSID_SCAN(void *hDeviceContext); /*--------------------- Export Variables --------------------------*/ - /*--------------------- Export Functions --------------------------*/ - - /* * Description: * Stop AdHoc beacon during scan process @@ -119,6 +113,7 @@ BOOL s_bClearBSSID_SCAN ( * Return Value: none * */ + static void vAdHocBeaconStop(PSDevice pDevice) @@ -210,9 +205,9 @@ vAdHocBeaconRestart(PSDevice pDevice) -*/ static -VOID +void s_vProbeChannel( - IN PSDevice pDevice + PSDevice pDevice ) { //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M @@ -224,7 +219,7 @@ s_vProbeChannel( PBYTE pbyRate; PSTxMgmtPacket pTxPacket; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - UINT ii; + unsigned int ii; if (pDevice->byBBType == BB_TYPE_11A) { @@ -275,12 +270,12 @@ s_vProbeChannel( PSTxMgmtPacket s_MgrMakeProbeRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PBYTE pScanBSSID, - IN PWLAN_IE_SSID pSSID, - IN PWLAN_IE_SUPP_RATES pCurrRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + PSDevice pDevice, + PSMgmtObject pMgmt, + PBYTE pScanBSSID, + PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates ) { @@ -321,41 +316,27 @@ s_MgrMakeProbeRequest( return pTxPacket; } - - - - -VOID -vCommandTimerWait( - IN HANDLE hDeviceContext, - IN UINT MSecond - ) +void vCommandTimerWait(void *hDeviceContext, unsigned int MSecond) { PSDevice pDevice = (PSDevice)hDeviceContext; init_timer(&pDevice->sTimerCommand); - pDevice->sTimerCommand.data = (ULONG)pDevice; + pDevice->sTimerCommand.data = (unsigned long)pDevice; pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; // RUN_AT :1 msec ~= (HZ/1024) - pDevice->sTimerCommand.expires = (UINT)RUN_AT((MSecond * HZ) >> 10); + pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10); add_timer(&pDevice->sTimerCommand); return; } - - - -VOID -vRunCommand( - IN HANDLE hDeviceContext - ) +void vRunCommand(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; PWLAN_IE_SSID pItemSSIDCurr; CMD_STATUS Status; - UINT ii; + unsigned int ii; BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; struct sk_buff *skb; BYTE byData; @@ -435,7 +416,8 @@ vRunCommand( pMgmt->abyScanBSSID[5] = 0xFF; pItemSSID->byElementID = WLAN_EID_SSID; // clear bssid list - // BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); + /* BSSvClearBSSList((void *) pDevice, + pDevice->bLinkPass); */ pMgmt->eScanState = WMAC_IS_SCANNING; pDevice->byScanBBType = pDevice->byBBType; //lucas pDevice->bStopDataPkt = TRUE; @@ -480,11 +462,11 @@ vRunCommand( (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { s_vProbeChannel(pDevice); spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((HANDLE)pDevice, 100); + vCommandTimerWait((void *) pDevice, 100); return; } else { spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((HANDLE)pDevice, WCMD_PASSIVE_SCAN_TIME); + vCommandTimerWait((void *) pDevice, WCMD_PASSIVE_SCAN_TIME); return; } @@ -552,7 +534,11 @@ vRunCommand( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); // reason = 8 : disassoc because sta has left - vMgrDisassocBeginSta((HANDLE)pDevice, pMgmt, pMgmt->abyCurrBSSID, (8), &Status); + vMgrDisassocBeginSta((void *) pDevice, + pMgmt, + pMgmt->abyCurrBSSID, + (8), + &Status); pDevice->bLinkPass = FALSE; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); // unlock command busy @@ -614,22 +600,26 @@ vRunCommand( // set initial state pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; - PSvDisablePowerSaving((HANDLE)pDevice); + PSvDisablePowerSaving((void *) pDevice); BSSvClearNodeDBTable(pDevice, 0); - vMgrJoinBSSBegin((HANDLE)pDevice, &Status); + vMgrJoinBSSBegin((void *) pDevice, &Status); // if Infra mode if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) { // Call mgr to begin the deauthentication // reason = (3) beacuse sta has left ESS - if (pMgmt->eCurrState>= WMAC_STATE_AUTH) { - vMgrDeAuthenBeginSta((HANDLE)pDevice, pMgmt, pMgmt->abyCurrBSSID, (3), &Status); - } + if (pMgmt->eCurrState >= WMAC_STATE_AUTH) { + vMgrDeAuthenBeginSta((void *)pDevice, + pMgmt, + pMgmt->abyCurrBSSID, + (3), + &Status); + } // Call mgr to begin the authentication - vMgrAuthenBeginSta((HANDLE)pDevice, pMgmt, &Status); + vMgrAuthenBeginSta((void *) pDevice, pMgmt, &Status); if (Status == CMD_STATUS_SUCCESS) { pDevice->byLinkWaitCount = 0; pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT; - vCommandTimerWait((HANDLE)pDevice, AUTHENTICATE_TIMEOUT); + vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT); spin_unlock_irq(&pDevice->lock); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); return; @@ -648,10 +638,12 @@ vRunCommand( } else { // start own IBSS - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CreateOwn IBSS by CurrMode = IBSS_STA \n"); - vMgrCreateOwnIBSS((HANDLE)pDevice, &Status); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "CreateOwn IBSS by CurrMode = IBSS_STA\n"); + vMgrCreateOwnIBSS((void *) pDevice, &Status); if (Status != CMD_STATUS_SUCCESS){ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail ! \n"); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); }; BSSvAddMulticastNode(pDevice); } @@ -662,10 +654,12 @@ vRunCommand( if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA || pMgmt->eConfigMode == WMAC_CONFIG_AUTO) { // start own IBSS - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CreateOwn IBSS by CurrMode = STANDBY \n"); - vMgrCreateOwnIBSS((HANDLE)pDevice, &Status); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "CreateOwn IBSS by CurrMode = STANDBY\n"); + vMgrCreateOwnIBSS((void *) pDevice, &Status); if (Status != CMD_STATUS_SUCCESS){ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_IBSS_CREATE fail ! \n"); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); }; BSSvAddMulticastNode(pDevice); s_bClearBSSID_SCAN(pDevice); @@ -701,12 +695,12 @@ vRunCommand( pDevice->byLinkWaitCount = 0; // Call mgr to begin the association DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_AUTH\n"); - vMgrAssocBeginSta((HANDLE)pDevice, pMgmt, &Status); + vMgrAssocBeginSta((void *) pDevice, pMgmt, &Status); if (Status == CMD_STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState = WLAN_ASSOCIATE_WAIT\n"); pDevice->byLinkWaitCount = 0; pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; - vCommandTimerWait((HANDLE)pDevice, ASSOCIATE_TIMEOUT); + vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT); spin_unlock_irq(&pDevice->lock); return; } @@ -718,7 +712,7 @@ vRunCommand( pDevice->byLinkWaitCount ++; printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((HANDLE)pDevice, AUTHENTICATE_TIMEOUT/2); + vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT/2); return; } pDevice->byLinkWaitCount = 0; @@ -742,7 +736,8 @@ vRunCommand( if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); if (pDevice->ePSMode != WMAC_POWER_CAM) { - PSvEnablePowerSaving((HANDLE)pDevice, pMgmt->wListenInterval); + PSvEnablePowerSaving((void *) pDevice, + pMgmt->wListenInterval); } /* if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) { @@ -765,7 +760,7 @@ vRunCommand( // printk("Re-initial TxDataTimer****\n"); del_timer(&pDevice->sTimerTxData); init_timer(&pDevice->sTimerTxData); - pDevice->sTimerTxData.data = (ULONG)pDevice; + pDevice->sTimerTxData.data = (unsigned long) pDevice; pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData; pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback pDevice->fTxDataInSleep = FALSE; @@ -786,7 +781,7 @@ vRunCommand( pDevice->byLinkWaitCount ++; printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((HANDLE)pDevice, ASSOCIATE_TIMEOUT/2); + vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT/2); return; } pDevice->byLinkWaitCount = 0; @@ -823,9 +818,10 @@ vRunCommand( pMgmt->eCurrState = WMAC_STATE_IDLE; pDevice->bFixRate = FALSE; - vMgrCreateOwnIBSS((HANDLE)pDevice, &Status); - if (Status != CMD_STATUS_SUCCESS){ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail ! \n"); + vMgrCreateOwnIBSS((void *) pDevice, &Status); + if (Status != CMD_STATUS_SUCCESS) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "vMgrCreateOwnIBSS fail!\n"); }; // alway turn off unicast bit MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_UNICAST); @@ -948,7 +944,11 @@ vRunCommand( if (pDevice->bLinkPass == TRUE) { // reason = 8 : disassoc because sta has left - vMgrDisassocBeginSta((HANDLE)pDevice, pMgmt, pMgmt->abyCurrBSSID, (8), &Status); + vMgrDisassocBeginSta((void *) pDevice, + pMgmt, + pMgmt->abyCurrBSSID, + (8), + &Status); pDevice->bLinkPass = FALSE; // unlock command busy pMgmt->eCurrState = WMAC_STATE_IDLE; @@ -1185,18 +1185,15 @@ s_bCommandComplete ( break; } - - vCommandTimerWait((HANDLE)pDevice, 0); + vCommandTimerWait((void *) pDevice, 0); } return TRUE; } -BOOL bScheduleCommand ( - IN HANDLE hDeviceContext, - IN CMD_CODE eCommand, - IN PBYTE pbyItem0 - ) +BOOL bScheduleCommand(void *hDeviceContext, + CMD_CODE eCommand, + PBYTE pbyItem0) { PSDevice pDevice = (PSDevice)hDeviceContext; @@ -1264,14 +1261,11 @@ BOOL bScheduleCommand ( * Return Value: TRUE if success; otherwise FALSE * */ -static -BOOL s_bClearBSSID_SCAN ( - IN HANDLE hDeviceContext - ) +static BOOL s_bClearBSSID_SCAN(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; - UINT uCmdDequeueIdx = pDevice->uCmdDequeueIdx; - UINT 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 ++) { @@ -1287,10 +1281,7 @@ BOOL s_bClearBSSID_SCAN ( //mike add:reset command timer -VOID -vResetCommandTimer( - IN HANDLE hDeviceContext - ) +void vResetCommandTimer(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; @@ -1298,7 +1289,7 @@ vResetCommandTimer( del_timer(&pDevice->sTimerCommand); //init timer init_timer(&pDevice->sTimerCommand); - pDevice->sTimerCommand.data = (ULONG)pDevice; + pDevice->sTimerCommand.data = (unsigned long)pDevice; pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; pDevice->sTimerCommand.expires = RUN_AT(HZ); pDevice->cbFreeCmdQueue = CMD_Q_SIZE; @@ -1311,10 +1302,7 @@ vResetCommandTimer( //2007-0115-08<Add>by MikeLiu #ifdef TxInSleep -VOID -BSSvSecondTxData( - IN HANDLE hDeviceContext - ) +void BSSvSecondTxData(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); diff --git a/drivers/staging/vt6656/wcmd.h b/drivers/staging/vt6656/wcmd.h index 90d672b462b1..09c4411c6891 100644 --- a/drivers/staging/vt6656/wcmd.h +++ b/drivers/staging/vt6656/wcmd.h @@ -105,46 +105,32 @@ typedef enum tagCMD_STATE { WLAN_CMD_IDLE } CMD_STATE, *PCMD_STATE; - - /*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Variables --------------------------*/ - /*--------------------- Export Types ------------------------------*/ - /*--------------------- Export Functions --------------------------*/ -VOID -vResetCommandTimer( - IN HANDLE hDeviceContext - ); -BOOL -bScheduleCommand( - IN HANDLE hDeviceContext, - IN CMD_CODE eCommand, - IN PBYTE pbyItem0 - ); +void vResetCommandTimer(void *hDeviceContext); + +BOOL bScheduleCommand(void *hDeviceContext, + CMD_CODE eCommand, + PBYTE pbyItem0); + +void vRunCommand(void *hDeviceContext); -VOID -vRunCommand( - IN HANDLE hDeviceContext - ); /* -VOID +void WCMDvCommandThread( - PVOID Context + void * Context ); */ //2007-0115-09<Add>by MikeLiu #ifdef TxInSleep -VOID -BSSvSecondTxData( - IN HANDLE hDeviceContext - ); +void BSSvSecondTxData(void *hDeviceContext); #endif -#endif //__WCMD_H__ +#endif /* __WCMD_H__ */ diff --git a/drivers/staging/vt6656/wctl.c b/drivers/staging/vt6656/wctl.c index 40986da1e4a2..857ce0bc00a4 100644 --- a/drivers/staging/vt6656/wctl.c +++ b/drivers/staging/vt6656/wctl.c @@ -69,8 +69,8 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) { - UINT uIndex; - UINT ii; + unsigned int uIndex; + unsigned int ii; PSCacheEntry pCacheEntry; if (IS_FC_RETRY(pMACHeader)) { @@ -91,7 +91,7 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) /* Not fount in cache - insert */ pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr]; pCacheEntry->wFmSequence = pMACHeader->wSeqCtl; - memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), U_ETHER_ADDR_LEN); + 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; @@ -111,9 +111,9 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) * Return Value: index number in Defragment Database * */ -UINT WCTLuSearchDFCB (PSDevice pDevice, PS802_11Header pMACHeader) +unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader) { -UINT ii; + unsigned int ii; for(ii=0;ii<pDevice->cbDFCB;ii++) { if ((pDevice->sRxDFCB[ii].bInUse == TRUE) && @@ -141,9 +141,9 @@ UINT ii; * Return Value: index number in Defragment Database * */ -UINT WCTLuInsertDFCB (PSDevice pDevice, PS802_11Header pMACHeader) +unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader) { -UINT ii; + unsigned int ii; if (pDevice->cbFreeDFCB == 0) return(pDevice->cbDFCB); @@ -154,7 +154,9 @@ UINT ii; 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]), &(pMACHeader->abyAddr2[0]), U_ETHER_ADDR_LEN); + memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), + &(pMACHeader->abyAddr2[0]), + ETH_ALEN); return(ii); } } @@ -178,9 +180,10 @@ UINT ii; * Return Value: TRUE if it is valid fragment packet and we have resource to defragment; otherwise FALSE * */ -BOOL WCTLbHandleFragment (PSDevice pDevice, PS802_11Header pMACHeader, UINT cbFrameLength, BOOL bWEP, BOOL bExtIV) +BOOL WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, + unsigned int cbFrameLength, BOOL bWEP, BOOL bExtIV) { -UINT uHeaderSize; +unsigned int uHeaderSize; if (bWEP == TRUE) { diff --git a/drivers/staging/vt6656/wctl.h b/drivers/staging/vt6656/wctl.h index a1ac4791bfd3..7270af68c89d 100644 --- a/drivers/staging/vt6656/wctl.h +++ b/drivers/staging/vt6656/wctl.h @@ -90,7 +90,6 @@ (uVar)++; \ } - /*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Variables --------------------------*/ @@ -98,11 +97,9 @@ /*--------------------- Export Functions --------------------------*/ BOOL WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); -BOOL WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, UINT cbFrameLength, BOOL bWEP, BOOL bExtIV); -UINT WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader); -UINT WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader); - -#endif // __WCTL_H__ - - +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); +#endif /* __WCTL_H__ */ diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index 330aea69d231..93c15f0580fe 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -94,160 +94,160 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ //2008-0730-01<Add>by MikeLiu static BOOL ChannelExceedZoneType( - IN PSDevice pDevice, - IN BYTE byCurrChannel + PSDevice pDevice, + BYTE byCurrChannel ); // Association/diassociation functions static PSTxMgmtPacket s_MgrMakeAssocRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PBYTE pDAddr, - IN WORD wCurrCapInfo, - IN WORD wListenInterval, - IN PWLAN_IE_SSID pCurrSSID, - IN PWLAN_IE_SUPP_RATES pCurrRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + 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 -VOID +void s_vMgrRxAssocRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket, - IN UINT uNodeIndex + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket, + unsigned int uNodeIndex ); static PSTxMgmtPacket s_MgrMakeReAssocRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PBYTE pDAddr, - IN WORD wCurrCapInfo, - IN WORD wListenInterval, - IN PWLAN_IE_SSID pCurrSSID, - IN PWLAN_IE_SUPP_RATES pCurrRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + 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 -VOID +void s_vMgrRxAssocResponse( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket, - IN BOOL bReAssocType + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket, + BOOL bReAssocType ); static -VOID +void s_vMgrRxDisassociation( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ); // Authentication/deauthen functions static -VOID +void s_vMgrRxAuthenSequence_1( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PWLAN_FR_AUTHEN pFrame + PSDevice pDevice, + PSMgmtObject pMgmt, + PWLAN_FR_AUTHEN pFrame ); static -VOID +void s_vMgrRxAuthenSequence_2( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PWLAN_FR_AUTHEN pFrame + PSDevice pDevice, + PSMgmtObject pMgmt, + PWLAN_FR_AUTHEN pFrame ); static -VOID +void s_vMgrRxAuthenSequence_3( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PWLAN_FR_AUTHEN pFrame + PSDevice pDevice, + PSMgmtObject pMgmt, + PWLAN_FR_AUTHEN pFrame ); static -VOID +void s_vMgrRxAuthenSequence_4( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PWLAN_FR_AUTHEN pFrame + PSDevice pDevice, + PSMgmtObject pMgmt, + PWLAN_FR_AUTHEN pFrame ); static -VOID +void s_vMgrRxAuthentication( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ); static -VOID +void s_vMgrRxDeauthentication( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ); // Scan functions // probe request/response functions static -VOID +void s_vMgrRxProbeRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ); static -VOID +void s_vMgrRxProbeResponse( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ); // beacon functions static -VOID +void s_vMgrRxBeacon( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket, - IN BOOL bInScan + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket, + BOOL bInScan ); static -VOID +void s_vMgrFormatTIM( - IN PSMgmtObject pMgmt, - IN PWLAN_IE_TIM pTIM + PSMgmtObject pMgmt, + PWLAN_IE_TIM pTIM ); static PSTxMgmtPacket s_MgrMakeBeacon( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN WORD wCurrCapInfo, - IN WORD wCurrBeaconPeriod, - IN UINT uCurrChannel, - IN WORD wCurrATIMWinodw, - IN PWLAN_IE_SSID pCurrSSID, - IN PBYTE pCurrBSSID, - IN PWLAN_IE_SUPP_RATES pCurrSuppRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + 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 ); @@ -255,88 +255,84 @@ s_MgrMakeBeacon( static PSTxMgmtPacket s_MgrMakeAssocResponse( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN WORD wCurrCapInfo, - IN WORD wAssocStatus, - IN WORD wAssocAID, - IN PBYTE pDstAddr, - IN PWLAN_IE_SUPP_RATES pCurrSuppRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + 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( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN WORD wCurrCapInfo, - IN WORD wAssocStatus, - IN WORD wAssocAID, - IN PBYTE pDstAddr, - IN PWLAN_IE_SUPP_RATES pCurrSuppRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + PSDevice pDevice, + PSMgmtObject pMgmt, + WORD wCurrCapInfo, + WORD wAssocStatus, + WORD wAssocAID, + PBYTE pDstAddr, + PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates ); // Probe response static PSTxMgmtPacket s_MgrMakeProbeResponse( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN WORD wCurrCapInfo, - IN WORD wCurrBeaconPeriod, - IN UINT uCurrChannel, - IN WORD wCurrATIMWinodw, - IN PBYTE pDstAddr, - IN PWLAN_IE_SSID pCurrSSID, - IN PBYTE pCurrBSSID, - IN PWLAN_IE_SUPP_RATES pCurrSuppRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates, - IN BYTE byPHYType + 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 ); // received status static -VOID +void s_vMgrLogStatus( - IN PSMgmtObject pMgmt, - IN WORD wStatus + PSMgmtObject pMgmt, + WORD wStatus ); static -VOID +void s_vMgrSynchBSS ( - IN PSDevice pDevice, - IN UINT uBSSMode, - IN PKnownBSS pCurr, - OUT PCMD_STATUS pStatus + PSDevice pDevice, + unsigned int uBSSMode, + PKnownBSS pCurr, + PCMD_STATUS pStatus ); static BOOL s_bCipherMatch ( - IN PKnownBSS pBSSNode, - IN NDIS_802_11_ENCRYPTION_STATUS EncStatus, - OUT PBYTE pbyCCSPK, - OUT PBYTE pbyCCSGK + PKnownBSS pBSSNode, + NDIS_802_11_ENCRYPTION_STATUS EncStatus, + PBYTE pbyCCSPK, + PBYTE pbyCCSGK ); - static VOID Encyption_Rebuild( - IN PSDevice pDevice, - IN PKnownBSS pCurr + static void Encyption_Rebuild( + PSDevice pDevice, + PKnownBSS pCurr ); - - /*--------------------- Export Variables --------------------------*/ - /*--------------------- Export Functions --------------------------*/ - /*+ * * Routine Description: @@ -347,10 +343,7 @@ s_bCipherMatch ( * -*/ -VOID -vMgrObjectInit( - IN HANDLE hDeviceContext - ) +void vMgrObjectInit(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -368,22 +361,22 @@ vMgrObjectInit( pMgmt->byCSSPK = KEY_CTL_NONE; pMgmt->byCSSGK = KEY_CTL_NONE; pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI; - BSSvClearBSSList((HANDLE)pDevice, FALSE); + BSSvClearBSSList((void *) pDevice, FALSE); init_timer(&pMgmt->sTimerSecondCallback); - pMgmt->sTimerSecondCallback.data = (ULONG)pDevice; + pMgmt->sTimerSecondCallback.data = (unsigned long)pDevice; pMgmt->sTimerSecondCallback.function = (TimerFunction)BSSvSecondCallBack; pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ); init_timer(&pDevice->sTimerCommand); - pDevice->sTimerCommand.data = (ULONG)pDevice; + pDevice->sTimerCommand.data = (unsigned long)pDevice; pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; pDevice->sTimerCommand.expires = RUN_AT(HZ); //2007-0115-10<Add>by MikeLiu #ifdef TxInSleep init_timer(&pDevice->sTimerTxData); - pDevice->sTimerTxData.data = (ULONG)pDevice; + pDevice->sTimerTxData.data = (unsigned long)pDevice; pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData; pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback pDevice->fTxDataInSleep = FALSE; @@ -401,8 +394,6 @@ vMgrObjectInit( return; } - - /*+ * * Routine Description: @@ -414,13 +405,9 @@ vMgrObjectInit( * -*/ - -VOID -vMgrAssocBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - OUT PCMD_STATUS pStatus - ) +void vMgrAssocBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PCMD_STATUS pStatus) { PSDevice pDevice = (PSDevice)hDeviceContext; PSTxMgmtPacket pTxPacket; @@ -491,12 +478,9 @@ vMgrAssocBeginSta( * -*/ -VOID -vMgrReAssocBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - OUT PCMD_STATUS pStatus - ) +void vMgrReAssocBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PCMD_STATUS pStatus) { PSDevice pDevice = (PSDevice)hDeviceContext; PSTxMgmtPacket pTxPacket; @@ -570,14 +554,11 @@ vMgrReAssocBeginSta( * -*/ -VOID -vMgrDisassocBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - IN PBYTE abyDestAddress, - IN WORD wReason, - OUT PCMD_STATUS pStatus - ) +void vMgrDisassocBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PBYTE abyDestAddress, + WORD wReason, + PCMD_STATUS pStatus) { PSDevice pDevice = (PSDevice)hDeviceContext; PSTxMgmtPacket pTxPacket = NULL; @@ -633,12 +614,12 @@ vMgrDisassocBeginSta( -*/ static -VOID +void s_vMgrRxAssocRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket, - IN UINT uNodeIndex + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket, + unsigned int uNodeIndex ) { WLAN_FR_ASSOCREQ sFrame; @@ -646,7 +627,7 @@ s_vMgrRxAssocRequest( PSTxMgmtPacket pTxPacket; WORD wAssocStatus = 0; WORD wAssocAID = 0; - UINT uRateLen = WLAN_RATES_MAXLEN; + unsigned int uRateLen = WLAN_RATES_MAXLEN; BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; @@ -691,7 +672,7 @@ s_vMgrRxAssocRequest( } - RATEvParseMaxRate((PVOID)pDevice, + RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, FALSE, // do not change our basic rate @@ -789,12 +770,12 @@ s_vMgrRxAssocRequest( -*/ static -VOID +void s_vMgrRxReAssocRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket, - IN UINT uNodeIndex + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket, + unsigned int uNodeIndex ) { WLAN_FR_REASSOCREQ sFrame; @@ -802,7 +783,7 @@ s_vMgrRxReAssocRequest( PSTxMgmtPacket pTxPacket; WORD wAssocStatus = 0; WORD wAssocAID = 0; - UINT uRateLen = WLAN_RATES_MAXLEN; + unsigned int uRateLen = WLAN_RATES_MAXLEN; BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; @@ -844,7 +825,7 @@ s_vMgrRxReAssocRequest( } - RATEvParseMaxRate((PVOID)pDevice, + RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, FALSE, // do not change our basic rate @@ -936,12 +917,12 @@ s_vMgrRxReAssocRequest( -*/ static -VOID +void s_vMgrRxAssocResponse( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket, - IN BOOL bReAssocType + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket, + BOOL bReAssocType ) { WLAN_FR_ASSOCRESP sFrame; @@ -958,12 +939,12 @@ s_vMgrRxAssocResponse( sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; // decode the frame vMgrDecodeAssocResponse(&sFrame); - if ((sFrame.pwCapInfo == 0) || - (sFrame.pwStatus == 0) || - (sFrame.pwAid == 0) || - (sFrame.pSuppRates == 0)){ - DBG_PORT80(0xCC); - return; + if ((sFrame.pwCapInfo == NULL) + || (sFrame.pwStatus == NULL) + || (sFrame.pwAid == NULL) + || (sFrame.pSuppRates == NULL)) { + DBG_PORT80(0xCC); + return; }; pMgmt->sAssocInfo.AssocInfo.ResponseFixedIEs.Capabilities = *(sFrame.pwCapInfo); @@ -987,7 +968,10 @@ s_vMgrRxAssocResponse( }; DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Association Successful, AID=%d.\n", pMgmt->wCurrAID & ~(BIT14|BIT15)); pMgmt->eCurrState = WMAC_STATE_ASSOC; - BSSvUpdateAPNode((HANDLE)pDevice, sFrame.pwCapInfo, sFrame.pSuppRates, sFrame.pExtSuppRates); + BSSvUpdateAPNode((void *) pDevice, + sFrame.pwCapInfo, + sFrame.pSuppRates, + sFrame.pExtSuppRates); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID); pDevice->bLinkPass = TRUE; @@ -1089,8 +1073,6 @@ if(pMgmt->eCurrState == WMAC_STATE_ASSOC) return; } - - /*+ * * Routine Description: @@ -1102,12 +1084,9 @@ if(pMgmt->eCurrState == WMAC_STATE_ASSOC) * -*/ -VOID -vMgrAuthenBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - OUT PCMD_STATUS pStatus - ) +void vMgrAuthenBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PCMD_STATUS pStatus) { PSDevice pDevice = (PSDevice)hDeviceContext; WLAN_FR_AUTHEN sFrame; @@ -1147,8 +1126,6 @@ vMgrAuthenBeginSta( return ; } - - /*+ * * Routine Description: @@ -1160,14 +1137,11 @@ vMgrAuthenBeginSta( * -*/ -VOID -vMgrDeAuthenBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - IN PBYTE abyDestAddress, - IN WORD wReason, - OUT PCMD_STATUS pStatus - ) +void vMgrDeAuthenBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PBYTE abyDestAddress, + WORD wReason, + PCMD_STATUS pStatus) { PSDevice pDevice = (PSDevice)hDeviceContext; WLAN_FR_DEAUTHEN sFrame; @@ -1217,11 +1191,11 @@ vMgrDeAuthenBeginSta( -*/ static -VOID +void s_vMgrRxAuthentication( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ) { WLAN_FR_AUTHEN sFrame; @@ -1275,15 +1249,15 @@ s_vMgrRxAuthentication( static -VOID +void s_vMgrRxAuthenSequence_1( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PWLAN_FR_AUTHEN pFrame + PSDevice pDevice, + PSMgmtObject pMgmt, + PWLAN_FR_AUTHEN pFrame ) { PSTxMgmtPacket pTxPacket = NULL; - UINT uNodeIndex; + unsigned int uNodeIndex; WLAN_FR_AUTHEN sFrame; PSKeyItem pTransmitKey; @@ -1381,11 +1355,11 @@ s_vMgrRxAuthenSequence_1( -*/ static -VOID +void s_vMgrRxAuthenSequence_2( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PWLAN_FR_AUTHEN pFrame + PSDevice pDevice, + PSMgmtObject pMgmt, + PWLAN_FR_AUTHEN pFrame ) { WLAN_FR_AUTHEN sFrame; @@ -1405,12 +1379,11 @@ s_vMgrRxAuthenSequence_2( s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); pMgmt->eCurrState = WMAC_STATE_IDLE; } - if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT ) { -// spin_unlock_irq(&pDevice->lock); -// vCommandTimerWait((HANDLE)pDevice, 0); -// spin_lock_irq(&pDevice->lock); + if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) { + /* spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, 0); + spin_lock_irq(&pDevice->lock); */ } - break; case WLAN_AUTH_ALG_SHAREDKEY: @@ -1453,9 +1426,9 @@ s_vMgrRxAuthenSequence_2( else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:rx Auth_reply sequence_2 status error ...\n"); if ( pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT ) { -// spin_unlock_irq(&pDevice->lock); -// vCommandTimerWait((HANDLE)pDevice, 0); -// spin_lock_irq(&pDevice->lock); + /* spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, 0); + spin_lock_irq(&pDevice->lock); */ } s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); } @@ -1483,16 +1456,16 @@ s_vMgrRxAuthenSequence_2( -*/ static -VOID +void s_vMgrRxAuthenSequence_3( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PWLAN_FR_AUTHEN pFrame + PSDevice pDevice, + PSMgmtObject pMgmt, + PWLAN_FR_AUTHEN pFrame ) { PSTxMgmtPacket pTxPacket = NULL; - UINT uStatusCode = 0 ; - UINT uNodeIndex = 0; + unsigned int uStatusCode = 0 ; + unsigned int uNodeIndex = 0; WLAN_FR_AUTHEN sFrame; if (!WLAN_GET_FC_ISWEP(pFrame->pHdr->sA3.wFrameCtl)) { @@ -1571,11 +1544,11 @@ reply: * -*/ static -VOID +void s_vMgrRxAuthenSequence_4( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PWLAN_FR_AUTHEN pFrame + PSDevice pDevice, + PSMgmtObject pMgmt, + PWLAN_FR_AUTHEN pFrame ) { @@ -1591,11 +1564,10 @@ s_vMgrRxAuthenSequence_4( } if ( pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT ) { -// spin_unlock_irq(&pDevice->lock); -// vCommandTimerWait((HANDLE)pDevice, 0); -// spin_lock_irq(&pDevice->lock); + /* spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, 0); + spin_lock_irq(&pDevice->lock); */ } - } /*+ @@ -1610,15 +1582,15 @@ s_vMgrRxAuthenSequence_4( -*/ static -VOID +void s_vMgrRxDisassociation( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ) { WLAN_FR_DISASSOC sFrame; - UINT uNodeIndex = 0; + unsigned int uNodeIndex = 0; CMD_STATUS CmdStatus; viawget_wpa_header *wpahdr; @@ -1700,15 +1672,15 @@ s_vMgrRxDisassociation( -*/ static -VOID +void s_vMgrRxDeauthentication( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ) { WLAN_FR_DEAUTHEN sFrame; - UINT uNodeIndex = 0; + unsigned int uNodeIndex = 0; viawget_wpa_header *wpahdr; @@ -1791,8 +1763,8 @@ s_vMgrRxDeauthentication( -*/ static BOOL ChannelExceedZoneType( - IN PSDevice pDevice, - IN BYTE byCurrChannel + PSDevice pDevice, + BYTE byCurrChannel ) { BOOL exceed=FALSE; @@ -1826,12 +1798,12 @@ ChannelExceedZoneType( -*/ static -VOID +void s_vMgrRxBeacon( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket, - IN BOOL bInScan + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket, + BOOL bInScan ) { @@ -1845,17 +1817,17 @@ s_vMgrRxBeacon( BOOL bUpdateTSF = FALSE; BOOL bIsAPBeacon = FALSE; BOOL bIsChannelEqual = FALSE; - UINT uLocateByteIndex; + unsigned int uLocateByteIndex; BYTE byTIMBitOn = 0; WORD wAIDNumber = 0; - UINT uNodeIndex; + unsigned int uNodeIndex; QWORD qwTimestamp, qwLocalTSF; QWORD qwCurrTSF; WORD wStartIndex = 0; WORD wAIDIndex = 0; BYTE byCurrChannel = pRxPacket->byRxChannel; ERPObject sERP; - UINT uRateLen = WLAN_RATES_MAXLEN; + unsigned int uRateLen = WLAN_RATES_MAXLEN; BOOL bChannelHit = FALSE; BYTE byOldPreambleType; @@ -1871,14 +1843,14 @@ s_vMgrRxBeacon( // decode the beacon frame vMgrDecodeBeacon(&sFrame); - if ((sFrame.pwBeaconInterval == 0) || - (sFrame.pwCapInfo == 0) || - (sFrame.pSSID == 0) || - (sFrame.pSuppRates == 0) ) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n"); - return; - }; + if ((sFrame.pwBeaconInterval == NULL) + || (sFrame.pwCapInfo == NULL) + || (sFrame.pSSID == NULL) + || (sFrame.pSuppRates == NULL)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n"); + return; + }; if( byCurrChannel > CB_MAX_CHANNEL_24G ) { @@ -1913,10 +1885,12 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) sERP.byERP = 0; } - pBSSList = BSSpAddrIsInBSSList((HANDLE)pDevice, sFrame.pHdr->sA3.abyAddr3, sFrame.pSSID); + pBSSList = BSSpAddrIsInBSSList((void *) pDevice, + sFrame.pHdr->sA3.abyAddr3, + sFrame.pSSID); if (pBSSList == NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon/insert: RxChannel = : %d\n", byCurrChannel); - BSSbInsertToBSSList((HANDLE)pDevice, + BSSbInsertToBSSList((void *) pDevice, sFrame.pHdr->sA3.abyAddr3, *sFrame.pqwTimestamp, *sFrame.pwBeaconInterval, @@ -1932,12 +1906,11 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) sFrame.pIE_Quiet, sFrame.len - WLAN_HDR_ADDR3_LEN, sFrame.pHdr->sA4.abyAddr4, // payload of beacon - (HANDLE)pRxPacket - ); + (void *) pRxPacket); } else { // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"update bcn: RxChannel = : %d\n", byCurrChannel); - BSSbUpdateToBSSList((HANDLE)pDevice, + BSSbUpdateToBSSList((void *) pDevice, *sFrame.pqwTimestamp, *sFrame.pwBeaconInterval, *sFrame.pwCapInfo, @@ -1954,8 +1927,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) pBSSList, sFrame.len - WLAN_HDR_ADDR3_LEN, sFrame.pHdr->sA4.abyAddr4, // payload of probresponse - (HANDLE)pRxPacket - ); + (void *) pRxPacket); } @@ -2089,7 +2061,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pBSSList->abyExtSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, uRateLen); - RATEvParseMaxRate( (PVOID)pDevice, + RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, TRUE, @@ -2152,9 +2124,9 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) if (bTSFLargeDiff) bUpdateTSF = TRUE; - if ((pDevice->bEnablePSMode == TRUE) &&(sFrame.pTIM != 0)) { + if ((pDevice->bEnablePSMode == TRUE) && (sFrame.pTIM)) { - // deal with DTIM, analysis TIM + /* deal with DTIM, analysis TIM */ pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? TRUE : FALSE ; pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount; pMgmt->byDTIMPeriod = sFrame.pTIM->byDTIMPeriod; @@ -2227,7 +2199,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, WLAN_RATES_MAXLEN_11B); - RATEvParseMaxRate( (PVOID)pDevice, + RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, NULL, TRUE, @@ -2248,7 +2220,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, WLAN_RATES_MAXLEN_11B); - RATEvParseMaxRate( (PVOID)pDevice, + RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, NULL, TRUE, @@ -2324,7 +2296,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) // set highest basic rate // s_vSetHighestBasicRate(pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates); // Prepare beacon frame - bMgrPrepareBeaconToSend((HANDLE)pDevice, pMgmt); + bMgrPrepareBeaconToSend((void *) pDevice, pMgmt); // } }; } @@ -2341,8 +2313,6 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) return; } - - /*+ * * Routine Description: @@ -2355,11 +2325,9 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) * CMD_STATUS * -*/ -VOID -vMgrCreateOwnIBSS( - IN HANDLE hDeviceContext, - OUT PCMD_STATUS pStatus - ) + +void vMgrCreateOwnIBSS(void *hDeviceContext, + PCMD_STATUS pStatus) { PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -2368,7 +2336,7 @@ vMgrCreateOwnIBSS( BYTE byTopCCKBasicRate; BYTE byTopOFDMBasicRate; QWORD qwCurrTSF; - UINT ii; + 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}; @@ -2466,7 +2434,8 @@ vMgrCreateOwnIBSS( // set basic rate - RATEvParseMaxRate((PVOID)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + RATEvParseMaxRate((void *)pDevice, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, TRUE, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, &byTopCCKBasicRate, &byTopOFDMBasicRate); @@ -2608,13 +2577,11 @@ vMgrCreateOwnIBSS( pMgmt->eCurrState = WMAC_STATE_STARTED; // Prepare beacon to send - if (bMgrPrepareBeaconToSend((HANDLE)pDevice, pMgmt)) { - *pStatus = CMD_STATUS_SUCCESS; - } - return ; -} - + if (bMgrPrepareBeaconToSend((void *) pDevice, pMgmt)) + *pStatus = CMD_STATUS_SUCCESS; + return; +} /*+ * @@ -2629,21 +2596,16 @@ vMgrCreateOwnIBSS( * -*/ -VOID -vMgrJoinBSSBegin( - IN HANDLE hDeviceContext, - OUT PCMD_STATUS pStatus - ) +void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PKnownBSS pCurr = NULL; - UINT ii, uu; + unsigned int ii, uu; PWLAN_IE_SUPP_RATES pItemRates = NULL; PWLAN_IE_SUPP_RATES pItemExtRates = NULL; PWLAN_IE_SSID pItemSSID; - UINT uRateLen = WLAN_RATES_MAXLEN; + unsigned int uRateLen = WLAN_RATES_MAXLEN; WORD wMaxBasicRate = RATE_1M; WORD wMaxSuppRate = RATE_1M; WORD wSuppRate; @@ -2743,9 +2705,10 @@ vMgrJoinBSSBegin( uRateLen); // Stuffing Rate IE if ((pItemExtRates->len > 0) && (pItemRates->len < 8)) { - for (ii = 0; ii < (UINT)(8 - pItemRates->len); ) { - pItemRates->abyRates[pItemRates->len + ii] = pItemExtRates->abyRates[ii]; - ii ++; + for (ii = 0; ii < (unsigned int) (8 - pItemRates->len); ) { + pItemRates->abyRates[pItemRates->len + ii] = + pItemExtRates->abyRates[ii]; + ii++; if (pItemExtRates->len <= ii) break; } @@ -2760,7 +2723,7 @@ vMgrJoinBSSBegin( } } - RATEvParseMaxRate((PVOID)pDevice, pItemRates, pItemExtRates, TRUE, + RATEvParseMaxRate((void *)pDevice, pItemRates, pItemExtRates, TRUE, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, &byTopCCKBasicRate, &byTopOFDMBasicRate); vUpdateIFS(pDevice); @@ -2781,12 +2744,17 @@ vMgrJoinBSSBegin( // Add current BSS to Candidate list // This should only works for WPA2 BSS, and WPA2 BSS check must be done before. if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { - BOOL bResult = bAdd_PMKID_Candidate((HANDLE)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); + 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) { - vFlush_PMKID_Candidate((HANDLE)pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFlush_PMKID_Candidate: 4\n"); - bAdd_PMKID_Candidate((HANDLE)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); + vFlush_PMKID_Candidate((void *) pDevice); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "vFlush_PMKID_Candidate: 4\n"); + bAdd_PMKID_Candidate((void *) pDevice, + pMgmt->abyCurrBSSID, + &pCurr->sRSNCapObj); } } @@ -2899,7 +2867,8 @@ vMgrJoinBSSBegin( (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, WLAN_RATES_MAXLEN_11B); // set basic rate - RATEvParseMaxRate((PVOID)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + RATEvParseMaxRate((void *)pDevice, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, NULL, TRUE, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, &byTopCCKBasicRate, &byTopOFDMBasicRate); vUpdateIFS(pDevice); @@ -2938,7 +2907,7 @@ vMgrJoinBSSBegin( CARDvSetRSPINF(pDevice, (BYTE)pDevice->byBBType); // Prepare beacon - bMgrPrepareBeaconToSend((HANDLE)pDevice, pMgmt); + bMgrPrepareBeaconToSend((void *) pDevice, pMgmt); } else { pMgmt->eCurrState = WMAC_STATE_IDLE; @@ -2960,12 +2929,12 @@ vMgrJoinBSSBegin( * -*/ static -VOID +void s_vMgrSynchBSS ( - IN PSDevice pDevice, - IN UINT uBSSMode, - IN PKnownBSS pCurr, - OUT PCMD_STATUS pStatus + PSDevice pDevice, + unsigned int uBSSMode, + PKnownBSS pCurr, + PCMD_STATUS pStatus ) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -3004,7 +2973,7 @@ s_vMgrSynchBSS ( pDevice->byPreambleType = 0; pDevice->wBasicRate = 0; // Set Basic Rate - CARDbAddBasicRate((PVOID)pDevice, RATE_1M); + CARDbAddBasicRate((void *)pDevice, RATE_1M); // calculate TSF offset // TSF Offset = Received Timestamp TSF - Marked Local's TSF @@ -3122,13 +3091,13 @@ s_vMgrSynchBSS ( //mike add: fix NetworkManager 0.7.0 hidden ssid mode in WPA encryption // ,need reset eAuthenMode and eEncryptionStatus - static VOID Encyption_Rebuild( - IN PSDevice pDevice, - IN PKnownBSS pCurr + static void Encyption_Rebuild( + PSDevice pDevice, + PKnownBSS pCurr ) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - // UINT ii , uSameBssidNum=0; + /* unsigned int ii, uSameBssidNum=0; */ // for (ii = 0; ii < MAX_BSS_NUM; ii++) { // if (pMgmt->sBSSList[ii].bActive && @@ -3174,20 +3143,20 @@ s_vMgrSynchBSS ( * * * Return Value: - * VOID + * void * -*/ static -VOID +void s_vMgrFormatTIM( - IN PSMgmtObject pMgmt, - IN PWLAN_IE_TIM pTIM + PSMgmtObject pMgmt, + PWLAN_IE_TIM pTIM ) { BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; BYTE byMap; - UINT ii, jj; + unsigned int ii, jj; BOOL bStartFound = FALSE; BOOL bMulticast = FALSE; WORD wStartIndex = 0; @@ -3256,16 +3225,16 @@ s_vMgrFormatTIM( static PSTxMgmtPacket s_MgrMakeBeacon( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN WORD wCurrCapInfo, - IN WORD wCurrBeaconPeriod, - IN UINT uCurrChannel, - IN WORD wCurrATIMWinodw, - IN PWLAN_IE_SSID pCurrSSID, - IN PBYTE pCurrBSSID, - IN PWLAN_IE_SUPP_RATES pCurrSuppRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + 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 ) { PSTxMgmtPacket pTxPacket = NULL; @@ -3430,18 +3399,18 @@ s_MgrMakeBeacon( PSTxMgmtPacket s_MgrMakeProbeResponse( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN WORD wCurrCapInfo, - IN WORD wCurrBeaconPeriod, - IN UINT uCurrChannel, - IN WORD wCurrATIMWinodw, - IN PBYTE pDstAddr, - IN PWLAN_IE_SSID pCurrSSID, - IN PBYTE pCurrBSSID, - IN PWLAN_IE_SUPP_RATES pCurrSuppRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates, - IN BYTE byPHYType + 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 ) { PSTxMgmtPacket pTxPacket = NULL; @@ -3562,14 +3531,14 @@ s_MgrMakeProbeResponse( PSTxMgmtPacket s_MgrMakeAssocRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PBYTE pDAddr, - IN WORD wCurrCapInfo, - IN WORD wListenInterval, - IN PWLAN_IE_SSID pCurrSSID, - IN PWLAN_IE_SUPP_RATES pCurrRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + PSDevice pDevice, + PSMgmtObject pMgmt, + PBYTE pDAddr, + WORD wCurrCapInfo, + WORD wListenInterval, + PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates ) { PSTxMgmtPacket pTxPacket = NULL; @@ -3704,7 +3673,7 @@ s_MgrMakeAssocRequest( } else if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && (pMgmt->pCurrBSS != NULL)) { - UINT ii; + unsigned int ii; PWORD pwPMKID; // WPA IE @@ -3773,13 +3742,17 @@ s_MgrMakeAssocRequest( pwPMKID = (PWORD)pbyRSN; // Point to PMKID count *pwPMKID = 0; // Initialize PMKID count pbyRSN += 2; // Point to PMKID list - for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { - if ( !memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { - (*pwPMKID) ++; - memcpy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); - pbyRSN += 16; - } - } + for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { + if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], + pMgmt->abyCurrBSSID, + ETH_ALEN)) { + (*pwPMKID)++; + memcpy(pbyRSN, + pDevice->gsPMKID.BSSIDInfo[ii].PMKID, + 16); + pbyRSN += 16; + } + } if (*pwPMKID != 0) { sFrame.pRSN->len += (2 + (*pwPMKID)*16); } @@ -3820,14 +3793,14 @@ s_MgrMakeAssocRequest( PSTxMgmtPacket s_MgrMakeReAssocRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PBYTE pDAddr, - IN WORD wCurrCapInfo, - IN WORD wListenInterval, - IN PWLAN_IE_SSID pCurrSSID, - IN PWLAN_IE_SUPP_RATES pCurrRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + PSDevice pDevice, + PSMgmtObject pMgmt, + PBYTE pDAddr, + WORD wCurrCapInfo, + WORD wListenInterval, + PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates ) { PSTxMgmtPacket pTxPacket = NULL; @@ -3960,7 +3933,7 @@ s_MgrMakeReAssocRequest( } else if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && (pMgmt->pCurrBSS != NULL)) { - UINT ii; + unsigned int ii; PWORD pwPMKID; /* WPA IE */ @@ -4030,10 +4003,14 @@ s_MgrMakeReAssocRequest( *pwPMKID = 0; // Initialize PMKID count pbyRSN += 2; // Point to PMKID list for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { - if ( !memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { - (*pwPMKID) ++; - memcpy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); - pbyRSN += 16; + if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], + pMgmt->abyCurrBSSID, + ETH_ALEN)) { + (*pwPMKID)++; + memcpy(pbyRSN, + pDevice->gsPMKID.BSSIDInfo[ii].PMKID, + 16); + pbyRSN += 16; } } if (*pwPMKID != 0) { @@ -4057,8 +4034,6 @@ s_MgrMakeReAssocRequest( return pTxPacket; } - - /*+ * * Routine Description: @@ -4070,17 +4045,16 @@ s_MgrMakeReAssocRequest( * -*/ - PSTxMgmtPacket s_MgrMakeAssocResponse( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN WORD wCurrCapInfo, - IN WORD wAssocStatus, - IN WORD wAssocAID, - IN PBYTE pDstAddr, - IN PWLAN_IE_SUPP_RATES pCurrSuppRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + PSDevice pDevice, + PSMgmtObject pMgmt, + WORD wCurrCapInfo, + WORD wAssocStatus, + WORD wAssocAID, + PBYTE pDstAddr, + PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates ) { PSTxMgmtPacket pTxPacket = NULL; @@ -4147,14 +4121,14 @@ s_MgrMakeAssocResponse( PSTxMgmtPacket s_MgrMakeReAssocResponse( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN WORD wCurrCapInfo, - IN WORD wAssocStatus, - IN WORD wAssocAID, - IN PBYTE pDstAddr, - IN PWLAN_IE_SUPP_RATES pCurrSuppRates, - IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates + PSDevice pDevice, + PSMgmtObject pMgmt, + WORD wCurrCapInfo, + WORD wAssocStatus, + WORD wAssocAID, + PBYTE pDstAddr, + PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates ) { PSTxMgmtPacket pTxPacket = NULL; @@ -4219,11 +4193,11 @@ s_MgrMakeReAssocResponse( -*/ static -VOID +void s_vMgrRxProbeResponse( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ) { PKnownBSS pBSSList = NULL; @@ -4239,14 +4213,16 @@ s_vMgrRxProbeResponse( sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; vMgrDecodeProbeResponse(&sFrame); - if ((sFrame.pqwTimestamp == 0) || - (sFrame.pwBeaconInterval == 0) || - (sFrame.pwCapInfo == 0) || - (sFrame.pSSID == 0) || - (sFrame.pSuppRates == 0)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p] \n", pRxPacket->p80211Header); - DBG_PORT80(0xCC); - return; + if ((sFrame.pqwTimestamp == NULL) + || (sFrame.pwBeaconInterval == NULL) + || (sFrame.pwCapInfo == NULL) + || (sFrame.pSSID == NULL) + || (sFrame.pSuppRates == NULL)) { + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p]\n", + pRxPacket->p80211Header); + DBG_PORT80(0xCC); + return; }; if(sFrame.pSSID->len == 0) @@ -4256,22 +4232,23 @@ s_vMgrRxProbeResponse( //{{ RobertYu:20050201, 11a byCurrChannel != sFrame.pDSParms->byCurrChannel mapping if( byCurrChannel > CB_MAX_CHANNEL_24G ) { - if (sFrame.pDSParms != 0) { - if (byCurrChannel == RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]) - bChannelHit = TRUE; - byCurrChannel = RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]; + if (sFrame.pDSParms) { + if (byCurrChannel == + RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]) + bChannelHit = TRUE; + byCurrChannel = + RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]; } else { - bChannelHit = TRUE; + bChannelHit = TRUE; } - } else { - if (sFrame.pDSParms != 0) { - if (byCurrChannel == sFrame.pDSParms->byCurrChannel) - bChannelHit = TRUE; - byCurrChannel = sFrame.pDSParms->byCurrChannel; - } else { - bChannelHit = TRUE; - } + if (sFrame.pDSParms) { + if (byCurrChannel == sFrame.pDSParms->byCurrChannel) + bChannelHit = TRUE; + byCurrChannel = sFrame.pDSParms->byCurrChannel; + } else { + bChannelHit = TRUE; + } } //RobertYu:20050201 @@ -4279,7 +4256,7 @@ s_vMgrRxProbeResponse( if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) return; - if (sFrame.pERP != NULL) { + if (sFrame.pERP) { sERP.byERP = sFrame.pERP->byContext; sERP.bERPExist = TRUE; } else { @@ -4289,31 +4266,32 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) // update or insert the bss - pBSSList = BSSpAddrIsInBSSList((HANDLE)pDevice, sFrame.pHdr->sA3.abyAddr3, sFrame.pSSID); + pBSSList = BSSpAddrIsInBSSList((void *) pDevice, + sFrame.pHdr->sA3.abyAddr3, + sFrame.pSSID); if (pBSSList) { - BSSbUpdateToBSSList((HANDLE)pDevice, - *sFrame.pqwTimestamp, - *sFrame.pwBeaconInterval, - *sFrame.pwCapInfo, - byCurrChannel, - bChannelHit, - sFrame.pSSID, - sFrame.pSuppRates, - sFrame.pExtSuppRates, - &sERP, - sFrame.pRSN, - sFrame.pRSNWPA, - sFrame.pIE_Country, - sFrame.pIE_Quiet, - pBSSList, - sFrame.len - WLAN_HDR_ADDR3_LEN, - sFrame.pHdr->sA4.abyAddr4, // payload of probresponse - (HANDLE)pRxPacket - ); - } - else { + BSSbUpdateToBSSList((void *) pDevice, + *sFrame.pqwTimestamp, + *sFrame.pwBeaconInterval, + *sFrame.pwCapInfo, + byCurrChannel, + bChannelHit, + sFrame.pSSID, + sFrame.pSuppRates, + sFrame.pExtSuppRates, + &sERP, + sFrame.pRSN, + sFrame.pRSNWPA, + sFrame.pIE_Country, + sFrame.pIE_Quiet, + pBSSList, + sFrame.len - WLAN_HDR_ADDR3_LEN, + /* payload of probresponse */ + sFrame.pHdr->sA4.abyAddr4, + (void *) pRxPacket); + } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Probe resp/insert: RxChannel = : %d\n", byCurrChannel); - BSSbInsertToBSSList((HANDLE)pDevice, + BSSbInsertToBSSList((void *) pDevice, sFrame.pHdr->sA3.abyAddr3, *sFrame.pqwTimestamp, *sFrame.pwBeaconInterval, @@ -4328,9 +4306,8 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) sFrame.pIE_Country, sFrame.pIE_Quiet, sFrame.len - WLAN_HDR_ADDR3_LEN, - sFrame.pHdr->sA4.abyAddr4, // payload of beacon - (HANDLE)pRxPacket - ); + sFrame.pHdr->sA4.abyAddr4, /* payload of beacon */ + (void *) pRxPacket); } return; @@ -4349,11 +4326,11 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) static -VOID +void s_vMgrRxProbeRequest( - IN PSDevice pDevice, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket + PSDevice pDevice, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket ) { WLAN_FR_PROBEREQ sFrame; @@ -4426,10 +4403,6 @@ s_vMgrRxProbeRequest( return; } - - - - /*+ * * Routine Description: @@ -4444,17 +4417,13 @@ s_vMgrRxProbeRequest( * -*/ - -VOID -vMgrRxManagePacket( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket - ) +void vMgrRxManagePacket(void *hDeviceContext, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket) { PSDevice pDevice = (PSDevice)hDeviceContext; BOOL bInScan = FALSE; - UINT uNodeIndex = 0; + unsigned int uNodeIndex = 0; NODE_STATE eNodeState = 0; CMD_STATUS Status; @@ -4583,9 +4552,6 @@ vMgrRxManagePacket( return; } - - - /*+ * * Routine Description: @@ -4597,11 +4563,7 @@ vMgrRxManagePacket( * TRUE if success; FALSE if failed. * -*/ -BOOL -bMgrPrepareBeaconToSend( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt - ) +BOOL bMgrPrepareBeaconToSend(void *hDeviceContext, PSMgmtObject pMgmt) { PSDevice pDevice = (PSDevice)hDeviceContext; PSTxMgmtPacket pTxPacket; @@ -4653,10 +4615,10 @@ bMgrPrepareBeaconToSend( * -*/ static -VOID +void s_vMgrLogStatus( - IN PSMgmtObject pMgmt, - IN WORD wStatus + PSMgmtObject pMgmt, + WORD wStatus ) { switch( wStatus ){ @@ -4705,7 +4667,6 @@ s_vMgrLogStatus( } } - /* * * Description: @@ -4722,16 +4683,14 @@ s_vMgrLogStatus( * Return Value: none. * -*/ -BOOL -bAdd_PMKID_Candidate ( - IN HANDLE hDeviceContext, - IN PBYTE pbyBSSID, - IN PSRSNCapObject psRSNCapObj - ) + +BOOL bAdd_PMKID_Candidate(void *hDeviceContext, + PBYTE pbyBSSID, + PSRSNCapObject psRSNCapObj) { PSDevice pDevice = (PSDevice)hDeviceContext; PPMKID_CANDIDATE pCandidateList; - UINT ii = 0; + unsigned int ii = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); @@ -4745,13 +4704,16 @@ bAdd_PMKID_Candidate ( // Update Old Candidate for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { - pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; - if ( !memcmp(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN)) { - 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); - } + pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; + if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) { + 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); + } return TRUE; } } @@ -4763,7 +4725,7 @@ bAdd_PMKID_Candidate ( } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); } - memcpy(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN); + 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; @@ -4783,10 +4745,8 @@ bAdd_PMKID_Candidate ( * Return Value: none. * -*/ -VOID -vFlush_PMKID_Candidate ( - IN HANDLE hDeviceContext - ) + +void vFlush_PMKID_Candidate(void *hDeviceContext) { PSDevice pDevice = (PSDevice)hDeviceContext; @@ -4798,10 +4758,10 @@ vFlush_PMKID_Candidate ( static BOOL s_bCipherMatch ( - IN PKnownBSS pBSSNode, - IN NDIS_802_11_ENCRYPTION_STATUS EncStatus, - OUT PBYTE pbyCCSPK, - OUT PBYTE pbyCCSGK + PKnownBSS pBSSNode, + NDIS_802_11_ENCRYPTION_STATUS EncStatus, + PBYTE pbyCCSPK, + PBYTE pbyCCSGK ) { BYTE byMulticastCipher = KEY_CTL_INVALID; diff --git a/drivers/staging/vt6656/wmgr.h b/drivers/staging/vt6656/wmgr.h index c682a7fcbefa..1e5b916aea1d 100644 --- a/drivers/staging/vt6656/wmgr.h +++ b/drivers/staging/vt6656/wmgr.h @@ -84,37 +84,37 @@ //mike define: make timer to expire after desired times #define timer_expire(timer,next_tick) mod_timer(&timer, RUN_AT(next_tick)) -typedef void (*TimerFunction)(ULONG); +typedef void (*TimerFunction)(unsigned long); //+++ NDIS related -typedef UCHAR NDIS_802_11_MAC_ADDRESS[6]; +typedef unsigned char NDIS_802_11_MAC_ADDRESS[ETH_ALEN]; typedef struct _NDIS_802_11_AI_REQFI { - USHORT Capabilities; - USHORT ListenInterval; + unsigned short Capabilities; + unsigned short ListenInterval; NDIS_802_11_MAC_ADDRESS CurrentAPAddress; } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI; typedef struct _NDIS_802_11_AI_RESFI { - USHORT Capabilities; - USHORT StatusCode; - USHORT AssociationId; + unsigned short Capabilities; + unsigned short StatusCode; + unsigned short AssociationId; } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI; typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION { - ULONG Length; - USHORT AvailableRequestFixedIEs; + unsigned long Length; + unsigned short AvailableRequestFixedIEs; NDIS_802_11_AI_REQFI RequestFixedIEs; - ULONG RequestIELength; - ULONG OffsetRequestIEs; - USHORT AvailableResponseFixedIEs; + unsigned long RequestIELength; + unsigned long OffsetRequestIEs; + unsigned short AvailableResponseFixedIEs; NDIS_802_11_AI_RESFI ResponseFixedIEs; - ULONG ResponseIELength; - ULONG OffsetResponseIEs; + unsigned long ResponseIELength; + unsigned long OffsetResponseIEs; } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION; @@ -123,7 +123,7 @@ typedef struct tagSAssocInfo { NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; BYTE abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN]; // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION - ULONG RequestIELength; + unsigned long RequestIELength; BYTE abyReqIEs[WLAN_BEACON_FR_MAXLEN]; } SAssocInfo, *PSAssocInfo; //--- @@ -222,8 +222,8 @@ typedef enum tagWMAC_POWER_MODE { typedef struct tagSTxMgmtPacket { PUWLAN_80211HDR p80211Header; - UINT cbMPDULen; - UINT cbPayloadLen; + unsigned int cbMPDULen; + unsigned int cbPayloadLen; } STxMgmtPacket, *PSTxMgmtPacket; @@ -233,9 +233,9 @@ typedef struct tagSRxMgmtPacket { PUWLAN_80211HDR p80211Header; QWORD qwLocalTSF; - UINT cbMPDULen; - UINT cbPayloadLen; - UINT uRSSI; + unsigned int cbMPDULen; + unsigned int cbPayloadLen; + unsigned int uRSSI; BYTE bySQ; BYTE byRxRate; BYTE byRxChannel; @@ -246,8 +246,7 @@ typedef struct tagSRxMgmtPacket { typedef struct tagSMgmtObject { - - PVOID pAdapter; + void *pAdapter; // MAC address BYTE abyMACAddr[WLAN_ADDR_LEN]; @@ -273,21 +272,21 @@ typedef struct tagSMgmtObject BOOL bCurrBSSIDFilterOn; // Current state vars - UINT uCurrChannel; + 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; - UINT uRSSITrigger; + unsigned int uRSSITrigger; WORD wCurrATIMWindow; WORD wCurrBeaconPeriod; BOOL bIsDS; BYTE byERPContext; CMD_STATE eCommandState; - UINT uScanChannel; + unsigned int uScanChannel; // Desire joinning BSS vars BYTE abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; @@ -302,22 +301,22 @@ typedef struct tagSMgmtObject // Adhoc or AP configuration vars WORD wIBSSBeaconPeriod; WORD wIBSSATIMWindow; - UINT uIBSSChannel; + unsigned int uIBSSChannel; BYTE abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; BYTE byAPBBType; BYTE abyWPAIE[MAX_WPA_IE_LEN]; WORD wWPAIELen; - UINT uAssocCount; + unsigned int uAssocCount; BOOL bMoreData; // Scan state vars WMAC_SCAN_STATE eScanState; WMAC_SCAN_TYPE eScanType; - UINT uScanStartCh; - UINT uScanEndCh; + unsigned int uScanStartCh; + unsigned int uScanEndCh; WORD wScanSteps; - UINT uScanBSSType; + unsigned int uScanBSSType; // Desire scannig vars BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; BYTE abyScanBSSID[WLAN_BSSID_LEN]; @@ -345,8 +344,8 @@ typedef struct tagSMgmtObject BYTE abyPSTxMap[MAX_NODE_NUM + 1]; // managment command related - UINT uCmdBusy; - UINT uCmdHostAPBusy; + unsigned int uCmdBusy; + unsigned int uCmdHostAPBusy; // managment packet pool PBYTE pbyMgmtPacketPool; @@ -390,7 +389,7 @@ typedef struct tagSMgmtObject BOOL bSwitchChannel; BYTE byNewChannel; PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep; - UINT uLengthOfRepEIDs; + unsigned int uLengthOfRepEIDs; BYTE abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN]; BYTE abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN]; BYTE abyIECountry[WLAN_A3FR_MAXLEN]; @@ -401,102 +400,61 @@ typedef struct tagSMgmtObject } SMgmtObject, *PSMgmtObject; - /*--------------------- Export Macros ------------------------------*/ - /*--------------------- Export Functions --------------------------*/ +void vMgrObjectInit(void *hDeviceContext); -void -vMgrObjectInit( - IN HANDLE hDeviceContext - ); +void vMgrAssocBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PCMD_STATUS pStatus); +void vMgrReAssocBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PCMD_STATUS pStatus); -void -vMgrAssocBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - OUT PCMD_STATUS pStatus - ); +void vMgrDisassocBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PBYTE abyDestAddress, + WORD wReason, + PCMD_STATUS pStatus); -VOID -vMgrReAssocBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - OUT PCMD_STATUS pStatus - ); +void vMgrAuthenBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PCMD_STATUS pStatus); -VOID -vMgrDisassocBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - IN PBYTE abyDestAddress, - IN WORD wReason, - OUT PCMD_STATUS pStatus - ); +void vMgrCreateOwnIBSS(void *hDeviceContext, + PCMD_STATUS pStatus); -VOID -vMgrAuthenBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - OUT PCMD_STATUS pStatus - ); +void vMgrJoinBSSBegin(void *hDeviceContext, + PCMD_STATUS pStatus); -VOID -vMgrCreateOwnIBSS( - IN HANDLE hDeviceContext, - OUT PCMD_STATUS pStatus - ); - -VOID -vMgrJoinBSSBegin( - IN HANDLE hDeviceContext, - OUT PCMD_STATUS pStatus - ); - -VOID -vMgrRxManagePacket( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - IN PSRxMgmtPacket pRxPacket - ); +void vMgrRxManagePacket(void *hDeviceContext, + PSMgmtObject pMgmt, + PSRxMgmtPacket pRxPacket); /* -VOID +void vMgrScanBegin( - IN HANDLE hDeviceContext, - OUT PCMD_STATUS pStatus + void *hDeviceContext, + PCMD_STATUS pStatus ); */ -VOID -vMgrDeAuthenBeginSta( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt, - IN PBYTE abyDestAddress, - IN WORD wReason, - OUT PCMD_STATUS pStatus - ); +void vMgrDeAuthenBeginSta(void *hDeviceContext, + PSMgmtObject pMgmt, + PBYTE abyDestAddress, + WORD wReason, + PCMD_STATUS pStatus); -BOOL -bMgrPrepareBeaconToSend( - IN HANDLE hDeviceContext, - IN PSMgmtObject pMgmt - ); +BOOL bMgrPrepareBeaconToSend(void *hDeviceContext, + PSMgmtObject pMgmt); +BOOL bAdd_PMKID_Candidate(void *hDeviceContext, + PBYTE pbyBSSID, + PSRSNCapObject psRSNCapObj); -BOOL -bAdd_PMKID_Candidate ( - IN HANDLE hDeviceContext, - IN PBYTE pbyBSSID, - IN PSRSNCapObject psRSNCapObj - ); - -VOID -vFlush_PMKID_Candidate ( - IN HANDLE hDeviceContext - ); +void vFlush_PMKID_Candidate(void *hDeviceContext); -#endif // __WMGR_H__ +#endif /* __WMGR_H__ */ diff --git a/drivers/staging/vt6656/wpa.c b/drivers/staging/vt6656/wpa.c index 5da671418b52..1fa6c9b88ed3 100644 --- a/drivers/staging/vt6656/wpa.c +++ b/drivers/staging/vt6656/wpa.c @@ -68,9 +68,9 @@ const BYTE abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 }; * -*/ -VOID +void WPA_ClearRSN ( - IN PKnownBSS pBSSList + PKnownBSS pBSSList ) { int ii; @@ -104,10 +104,10 @@ WPA_ClearRSN ( * Return Value: none. * -*/ -VOID +void WPA_ParseRSN ( - IN PKnownBSS pBSSList, - IN PWLAN_IE_RSN_EXT pRSN + PKnownBSS pBSSList, + PWLAN_IE_RSN_EXT pRSN ) { PWLAN_IE_RSN_AUTH pIE_RSN_Auth = NULL; @@ -241,7 +241,7 @@ BOOL WPA_SearchRSN ( BYTE byCmd, BYTE byEncrypt, - IN PKnownBSS pBSSList + PKnownBSS pBSSList ) { int ii; @@ -299,7 +299,7 @@ WPA_SearchRSN ( -*/ BOOL WPAb_Is_RSN ( - IN PWLAN_IE_RSN_EXT pRSN + PWLAN_IE_RSN_EXT pRSN ) { if (pRSN == NULL) diff --git a/drivers/staging/vt6656/wpa.h b/drivers/staging/vt6656/wpa.h index 9d9ce01d0c61..889489adbb81 100644 --- a/drivers/staging/vt6656/wpa.h +++ b/drivers/staging/vt6656/wpa.h @@ -58,27 +58,27 @@ /*--------------------- Export Functions --------------------------*/ -VOID +void WPA_ClearRSN( - IN PKnownBSS pBSSList + PKnownBSS pBSSList ); -VOID +void WPA_ParseRSN( - IN PKnownBSS pBSSList, - IN PWLAN_IE_RSN_EXT pRSN + PKnownBSS pBSSList, + PWLAN_IE_RSN_EXT pRSN ); BOOL WPA_SearchRSN( BYTE byCmd, BYTE byEncrypt, - IN PKnownBSS pBSSList + PKnownBSS pBSSList ); BOOL WPAb_Is_RSN( - IN PWLAN_IE_RSN_EXT pRSN + PWLAN_IE_RSN_EXT pRSN ); -#endif // __WPA_H__ +#endif /* __WPA_H__ */ diff --git a/drivers/staging/vt6656/wpa2.c b/drivers/staging/vt6656/wpa2.c index fa3aeedfb278..6d13190885d1 100644 --- a/drivers/staging/vt6656/wpa2.c +++ b/drivers/staging/vt6656/wpa2.c @@ -71,9 +71,9 @@ const BYTE abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; * Return Value: none. * -*/ -VOID +void WPA2_ClearRSN ( - IN PKnownBSS pBSSNode + PKnownBSS pBSSNode ) { int ii; @@ -106,10 +106,10 @@ WPA2_ClearRSN ( * Return Value: none. * -*/ -VOID +void WPA2vParseRSN ( - IN PKnownBSS pBSSNode, - IN PWLAN_IE_RSN pRSN + PKnownBSS pBSSNode, + PWLAN_IE_RSN pRSN ) { int i, j; @@ -260,15 +260,14 @@ WPA2vParseRSN ( * Return Value: length of IEs. * -*/ -UINT -WPA2uSetIEs( - IN PVOID pMgmtHandle, - OUT PWLAN_IE_RSN pRSNIEs +unsigned int +WPA2uSetIEs(void *pMgmtHandle, + PWLAN_IE_RSN pRSNIEs ) { PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; PBYTE pbyBuffer = NULL; - UINT ii = 0; + unsigned int ii = 0; PWORD pwPMKID = NULL; if (pRSNIEs == NULL) { @@ -337,20 +336,25 @@ WPA2uSetIEs( } pRSNIEs->len +=2; - if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && - (pMgmt->bRoaming == TRUE) && + if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && + (pMgmt->bRoaming == TRUE) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { - // RSN PMKID - pwPMKID = (PWORD)(&pRSNIEs->abyRSN[18]); // Point to PMKID count - *pwPMKID = 0; // Initialize PMKID count - pbyBuffer = &pRSNIEs->abyRSN[20]; // Point to PMKID list - for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) { - if ( !memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { - (*pwPMKID) ++; - memcpy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16); - pbyBuffer += 16; - } - } + /* RSN PMKID, pointer to PMKID count */ + pwPMKID = (PWORD)(&pRSNIEs->abyRSN[18]); + *pwPMKID = 0; /* Initialize PMKID count */ + pbyBuffer = &pRSNIEs->abyRSN[20]; /* Point to PMKID list */ + for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) { + if (!memcmp(&pMgmt-> + gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], + pMgmt->abyCurrBSSID, + ETH_ALEN)) { + (*pwPMKID)++; + memcpy(pbyBuffer, + pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, + 16); + pbyBuffer += 16; + } + } if (*pwPMKID != 0) { pRSNIEs->len += (2 + (*pwPMKID)*16); } else { diff --git a/drivers/staging/vt6656/wpa2.h b/drivers/staging/vt6656/wpa2.h index e553b3869008..429a910a5c50 100644 --- a/drivers/staging/vt6656/wpa2.h +++ b/drivers/staging/vt6656/wpa2.h @@ -45,7 +45,7 @@ typedef struct tagsPMKIDInfo { } PMKIDInfo, *PPMKIDInfo; typedef struct tagSPMKIDCache { - ULONG BSSIDInfoCount; + unsigned long BSSIDInfoCount; PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE]; } SPMKIDCache, *PSPMKIDCache; @@ -58,21 +58,21 @@ typedef struct tagSPMKIDCache { /*--------------------- Export Functions --------------------------*/ -VOID +void WPA2_ClearRSN ( - IN PKnownBSS pBSSNode + PKnownBSS pBSSNode ); -VOID +void WPA2vParseRSN ( - IN PKnownBSS pBSSNode, - IN PWLAN_IE_RSN pRSN + PKnownBSS pBSSNode, + PWLAN_IE_RSN pRSN ); -UINT +unsigned int WPA2uSetIEs( - IN PVOID pMgmtHandle, - OUT PWLAN_IE_RSN pRSNIEs + void *pMgmtHandle, + PWLAN_IE_RSN pRSNIEs ); -#endif // __WPA2_H__ +#endif /* __WPA2_H__ */ diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c index 4555bc0448b9..961f583368a1 100644 --- a/drivers/staging/vt6656/wpactl.c +++ b/drivers/staging/vt6656/wpactl.c @@ -103,7 +103,7 @@ static int wpa_init_wpadev(PSDevice pDevice) wpadev_priv = netdev_priv(pDevice->wpadev); *wpadev_priv = *pDevice; - memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN); + memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, ETH_ALEN); pDevice->wpadev->base_addr = dev->base_addr; pDevice->wpadev->irq = dev->irq; pDevice->wpadev->mem_start = dev->mem_start; @@ -489,7 +489,7 @@ static int wpa_set_disassociate(PSDevice pDevice, spin_lock_irq(&pDevice->lock); if (pDevice->bLinkPass) { if (!memcmp(param->addr, pMgmt->abyCurrBSSID, 6)) - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_DISASSOCIATE, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL); } spin_unlock_irq(&pDevice->lock); @@ -513,7 +513,7 @@ static int wpa_set_disassociate(PSDevice pDevice, */ static int wpa_set_scan(PSDevice pDevice, - struct viawget_wpa_param *param) + struct viawget_wpa_param *param) { int ret = 0; @@ -531,9 +531,11 @@ memcpy(pItemSSID->abySSID, param->u.scan_req.ssid, param->u.scan_req.ssid_len); pItemSSID->len = param->u.scan_req.ssid_len; spin_lock_irq(&pDevice->lock); - BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); - // bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, NULL); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); + BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); + /* bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); */ + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); spin_unlock_irq(&pDevice->lock); return ret; @@ -676,13 +678,12 @@ static int wpa_get_scan(PSDevice pDevice, count++; }; - pBuf = kmalloc(sizeof(struct viawget_scan_result) * count, (int)GFP_ATOMIC); + pBuf = kcalloc(count, sizeof(struct viawget_scan_result), (int)GFP_ATOMIC); if (pBuf == NULL) { ret = -ENOMEM; return ret; } - memset(pBuf, 0, sizeof(struct viawget_scan_result) * count); scan_buf = (struct viawget_scan_result *)pBuf; pBSS = &(pMgmt->sBSSList[0]); for (ii = 0, jj = 0; ii < MAX_BSS_NUM ; ii++) { @@ -886,12 +887,14 @@ static int wpa_set_associate(PSDevice pDevice, if (pCurr == NULL){ printk("wpa_set_associate---->hidden mode site survey before associate.......\n"); - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); }; } /****************************************************************/ - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, NULL); + bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL); spin_unlock_irq(&pDevice->lock); return ret; @@ -922,7 +925,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) p->length > VIAWGET_WPA_MAX_BUF_SIZE || !p->pointer) return -EINVAL; - param = (struct viawget_wpa_param *) kmalloc((int)p->length, (int)GFP_KERNEL); + param = kmalloc((int)p->length, (int)GFP_KERNEL); if (param == NULL) return -ENOMEM; diff --git a/drivers/staging/vt6656/wpactl.h b/drivers/staging/vt6656/wpactl.h index 56179f01311a..00c8451ab50b 100644 --- a/drivers/staging/vt6656/wpactl.h +++ b/drivers/staging/vt6656/wpactl.h @@ -52,9 +52,7 @@ typedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE, #define GENERIC_INFO_ELEM 0xdd #define RSN_INFO_ELEM 0x30 - - -typedef ULONGLONG NDIS_802_11_KEY_RSC; +typedef unsigned long long NDIS_802_11_KEY_RSC; /*--------------------- Export Classes ----------------------------*/ @@ -66,7 +64,4 @@ int wpa_set_wpadev(PSDevice pDevice, int val); int wpa_ioctl(PSDevice pDevice, struct iw_point *p); int wpa_set_keys(PSDevice pDevice, void *ctx, BOOL fcpfkernel); -#endif // __WPACL_H__ - - - +#endif /* __WPACL_H__ */ |