diff options
Diffstat (limited to 'drivers/staging/vt6656')
75 files changed, 1850 insertions, 3980 deletions
diff --git a/drivers/staging/vt6656/80211hdr.h b/drivers/staging/vt6656/80211hdr.h index b87d5434077a..000304ffad6c 100644 --- a/drivers/staging/vt6656/80211hdr.h +++ b/drivers/staging/vt6656/80211hdr.h @@ -28,10 +28,6 @@ #ifndef __80211HDR_H__ #define __80211HDR_H__ -#include "ttype.h" - -/*--------------------- Export Definitions -------------------------*/ - /* bit type */ #define BIT0 0x00000001 #define BIT1 0x00000002 @@ -155,22 +151,22 @@ #ifdef __BIG_ENDIAN /* 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) \ +#define WLAN_GET_FC_PRVER(n) ((((u16)(n) >> 8) & (BIT0 | BIT1)) +#define WLAN_GET_FC_FTYPE(n) ((((u16)(n) >> 8) & (BIT2 | BIT3)) >> 2) +#define WLAN_GET_FC_FSTYPE(n) ((((u16)(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) -#define WLAN_GET_FC_RETRY(n) ((((WORD)(n) << 8) & (BIT11)) >> 11) -#define WLAN_GET_FC_PWRMGT(n) ((((WORD)(n) << 8) & (BIT12)) >> 12) -#define WLAN_GET_FC_MOREDATA(n) ((((WORD)(n) << 8) & (BIT13)) >> 13) -#define WLAN_GET_FC_ISWEP(n) ((((WORD)(n) << 8) & (BIT14)) >> 14) -#define WLAN_GET_FC_ORDER(n) ((((WORD)(n) << 8) & (BIT15)) >> 15) +#define WLAN_GET_FC_TODS(n) ((((u16)(n) << 8) & (BIT8)) >> 8) +#define WLAN_GET_FC_FROMDS(n) ((((u16)(n) << 8) & (BIT9)) >> 9) +#define WLAN_GET_FC_MOREFRAG(n) ((((u16)(n) << 8) & (BIT10)) >> 10) +#define WLAN_GET_FC_RETRY(n) ((((u16)(n) << 8) & (BIT11)) >> 11) +#define WLAN_GET_FC_PWRMGT(n) ((((u16)(n) << 8) & (BIT12)) >> 12) +#define WLAN_GET_FC_MOREDATA(n) ((((u16)(n) << 8) & (BIT13)) >> 13) +#define WLAN_GET_FC_ISWEP(n) ((((u16)(n) << 8) & (BIT14)) >> 14) +#define WLAN_GET_FC_ORDER(n) ((((u16)(n) << 8) & (BIT15)) >> 15) /* 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) \ +#define WLAN_GET_SEQ_FRGNUM(n) (((u16)(n) >> 8) & (BIT0|BIT1|BIT2|BIT3)) +#define WLAN_GET_SEQ_SEQNUM(n) ((((u16)(n) >> 8) \ & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) /* Capability Field bit */ @@ -190,21 +186,21 @@ #else /* 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) -#define WLAN_GET_FC_TODS(n) ((((WORD)(n)) & (BIT8)) >> 8) -#define WLAN_GET_FC_FROMDS(n) ((((WORD)(n)) & (BIT9)) >> 9) -#define WLAN_GET_FC_MOREFRAG(n) ((((WORD)(n)) & (BIT10)) >> 10) -#define WLAN_GET_FC_RETRY(n) ((((WORD)(n)) & (BIT11)) >> 11) -#define WLAN_GET_FC_PWRMGT(n) ((((WORD)(n)) & (BIT12)) >> 12) -#define WLAN_GET_FC_MOREDATA(n) ((((WORD)(n)) & (BIT13)) >> 13) -#define WLAN_GET_FC_ISWEP(n) ((((WORD)(n)) & (BIT14)) >> 14) -#define WLAN_GET_FC_ORDER(n) ((((WORD)(n)) & (BIT15)) >> 15) +#define WLAN_GET_FC_PRVER(n) (((u16)(n)) & (BIT0 | BIT1)) +#define WLAN_GET_FC_FTYPE(n) ((((u16)(n)) & (BIT2 | BIT3)) >> 2) +#define WLAN_GET_FC_FSTYPE(n) ((((u16)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4) +#define WLAN_GET_FC_TODS(n) ((((u16)(n)) & (BIT8)) >> 8) +#define WLAN_GET_FC_FROMDS(n) ((((u16)(n)) & (BIT9)) >> 9) +#define WLAN_GET_FC_MOREFRAG(n) ((((u16)(n)) & (BIT10)) >> 10) +#define WLAN_GET_FC_RETRY(n) ((((u16)(n)) & (BIT11)) >> 11) +#define WLAN_GET_FC_PWRMGT(n) ((((u16)(n)) & (BIT12)) >> 12) +#define WLAN_GET_FC_MOREDATA(n) ((((u16)(n)) & (BIT13)) >> 13) +#define WLAN_GET_FC_ISWEP(n) ((((u16)(n)) & (BIT14)) >> 14) +#define WLAN_GET_FC_ORDER(n) ((((u16)(n)) & (BIT15)) >> 15) /* 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) +#define WLAN_GET_SEQ_FRGNUM(n) (((u16)(n)) & (BIT0|BIT1|BIT2|BIT3)) +#define WLAN_GET_SEQ_SEQNUM(n) ((((u16)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) /* Capability Field bit */ #define WLAN_GET_CAP_INFO_ESS(n) ((n) & BIT0) @@ -235,20 +231,20 @@ #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) -#define WLAN_SET_FC_TODS(n) (((WORD)(n)) << 8) -#define WLAN_SET_FC_FROMDS(n) (((WORD)(n)) << 9) -#define WLAN_SET_FC_MOREFRAG(n) (((WORD)(n)) << 10) -#define WLAN_SET_FC_RETRY(n) (((WORD)(n)) << 11) -#define WLAN_SET_FC_PWRMGT(n) (((WORD)(n)) << 12) -#define WLAN_SET_FC_MOREDATA(n) (((WORD)(n)) << 13) -#define WLAN_SET_FC_ISWEP(n) (((WORD)(n)) << 14) -#define WLAN_SET_FC_ORDER(n) (((WORD)(n)) << 15) - -#define WLAN_SET_SEQ_FRGNUM(n) ((WORD)(n)) -#define WLAN_SET_SEQ_SEQNUM(n) (((WORD)(n)) << 4) +#define WLAN_SET_FC_PRVER(n) ((u16)(n)) +#define WLAN_SET_FC_FTYPE(n) (((u16)(n)) << 2) +#define WLAN_SET_FC_FSTYPE(n) (((u16)(n)) << 4) +#define WLAN_SET_FC_TODS(n) (((u16)(n)) << 8) +#define WLAN_SET_FC_FROMDS(n) (((u16)(n)) << 9) +#define WLAN_SET_FC_MOREFRAG(n) (((u16)(n)) << 10) +#define WLAN_SET_FC_RETRY(n) (((u16)(n)) << 11) +#define WLAN_SET_FC_PWRMGT(n) (((u16)(n)) << 12) +#define WLAN_SET_FC_MOREDATA(n) (((u16)(n)) << 13) +#define WLAN_SET_FC_ISWEP(n) (((u16)(n)) << 14) +#define WLAN_SET_FC_ORDER(n) (((u16)(n)) << 15) + +#define WLAN_SET_SEQ_FRGNUM(n) ((u16)(n)) +#define WLAN_SET_SEQ_SEQNUM(n) (((u16)(n)) << 4) /* ERP Field bit */ @@ -269,50 +265,50 @@ #define WLAN_MGMT_GET_TIM_OFFSET(b) (((b) & ~BIT0) >> 1) /* 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) +#define WLAN_HDR_A3_DATA_PTR(p) (((u8 *)(p)) + WLAN_HDR_ADDR3_LEN) +#define WLAN_HDR_A4_DATA_PTR(p) (((u8 *)(p)) + WLAN_HDR_ADDR4_LEN) /* IEEE ADDR */ #define IEEE_ADDR_UNIVERSAL 0x02 #define IEEE_ADDR_GROUP 0x01 typedef struct { - BYTE abyAddr[6]; + u8 abyAddr[6]; } IEEE_ADDR, *PIEEE_ADDR; /* 802.11 Header Format */ typedef struct tagWLAN_80211HDR_A2 { - WORD wFrameCtl; - WORD wDurationID; - BYTE abyAddr1[WLAN_ADDR_LEN]; - BYTE abyAddr2[WLAN_ADDR_LEN]; + u16 wFrameCtl; + u16 wDurationID; + u8 abyAddr1[WLAN_ADDR_LEN]; + u8 abyAddr2[WLAN_ADDR_LEN]; } __attribute__ ((__packed__)) WLAN_80211HDR_A2, *PWLAN_80211HDR_A2; typedef struct tagWLAN_80211HDR_A3 { - WORD wFrameCtl; - WORD wDurationID; - BYTE abyAddr1[WLAN_ADDR_LEN]; - BYTE abyAddr2[WLAN_ADDR_LEN]; - BYTE abyAddr3[WLAN_ADDR_LEN]; - WORD wSeqCtl; + u16 wFrameCtl; + u16 wDurationID; + u8 abyAddr1[WLAN_ADDR_LEN]; + u8 abyAddr2[WLAN_ADDR_LEN]; + u8 abyAddr3[WLAN_ADDR_LEN]; + u16 wSeqCtl; } __attribute__ ((__packed__)) WLAN_80211HDR_A3, *PWLAN_80211HDR_A3; typedef struct tagWLAN_80211HDR_A4 { - WORD wFrameCtl; - WORD wDurationID; - BYTE abyAddr1[WLAN_ADDR_LEN]; - BYTE abyAddr2[WLAN_ADDR_LEN]; - BYTE abyAddr3[WLAN_ADDR_LEN]; - WORD wSeqCtl; - BYTE abyAddr4[WLAN_ADDR_LEN]; + u16 wFrameCtl; + u16 wDurationID; + u8 abyAddr1[WLAN_ADDR_LEN]; + u8 abyAddr2[WLAN_ADDR_LEN]; + u8 abyAddr3[WLAN_ADDR_LEN]; + u16 wSeqCtl; + u8 abyAddr4[WLAN_ADDR_LEN]; } __attribute__ ((__packed__)) WLAN_80211HDR_A4, *PWLAN_80211HDR_A4; @@ -325,10 +321,4 @@ typedef union tagUWLAN_80211HDR { } UWLAN_80211HDR, *PUWLAN_80211HDR; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - #endif /* __80211HDR_H__ */ diff --git a/drivers/staging/vt6656/80211mgr.c b/drivers/staging/vt6656/80211mgr.c index 534d490539b6..61edb51f3836 100644 --- a/drivers/staging/vt6656/80211mgr.c +++ b/drivers/staging/vt6656/80211mgr.c @@ -27,8 +27,6 @@ * Functions: * vMgrEncodeBeacon - Encode the Beacon frame * vMgrDecodeBeacon - Decode the Beacon frame - * vMgrEncodeIBSSATIM - Encode the IBSS ATIM frame - * vMgrDecodeIBSSATIM - Decode the IBSS ATIM frame * vMgrEncodeDisassociation - Encode the Disassociation frame * vMgrDecodeDisassociation - Decode the Disassociation frame * vMgrEncodeAssocRequest - Encode the Association request frame @@ -46,7 +44,6 @@ * vMgrEncodeDeauthen - Encode the DeAuthentication frame * vMgrDecodeDeauthen - Decode the DeAuthentication frame * vMgrEncodeReassocResponse - Encode the Reassociation response frame - * vMgrDecodeReassocResponse - Decode the Reassociation response frame * * Revision History: * @@ -59,25 +56,8 @@ #include "80211hdr.h" #include "wpa.h" -/*--------------------- Static Definitions -------------------------*/ - - - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - static int msglevel = MSG_LEVEL_INFO; /*static int msglevel =MSG_LEVEL_DEBUG;*/ -/*--------------------- Static Functions --------------------------*/ - - - -/*--------------------- Export Variables --------------------------*/ - - -/*--------------------- Export Functions --------------------------*/ - /*+ * @@ -100,9 +80,9 @@ vMgrEncodeBeacon( pFrame->pqwTimestamp = (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_TS); - pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_BCN_INT); - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_CAPINFO); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID; @@ -121,7 +101,6 @@ vMgrEncodeBeacon( * -*/ - void vMgrDecodeBeacon( PWLAN_FR_BEACON pFrame @@ -135,15 +114,15 @@ vMgrDecodeBeacon( pFrame->pqwTimestamp = (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_TS); - pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_BCN_INT); - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_CAPINFO); /* Information elements */ - pItem = (PWLAN_IE)((PBYTE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))) + pItem = (PWLAN_IE)((u8 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))) + WLAN_BEACON_OFF_SSID); - while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) { + while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { switch (pItem->byElementID) { case WLAN_EID_SSID: @@ -224,53 +203,10 @@ vMgrDecodeBeacon( break; } - pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len); + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); } } - -/*+ - * - * Routine Description: - * Encode IBSS ATIM - * - * - * Return Value: - * None. - * --*/ - - -void -vMgrEncodeIBSSATIM( - PWLAN_FR_IBSSATIM pFrame - ) -{ - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - pFrame->len = WLAN_HDR_ADDR3_LEN; -} - - -/*+ - * - * Routine Description: - * Decode IBSS ATIM - * - * - * Return Value: - * None. - * --*/ - -void -vMgrDecodeIBSSATIM( - PWLAN_FR_IBSSATIM pFrame - ) -{ - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; -} - - /*+ * * Routine Description: @@ -289,14 +225,12 @@ vMgrEncodeDisassociation( { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_DISASSOC_OFF_REASON); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON + sizeof(*(pFrame->pwReason)); } - /*+ * * Routine Description: @@ -316,7 +250,7 @@ vMgrDecodeDisassociation( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_DISASSOC_OFF_REASON); } @@ -331,7 +265,6 @@ vMgrDecodeDisassociation( * -*/ - void vMgrEncodeAssocRequest( PWLAN_FR_ASSOCREQ pFrame @@ -339,14 +272,13 @@ vMgrEncodeAssocRequest( { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCREQ_OFF_CAP_INFO); - pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwListenInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCREQ_OFF_LISTEN_INT); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCREQ_OFF_LISTEN_INT + sizeof(*(pFrame->pwListenInterval)); } - /*+ * * Routine Description: (AP) @@ -367,16 +299,16 @@ vMgrDecodeAssocRequest( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCREQ_OFF_CAP_INFO); - pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwListenInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCREQ_OFF_LISTEN_INT); /* Information elements */ pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCREQ_OFF_SSID); - while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) { + while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { switch (pItem->byElementID) { case WLAN_EID_SSID: if (pFrame->pSSID == NULL) @@ -407,7 +339,7 @@ vMgrDecodeAssocRequest( pItem->byElementID); break; } - pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len); + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); } } @@ -430,17 +362,16 @@ vMgrEncodeAssocResponse( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCRESP_OFF_CAP_INFO); - pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCRESP_OFF_STATUS); - pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwAid = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCRESP_OFF_AID); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid)); } - /*+ * * Routine Description: @@ -462,11 +393,11 @@ vMgrDecodeAssocResponse( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCRESP_OFF_CAP_INFO); - pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCRESP_OFF_STATUS); - pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwAid = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_ASSOCRESP_OFF_AID); /* Information elements */ @@ -474,16 +405,15 @@ vMgrDecodeAssocResponse( + WLAN_ASSOCRESP_OFF_SUPP_RATES); pItem = (PWLAN_IE)(pFrame->pSuppRates); - pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len); + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); - if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) { + if ((((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) { pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pFrame->pExtSuppRates=[%p].\n", pItem); } else pFrame->pExtSuppRates = NULL; } - /*+ * * Routine Description: @@ -503,16 +433,15 @@ vMgrEncodeReassocRequest( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCREQ_OFF_CAP_INFO); - pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwListenInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCREQ_OFF_LISTEN_INT); pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCREQ_OFF_CURR_AP); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP + sizeof(*(pFrame->pAddrCurrAP)); } - /*+ * * Routine Description: (AP) @@ -524,7 +453,6 @@ vMgrEncodeReassocRequest( * -*/ - void vMgrDecodeReassocRequest( PWLAN_FR_REASSOCREQ pFrame @@ -534,9 +462,9 @@ vMgrDecodeReassocRequest( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCREQ_OFF_CAP_INFO); - pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwListenInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCREQ_OFF_LISTEN_INT); pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCREQ_OFF_CURR_AP); @@ -545,7 +473,7 @@ vMgrDecodeReassocRequest( pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCREQ_OFF_SSID); - while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) { + while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { switch (pItem->byElementID) { case WLAN_EID_SSID: @@ -576,12 +504,10 @@ vMgrDecodeReassocRequest( pItem->byElementID); break; } - pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len); + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); } } - - /*+ * * Routine Description: @@ -593,7 +519,6 @@ vMgrDecodeReassocRequest( * -*/ - void vMgrEncodeProbeRequest( PWLAN_FR_PROBEREQ pFrame @@ -626,7 +551,7 @@ vMgrDecodeProbeRequest( /* Information elements */ pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))); - while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) { + while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { switch (pItem->byElementID) { case WLAN_EID_SSID: @@ -649,11 +574,10 @@ vMgrDecodeProbeRequest( break; } - pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len); + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); } } - /*+ * * Routine Description: @@ -665,7 +589,6 @@ vMgrDecodeProbeRequest( * -*/ - void vMgrEncodeProbeResponse( PWLAN_FR_PROBERESP pFrame @@ -677,17 +600,15 @@ vMgrEncodeProbeResponse( pFrame->pqwTimestamp = (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_TS); - pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_BCN_INT); - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_CAP_INFO); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO + sizeof(*(pFrame->pwCapInfo)); } - - /*+ * * Routine Description: @@ -706,23 +627,22 @@ vMgrDecodeProbeResponse( { PWLAN_IE pItem; - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ pFrame->pqwTimestamp = (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_TS); - pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_BCN_INT); - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_CAP_INFO); /* Information elements */ pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_SSID); - while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) { + while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { switch (pItem->byElementID) { case WLAN_EID_SSID: if (pFrame->pSSID == NULL) @@ -796,11 +716,10 @@ vMgrDecodeProbeResponse( break; } - pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len); + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); } } - /*+ * * Routine Description: @@ -820,16 +739,15 @@ vMgrEncodeAuthen( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwAuthAlgorithm = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwAuthAlgorithm = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_AUTHEN_OFF_AUTH_ALG); - pFrame->pwAuthSequence = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwAuthSequence = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_AUTHEN_OFF_AUTH_SEQ); - pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_AUTHEN_OFF_STATUS); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS + sizeof(*(pFrame->pwStatus)); } - /*+ * * Routine Description: @@ -851,22 +769,21 @@ vMgrDecodeAuthen( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwAuthAlgorithm = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwAuthAlgorithm = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_AUTHEN_OFF_AUTH_ALG); - pFrame->pwAuthSequence = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwAuthSequence = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_AUTHEN_OFF_AUTH_SEQ); - pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_AUTHEN_OFF_STATUS); /* Information elements */ pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_AUTHEN_OFF_CHALLENGE); - if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE)) + if ((((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE)) pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem; } - /*+ * * Routine Description: @@ -886,12 +803,11 @@ vMgrEncodeDeauthen( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_DEAUTHEN_OFF_REASON); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON + sizeof(*(pFrame->pwReason)); } - /*+ * * Routine Description: @@ -911,11 +827,10 @@ vMgrDecodeDeauthen( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_DEAUTHEN_OFF_REASON); } - /*+ * * Routine Description: (AP) @@ -935,53 +850,12 @@ vMgrEncodeReassocResponse( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCRESP_OFF_CAP_INFO); - pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCRESP_OFF_STATUS); - pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + pFrame->pwAid = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_REASSOCRESP_OFF_AID); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid)); } - - -/*+ - * - * Routine Description: - * Decode Reassociation Response - * - * - * Return Value: - * None. - * --*/ - - -void -vMgrDecodeReassocResponse( - PWLAN_FR_REASSOCRESP pFrame - ) -{ - PWLAN_IE pItem; - - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - - /* Fixed Fields */ - pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_CAP_INFO); - pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_STATUS); - pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_AID); - - /* Information elements */ - pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_SUPP_RATES); - - pItem = (PWLAN_IE)(pFrame->pSuppRates); - pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len); - - if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) - pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; -} diff --git a/drivers/staging/vt6656/80211mgr.h b/drivers/staging/vt6656/80211mgr.h index f8e16d8989ea..39cde1a0b66c 100644 --- a/drivers/staging/vt6656/80211mgr.h +++ b/drivers/staging/vt6656/80211mgr.h @@ -31,11 +31,8 @@ #ifndef __80211MGR_H__ #define __80211MGR_H__ -#include "ttype.h" #include "80211hdr.h" -/*--------------------- Export Definitions -------------------------*/ - #define WLAN_MIN_ARRAY 1 /* Information Element ID value */ @@ -213,192 +210,186 @@ #define MEASURE_MODE_INCAPABLE 0x02 #define MEASURE_MODE_REFUSED 0x04 -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - /* Information Element types */ #pragma pack(1) typedef struct tagWLAN_IE { - BYTE byElementID; - BYTE len; + u8 byElementID; + u8 len; } __attribute__ ((__packed__)) WLAN_IE, *PWLAN_IE; /* Service Set IDentity (SSID) */ #pragma pack(1) typedef struct tagWLAN_IE_SSID { - BYTE byElementID; - BYTE len; - BYTE abySSID[1]; + u8 byElementID; + u8 len; + u8 abySSID[1]; } __attribute__ ((__packed__)) WLAN_IE_SSID, *PWLAN_IE_SSID; /* Supported Rates */ #pragma pack(1) typedef struct tagWLAN_IE_SUPP_RATES { - BYTE byElementID; - BYTE len; - BYTE abyRates[1]; + u8 byElementID; + u8 len; + u8 abyRates[1]; } __attribute__ ((__packed__)) WLAN_IE_SUPP_RATES, *PWLAN_IE_SUPP_RATES; /* FH Parameter Set */ #pragma pack(1) typedef struct _WLAN_IE_FH_PARMS { - BYTE byElementID; - BYTE len; - WORD wDwellTime; - BYTE byHopSet; - BYTE byHopPattern; - BYTE byHopIndex; + u8 byElementID; + u8 len; + u16 wDwellTime; + u8 byHopSet; + u8 byHopPattern; + u8 byHopIndex; } WLAN_IE_FH_PARMS, *PWLAN_IE_FH_PARMS; /* DS Parameter Set */ #pragma pack(1) typedef struct tagWLAN_IE_DS_PARMS { - BYTE byElementID; - BYTE len; - BYTE byCurrChannel; + u8 byElementID; + u8 len; + u8 byCurrChannel; } __attribute__ ((__packed__)) WLAN_IE_DS_PARMS, *PWLAN_IE_DS_PARMS; /* CF Parameter Set */ #pragma pack(1) typedef struct tagWLAN_IE_CF_PARMS { - BYTE byElementID; - BYTE len; - BYTE byCFPCount; - BYTE byCFPPeriod; - WORD wCFPMaxDuration; - WORD wCFPDurRemaining; + u8 byElementID; + u8 len; + u8 byCFPCount; + u8 byCFPPeriod; + u16 wCFPMaxDuration; + u16 wCFPDurRemaining; } __attribute__ ((__packed__)) WLAN_IE_CF_PARMS, *PWLAN_IE_CF_PARMS; /* TIM */ #pragma pack(1) typedef struct tagWLAN_IE_TIM { - BYTE byElementID; - BYTE len; - BYTE byDTIMCount; - BYTE byDTIMPeriod; - BYTE byBitMapCtl; - BYTE byVirtBitMap[1]; + u8 byElementID; + u8 len; + u8 byDTIMCount; + u8 byDTIMPeriod; + u8 byBitMapCtl; + u8 byVirtBitMap[1]; } __attribute__ ((__packed__)) WLAN_IE_TIM, *PWLAN_IE_TIM; /* IBSS Parameter Set */ #pragma pack(1) typedef struct tagWLAN_IE_IBSS_PARMS { - BYTE byElementID; - BYTE len; - WORD wATIMWindow; + u8 byElementID; + u8 len; + u16 wATIMWindow; } __attribute__ ((__packed__)) WLAN_IE_IBSS_PARMS, *PWLAN_IE_IBSS_PARMS; /* Challenge Text */ #pragma pack(1) typedef struct tagWLAN_IE_CHALLENGE { - BYTE byElementID; - BYTE len; - BYTE abyChallenge[1]; + u8 byElementID; + u8 len; + u8 abyChallenge[1]; } __attribute__ ((__packed__)) WLAN_IE_CHALLENGE, *PWLAN_IE_CHALLENGE; #pragma pack(1) typedef struct tagWLAN_IE_RSN_EXT { - BYTE byElementID; - BYTE len; - BYTE abyOUI[4]; - WORD wVersion; - BYTE abyMulticast[4]; - WORD wPKCount; + u8 byElementID; + u8 len; + u8 abyOUI[4]; + u16 wVersion; + u8 abyMulticast[4]; + u16 wPKCount; struct { - BYTE abyOUI[4]; + u8 abyOUI[4]; } PKSList[1]; /* the rest is variable so need to overlay ieauth structure */ } WLAN_IE_RSN_EXT, *PWLAN_IE_RSN_EXT; #pragma pack(1) typedef struct tagWLAN_IE_RSN_AUTH { - WORD wAuthCount; + u16 wAuthCount; struct { - BYTE abyOUI[4]; + u8 abyOUI[4]; } AuthKSList[1]; } WLAN_IE_RSN_AUTH, *PWLAN_IE_RSN_AUTH; /* RSN Identity */ #pragma pack(1) typedef struct tagWLAN_IE_RSN { - BYTE byElementID; - BYTE len; - WORD wVersion; - BYTE abyRSN[WLAN_MIN_ARRAY]; + u8 byElementID; + u8 len; + u16 wVersion; + u8 abyRSN[WLAN_MIN_ARRAY]; } WLAN_IE_RSN, *PWLAN_IE_RSN; /* CCX Identity DavidWang */ #pragma pack(1) typedef struct tagWLAN_IE_CCX { -BYTE byElementID; -BYTE len; -BYTE abyCCX[30]; +u8 byElementID; +u8 len; +u8 abyCCX[30]; } WLAN_IE_CCX, *PWLAN_IE_CCX; #pragma pack(1) typedef struct tagWLAN_IE_CCX_IP { -BYTE byElementID; -BYTE len; -BYTE abyCCXOUI[4]; -BYTE abyCCXIP[4]; -BYTE abyCCXREV[2]; +u8 byElementID; +u8 len; +u8 abyCCXOUI[4]; +u8 abyCCXIP[4]; +u8 abyCCXREV[2]; } WLAN_IE_CCX_IP, *PWLAN_IE_CCX_IP; #pragma pack(1) typedef struct tagWLAN_IE_CCX_Ver { -BYTE byElementID; -BYTE len; -BYTE abyCCXVer[5]; +u8 byElementID; +u8 len; +u8 abyCCXVer[5]; } WLAN_IE_CCX_Ver, *PWLAN_IE_CCX_Ver; /* ERP */ #pragma pack(1) typedef struct tagWLAN_IE_ERP { - BYTE byElementID; - BYTE len; - BYTE byContext; + u8 byElementID; + u8 len; + u8 byContext; } __attribute__ ((__packed__)) WLAN_IE_ERP, *PWLAN_IE_ERP; #pragma pack(1) typedef struct _MEASEURE_REQ { - BYTE byChannel; - BYTE abyStartTime[8]; - BYTE abyDuration[2]; + u8 byChannel; + u8 abyStartTime[8]; + u8 abyDuration[2]; } MEASEURE_REQ, *PMEASEURE_REQ, MEASEURE_REQ_BASIC, *PMEASEURE_REQ_BASIC, MEASEURE_REQ_CCA, *PMEASEURE_REQ_CCA, MEASEURE_REQ_RPI, *PMEASEURE_REQ_RPI; typedef struct _MEASEURE_REP_BASIC { - BYTE byChannel; - BYTE abyStartTime[8]; - BYTE abyDuration[2]; - BYTE byMap; + u8 byChannel; + u8 abyStartTime[8]; + u8 abyDuration[2]; + u8 byMap; } MEASEURE_REP_BASIC, *PMEASEURE_REP_BASIC; typedef struct _MEASEURE_REP_CCA { - BYTE byChannel; - BYTE abyStartTime[8]; - BYTE abyDuration[2]; - BYTE byCCABusyFraction; + u8 byChannel; + u8 abyStartTime[8]; + u8 abyDuration[2]; + u8 byCCABusyFraction; } MEASEURE_REP_CCA, *PMEASEURE_REP_CCA; typedef struct _MEASEURE_REP_RPI { - BYTE byChannel; - BYTE abyStartTime[8]; - BYTE abyDuration[2]; - BYTE abyRPIdensity[8]; + u8 byChannel; + u8 abyStartTime[8]; + u8 abyDuration[2]; + u8 abyRPIdensity[8]; } MEASEURE_REP_RPI, *PMEASEURE_REP_RPI; typedef union _MEASEURE_REP { @@ -410,85 +401,84 @@ typedef union _MEASEURE_REP { } MEASEURE_REP, *PMEASEURE_REP; typedef struct _WLAN_IE_MEASURE_REQ { - BYTE byElementID; - BYTE len; - BYTE byToken; - BYTE byMode; - BYTE byType; + u8 byElementID; + u8 len; + u8 byToken; + u8 byMode; + u8 byType; MEASEURE_REQ sReq; } WLAN_IE_MEASURE_REQ, *PWLAN_IE_MEASURE_REQ; typedef struct _WLAN_IE_MEASURE_REP { - BYTE byElementID; - BYTE len; - BYTE byToken; - BYTE byMode; - BYTE byType; + u8 byElementID; + u8 len; + u8 byToken; + u8 byMode; + u8 byType; MEASEURE_REP sRep; } WLAN_IE_MEASURE_REP, *PWLAN_IE_MEASURE_REP; typedef struct _WLAN_IE_CH_SW { - BYTE byElementID; - BYTE len; - BYTE byMode; - BYTE byChannel; - BYTE byCount; + u8 byElementID; + u8 len; + u8 byMode; + u8 byChannel; + u8 byCount; } WLAN_IE_CH_SW, *PWLAN_IE_CH_SW; typedef struct _WLAN_IE_QUIET { - BYTE byElementID; - BYTE len; - BYTE byQuietCount; - BYTE byQuietPeriod; - BYTE abyQuietDuration[2]; - BYTE abyQuietOffset[2]; + u8 byElementID; + u8 len; + u8 byQuietCount; + u8 byQuietPeriod; + u8 abyQuietDuration[2]; + u8 abyQuietOffset[2]; } WLAN_IE_QUIET, *PWLAN_IE_QUIET; typedef struct _WLAN_IE_COUNTRY { - BYTE byElementID; - BYTE len; - BYTE abyCountryString[3]; - BYTE abyCountryInfo[3]; + u8 byElementID; + u8 len; + u8 abyCountryString[3]; + u8 abyCountryInfo[3]; } WLAN_IE_COUNTRY, *PWLAN_IE_COUNTRY; typedef struct _WLAN_IE_PW_CONST { - BYTE byElementID; - BYTE len; - BYTE byPower; + u8 byElementID; + u8 len; + u8 byPower; } WLAN_IE_PW_CONST, *PWLAN_IE_PW_CONST; typedef struct _WLAN_IE_PW_CAP { - BYTE byElementID; - BYTE len; - BYTE byMinPower; - BYTE byMaxPower; + u8 byElementID; + u8 len; + u8 byMinPower; + u8 byMaxPower; } WLAN_IE_PW_CAP, *PWLAN_IE_PW_CAP; typedef struct _WLAN_IE_SUPP_CH { - BYTE byElementID; - BYTE len; - BYTE abyChannelTuple[2]; + u8 byElementID; + u8 len; + u8 abyChannelTuple[2]; } WLAN_IE_SUPP_CH, *PWLAN_IE_SUPP_CH; typedef struct _WLAN_IE_TPC_REQ { - BYTE byElementID; - BYTE len; + u8 byElementID; + u8 len; } WLAN_IE_TPC_REQ, *PWLAN_IE_TPC_REQ; typedef struct _WLAN_IE_TPC_REP { - BYTE byElementID; - BYTE len; - BYTE byTxPower; - BYTE byLinkMargin; + u8 byElementID; + u8 len; + u8 byTxPower; + u8 byLinkMargin; } WLAN_IE_TPC_REP, *PWLAN_IE_TPC_REP; - typedef struct _WLAN_IE_IBSS_DFS { - BYTE byElementID; - BYTE len; - BYTE abyDFSOwner[6]; - BYTE byDFSRecovery; - BYTE abyChannelMap[2]; + u8 byElementID; + u8 len; + u8 abyDFSOwner[6]; + u8 byDFSRecovery; + u8 abyChannelMap[2]; } WLAN_IE_IBSS_DFS, *PWLAN_IE_IBSS_DFS; #pragma pack() @@ -500,7 +490,7 @@ typedef struct tagWLAN_FR_MGMT { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; } WLAN_FR_MGMT, *PWLAN_FR_MGMT; @@ -510,12 +500,12 @@ typedef struct tagWLAN_FR_BEACON { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ u64 *pqwTimestamp; - PWORD pwBeaconInterval; - PWORD pwCapInfo; + u16 * pwBeaconInterval; + u16 * pwCapInfo; /* info elements */ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; @@ -541,7 +531,7 @@ typedef struct tagWLAN_FR_IBSSATIM { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ @@ -555,10 +545,10 @@ typedef struct tagWLAN_FR_DISASSOC { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ - PWORD pwReason; + u16 * pwReason; /* info elements */ } WLAN_FR_DISASSOC, *PWLAN_FR_DISASSOC; @@ -568,11 +558,11 @@ typedef struct tagWLAN_FR_ASSOCREQ { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ - PWORD pwCapInfo; - PWORD pwListenInterval; + u16 * pwCapInfo; + u16 * pwListenInterval; /* info elements */ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; @@ -592,12 +582,12 @@ typedef struct tagWLAN_FR_ASSOCRESP { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ - PWORD pwCapInfo; - PWORD pwStatus; - PWORD pwAid; + u16 * pwCapInfo; + u16 * pwStatus; + u16 * pwAid; /* info elements */ PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_SUPP_RATES pExtSuppRates; @@ -609,12 +599,12 @@ typedef struct tagWLAN_FR_REASSOCREQ { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ - PWORD pwCapInfo; - PWORD pwListenInterval; + u16 * pwCapInfo; + u16 * pwListenInterval; PIEEE_ADDR pAddrCurrAP; /* info elements */ @@ -634,12 +624,12 @@ typedef struct tagWLAN_FR_REASSOCRESP { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ - PWORD pwCapInfo; - PWORD pwStatus; - PWORD pwAid; + u16 * pwCapInfo; + u16 * pwStatus; + u16 * pwAid; /* info elements */ PWLAN_IE_SUPP_RATES pSuppRates; PWLAN_IE_SUPP_RATES pExtSuppRates; @@ -651,7 +641,7 @@ typedef struct tagWLAN_FR_PROBEREQ { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ /* info elements */ @@ -666,12 +656,12 @@ typedef struct tagWLAN_FR_PROBERESP { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ u64 *pqwTimestamp; - PWORD pwBeaconInterval; - PWORD pwCapInfo; + u16 * pwBeaconInterval; + u16 * pwCapInfo; /* info elements */ PWLAN_IE_SSID pSSID; PWLAN_IE_SUPP_RATES pSuppRates; @@ -695,12 +685,12 @@ typedef struct tagWLAN_FR_AUTHEN { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ - PWORD pwAuthAlgorithm; - PWORD pwAuthSequence; - PWORD pwStatus; + u16 * pwAuthAlgorithm; + u16 * pwAuthSequence; + u16 * pwStatus; /* info elements */ PWLAN_IE_CHALLENGE pChallenge; @@ -711,17 +701,15 @@ typedef struct tagWLAN_FR_DEAUTHEN { unsigned int uType; unsigned int len; - PBYTE pBuf; + u8 * pBuf; PUWLAN_80211HDR pHdr; /* fixed fields */ - PWORD pwReason; + u16 * pwReason; /* info elements */ } WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN; -/*--------------------- Export Functions --------------------------*/ - void vMgrEncodeBeacon( PWLAN_FR_BEACON pFrame @@ -733,16 +721,6 @@ vMgrDecodeBeacon( ); void -vMgrEncodeIBSSATIM( - PWLAN_FR_IBSSATIM pFrame - ); - -void -vMgrDecodeIBSSATIM( - PWLAN_FR_IBSSATIM pFrame - ); - -void vMgrEncodeDisassociation( PWLAN_FR_DISASSOC pFrame ); @@ -827,9 +805,4 @@ vMgrEncodeReassocResponse( PWLAN_FR_REASSOCRESP pFrame ); -void -vMgrDecodeReassocResponse( - PWLAN_FR_REASSOCRESP pFrame - ); - #endif /* __80211MGR_H__ */ diff --git a/drivers/staging/vt6656/TODO b/drivers/staging/vt6656/TODO index a318995ba07f..e154b2f3b247 100644 --- a/drivers/staging/vt6656/TODO +++ b/drivers/staging/vt6656/TODO @@ -7,7 +7,7 @@ TODO: - split rf.c - abstract VT3184 chipset specific code - add common vt665x infrastructure -- kill ttype.h +- kill ttype.h -- done - switch to use LIB80211 - switch to use MAC80211 - use kernel coding style diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c index fb6124d9082a..28a4c4c30416 100644 --- a/drivers/staging/vt6656/aes_ccmp.c +++ b/drivers/staging/vt6656/aes_ccmp.c @@ -33,17 +33,11 @@ #include "device.h" #include "80211hdr.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - /* * SBOX Table */ -BYTE sbox_table[256] = { +u8 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, @@ -62,7 +56,7 @@ BYTE sbox_table[256] = { 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; -BYTE dot2_table[256] = { +u8 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, @@ -81,7 +75,7 @@ BYTE dot2_table[256] = { 0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5 }; -BYTE dot3_table[256] = { +u8 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, @@ -100,17 +94,11 @@ BYTE dot3_table[256] = { 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a }; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - -static void xor_128(BYTE *a, BYTE *b, BYTE *out) +static void xor_128(u8 *a, u8 *b, u8 *out) { - PDWORD dwPtrA = (PDWORD) a; - PDWORD dwPtrB = (PDWORD) b; - PDWORD dwPtrOut = (PDWORD) out; + u32 * dwPtrA = (u32 *) a; + u32 * dwPtrB = (u32 *) b; + u32 * dwPtrOut = (u32 *) out; (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); @@ -118,20 +106,19 @@ static void xor_128(BYTE *a, BYTE *b, BYTE *out) (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); } - -static void xor_32(BYTE *a, BYTE *b, BYTE *out) +static void xor_32(u8 *a, u8 *b, u8 *out) { - PDWORD dwPtrA = (PDWORD) a; - PDWORD dwPtrB = (PDWORD) b; - PDWORD dwPtrOut = (PDWORD) out; + u32 * dwPtrA = (u32 *) a; + u32 * dwPtrB = (u32 *) b; + u32 * dwPtrOut = (u32 *) out; (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); } -void AddRoundKey(BYTE *key, int round) +void AddRoundKey(u8 *key, int round) { - BYTE sbox_key[4]; - BYTE rcon_table[10] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36}; + u8 sbox_key[4]; + u8 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]]; @@ -146,7 +133,7 @@ void AddRoundKey(BYTE *key, int round) xor_32(&key[12], &key[8], &key[12]); } -void SubBytes(BYTE *in, BYTE *out) +void SubBytes(u8 *in, u8 *out) { int i; @@ -154,7 +141,7 @@ void SubBytes(BYTE *in, BYTE *out) out[i] = sbox_table[in[i]]; } -void ShiftRows(BYTE *in, BYTE *out) +void ShiftRows(u8 *in, u8 *out) { out[0] = in[0]; out[1] = in[5]; @@ -174,7 +161,7 @@ void ShiftRows(BYTE *in, BYTE *out) out[15] = in[11]; } -void MixColumns(BYTE *in, BYTE *out) +void MixColumns(u8 *in, u8 *out) { out[0] = dot2_table[in[0]] ^ dot3_table[in[1]] ^ in[2] ^ in[3]; @@ -183,13 +170,13 @@ void MixColumns(BYTE *in, BYTE *out) out[3] = dot3_table[in[0]] ^ in[1] ^ in[2] ^ dot2_table[in[3]]; } -void AESv128(BYTE *key, BYTE *data, BYTE *ciphertext) +void AESv128(u8 *key, u8 *data, u8 *ciphertext) { int i; int round; - BYTE TmpdataA[16]; - BYTE TmpdataB[16]; - BYTE abyRoundKey[16]; + u8 TmpdataA[16]; + u8 TmpdataB[16]; + u8 abyRoundKey[16]; for (i = 0; i < 16; i++) abyRoundKey[i] = key[i]; @@ -231,32 +218,32 @@ void AESv128(BYTE *key, BYTE *data, BYTE *ciphertext) * */ -bool AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) +bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 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; + u8 abyNonce[13]; + u8 MIC_IV[16]; + u8 MIC_HDR1[16]; + u8 MIC_HDR2[16]; + u8 abyMIC[16]; + u8 abyCTRPLD[16]; + u8 abyTmp[16]; + u8 abyPlainText[16]; + u8 abyLastCipher[16]; + + struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *) pbyFrame; + u8 * pbyIV; + u8 * pbyPayload; + u16 wHLen = 22; /* 8 is IV, 8 is MIC, 4 is CRC */ - WORD wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN; + u16 wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN; bool bA4 = false; - BYTE byTmp; - WORD wCnt; + u8 byTmp; + u16 wCnt; int ii, jj, kk; pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; - if (WLAN_GET_FC_TODS(*(PWORD) pbyFrame) && - WLAN_GET_FC_FROMDS(*(PWORD) pbyFrame)) { + if (WLAN_GET_FC_TODS(*(u16 *) pbyFrame) && + WLAN_GET_FC_FROMDS(*(u16 *) pbyFrame)) { bA4 = true; pbyIV += 6; /* 6 is 802.11 address4 */ wHLen += 6; @@ -265,7 +252,7 @@ bool AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) pbyPayload = pbyIV + 8; /* IV-length */ abyNonce[0] = 0x00; /* now is 0, if Qos here will be priority */ - memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN); + memcpy(&(abyNonce[1]), pMACHeader->addr2, ETH_ALEN); abyNonce[7] = pbyIV[7]; abyNonce[8] = pbyIV[6]; abyNonce[9] = pbyIV[5]; @@ -276,28 +263,28 @@ bool AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) /* 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_IV[14] = (u8)(wPayloadSize >> 8); + MIC_IV[15] = (u8)(wPayloadSize & 0xff); /* MIC_HDR1 */ - MIC_HDR1[0] = (BYTE)(wHLen >> 8); - MIC_HDR1[1] = (BYTE)(wHLen & 0xff); - byTmp = (BYTE)(pMACHeader->wFrameCtl & 0xff); + MIC_HDR1[0] = (u8)(wHLen >> 8); + MIC_HDR1[1] = (u8)(wHLen & 0xff); + byTmp = (u8)(pMACHeader->frame_control & 0xff); MIC_HDR1[2] = byTmp & 0x8f; - byTmp = (BYTE)(pMACHeader->wFrameCtl >> 8); + byTmp = (u8)(pMACHeader->frame_control >> 8); byTmp &= 0x87; MIC_HDR1[3] = byTmp | 0x40; - memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN); - memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN); + memcpy(&(MIC_HDR1[4]), pMACHeader->addr1, ETH_ALEN); + memcpy(&(MIC_HDR1[10]), pMACHeader->addr2, ETH_ALEN); /* MIC_HDR2 */ - memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN); - byTmp = (BYTE)(pMACHeader->wSeqCtl & 0xff); + memcpy(&(MIC_HDR2[0]), pMACHeader->addr3, ETH_ALEN); + byTmp = (u8)(pMACHeader->seq_ctrl & 0xff); MIC_HDR2[6] = byTmp & 0x0f; MIC_HDR2[7] = 0; if (bA4) { - memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, ETH_ALEN); + memcpy(&(MIC_HDR2[8]), pMACHeader->addr4, ETH_ALEN); } else { MIC_HDR2[8] = 0x00; MIC_HDR2[9] = 0x00; @@ -326,8 +313,8 @@ bool AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) for (jj = wPayloadSize; jj > 16; jj = jj-16) { - abyCTRPLD[14] = (BYTE) (wCnt >> 8); - abyCTRPLD[15] = (BYTE) (wCnt & 0xff); + abyCTRPLD[14] = (u8) (wCnt >> 8); + abyCTRPLD[15] = (u8) (wCnt & 0xff); AESv128(pbyRxKey, abyCTRPLD, abyTmp); @@ -349,8 +336,8 @@ bool AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) for (ii = jj; ii < 16; ii++) abyLastCipher[ii] = 0x00; - abyCTRPLD[14] = (BYTE) (wCnt >> 8); - abyCTRPLD[15] = (BYTE) (wCnt & 0xff); + abyCTRPLD[14] = (u8) (wCnt >> 8); + abyCTRPLD[15] = (u8) (wCnt & 0xff); AESv128(pbyRxKey, abyCTRPLD, abyTmp); for (kk = 0; kk < 16; kk++) @@ -370,8 +357,8 @@ bool AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize) /* => above is the calculated MIC */ wCnt = 0; - abyCTRPLD[14] = (BYTE) (wCnt >> 8); - abyCTRPLD[15] = (BYTE) (wCnt & 0xff); + abyCTRPLD[14] = (u8) (wCnt >> 8); + abyCTRPLD[15] = (u8) (wCnt & 0xff); AESv128(pbyRxKey, abyCTRPLD, abyTmp); for (kk = 0; kk < 8; kk++) diff --git a/drivers/staging/vt6656/aes_ccmp.h b/drivers/staging/vt6656/aes_ccmp.h index a2e2c4e9a5c9..ed6a9ae315de 100644 --- a/drivers/staging/vt6656/aes_ccmp.h +++ b/drivers/staging/vt6656/aes_ccmp.h @@ -30,17 +30,6 @@ #ifndef __AES_H__ #define __AES_H__ -#include "ttype.h" - -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ -bool AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize); +bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize); #endif /* __AES_CCMP_H__ */ diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index a9f525e9d16e..33fa76759bf1 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -29,8 +29,6 @@ * BBuGetFrameTime - Calculate data frame transmitting time * BBvCalculateParameter - Calculate PhyLength, PhyService and Phy Signal parameter for baseband Tx * BBbVT3184Init - VIA VT3184 baseband chip init code - * BBvLoopbackOn - Turn on BaseBand Loopback mode - * BBvLoopbackOff - Turn off BaseBand Loopback mode * * Revision History: * @@ -47,26 +45,10 @@ #include "datarate.h" #include "rndis.h" -/*--------------------- Static Definitions -------------------------*/ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - - -BYTE abyVT3184_AGC[] = { +u8 abyVT3184_AGC[] = { 0x00, //0 0x00, //1 0x02, //2 @@ -133,8 +115,7 @@ BYTE abyVT3184_AGC[] = { 0x3E //3F }; - -BYTE abyVT3184_AL2230[] = { +u8 abyVT3184_AL2230[] = { 0x31,//00 0x00, 0x00, @@ -393,10 +374,8 @@ BYTE abyVT3184_AL2230[] = { 0x00 }; - - //{{RobertYu:20060515, new BB setting for VT3226D0 -BYTE abyVT3184_VT3226D0[] = { +u8 abyVT3184_VT3226D0[] = { 0x31,//00 0x00, 0x00, @@ -655,11 +634,9 @@ BYTE abyVT3184_VT3226D0[] = { 0x00, }; -const WORD awcFrameTime[MAX_RATE] = +const u16 awcFrameTime[MAX_RATE] = {10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216}; -/*--------------------- Static Functions --------------------------*/ - /* static unsigned long @@ -674,7 +651,6 @@ void s_vClearSQ3Value(PSDevice pDevice); */ -/*--------------------- Export Variables --------------------------*/ /* * Description: Calculate data frame transmitting time * @@ -691,10 +667,10 @@ s_vClearSQ3Value(PSDevice pDevice); */ unsigned int BBuGetFrameTime( - BYTE byPreambleType, - BYTE byPktType, + u8 byPreambleType, + u8 byPktType, unsigned int cbFrameLength, - WORD wRate + u16 wRate ) { unsigned int uFrameTime; @@ -703,7 +679,6 @@ BBuGetFrameTime( unsigned int uRateIdx = (unsigned int)wRate; unsigned int uRate = 0; - if (uRateIdx > RATE_54M) { ASSERT(0); return 0; @@ -900,15 +875,14 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, *pbyPhySrv = 0x00; if (bExtBit) *pbyPhySrv = *pbyPhySrv | 0x80; - *pwPhyLen = (WORD) cbUsCount; + *pwPhyLen = (u16) cbUsCount; } else { *pbyPhySrv = 0x00; - *pwPhyLen = (WORD)cbFrameLength; + *pwPhyLen = (u16)cbFrameLength; } } - /* * Description: Set Antenna mode * @@ -937,10 +911,9 @@ void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode) break; } - CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SET_ANTMD, - (WORD) byAntennaMode, + (u16) byAntennaMode, 0, 0, NULL); @@ -963,11 +936,11 @@ void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode) int BBbVT3184Init(struct vnt_private *pDevice) { int ntStatus; - WORD wLength; - PBYTE pbyAddr; - PBYTE pbyAgc; - WORD wLengthAgc; - BYTE abyArray[256]; + u16 wLength; + u8 * pbyAddr; + u8 * pbyAgc; + u16 wLengthAgc; + u8 abyArray[256]; ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, @@ -979,7 +952,6 @@ int BBbVT3184Init(struct vnt_private *pDevice) return false; } - // if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04) // return false; @@ -1118,7 +1090,6 @@ else { abyArray ); - if ((pDevice->byRFType == RF_VT3226) || //RobertYu:20051116, 20060111 remove VT3226D0 (pDevice->byRFType == RF_VT3342A0) //RobertYu:20060609 ) { @@ -1131,7 +1102,6 @@ else { MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01); } - ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x04,0x7F); ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01); @@ -1139,96 +1109,6 @@ else { return true;//ntStatus; } - -/* - * Description: Turn on BaseBand Loopback mode - * - * Parameters: - * In: - * pDevice - Device Structure - * - * Out: - * none - * - * Return Value: none - * - */ -void BBvLoopbackOn(struct vnt_private *pDevice) -{ - BYTE byData; - - //CR C9 = 0x00 - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xC9, &pDevice->byBBCRc9);//CR201 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0); - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x4D, &pDevice->byBBCR4d);//CR77 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, 0x90); - - //CR 88 = 0x02(CCK), 0x03(OFDM) - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x88, &pDevice->byBBCR88);//CR136 - - if (pDevice->wCurrentRate <= RATE_11M) { //CCK - // Enable internal digital loopback: CR33 |= 0000 0001 - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData | 0x01));//CR33 - // CR154 = 0x00 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, 0); //CR154 - - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x02);//CR239 - } - else { //OFDM - // Enable internal digital loopback:CR154 |= 0000 0001 - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData | 0x01));//CR154 - // CR33 = 0x00 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, 0); //CR33 - - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x03);//CR239 - } - - //CR14 = 0x00 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, 0);//CR14 - - // Disable TX_IQUN - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x09, &pDevice->byBBCR09); - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, (BYTE)(pDevice->byBBCR09 & 0xDE)); -} - -/* - * Description: Turn off BaseBand Loopback mode - * - * Parameters: - * In: - * pDevice - Device Structure - * - * Out: - * none - * - * Return Value: none - * - */ -void BBvLoopbackOff(struct vnt_private *pDevice) -{ - u8 byData; - - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, pDevice->byBBCRc9);//CR201 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, pDevice->byBBCR88);//CR136 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, pDevice->byBBCR09);//CR136 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, pDevice->byBBCR4d);//CR77 - - if (pDevice->wCurrentRate <= RATE_11M) { // CCK - // Set the CR33 Bit2 to disable internal Loopback. - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData & 0xFE));//CR33 - } else { /* OFDM */ - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData & 0xFE));//CR154 - } - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x0E, &byData);//CR14 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, (BYTE)(byData | 0x80));//CR14 - -} - - /* * Description: Set ShortSlotTime mode * @@ -1243,7 +1123,7 @@ void BBvLoopbackOff(struct vnt_private *pDevice) */ void BBvSetShortSlotTime(struct vnt_private *pDevice) { - BYTE byBBVGA=0; + u8 byBBVGA=0; if (pDevice->bShortSlotTime) pDevice->byBBRxConf &= 0xDF;//1101 1111 @@ -1257,8 +1137,7 @@ void BBvSetShortSlotTime(struct vnt_private *pDevice) ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf); } - -void BBvSetVGAGainOffset(struct vnt_private *pDevice, BYTE byData) +void BBvSetVGAGainOffset(struct vnt_private *pDevice, u8 byData) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData); @@ -1272,27 +1151,6 @@ void BBvSetVGAGainOffset(struct vnt_private *pDevice, BYTE byData) ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);//CR10 } - -/* - * Description: Baseband SoftwareReset - * - * Parameters: - * In: - * dwIoBase - I/O base address - * Out: - * none - * - * Return Value: none - * - */ -void BBvSoftwareReset(struct vnt_private *pDevice) -{ - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0x40); - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0); - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0x01); - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0); -} - /* * Description: BBvSetDeepSleep * @@ -1317,7 +1175,6 @@ void BBvExitDeepSleep(struct vnt_private *pDevice) ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13 } - static unsigned long s_ulGetLowSQ3(struct vnt_private *pDevice) { int ii; @@ -1364,7 +1221,6 @@ static unsigned long s_ulGetRatio(struct vnt_private *pDevice) return ulRatio; } - static void s_vClearSQ3Value(struct vnt_private *pDevice) { int ii; @@ -1376,7 +1232,6 @@ static void s_vClearSQ3Value(struct vnt_private *pDevice) } } - /* * Description: Antenna Diversity * @@ -1508,7 +1363,6 @@ void BBvAntennaDiversity(struct vnt_private *pDevice, } //byAntennaState } - /*+ * * Description: @@ -1541,11 +1395,9 @@ void TimerSQ3CallBack(struct vnt_private *pDevice) add_timer(&pDevice->TimerSQ3Tmax3); add_timer(&pDevice->TimerSQ3Tmax2); - spin_unlock_irq(&pDevice->lock); } - /*+ * * Description: @@ -1594,7 +1446,6 @@ void TimerSQ3Tmax3CallBack(struct vnt_private *pDevice) void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning) { - switch(pDevice->byRFType) { case RF_AL2230: diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h index fba61605a692..0a634adabf0e 100644 --- a/drivers/staging/vt6656/baseband.h +++ b/drivers/staging/vt6656/baseband.h @@ -33,12 +33,9 @@ #ifndef __BASEBAND_H__ #define __BASEBAND_H__ -#include "ttype.h" #include "tether.h" #include "device.h" -/*--------------------- Export Definitions -------------------------*/ - #define PREAMBLE_LONG 0 #define PREAMBLE_SHORT 1 @@ -84,23 +81,12 @@ #define TOP_RATE_2M 0x00200000 #define TOP_RATE_1M 0x00100000 - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - unsigned int BBuGetFrameTime( - BYTE byPreambleType, - BYTE byFreqType, + u8 byPreambleType, + u8 byFreqType, unsigned int cbFrameLength, - WORD wRate + u16 wRate ); void BBvCalculateParameter(struct vnt_private *, u32 cbFrameLength, @@ -113,9 +99,6 @@ void TimerSQ3CallBack(struct vnt_private *); void TimerSQ3Tmax3CallBack(struct vnt_private *); void BBvAntennaDiversity(struct vnt_private *, u8 byRxRate, u8 bySQ3); -void BBvLoopbackOn(struct vnt_private *); -void BBvLoopbackOff(struct vnt_private *); -void BBvSoftwareReset(struct vnt_private *); void BBvSetShortSlotTime(struct vnt_private *); void BBvSetVGAGainOffset(struct vnt_private *, u8 byData); diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index e214fcf83868..ee79bbdf1a06 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -39,7 +39,6 @@ * */ -#include "ttype.h" #include "tmacro.h" #include "tether.h" #include "device.h" @@ -59,27 +58,17 @@ #include "rndis.h" #include "iowpa.h" -/*--------------------- Static Definitions -------------------------*/ - - - - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; - - -const WORD awHWRetry0[5][5] = { +const u16 awHWRetry0[5][5] = { {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M}, {RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M}, {RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M}, {RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M}, {RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M} }; -const WORD awHWRetry1[5][5] = { +const u16 awHWRetry1[5][5] = { {RATE_18M, RATE_18M, RATE_12M, RATE_6M, RATE_6M}, {RATE_24M, RATE_24M, RATE_18M, RATE_6M, RATE_6M}, {RATE_36M, RATE_36M, RATE_24M, RATE_12M, RATE_12M}, @@ -87,23 +76,10 @@ const WORD awHWRetry1[5][5] = { {RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M} }; - - -/*--------------------- Static Functions --------------------------*/ - static void s_vCheckSensitivity(struct vnt_private *pDevice); static void s_vCheckPreEDThreshold(struct vnt_private *pDevice); static void s_uCalculateLinkQual(struct vnt_private *pDevice); -/*--------------------- Export Variables --------------------------*/ - - -/*--------------------- Export Functions --------------------------*/ - - - - - /*+ * * Routine Description: @@ -221,7 +197,6 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, pCurrBSS->abyBSSID); jj++; - if (pSelect == NULL) { pSelect = pCurrBSS; } else { @@ -249,7 +224,6 @@ pDevice->bSameBSSMaxNum = jj; } - /*+ * * Routine Description: @@ -260,7 +234,6 @@ pDevice->bSameBSSMaxNum = jj; * -*/ - void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -285,8 +258,6 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) BSSvClearAnyBSSJoinRecord(pDevice); } - - /*+ * * Routine Description: @@ -320,8 +291,6 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice, return NULL; }; - - /*+ * * Routine Description: @@ -357,7 +326,6 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, unsigned int ii; bool bParsingQuiet = false; - pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]); for (ii = 0; ii < MAX_BSS_NUM; ii++) { @@ -430,7 +398,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, unsigned int uLen = pRSNWPA->len + 2; if (uLen <= (uIELength - - (unsigned int) (ULONG_PTR) ((PBYTE) pRSNWPA - pbyIEs))) { + (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) { pBSSList->wWPALen = uLen; memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); WPA_ParseRSN(pBSSList, pRSNWPA); @@ -443,7 +411,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, unsigned int uLen = pRSN->len + 2; if (uLen <= (uIELength - - (unsigned int) (ULONG_PTR) ((PBYTE) pRSN - pbyIEs))) { + (unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) { pBSSList->wRSNLen = uLen; memcpy(pBSSList->byRSNIE, pRSN, uLen); WPA2vParseRSN(pBSSList, pRSN); @@ -483,7 +451,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, if (pDevice->bUpdateBBVGA) { // Monitor if RSSI is too strong. pBSSList->byRSSIStatCnt = 0; - RFvRSSITodBm(pDevice, (BYTE)(pRxPacket->uRSSI), &pBSSList->ldBmMAX); + RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &pBSSList->ldBmMAX); pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX; pBSSList->ldBmAverRange = pBSSList->ldBmMAX; for (ii = 1; ii < RSSI_STAT_COUNT; ii++) @@ -498,7 +466,6 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, return true; } - /*+ * * Routine Description: @@ -539,7 +506,6 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, if (pBSSList == NULL) return false; - pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); @@ -592,7 +558,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, if (pRSNWPA != NULL) { unsigned int uLen = pRSNWPA->len + 2; if (uLen <= (uIELength - - (unsigned int) (ULONG_PTR) ((PBYTE) pRSNWPA - pbyIEs))) { + (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) { pBSSList->wWPALen = uLen; memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); WPA_ParseRSN(pBSSList, pRSNWPA); @@ -604,7 +570,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, if (pRSN != NULL) { unsigned int uLen = pRSN->len + 2; if (uLen <= (uIELength - - (unsigned int) (ULONG_PTR) ((PBYTE) pRSN - pbyIEs))) { + (unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) { pBSSList->wRSNLen = uLen; memcpy(pBSSList->byRSNIE, pRSN, uLen); WPA2vParseRSN(pBSSList, pRSN); @@ -612,7 +578,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, } if (pRxPacket->uRSSI != 0) { - RFvRSSITodBm(pDevice, (BYTE)(pRxPacket->uRSSI), &ldBm); + RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &ldBm); // Monitor if RSSI is too strong. pBSSList->byRSSIStatCnt++; pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT; @@ -638,10 +604,6 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, return true; } - - - - /*+ * * Routine Description: @@ -672,8 +634,6 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice, return false; }; - - /*+ * * Routine Description: @@ -731,8 +691,6 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii); }; - - /*+ * * Routine Description: @@ -750,7 +708,6 @@ void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex) u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; struct sk_buff *skb; - while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL) dev_kfree_skb(skb); // clear context @@ -948,7 +905,6 @@ if(pDevice->byReAssocCount > 0) { if (pMgmt->sNodeDBTable[ii].bPSEnable) uSleepySTACnt++; - } // Rate fallback check @@ -981,7 +937,6 @@ if(pDevice->byReAssocCount > 0) { } - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->byBBType == BB_TYPE_11G)) { // on/off protect mode @@ -1031,7 +986,6 @@ if(pDevice->byReAssocCount > 0) { } - // Check if any STA in PS mode, enable DTIM multicast deliver if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (uSleepySTACnt > 0) @@ -1205,9 +1159,9 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, byPktNum = (byPktNO & 0x0F) >> 4; byTxRetry = (byTSR & 0xF0) >> 4; - wRate = (WORD) (byPktNO & 0xF0) >> 4; + wRate = (u16) (byPktNO & 0xF0) >> 4; wFIFOCtl = pStatistic->abyTxPktInfo[byPktNum].wFIFOCtl; - pbyDestAddr = (PBYTE) &( pStatistic->abyTxPktInfo[byPktNum].abyDestAddr[0]); + pbyDestAddr = (u8 *) &( pStatistic->abyTxPktInfo[byPktNum].abyDestAddr[0]); if (wFIFOCtl & FIFOCTL_AUTO_FB_0) { byFallBack = AUTO_FB_0; @@ -1433,7 +1387,7 @@ if(pDevice->bLinkPass !=true) } else { - RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); + RFvRSSITodBm(pDevice, (u8)(pDevice->uCurrRSSI), &ldBm); if(-ldBm < 50) { RssiRatio = 4000; } @@ -1473,7 +1427,7 @@ static void s_vCheckPreEDThreshold(struct vnt_private *pDevice) ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID); if (pBSSList != NULL) { - pDevice->byBBPreEDRSSI = (BYTE) (~(pBSSList->ldBmAverRange) + 1); + pDevice->byBBPreEDRSSI = (u8) (~(pBSSList->ldBmAverRange) + 1); BBvUpdatePreEDThreshold(pDevice, false); } } diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h index 08091a0a7c40..bce3b4654165 100644 --- a/drivers/staging/vt6656/bssdb.h +++ b/drivers/staging/vt6656/bssdb.h @@ -36,8 +36,6 @@ #include "card.h" #include "mib.h" -/*--------------------- Export Definitions -------------------------*/ - #define MAX_NODE_NUM 64 #define MAX_BSS_NUM 42 #define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */ @@ -66,46 +64,37 @@ #define MAX_WPA_IE_LEN 64 - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - - -/*--------------------- Export Types ------------------------------*/ - // // IEEE 802.11 Structures and definitions // typedef struct tagSERPObject { bool bERPExist; - BYTE byERP; + u8 byERP; } ERPObject, *PERPObject; - typedef struct tagSRSNCapObject { bool bRSNCapExist; - WORD wRSNCap; + u16 wRSNCap; } SRSNCapObject, *PSRSNCapObject; // BSS info(AP) typedef struct tagKnownBSS { // BSS info bool bActive; - BYTE abyBSSID[WLAN_BSSID_LEN]; + u8 abyBSSID[WLAN_BSSID_LEN]; unsigned int uChannel; - BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - BYTE abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; unsigned int uRSSI; - BYTE bySQ; - WORD wBeaconInterval; - WORD wCapInfo; - BYTE abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - BYTE byRxRate; - -// WORD wATIMWindow; - BYTE byRSSIStatCnt; + u8 bySQ; + u16 wBeaconInterval; + u16 wCapInfo; + u8 abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + u8 byRxRate; + +// u16 wATIMWindow; + u8 byRSSIStatCnt; signed long ldBmMAX; signed long ldBmAverage[RSSI_STAT_COUNT]; signed long ldBmAverRange; @@ -114,32 +103,32 @@ typedef struct tagKnownBSS { //++ WPA informations bool bWPAValid; - BYTE byGKType; - BYTE abyPKType[4]; - WORD wPKCount; - BYTE abyAuthType[4]; - WORD wAuthCount; - BYTE byDefaultK_as_PK; - BYTE byReplayIdx; + u8 byGKType; + u8 abyPKType[4]; + u16 wPKCount; + u8 abyAuthType[4]; + u16 wAuthCount; + u8 byDefaultK_as_PK; + u8 byReplayIdx; //-- //++ WPA2 informations bool bWPA2Valid; - BYTE byCSSGK; - WORD wCSSPKCount; - BYTE abyCSSPK[4]; - WORD wAKMSSAuthCount; - BYTE abyAKMSSAuthType[4]; + u8 byCSSGK; + u16 wCSSPKCount; + u8 abyCSSPK[4]; + u16 wAKMSSAuthCount; + u8 abyAKMSSAuthType[4]; //++ wpactl - BYTE byWPAIE[MAX_WPA_IE_LEN]; - BYTE byRSNIE[MAX_WPA_IE_LEN]; - WORD wWPALen; - WORD wRSNLen; + u8 byWPAIE[MAX_WPA_IE_LEN]; + u8 byRSNIE[MAX_WPA_IE_LEN]; + u16 wWPALen; + u16 wRSNLen; // Clear count unsigned int uClearCount; -// BYTE abyIEs[WLAN_BEACON_FR_MAXLEN]; +// u8 abyIEs[WLAN_BEACON_FR_MAXLEN]; unsigned int uIELength; u64 qwBSSTimestamp; u64 qwLocalTSF;/* local TSF timer */ @@ -148,13 +137,11 @@ typedef struct tagKnownBSS { ERPObject sERP; SRSNCapObject sRSNCapObj; - BYTE abyIEs[1024]; // don't move this field !! + u8 abyIEs[1024]; // don't move this field !! } __attribute__ ((__packed__)) KnownBSS , *PKnownBSS; - - typedef enum tagNODE_STATE { NODE_FREE, NODE_AGED, @@ -163,48 +150,47 @@ typedef enum tagNODE_STATE { NODE_ASSOC } NODE_STATE, *PNODE_STATE; - // STA node info typedef struct tagKnownNodeDB { // STA info bool bActive; - BYTE abyMACAddr[WLAN_ADDR_LEN]; - BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; - BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; - WORD wTxDataRate; + u8 abyMACAddr[WLAN_ADDR_LEN]; + u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; + u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; + u16 wTxDataRate; bool bShortPreamble; bool bERPExist; bool bShortSlotTime; unsigned int uInActiveCount; - WORD wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp. - WORD wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon. - WORD wSuppRate; - BYTE byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode - BYTE byTopCCKBasicRate; //Records the highest basic rate in CCK mode + u16 wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp. + u16 wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon. + u16 wSuppRate; + u8 byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode + u8 byTopCCKBasicRate; //Records the highest basic rate in CCK mode // For AP mode struct sk_buff_head sTxPSQueue; - WORD wCapInfo; - WORD wListenInterval; - WORD wAID; + u16 wCapInfo; + u16 wListenInterval; + u16 wAID; NODE_STATE eNodeState; bool bPSEnable; bool bRxPSPoll; - BYTE byAuthSequence; + u8 byAuthSequence; unsigned long ulLastRxJiffer; - BYTE bySuppRate; - DWORD dwFlags; - WORD wEnQueueCnt; + u8 bySuppRate; + u32 dwFlags; + u16 wEnQueueCnt; bool bOnFly; unsigned long long KeyRSC; - BYTE byKeyIndex; - DWORD dwKeyIndex; - BYTE byCipherSuite; - DWORD dwTSC47_16; - WORD wTSC15_0; + u8 byKeyIndex; + u32 dwKeyIndex; + u8 byCipherSuite; + u32 dwTSC47_16; + u16 wTSC15_0; unsigned int uWepKeyLength; - BYTE abyWepKey[WLAN_WEPMAX_KEYLEN]; + u8 abyWepKey[WLAN_WEPMAX_KEYLEN]; // // Auto rate fallback vars bool bIsInFallback; @@ -223,8 +209,6 @@ typedef struct tagKnownNodeDB { } KnownNodeDB, *PKnownNodeDB; -/*--------------------- Export Functions --------------------------*/ - PKnownBSS BSSpSearchBSSList(struct vnt_private *, u8 *pbyDesireBSSID, u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType); @@ -270,7 +254,7 @@ int BSSbUpdateToBSSList(struct vnt_private *, u8 *pbyIEs, void *pRxPacketContext); -int BSSbIsSTAInNodeDB(struct vnt_private *, PBYTE abyDstAddr, +int BSSbIsSTAInNodeDB(struct vnt_private *, u8 * abyDstAddr, u32 *puNodeIndex); void BSSvCreateOneNode(struct vnt_private *, u32 *puNodeIndex); diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 22918a106d73..24291aee58b5 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -60,28 +60,15 @@ #include "rndis.h" #include "control.h" -/*--------------------- Static Definitions -------------------------*/ - //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; - -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ -//const WORD cwRXBCNTSFOff[MAX_RATE] = +//const u16 cwRXBCNTSFOff[MAX_RATE] = //{17, 34, 96, 192, 34, 23, 17, 11, 8, 5, 4, 3}; -const WORD cwRXBCNTSFOff[MAX_RATE] = +const u16 cwRXBCNTSFOff[MAX_RATE] = {192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3}; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ /* * Description: Set NIC media channel * @@ -114,7 +101,7 @@ void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel) CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SELECT_CHANNLE, - (WORD) uConnectionChannel, + (u16) uConnectionChannel, 0, 0, NULL @@ -133,7 +120,7 @@ void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel) pDevice->byCurPwr = 0xFF; RFbRawSetPower(pDevice, pDevice->abyCCKPwrTbl[uConnectionChannel-1], RATE_1M); } - ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_CHANNEL,(BYTE)(uConnectionChannel|0x80)); + ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_CHANNEL,(u8)(uConnectionChannel|0x80)); } /* @@ -220,10 +207,10 @@ static u16 swGetOFDMControlRate(struct vnt_private *pDevice, u16 wRateIdx) */ void CARDvCalculateOFDMRParameter ( - WORD wRate, - BYTE byBBType, - PBYTE pbyTxRate, - PBYTE pbyRsvTime + u16 wRate, + u8 byBBType, + u8 * pbyTxRate, + u8 * pbyRsvTime ) { switch (wRate) { @@ -434,23 +421,23 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType) &abyTxRate[8], &abyRsvTime[8]); - abyData[0] = (BYTE)(awLen[0]&0xFF); - abyData[1] = (BYTE)(awLen[0]>>8); + abyData[0] = (u8)(awLen[0]&0xFF); + abyData[1] = (u8)(awLen[0]>>8); abyData[2] = abySignal[0]; abyData[3] = abyServ[0]; - abyData[4] = (BYTE)(awLen[1]&0xFF); - abyData[5] = (BYTE)(awLen[1]>>8); + abyData[4] = (u8)(awLen[1]&0xFF); + abyData[5] = (u8)(awLen[1]>>8); abyData[6] = abySignal[1]; abyData[7] = abyServ[1]; - abyData[8] = (BYTE)(awLen[2]&0xFF); - abyData[9] = (BYTE)(awLen[2]>>8); + abyData[8] = (u8)(awLen[2]&0xFF); + abyData[9] = (u8)(awLen[2]>>8); abyData[10] = abySignal[2]; abyData[11] = abyServ[2]; - abyData[12] = (BYTE)(awLen[3]&0xFF); - abyData[13] = (BYTE)(awLen[3]>>8); + abyData[12] = (u8)(awLen[3]&0xFF); + abyData[13] = (u8)(awLen[3]>>8); abyData[14] = abySignal[3]; abyData[15] = abyServ[3]; @@ -500,7 +487,7 @@ void vUpdateIFS(struct vnt_private *pDevice) byMaxMin = 5; } else {// PK_TYPE_11GA & PK_TYPE_11GB - BYTE byRate = 0; + u8 byRate = 0; bool bOFDMRate = false; unsigned int ii = 0; PWLAN_IE_SUPP_RATES pItemRates = NULL; @@ -515,7 +502,7 @@ void vUpdateIFS(struct vnt_private *pDevice) pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt.abyCurrSuppRates; for (ii = 0; ii < pItemRates->len; ii++) { - byRate = (BYTE)(pItemRates->abyRates[ii]&0x7F); + byRate = (u8)(pItemRates->abyRates[ii]&0x7F); if (RATEwGetRateIdx(byRate) > RATE_11M) { bOFDMRate = true; break; @@ -525,7 +512,7 @@ void vUpdateIFS(struct vnt_private *pDevice) pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt .abyCurrExtSuppRates; for (ii = 0; ii < pItemRates->len; ii++) { - byRate = (BYTE)(pItemRates->abyRates[ii]&0x7F); + byRate = (u8)(pItemRates->abyRates[ii]&0x7F); if (RATEwGetRateIdx(byRate) > RATE_11M) { bOFDMRate = true; break; @@ -544,10 +531,10 @@ void vUpdateIFS(struct vnt_private *pDevice) pDevice->uCwMax = C_CWMAX; pDevice->uEIFS = C_EIFS; - byData[0] = (BYTE)pDevice->uSIFS; - byData[1] = (BYTE)pDevice->uDIFS; - byData[2] = (BYTE)pDevice->uEIFS; - byData[3] = (BYTE)pDevice->uSlot; + byData[0] = (u8)pDevice->uSIFS; + byData[1] = (u8)pDevice->uDIFS; + byData[2] = (u8)pDevice->uEIFS; + byData[3] = (u8)pDevice->uSlot; CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, MAC_REG_SIFS, @@ -571,7 +558,7 @@ void CARDvUpdateBasicTopRate(struct vnt_private *pDevice) //Determines the highest basic rate. for (ii = RATE_54M; ii >= RATE_6M; ii --) { - if ( (pDevice->wBasicRate) & ((WORD)(1<<ii)) ) { + if ( (pDevice->wBasicRate) & ((u16)(1<<ii)) ) { byTopOFDM = ii; break; } @@ -579,7 +566,7 @@ void CARDvUpdateBasicTopRate(struct vnt_private *pDevice) pDevice->byTopOFDMBasicRate = byTopOFDM; for (ii = RATE_11M;; ii --) { - if ( (pDevice->wBasicRate) & ((WORD)(1<<ii)) ) { + if ( (pDevice->wBasicRate) & ((u16)(1<<ii)) ) { byTopCCK = ii; break; } @@ -617,7 +604,7 @@ int CARDbIsOFDMinBasicRate(struct vnt_private *pDevice) int ii; for (ii = RATE_54M; ii >= RATE_6M; ii --) { - if ((pDevice->wBasicRate) & ((WORD)(1<<ii))) + if ((pDevice->wBasicRate) & ((u16)(1<<ii))) return true; } return false; @@ -627,7 +614,7 @@ u8 CARDbyGetPktType(struct vnt_private *pDevice) { if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) { - return (BYTE)pDevice->byBBType; + return (u8)pDevice->byBBType; } else if (CARDbIsOFDMinBasicRate(pDevice)) { return PK_TYPE_11GA; @@ -637,7 +624,6 @@ u8 CARDbyGetPktType(struct vnt_private *pDevice) } } - /* * Description: Calculate TSF offset of two TSF input * Get TSF Offset from RxBCN's TSF and local TSF @@ -653,10 +639,10 @@ u8 CARDbyGetPktType(struct vnt_private *pDevice) * Return Value: TSF Offset value * */ -u64 CARDqGetTSFOffset(BYTE byRxRate, u64 qwTSF1, u64 qwTSF2) +u64 CARDqGetTSFOffset(u8 byRxRate, u64 qwTSF1, u64 qwTSF2) { u64 qwTSFOffset = 0; - WORD wRxBcnTSFOffst = 0; + u16 wRxBcnTSFOffst = 0; wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate % MAX_RATE]; @@ -667,8 +653,6 @@ u64 CARDqGetTSFOffset(BYTE byRxRate, u64 qwTSF1, u64 qwTSF2) return qwTSFOffset; } - - /* * Description: Sync. TSF counter to BSS * Get TSF offset and write to HW @@ -690,7 +674,6 @@ void CARDvAdjustTSF(struct vnt_private *pDevice, u8 byRxRate, u64 qwTSFOffset = 0; u8 pbyData[8]; - qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF); // adjust TSF // HW's TSF add TSF Offset reg @@ -734,7 +717,6 @@ bool CARDbGetCurrentTSF(struct vnt_private *pDevice, u64 *pqwCurrTSF) return true; } - /* * Description: Clear NIC TSF counter * Clear local TSF counter @@ -770,7 +752,7 @@ bool CARDbClearCurrentTSF(struct vnt_private *pDevice) * Return Value: TSF value of next Beacon * */ -u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval) +u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBeaconInterval) { unsigned int uLowNextTBTT; @@ -790,13 +772,12 @@ u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval) if ((~uLowNextTBTT) < uLowRemain) qwTSF = ((qwTSF >> 32) + 1) << 32; - qwTSF = (qwTSF & 0xffffffff00000000UL) | + qwTSF = (qwTSF & 0xffffffff00000000ULL) | (u64)(uLowNextTBTT + uLowRemain); return (qwTSF); } - /* * Description: Set NIC TSF counter for first Beacon time * Get NEXTTBTT from adjusted TSF and Beacon Interval @@ -811,7 +792,7 @@ u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval) * Return Value: none * */ -void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, WORD wBeaconInterval) +void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, u16 wBeaconInterval) { u64 qwNextTBTT = 0; u8 pbyData[8]; @@ -841,7 +822,6 @@ void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, WORD wBeaconInterval) return; } - /* * Description: Sync NIC TSF counter for Beacon time * Get NEXTTBTT and write to HW @@ -883,7 +863,6 @@ void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, pbyData ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8lx]\n", (unsigned long)qwTSF); @@ -929,7 +908,6 @@ int CARDbRadioPowerOff(struct vnt_private *pDevice) return bResult; } - /* * Description: Turn on Radio power * @@ -996,7 +974,7 @@ void CARDvSetBSSMode(struct vnt_private *pDevice) } vUpdateIFS(pDevice); - CARDvSetRSPINF(pDevice, (BYTE)pDevice->byBBType); + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); if ( pDevice->byBBType == BB_TYPE_11A ) { //request by Jack 2005-04-26 @@ -1016,44 +994,3 @@ void CARDvSetBSSMode(struct vnt_private *pDevice) pDevice->abyBBVGA[3] = 0x0; } } - -/* - * - * Description: - * Do Channel Switch defined in 802.11h - * - * Parameters: - * In: - * hDeviceContext - device structure point - * Out: - * none - * - * Return Value: none. - * --*/ -int CARDbChannelSwitch(struct vnt_private *pDevice, u8 byMode, - u8 byNewChannel, u8 byCount) -{ - int bResult = true; - - if (byCount == 0) { - pDevice->vnt_mgmt.uCurrChannel = byNewChannel; - CARDbSetMediaChannel(pDevice, byNewChannel); - return bResult; - } - pDevice->byChannelSwitchCount = byCount; - pDevice->byNewChannel = byNewChannel; - pDevice->bChannelSwitch = true; - - if (byMode == 1) { - //bResult=CARDbStopTxPacket(pDevice, PKT_TYPE_802_11_ALL); - pDevice->bStopDataPkt = true; - } - return bResult; -} - - - - - - diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index 5123bc7d0dcd..c3017a74fa0f 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -29,11 +29,6 @@ #ifndef __CARD_H__ #define __CARD_H__ #include "device.h" -#include "ttype.h" - -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ /* init card type */ @@ -55,9 +50,6 @@ typedef enum _CARD_OP_MODE { #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 --------------------------*/ struct vnt_private; void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel); @@ -70,16 +62,14 @@ void CARDvAdjustTSF(struct vnt_private *pDevice, u8 byRxRate, u64 qwBSSTimestamp, u64 qwLocalTSF); bool CARDbGetCurrentTSF(struct vnt_private *pDevice, u64 *pqwCurrTSF); bool CARDbClearCurrentTSF(struct vnt_private *pDevice); -void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, WORD wBeaconInterval); +void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, u16 wBeaconInterval); void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, - WORD wBeaconInterval); -u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval); -u64 CARDqGetTSFOffset(BYTE byRxRate, u64 qwTSF1, u64 qwTSF2); + u16 wBeaconInterval); +u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBeaconInterval); +u64 CARDqGetTSFOffset(u8 byRxRate, u64 qwTSF1, u64 qwTSF2); int CARDbRadioPowerOff(struct vnt_private *pDevice); int CARDbRadioPowerOn(struct vnt_private *pDevice); u8 CARDbyGetPktType(struct vnt_private *pDevice); void CARDvSetBSSMode(struct vnt_private *pDevice); -int CARDbChannelSwitch(struct vnt_private *pDevice, u8 byMode, - u8 byNewChannel, u8 byCount); #endif /* __CARD_H__ */ diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index 4181e3e12ea9..5158ff4b346a 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -39,15 +39,9 @@ #include "channel.h" #include "rf.h" -/*--------------------- Static Definitions -------------------------*/ static int msglevel = MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Export Definitions -------------------------*/ - - static SChannelTblElement sChannelTbl[CB_MAX_CHANNEL+1] = { {0, 0, false}, @@ -109,17 +103,15 @@ static SChannelTblElement sChannelTbl[CB_MAX_CHANNEL+1] = {165, 5825, true} //56 }; - - /************************************************************************ * The Radar regulation rules for each country ************************************************************************/ static struct { - BYTE byChannelCountryCode; /* The country code */ + u8 byChannelCountryCode; /* The country code */ char chCountryCode[2]; - BYTE bChannelIdxList[CB_MAX_CHANNEL]; /* Available channels Index */ - BYTE byPower[CB_MAX_CHANNEL]; + u8 bChannelIdxList[CB_MAX_CHANNEL]; /* Available channels Index */ + u8 byPower[CB_MAX_CHANNEL]; } ChannelRuleTab[] = { /************************************************************************ @@ -368,7 +360,6 @@ static struct /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 */ }; -/*--------------------- Export function -------------------------*/ /************************************************************************ * Country Channel Valid * Input: CountryCode, ChannelNum @@ -410,32 +401,6 @@ exit: } /* end ChannelValid */ -/************************************************************************ - * CHvChannelGetList - * Get Available Channel List for a given country - * Input: - * CountryCode = The country code defined in country.h - * Output: - * ChannelBitMask = (QWORD *) correspondent bit mask - * of available channels - * 0x0000000000000001 means channel 1 is supported - * 0x0000000000000003 means channel 1,2 are supported - * 0x000000000000000F means channel 1,2,..15 are supported - ************************************************************************/ -bool -CHvChannelGetList ( - unsigned int uCountryCodeIdx, - PBYTE pbyChannelTable - ) -{ - if (uCountryCodeIdx >= CCODE_MAX) { - return (false); - } - memcpy(pbyChannelTable, ChannelRuleTab[uCountryCodeIdx].bChannelIdxList, CB_MAX_CHANNEL); - return (true); -} - - void CHvInitChannelTable(struct vnt_private *pDevice) { int bMultiBand = false; @@ -507,15 +472,3 @@ void CHvInitChannelTable(struct vnt_private *pDevice) }*/ } } - -BYTE CHbyGetChannelMapping(BYTE byChannelNumber) -{ -BYTE ii; -BYTE byCHMapping = 0; - - for (ii = 1; ii <= CB_MAX_CHANNEL; ii++) { - if (sChannelTbl[ii].byChannelNumber == byChannelNumber) - byCHMapping = ii; - } - return byCHMapping; -} diff --git a/drivers/staging/vt6656/channel.h b/drivers/staging/vt6656/channel.h index 9914dba0ba0c..95701e0cbee3 100644 --- a/drivers/staging/vt6656/channel.h +++ b/drivers/staging/vt6656/channel.h @@ -31,26 +31,14 @@ #define _CHANNEL_H_ #include "device.h" -#include "ttype.h" - -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ typedef struct tagSChannelTblElement { - BYTE byChannelNumber; + u8 byChannelNumber; unsigned int uFrequency; bool bValid; } SChannelTblElement, *PSChannelTblElement; -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - bool ChannelValid(unsigned int CountryCode, unsigned int ChannelNum); void CHvInitChannelTable(struct vnt_private *pDevice); -BYTE CHbyGetChannelMapping(BYTE byChannelNumber); - -bool CHvChannelGetList(unsigned int uCountryCodeIdx, PBYTE pbyChannelTable); #endif /* _CHANNEL_H_ */ diff --git a/drivers/staging/vt6656/control.c b/drivers/staging/vt6656/control.c index 743ef5fb7fe7..026784fcde82 100644 --- a/drivers/staging/vt6656/control.c +++ b/drivers/staging/vt6656/control.c @@ -43,18 +43,8 @@ #include "control.h" #include "rndis.h" -/*--------------------- Static Definitions -------------------------*/ /* static int msglevel =MSG_LEVEL_INFO; */ /* static int msglevel =MSG_LEVEL_DEBUG; */ -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, u8 data) diff --git a/drivers/staging/vt6656/control.h b/drivers/staging/vt6656/control.h index 76ce0244e100..9da9b96add70 100644 --- a/drivers/staging/vt6656/control.h +++ b/drivers/staging/vt6656/control.h @@ -30,12 +30,9 @@ #ifndef __CONTROL_H__ #define __CONTROL_H__ -#include "ttype.h" #include "device.h" #include "usbpipe.h" -/*--------------------- Export Definitions -------------------------*/ - #define CONTROLnsRequestOut(Device, Request, Value, Index, Length, Buffer) \ PIPEnsControlOut(Device, Request, Value, Index, Length, Buffer) @@ -45,12 +42,6 @@ #define CONTROLnsRequestIn(Device, Request, Value, Index, Length, Buffer) \ PIPEnsControlIn(Device, Request, Value, Index, Length, Buffer) -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, u8 data); @@ -60,5 +51,4 @@ void ControlvReadByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, void ControlvMaskByte(struct vnt_private *pDevice, u8 reg_type, u8 reg_off, u8 reg_mask, u8 data); - #endif /* __CONTROL_H__ */ diff --git a/drivers/staging/vt6656/country.h b/drivers/staging/vt6656/country.h index 7bdc8d47aedb..a0320d8f1362 100644 --- a/drivers/staging/vt6656/country.h +++ b/drivers/staging/vt6656/country.h @@ -156,7 +156,6 @@ typedef enum _COUNTRY_CODE { CCODE_MAX } COUNTRY_CODE; - /************************************************************************ * Function prototype ************************************************************************/ diff --git a/drivers/staging/vt6656/datarate.c b/drivers/staging/vt6656/datarate.c index 77464e819f6d..17fbc35ebcbf 100644 --- a/drivers/staging/vt6656/datarate.c +++ b/drivers/staging/vt6656/datarate.c @@ -33,7 +33,6 @@ * */ -#include "ttype.h" #include "tmacro.h" #include "mac.h" #include "80211mgr.h" @@ -44,33 +43,20 @@ #include "srom.h" #include "rf.h" -/*--------------------- Static Definitions -------------------------*/ - - - - -/*--------------------- Static Classes ----------------------------*/ - - - -/*--------------------- Static Variables --------------------------*/ - /* static int msglevel = MSG_LEVEL_DEBUG; */ static int msglevel =MSG_LEVEL_INFO; -const BYTE acbyIERate[MAX_RATE] = +const u8 acbyIERate[MAX_RATE] = {0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; #define AUTORATE_TXOK_CNT 0x0400 #define AUTORATE_TXFAIL_CNT 0x0064 #define AUTORATE_TIMEOUT 10 -/*--------------------- Static Functions --------------------------*/ - void s_vResetCounter(PKnownNodeDB psNodeDBTable); void s_vResetCounter(PKnownNodeDB psNodeDBTable) { - BYTE ii; + u8 ii; /* clear statistics counter for auto_rate */ for (ii = 0; ii <= MAX_RATE; ii++) { @@ -79,45 +65,6 @@ void s_vResetCounter(PKnownNodeDB psNodeDBTable) } } -/*--------------------- Export Variables --------------------------*/ - - -/*--------------------- Export Functions --------------------------*/ - - -/*+ - * - * Description: - * Get RateIdx from the value in SuppRates IE or ExtSuppRates IE - * - * Parameters: - * In: - * BYTE - Rate value in SuppRates IE or ExtSuppRates IE - * Out: - * none - * - * Return Value: RateIdx - * --*/ -BYTE -DATARATEbyGetRateIdx ( - BYTE byRate - ) -{ - BYTE ii; - - /* erase BasicRate flag */ - byRate = byRate & 0x7F; - - for (ii = 0; ii < MAX_RATE; ii ++) { - if (acbyIERate[ii] == byRate) - return ii; - } - return 0; -} - - - /*+ * * Routine Description: @@ -136,9 +83,6 @@ DATARATEbyGetRateIdx ( #define AUTORATE_TXCNT_THRESHOLD 20 #define AUTORATE_INC_THRESHOLD 30 - - - /*+ * * Description: @@ -146,19 +90,19 @@ DATARATEbyGetRateIdx ( * * Parameters: * In: - * BYTE - Rate value in SuppRates IE or ExtSuppRates IE + * u8 - Rate value in SuppRates IE or ExtSuppRates IE * Out: * none * * Return Value: RateIdx * -*/ -WORD +u16 RATEwGetRateIdx( - BYTE byRate + u8 byRate ) { - WORD ii; + u16 ii; /* erase BasicRate flag */ byRate = byRate & 0x7F; @@ -216,7 +160,7 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, } for (ii = 0; ii < uRateLen; ii++) { - byRate = (BYTE)(pItemRates->abyRates[ii]); + byRate = (u8)(pItemRates->abyRates[ii]); if (WLAN_MGMT_IS_BASICRATE(byRate) && (bUpdateBasicRate == true)) { /* @@ -226,7 +170,7 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", RATEwGetRateIdx(byRate)); } - byRate = (BYTE)(pItemRates->abyRates[ii]&0x7F); + byRate = (u8)(pItemRates->abyRates[ii]&0x7F); if (byHighSuppRate == 0) byHighSuppRate = byRate; if (byRate > byHighSuppRate) @@ -242,7 +186,7 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, uExtRateLen = WLAN_RATES_MAXLEN; for (ii = 0; ii < uExtRateLen ; ii++) { - byRate = (BYTE)(pItemExtRates->abyRates[ii]); + byRate = (u8)(pItemExtRates->abyRates[ii]); /* select highest basic rate */ if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) { /* @@ -252,7 +196,7 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", RATEwGetRateIdx(byRate)); } - byRate = (BYTE)(pItemExtRates->abyRates[ii]&0x7F); + byRate = (u8)(pItemExtRates->abyRates[ii]&0x7F); if (byHighSuppRate == 0) byHighSuppRate = byRate; if (byRate > byHighSuppRate) @@ -282,7 +226,6 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Exit ParseMaxRate\n"); } - /*+ * * Routine Description: @@ -336,7 +279,7 @@ void RATEvTxRateFallBack(struct vnt_private *pDevice, for (ii = 0; ii < MAX_RATE; ii++) { if (psNodeDBTable->wSuppRate & (0x0001<<ii)) { if (bAutoRate[ii] == true) { - wIdxUpRate = (WORD) ii; + wIdxUpRate = (u16) ii; } } else { bAutoRate[ii] = false; @@ -363,7 +306,7 @@ void RATEvTxRateFallBack(struct vnt_private *pDevice, if ( (dwThroughputTbl[ii] > dwThroughput) && (bAutoRate[ii]==true) ) { dwThroughput = dwThroughputTbl[ii]; - wIdxDownRate = (WORD) ii; + wIdxDownRate = (u16) ii; } } psNodeDBTable->wTxDataRate = wIdxDownRate; @@ -400,7 +343,7 @@ void RATEvTxRateFallBack(struct vnt_private *pDevice, * Return Value: None * -*/ -BYTE +u8 RATEuSetIE ( PWLAN_IE_SUPP_RATES pSrcRates, PWLAN_IE_SUPP_RATES pDstRates, @@ -423,6 +366,6 @@ RATEuSetIE ( } } } - return (BYTE)uRateCnt; + return (u8)uRateCnt; } diff --git a/drivers/staging/vt6656/datarate.h b/drivers/staging/vt6656/datarate.h index 8dc55bd61669..43cb77894b66 100644 --- a/drivers/staging/vt6656/datarate.h +++ b/drivers/staging/vt6656/datarate.h @@ -29,9 +29,6 @@ #ifndef __DATARATE_H__ #define __DATARATE_H__ - -/*--------------------- Export Definitions -------------------------*/ - #define FALLBACK_PKT_COLLECT_TR_H 50 /* pkts */ #define FALLBACK_PKT_COLLECT_TR_L 10 /* pkts */ #define FALLBACK_POLL_SECOND 5 /* 5 sec */ @@ -57,18 +54,6 @@ #define RATE_AUTO 12 #define MAX_RATE 12 -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - - -/*--------------------- Export Types ------------------------------*/ - - -/*--------------------- Export Functions --------------------------*/ - - - void RATEvParseMaxRate(struct vnt_private *, PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pItemExtRates, int bUpdateBasicRate, u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, u16 *pwSuppRate, @@ -77,22 +62,16 @@ void RATEvParseMaxRate(struct vnt_private *, PWLAN_IE_SUPP_RATES pItemRates, void RATEvTxRateFallBack(struct vnt_private *pDevice, PKnownNodeDB psNodeDBTable); -BYTE +u8 RATEuSetIE( PWLAN_IE_SUPP_RATES pSrcRates, PWLAN_IE_SUPP_RATES pDstRates, unsigned int uRateLen ); -WORD +u16 RATEwGetRateIdx( - BYTE byRate - ); - - -BYTE -DATARATEbyGetRateIdx( - BYTE byRate + u8 byRate ); #endif /* __DATARATE_H__ */ diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h index 0c0b614aaa11..64cb046fe988 100644 --- a/drivers/staging/vt6656/desc.h +++ b/drivers/staging/vt6656/desc.h @@ -33,7 +33,7 @@ #include <linux/types.h> #include <linux/mm.h> -#include "ttype.h" + #include "tether.h" /* max transmit or receive buffer size */ @@ -147,38 +147,38 @@ * RsvTime buffer header */ typedef struct tagSRrvTime_gRTS { - WORD wRTSTxRrvTime_ba; - WORD wRTSTxRrvTime_aa; - WORD wRTSTxRrvTime_bb; - WORD wReserved; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; + u16 wRTSTxRrvTime_ba; + u16 wRTSTxRrvTime_aa; + u16 wRTSTxRrvTime_bb; + u16 wReserved; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; } __attribute__ ((__packed__)) SRrvTime_gRTS, *PSRrvTime_gRTS; typedef const SRrvTime_gRTS *PCSRrvTime_gRTS; typedef struct tagSRrvTime_gCTS { - WORD wCTSTxRrvTime_ba; - WORD wReserved; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; + u16 wCTSTxRrvTime_ba; + u16 wReserved; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; } __attribute__ ((__packed__)) SRrvTime_gCTS, *PSRrvTime_gCTS; typedef const SRrvTime_gCTS *PCSRrvTime_gCTS; typedef struct tagSRrvTime_ab { - WORD wRTSTxRrvTime; - WORD wTxRrvTime; + u16 wRTSTxRrvTime; + u16 wTxRrvTime; } __attribute__ ((__packed__)) SRrvTime_ab, *PSRrvTime_ab; typedef const SRrvTime_ab *PCSRrvTime_ab; typedef struct tagSRrvTime_atim { - WORD wCTSTxRrvTime_ba; - WORD wTxRrvTime_a; + u16 wCTSTxRrvTime_ba; + u16 wTxRrvTime_a; } __attribute__ ((__packed__)) SRrvTime_atim, *PSRrvTime_atim; @@ -188,46 +188,46 @@ typedef const SRrvTime_atim *PCSRrvTime_atim; * RTS buffer header */ typedef struct tagSRTSData { - WORD wFrameControl; - WORD wDurationID; - BYTE abyRA[ETH_ALEN]; - BYTE abyTA[ETH_ALEN]; + u16 wFrameControl; + u16 wDurationID; + u8 abyRA[ETH_ALEN]; + u8 abyTA[ETH_ALEN]; } __attribute__ ((__packed__)) SRTSData, *PSRTSData; typedef const SRTSData *PCSRTSData; typedef struct tagSRTS_g { - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_ba; - WORD wDuration_aa; - WORD wDuration_bb; - WORD wReserved; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_ba; + u16 wDuration_aa; + u16 wDuration_bb; + u16 wReserved; SRTSData Data; } __attribute__ ((__packed__)) SRTS_g, *PSRTS_g; typedef const SRTS_g *PCSRTS_g; typedef struct tagSRTS_g_FB { - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_ba; - WORD wDuration_aa; - WORD wDuration_bb; - WORD wReserved; - WORD wRTSDuration_ba_f0; - WORD wRTSDuration_aa_f0; - WORD wRTSDuration_ba_f1; - WORD wRTSDuration_aa_f1; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_ba; + u16 wDuration_aa; + u16 wDuration_bb; + u16 wReserved; + u16 wRTSDuration_ba_f0; + u16 wRTSDuration_aa_f0; + u16 wRTSDuration_ba_f1; + u16 wRTSDuration_aa_f1; SRTSData Data; } __attribute__ ((__packed__)) SRTS_g_FB, *PSRTS_g_FB; @@ -235,11 +235,11 @@ SRTS_g_FB, *PSRTS_g_FB; typedef const SRTS_g_FB *PCSRTS_g_FB; typedef struct tagSRTS_ab { - BYTE bySignalField; - BYTE byServiceField; - WORD wTransmitLength; - WORD wDuration; - WORD wReserved; + u8 bySignalField; + u8 byServiceField; + u16 wTransmitLength; + u16 wDuration; + u16 wReserved; SRTSData Data; } __attribute__ ((__packed__)) SRTS_ab, *PSRTS_ab; @@ -247,13 +247,13 @@ SRTS_ab, *PSRTS_ab; typedef const SRTS_ab *PCSRTS_ab; typedef struct tagSRTS_a_FB { - BYTE bySignalField; - BYTE byServiceField; - WORD wTransmitLength; - WORD wDuration; - WORD wReserved; - WORD wRTSDuration_f0; - WORD wRTSDuration_f1; + u8 bySignalField; + u8 byServiceField; + u16 wTransmitLength; + u16 wDuration; + u16 wReserved; + u16 wRTSDuration_f0; + u16 wRTSDuration_f1; SRTSData Data; } __attribute__ ((__packed__)) SRTS_a_FB, *PSRTS_a_FB; @@ -264,19 +264,19 @@ typedef const SRTS_a_FB *PCSRTS_a_FB; * CTS buffer header */ typedef struct tagSCTSData { - WORD wFrameControl; - WORD wDurationID; - BYTE abyRA[ETH_ALEN]; - WORD wReserved; + u16 wFrameControl; + u16 wDurationID; + u8 abyRA[ETH_ALEN]; + u16 wReserved; } __attribute__ ((__packed__)) SCTSData, *PSCTSData; typedef struct tagSCTS { - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - WORD wDuration_ba; - WORD wReserved; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u16 wDuration_ba; + u16 wReserved; SCTSData Data; } __attribute__ ((__packed__)) SCTS, *PSCTS; @@ -284,13 +284,13 @@ SCTS, *PSCTS; typedef const SCTS *PCSCTS; typedef struct tagSCTS_FB { - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - WORD wDuration_ba; - WORD wReserved; - WORD wCTSDuration_ba_f0; - WORD wCTSDuration_ba_f1; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u16 wDuration_ba; + u16 wReserved; + u16 wCTSDuration_ba_f0; + u16 wCTSDuration_ba_f1; SCTSData Data; } __attribute__ ((__packed__)) SCTS_FB, *PSCTS_FB; @@ -302,17 +302,17 @@ typedef const SCTS_FB *PCSCTS_FB; */ typedef struct tagSTxBufHead { u32 adwTxKey[4]; - WORD wFIFOCtl; - WORD wTimeStamp; - WORD wFragCtl; - WORD wReserved; + u16 wFIFOCtl; + u16 wTimeStamp; + u16 wFragCtl; + u16 wReserved; } __attribute__ ((__packed__)) STxBufHead, *PSTxBufHead; typedef const STxBufHead *PCSTxBufHead; typedef struct tagSTxShortBufHead { - WORD wFIFOCtl; - WORD wTimeStamp; + u16 wFIFOCtl; + u16 wTimeStamp; } __attribute__ ((__packed__)) STxShortBufHead, *PSTxShortBufHead; typedef const STxShortBufHead *PCSTxShortBufHead; @@ -321,56 +321,56 @@ typedef const STxShortBufHead *PCSTxShortBufHead; * TX data header */ typedef struct tagSTxDataHead_g { - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } __attribute__ ((__packed__)) STxDataHead_g, *PSTxDataHead_g; typedef const STxDataHead_g *PCSTxDataHead_g; typedef struct tagSTxDataHead_g_FB { - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wDuration_a_f0; - WORD wDuration_a_f1; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wDuration_a_f0; + u16 wDuration_a_f1; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } __attribute__ ((__packed__)) STxDataHead_g_FB, *PSTxDataHead_g_FB; typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB; typedef struct tagSTxDataHead_ab { - BYTE bySignalField; - BYTE byServiceField; - WORD wTransmitLength; - WORD wDuration; - WORD wTimeStampOff; + u8 bySignalField; + u8 byServiceField; + u16 wTransmitLength; + u16 wDuration; + u16 wTimeStampOff; } __attribute__ ((__packed__)) STxDataHead_ab, *PSTxDataHead_ab; typedef const STxDataHead_ab *PCSTxDataHead_ab; typedef struct tagSTxDataHead_a_FB { - BYTE bySignalField; - BYTE byServiceField; - WORD wTransmitLength; - WORD wDuration; - WORD wTimeStampOff; - WORD wDuration_f0; - WORD wDuration_f1; + u8 bySignalField; + u8 byServiceField; + u16 wTransmitLength; + u16 wDuration; + u16 wTimeStampOff; + u16 wDuration_f0; + u16 wDuration_f1; } __attribute__ ((__packed__)) STxDataHead_a_FB, *PSTxDataHead_a_FB; typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB; @@ -397,14 +397,14 @@ SBEACONCtl; typedef struct tagSSecretKey { u32 dwLowDword; - BYTE byHighByte; + u8 byHighByte; } __attribute__ ((__packed__)) SSecretKey; typedef struct tagSKeyEntry { - BYTE abyAddrHi[2]; - WORD wKCTL; - BYTE abyAddrLo[4]; + u8 abyAddrHi[2]; + u16 wKCTL; + u8 abyAddrLo[4]; u32 dwKey0[4]; u32 dwKey1[4]; u32 dwKey2[4]; diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 6bba2e06fa64..f07ba242811b 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -45,7 +45,6 @@ #include <linux/timer.h> #include <linux/usb.h> - #ifdef SIOCETHTOOL #define DEVICE_ETHTOOL_IOCTL_SUPPORT #include <linux/ethtool.h> @@ -66,7 +65,6 @@ */ #include "device_cfg.h" -#include "ttype.h" #include "80211hdr.h" #include "tether.h" #include "wmgr.h" @@ -78,7 +76,6 @@ #include "key.h" #include "card.h" -/*--------------------- Export Definitions -------------------------*/ #define VNT_USB_VENDOR_ID 0x160a #define VNT_USB_PRODUCT_ID 0x3184 @@ -122,7 +119,6 @@ #define ANT_RXA 2 #define ANT_RXB 3 - #define MAXCHECKHANGCNT 4 /* Packet type */ @@ -142,8 +138,6 @@ #define PRIVATE_Message 0 -/*--------------------- Export Types ------------------------------*/ - #define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); } #define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); } @@ -191,7 +185,7 @@ typedef struct _USB_SEND_CONTEXT { struct urb *pUrb; unsigned int uBufLen; CONTEXT_TYPE Type; - SEthernetHeader sEthHeader; + struct ethhdr sEthHeader; void *Next; bool bBoolInUse; unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS]; @@ -212,7 +206,7 @@ typedef struct _DEFAULT_CONFIG { */ typedef struct { unsigned int uDataLen; - PBYTE pDataBuf; + u8 * pDataBuf; /* struct urb *pUrb; */ bool bInUse; } INT_BUFFER, *PINT_BUFFER; @@ -251,7 +245,6 @@ typedef enum __DEVICE_NDIS_STATUS { /* PMKID Structures */ typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; - typedef enum _NDIS_802_11_WEP_STATUS { Ndis802_11WEPEnabled, @@ -269,7 +262,6 @@ typedef enum _NDIS_802_11_WEP_STATUS } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; - typedef enum _NDIS_802_11_STATUS_TYPE { Ndis802_11StatusType_Authentication, @@ -284,7 +276,6 @@ typedef struct _PMKID_CANDIDATE { unsigned long Flags; } PMKID_CANDIDATE, *PPMKID_CANDIDATE; - typedef struct _BSSID_INFO { NDIS_802_11_MAC_ADDRESS BSSID; @@ -309,16 +300,16 @@ typedef struct tagSPMKIDCandidateEvent { typedef struct tagSQuietControl { bool bEnable; - DWORD dwStartTime; - BYTE byPeriod; - WORD wDuration; + u32 dwStartTime; + u8 byPeriod; + u16 wDuration; } SQuietControl, *PSQuietControl; /* The receive duplicate detection cache entry */ typedef struct tagSCacheEntry{ - WORD wFmSequence; - BYTE abyAddr2[ETH_ALEN]; - WORD wFrameCtl; + u16 wFmSequence; + u8 abyAddr2[ETH_ALEN]; + u16 wFrameCtl; } SCacheEntry, *PSCacheEntry; typedef struct tagSCache{ @@ -335,12 +326,12 @@ typedef struct tagSCache{ */ typedef struct tagSDeFragControlBlock { - WORD wSequence; - WORD wFragNum; - BYTE abyAddr2[ETH_ALEN]; + u16 wSequence; + u16 wFragNum; + u8 abyAddr2[ETH_ALEN]; unsigned int uLifetime; struct sk_buff* skb; - PBYTE pbyRxBuffer; + u8 * pbyRxBuffer; unsigned int cbFrameLength; bool bInUse; } SDeFragControlBlock, *PSDeFragControlBlock; @@ -371,7 +362,6 @@ typedef struct tagSDeFragControlBlock /* for device_set_media_duplex */ #define DEVICE_LINK_CHANGE 0x00000001UL - typedef struct __device_opt { int nRxDescs0; /* number of RX descriptors 0 */ int nTxDescs0; /* number of TX descriptors 0, 1, 2, 3 */ @@ -386,7 +376,6 @@ typedef struct __device_opt { u32 flags; } OPTIONS, *POPTIONS; - struct vnt_private { /* netdev */ struct usb_device *usb; @@ -420,7 +409,6 @@ struct vnt_private { u32 cbFreeDFCB; u32 uCurrentDFCBIdx; - /* USB */ struct urb *pControlURB; struct urb *pInterruptURB; @@ -453,7 +441,6 @@ struct vnt_private { /* default config from file by user setting */ DEFAULT_CONFIG config_file; - /* Statistic for USB */ unsigned long ulBulkInPosted; unsigned long ulBulkInError; @@ -470,14 +457,12 @@ struct vnt_private { unsigned long ulIntInContCRCError; unsigned long ulIntInBytesRead; - /* Version control */ u16 wFirmwareVersion; u8 byLocalID; u8 byRFType; u8 byBBRxConf; - u8 byZoneType; int bZoneRegExist; @@ -571,7 +556,6 @@ struct vnt_private { u8 byTopOFDMBasicRate; u8 byTopCCKBasicRate; - u32 dwAotoRateTxOkCnt; u32 dwAotoRateTxFailCnt; u32 dwErrorRateThreshold[13]; @@ -684,7 +668,6 @@ struct vnt_private { SKeyManagement sKey; u32 dwIVCounter; - RC4Ext SBox; u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3]; u8 byKeyIndex; @@ -701,13 +684,11 @@ struct vnt_private { /* QoS */ int bGrpAckPolicy; - u8 byAutoFBCtrl; int bTxMICFail; int bRxMICFail; - /* For Update BaseBand VGA Gain Offset */ int bUpdateBBVGA; u32 uBBVGADiffCount; @@ -719,7 +700,6 @@ struct vnt_private { u8 byBBPreEDRSSI; u8 byBBPreEDIndex; - int bRadioCmd; u32 dwDiagRefCount; @@ -747,8 +727,8 @@ struct vnt_private { u8 byReAssocCount; u8 byLinkWaitCount; - SEthernetHeader sTxEthHeader; - SEthernetHeader sRxEthHeader; + struct ethhdr sTxEthHeader; + struct ethhdr sRxEthHeader; u8 abyBroadcastAddr[ETH_ALEN]; u8 abySNAP_RFC1042[ETH_ALEN]; u8 abySNAP_Bridgetunnel[ETH_ALEN]; @@ -757,7 +737,6 @@ struct vnt_private { SPMKID gsPMKID; SPMKIDCandidateEvent gsPMKIDCandidate; - /* for 802.11h */ int b11hEnable; @@ -788,9 +767,6 @@ struct vnt_private { }; - - - #define EnqueueRCB(_Head, _Tail, _RCB) \ { \ if (!_Head) { \ @@ -812,7 +788,6 @@ struct vnt_private { Head = RCB->Next; \ } - #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ if ((uVar) >= ((uModulo) - 1)) \ (uVar) = 0; \ @@ -820,7 +795,6 @@ struct vnt_private { (uVar)++; \ } - #define fMP_RESET_IN_PROGRESS 0x00000001 #define fMP_DISCONNECTED 0x00000002 #define fMP_HALT_IN_PROGRESS 0x00000004 @@ -841,8 +815,6 @@ struct vnt_private { #define MP_IS_READY(_M) (((_M)->Flags & \ (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0) -/*--------------------- Export Functions --------------------------*/ - int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF); #endif diff --git a/drivers/staging/vt6656/device_cfg.h b/drivers/staging/vt6656/device_cfg.h index 62290d0ac195..ea66b975fa5b 100644 --- a/drivers/staging/vt6656/device_cfg.h +++ b/drivers/staging/vt6656/device_cfg.h @@ -29,8 +29,6 @@ #include <linux/types.h> -#include "ttype.h" - typedef struct _version { unsigned char major; diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index e83f95e1d9a8..7ec166a2ac81 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -56,32 +56,20 @@ #include "datarate.h" #include "usbpipe.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; -const BYTE acbyRxRate[MAX_RATE] = +const u8 acbyRxRate[MAX_RATE] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Functions --------------------------*/ - -static BYTE s_byGetRateIdx(BYTE byRate); +static u8 s_byGetRateIdx(u8 byRate); static void s_vGetDASA( - PBYTE pbyRxBufferAddr, + u8 * pbyRxBufferAddr, unsigned int *pcbHeaderSize, - PSEthernetHeader psEthHeader + struct ethhdr *psEthHeader ); static void s_vProcessRxMACHeader(struct vnt_private *pDevice, @@ -102,8 +90,6 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, u32 FrameSize, u8 *pbyRsr, int bOnFly, PSKeyItem pKey, u8 *pbyNewRsr, s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16); -/*--------------------- Export Variables --------------------------*/ - /*+ * * Description: @@ -129,13 +115,12 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, u8 *pbyRxBuffer; u32 cbHeaderSize = 0; u16 *pwType; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; int ii; + pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize); - pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); - - s_vGetDASA((PBYTE)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader); + s_vGetDASA((u8 *)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader); if (bIsWEP) { if (bExtIV) { @@ -150,16 +135,16 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, cbHeaderSize += WLAN_HDR_ADDR3_LEN; }; - pbyRxBuffer = (PBYTE) (pbyRxBufferAddr + cbHeaderSize); + pbyRxBuffer = (u8 *) (pbyRxBufferAddr + cbHeaderSize); if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_Bridgetunnel[0])) { cbHeaderSize += 6; } else if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_RFC1042[0])) { cbHeaderSize += 6; - pwType = (PWORD) (pbyRxBufferAddr + cbHeaderSize); + pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); if ((*pwType == cpu_to_be16(ETH_P_IPX)) || (*pwType == cpu_to_le16(0xF380))) { cbHeaderSize -= 8; - pwType = (PWORD) (pbyRxBufferAddr + cbHeaderSize); + pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); if (bIsWEP) { if (bExtIV) { *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 8); // 8 is IV&ExtIV @@ -174,7 +159,7 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, } else { cbHeaderSize -= 2; - pwType = (PWORD) (pbyRxBufferAddr + cbHeaderSize); + pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); if (bIsWEP) { if (bExtIV) { *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 8); // 8 is IV&ExtIV @@ -188,21 +173,18 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, } cbHeaderSize -= (ETH_ALEN * 2); - pbyRxBuffer = (PBYTE) (pbyRxBufferAddr + cbHeaderSize); + pbyRxBuffer = (u8 *) (pbyRxBufferAddr + cbHeaderSize); for (ii = 0; ii < ETH_ALEN; ii++) - *pbyRxBuffer++ = pDevice->sRxEthHeader.abyDstAddr[ii]; + *pbyRxBuffer++ = pDevice->sRxEthHeader.h_dest[ii]; for (ii = 0; ii < ETH_ALEN; ii++) - *pbyRxBuffer++ = pDevice->sRxEthHeader.abySrcAddr[ii]; + *pbyRxBuffer++ = pDevice->sRxEthHeader.h_source[ii]; *pcbHeadSize = cbHeaderSize; } - - - -static BYTE s_byGetRateIdx(BYTE byRate) +static u8 s_byGetRateIdx(u8 byRate) { - BYTE byRateIdx; + u8 byRateIdx; for (byRateIdx = 0; byRateIdx <MAX_RATE ; byRateIdx++) { if (acbyRxRate[byRateIdx%MAX_RATE] == byRate) @@ -211,61 +193,59 @@ static BYTE s_byGetRateIdx(BYTE byRate) return 0; } - static void s_vGetDASA ( - PBYTE pbyRxBufferAddr, + u8 * pbyRxBufferAddr, unsigned int *pcbHeaderSize, - PSEthernetHeader psEthHeader + struct ethhdr *psEthHeader ) { unsigned int cbHeaderSize = 0; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; int ii; - pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize); - if ((pMACHeader->wFrameCtl & FC_TODS) == 0) { - if (pMACHeader->wFrameCtl & FC_FROMDS) { + if ((pMACHeader->frame_control & FC_TODS) == 0) { + if (pMACHeader->frame_control & FC_FROMDS) { for (ii = 0; ii < ETH_ALEN; ii++) { - psEthHeader->abyDstAddr[ii] = - pMACHeader->abyAddr1[ii]; - psEthHeader->abySrcAddr[ii] = - pMACHeader->abyAddr3[ii]; + psEthHeader->h_dest[ii] = + pMACHeader->addr1[ii]; + psEthHeader->h_source[ii] = + pMACHeader->addr3[ii]; } } else { /* IBSS mode */ for (ii = 0; ii < ETH_ALEN; ii++) { - psEthHeader->abyDstAddr[ii] = - pMACHeader->abyAddr1[ii]; - psEthHeader->abySrcAddr[ii] = - pMACHeader->abyAddr2[ii]; + psEthHeader->h_dest[ii] = + pMACHeader->addr1[ii]; + psEthHeader->h_source[ii] = + pMACHeader->addr2[ii]; } } } else { /* Is AP mode.. */ - if (pMACHeader->wFrameCtl & FC_FROMDS) { + if (pMACHeader->frame_control & FC_FROMDS) { for (ii = 0; ii < ETH_ALEN; ii++) { - psEthHeader->abyDstAddr[ii] = - pMACHeader->abyAddr3[ii]; - psEthHeader->abySrcAddr[ii] = - pMACHeader->abyAddr4[ii]; + psEthHeader->h_dest[ii] = + pMACHeader->addr3[ii]; + psEthHeader->h_source[ii] = + pMACHeader->addr4[ii]; cbHeaderSize += 6; } } else { for (ii = 0; ii < ETH_ALEN; ii++) { - psEthHeader->abyDstAddr[ii] = - pMACHeader->abyAddr3[ii]; - psEthHeader->abySrcAddr[ii] = - pMACHeader->abyAddr2[ii]; + psEthHeader->h_dest[ii] = + pMACHeader->addr3[ii]; + psEthHeader->h_source[ii] = + pMACHeader->addr2[ii]; } } }; *pcbHeaderSize = cbHeaderSize; } - int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, unsigned long BytesToIndicate) { @@ -273,7 +253,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, struct sk_buff *skb; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_rx_mgmt *pRxPacket = &pMgmt->sRxPacket; - PS802_11Header p802_11Header; + struct ieee80211_hdr *p802_11Header; u8 *pbyRsr, *pbyNewRsr, *pbyRSSI, *pbyFrame; u64 *pqwTSFTime; u32 bDeFragRx = false; @@ -297,10 +277,9 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, u8 abyVaildRate[MAX_RATE] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; u16 wPLCPwithPadding; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; int bRxeapol_key = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- RXbBulkInProcessData---\n"); skb = pRCB->skb; @@ -321,14 +300,14 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, return false; } - pbyDAddress = (PBYTE)(skb->data); + pbyDAddress = (u8 *)(skb->data); pbyRxSts = pbyDAddress+4; pbyRxRate = pbyDAddress+5; //real Frame Size = USBFrameSize -4WbkStatus - 4RxStatus - 8TSF - 4RSR - 4SQ3 - ?Padding //if SQ3 the range is 24~27, if no SQ3 the range is 20~23 //real Frame size in PLCPLength field. - pwPLCP_Length = (PWORD) (pbyDAddress + 6); + pwPLCP_Length = (u16 *) (pbyDAddress + 6); //Fix hardware bug => PLCP_Length error if ( ((BytesToIndicate - (*pwPLCP_Length)) > 27) || ((BytesToIndicate - (*pwPLCP_Length)) < 24) || @@ -377,45 +356,43 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, FrameSize ); - - pMACHeader = (PS802_11Header) pbyFrame; + pMACHeader = (struct ieee80211_hdr *) pbyFrame; //mike add: to judge if current AP is activated? if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) || (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) { if (pMgmt->sNodeDBTable[0].bActive) { - if (!compare_ether_addr(pMgmt->abyCurrBSSID, pMACHeader->abyAddr2)) { + if (!compare_ether_addr(pMgmt->abyCurrBSSID, pMACHeader->addr2)) { if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) pMgmt->sNodeDBTable[0].uInActiveCount = 0; } } } - if (!is_multicast_ether_addr(pMACHeader->abyAddr1)) { - if ( WCTLbIsDuplicate(&(pDevice->sDupRxCache), (PS802_11Header) pbyFrame) ) { + if (!is_multicast_ether_addr(pMACHeader->addr1)) { + if (WCTLbIsDuplicate(&(pDevice->sDupRxCache), (struct ieee80211_hdr *) pbyFrame)) { pDevice->s802_11Counter.FrameDuplicateCount++; return false; } if (compare_ether_addr(pDevice->abyCurrentNetAddr, - pMACHeader->abyAddr1)) { + pMACHeader->addr1)) { return false; } } - // Use for TKIP MIC s_vGetDASA(pbyFrame, &cbHeaderSize, &pDevice->sRxEthHeader); - if (!compare_ether_addr((PBYTE)&(pDevice->sRxEthHeader.abySrcAddr[0]), + if (!compare_ether_addr((u8 *)&(pDevice->sRxEthHeader.h_source[0]), pDevice->abyCurrentNetAddr)) return false; if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) { if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { - p802_11Header = (PS802_11Header) (pbyFrame); + p802_11Header = (struct ieee80211_hdr *) (pbyFrame); // get SA NodeIndex - if (BSSbIsSTAInNodeDB(pDevice, (PBYTE)(p802_11Header->abyAddr2), &iSANodeIndex)) { + if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(p802_11Header->addr2), &iSANodeIndex)) { pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = jiffies; pMgmt->sNodeDBTable[iSANodeIndex].uInActiveCount = 0; } @@ -428,7 +405,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } } - if (IS_FC_WEP(pbyFrame)) { bool bRxDecryOK = false; @@ -497,7 +473,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, FrameSize -= 4; // 4 is ICV } - // // RX OK // @@ -508,7 +483,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, (IS_FRAGMENT_PKT((pbyFrame))) ) { // defragment - bDeFragRx = WCTLbHandleFragment(pDevice, (PS802_11Header) (pbyFrame), FrameSize, bIsWEP, bExtIV); + bDeFragRx = WCTLbHandleFragment(pDevice, (struct ieee80211_hdr *) (pbyFrame), FrameSize, bIsWEP, bExtIV); pDevice->s802_11Counter.ReceivedFragmentCount++; if (bDeFragRx) { // defrag complete @@ -529,8 +504,8 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, // Handle Control & Manage Frame if (IS_TYPE_MGMT((pbyFrame))) { - PBYTE pbyData1; - PBYTE pbyData2; + u8 * pbyData1; + u8 * pbyData2; pRxPacket = &(pRCB->sMngPacket); pRxPacket->p80211Header = (PUWLAN_80211HDR)(pbyFrame); @@ -622,10 +597,10 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } //mike add:station mode check eapol-key challenge---> { - BYTE Protocol_Version; //802.1x Authentication - BYTE Packet_Type; //802.1x Authentication - BYTE Descriptor_type; - WORD Key_info; + u8 Protocol_Version; //802.1x Authentication + u8 Packet_Type; //802.1x Authentication + u8 Descriptor_type; + u16 Key_info; if (bIsWEP) cbIVOffset = 8; else @@ -653,10 +628,8 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } } - // Data frame Handle - if (pDevice->bEnablePSMode) { if (IS_FC_MOREDATA((pbyFrame))) { if (*pbyRsr & RSR_ADDROK) { @@ -699,11 +672,10 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } */ - // ----------------------------------------------- if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)){ - BYTE abyMacHdr[24]; + u8 abyMacHdr[24]; // Only 802.1x packet incoming allowed if (bIsWEP) @@ -739,7 +711,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, return false; } - if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) { if (bIsWEP) { FrameSize -= 8; //MIC @@ -750,44 +721,42 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, // Soft MIC if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) { if (bIsWEP) { - PDWORD pdwMIC_L; - PDWORD pdwMIC_R; - DWORD dwMIC_Priority; - DWORD dwMICKey0 = 0, dwMICKey1 = 0; - DWORD dwLocalMIC_L = 0; - DWORD dwLocalMIC_R = 0; - + u32 * pdwMIC_L; + u32 * pdwMIC_R; + u32 dwMIC_Priority; + u32 dwMICKey0 = 0, dwMICKey1 = 0; + u32 dwLocalMIC_L = 0; + u32 dwLocalMIC_R = 0; if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - dwMICKey0 = cpu_to_le32(*(PDWORD)(&pKey->abyKey[24])); - dwMICKey1 = cpu_to_le32(*(PDWORD)(&pKey->abyKey[28])); + dwMICKey0 = cpu_to_le32(*(u32 *)(&pKey->abyKey[24])); + dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[28])); } else { if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { - dwMICKey0 = cpu_to_le32(*(PDWORD)(&pKey->abyKey[16])); - dwMICKey1 = cpu_to_le32(*(PDWORD)(&pKey->abyKey[20])); + dwMICKey0 = cpu_to_le32(*(u32 *)(&pKey->abyKey[16])); + dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[20])); } else if ((pKey->dwKeyIndex & BIT28) == 0) { - dwMICKey0 = cpu_to_le32(*(PDWORD)(&pKey->abyKey[16])); - dwMICKey1 = cpu_to_le32(*(PDWORD)(&pKey->abyKey[20])); + dwMICKey0 = cpu_to_le32(*(u32 *)(&pKey->abyKey[16])); + dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[20])); } else { - dwMICKey0 = cpu_to_le32(*(PDWORD)(&pKey->abyKey[24])); - dwMICKey1 = cpu_to_le32(*(PDWORD)(&pKey->abyKey[28])); + dwMICKey0 = cpu_to_le32(*(u32 *)(&pKey->abyKey[24])); + dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[28])); } } MIC_vInit(dwMICKey0, dwMICKey1); - MIC_vAppend((PBYTE)&(pDevice->sRxEthHeader.abyDstAddr[0]), 12); + MIC_vAppend((u8 *)&(pDevice->sRxEthHeader.h_dest[0]), 12); dwMIC_Priority = 0; - MIC_vAppend((PBYTE)&dwMIC_Priority, 4); + MIC_vAppend((u8 *)&dwMIC_Priority, 4); // 4 is Rcv buffer header, 24 is MAC Header, and 8 is IV and Ext IV. - MIC_vAppend((PBYTE)(skb->data + 8 + WLAN_HDR_ADDR3_LEN + 8), + MIC_vAppend((u8 *)(skb->data + 8 + WLAN_HDR_ADDR3_LEN + 8), FrameSize - WLAN_HDR_ADDR3_LEN - 8); MIC_vGetMIC(&dwLocalMIC_L, &dwLocalMIC_R); MIC_vUnInit(); - pdwMIC_L = (PDWORD)(skb->data + 8 + FrameSize); - pdwMIC_R = (PDWORD)(skb->data + 8 + FrameSize + 4); - + pdwMIC_L = (u32 *)(skb->data + 8 + FrameSize); + pdwMIC_R = (u32 *)(skb->data + 8 + FrameSize + 4); if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) || (pDevice->bRxMICFail == true)) { @@ -818,7 +787,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } ev.src_addr.sa_family = ARPHRD_ETHER; - memcpy(ev.src_addr.sa_data, pMACHeader->abyAddr2, ETH_ALEN); + memcpy(ev.src_addr.sa_data, pMACHeader->addr2, ETH_ALEN); memset(&wrqu, 0, sizeof(wrqu)); wrqu.data.length = sizeof(ev); PRINT_K("wireless_send_event--->IWEVMICHAELMICFAILURE\n"); @@ -837,13 +806,13 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, if ((pKey != NULL) && ((pKey->byCipherSuite == KEY_CTL_TKIP) || (pKey->byCipherSuite == KEY_CTL_CCMP))) { if (bIsWEP) { - WORD wLocalTSC15_0 = 0; - DWORD dwLocalTSC47_16 = 0; + u16 wLocalTSC15_0 = 0; + u32 dwLocalTSC47_16 = 0; unsigned long long RSC = 0; // endian issues RSC = *((unsigned long long *) &(pKey->KeyRSC)); - wLocalTSC15_0 = (WORD) RSC; - dwLocalTSC47_16 = (DWORD) (RSC>>16); + wLocalTSC15_0 = (u16) RSC; + dwLocalTSC47_16 = (u32) (RSC>>16); RSC = dwRxTSC47_16; RSC <<= 16; @@ -876,8 +845,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } } // ----- End of Reply Counter Check -------------------------- - - s_vProcessRxMACHeader(pDevice, (PBYTE)(skb->data+8), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset); + s_vProcessRxMACHeader(pDevice, (u8 *)(skb->data+8), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset); FrameSize -= cbHeaderOffset; cbHeaderOffset += 8; // 8 is Rcv buffer header @@ -928,13 +896,12 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, s32 iSANodeIndex) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - PS802_11Header p802_11Header; + struct ieee80211_hdr *p802_11Header; CMD_STATUS Status; - if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { - p802_11Header = (PS802_11Header) (pbyFrame); + p802_11Header = (struct ieee80211_hdr *) (pbyFrame); if (!IS_TYPE_MGMT(pbyFrame)) { // Data & PS-Poll packet @@ -946,7 +913,7 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, // reason = (6) class 2 received from nonauth sta vMgrDeAuthenBeginSta(pDevice, pMgmt, - (PBYTE)(p802_11Header->abyAddr2), + (u8 *)(p802_11Header->addr2), (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); @@ -958,7 +925,7 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, // reason = (7) class 3 received from nonassoc sta vMgrDisassocBeginSta(pDevice, pMgmt, - (PBYTE)(p802_11Header->abyAddr2), + (u8 *)(p802_11Header->addr2), (WLAN_MGMT_REASON_CLASS3_NONASSOC), &Status ); @@ -1011,18 +978,18 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, else { vMgrDeAuthenBeginSta(pDevice, pMgmt, - (PBYTE)(p802_11Header->abyAddr2), + (u8 *)(p802_11Header->addr2), (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%pM\n", - p802_11Header->abyAddr3); + p802_11Header->addr3); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%pM\n", - p802_11Header->abyAddr2); + p802_11Header->addr2); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n", - p802_11Header->abyAddr1); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl ); + p802_11Header->addr1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: frame_control= %x\n", p802_11Header->frame_control); return true; } } @@ -1042,13 +1009,12 @@ static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, PSKeyItem pKey = NULL; u8 byDecMode = KEY_CTL_WEP; - *pwRxTSC15_0 = 0; *pdwRxTSC47_16 = 0; pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; - if ( WLAN_GET_FC_TODS(*(PWORD)pbyFrame) && - WLAN_GET_FC_FROMDS(*(PWORD)pbyFrame) ) { + if ( WLAN_GET_FC_TODS(*(u16 *)pbyFrame) && + WLAN_GET_FC_FROMDS(*(u16 *)pbyFrame) ) { pbyIV += 6; // 6 is 802.11 address4 PayloadLen -= 6; } @@ -1136,12 +1102,12 @@ static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, // TKIP/AES PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc - *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); + *pdwRxTSC47_16 = cpu_to_le32(*(u32 *)(pbyIV + 4)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %x\n", *pdwRxTSC47_16); if (byDecMode == KEY_CTL_TKIP) { *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); } else { - *pwRxTSC15_0 = cpu_to_le16(*(PWORD)pbyIV); + *pwRxTSC15_0 = cpu_to_le16(*(u16 *)pbyIV); } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); @@ -1149,8 +1115,8 @@ static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, (pDevice->byLocalID <= REV_ID_VT3253_A1)) { // Software TKIP // 1. 3253 A - PS802_11Header pMACHeader = (PS802_11Header) (pbyFrame); - TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); + struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *) (pbyFrame); + TKIPvMixKey(pKey->abyKey, pMACHeader->addr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { @@ -1173,7 +1139,7 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; u32 PayloadLen = FrameSize; u8 *pbyIV; u8 byKeyIdx; @@ -1183,8 +1149,8 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, *pdwRxTSC47_16 = 0; pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; - if ( WLAN_GET_FC_TODS(*(PWORD)pbyFrame) && - WLAN_GET_FC_FROMDS(*(PWORD)pbyFrame) ) { + if ( WLAN_GET_FC_TODS(*(u16 *)pbyFrame) && + WLAN_GET_FC_FROMDS(*(u16 *)pbyFrame) ) { pbyIV += 6; // 6 is 802.11 address4 PayloadLen -= 6; } @@ -1192,7 +1158,6 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, byKeyIdx >>= 6; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); - if (pMgmt->byCSSGK == KEY_CTL_TKIP) byDecMode = KEY_CTL_TKIP; else if (pMgmt->byCSSGK == KEY_CTL_CCMP) @@ -1235,13 +1200,13 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, // TKIP/AES PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc - *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); + *pdwRxTSC47_16 = cpu_to_le32(*(u32 *)(pbyIV + 4)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %x\n", *pdwRxTSC47_16); if (byDecMode == KEY_CTL_TKIP) { *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); } else { - *pwRxTSC15_0 = cpu_to_le16(*(PWORD)pbyIV); + *pwRxTSC15_0 = cpu_to_le16(*(u16 *)pbyIV); } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); @@ -1252,8 +1217,8 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, // 1. 3253 A // 2. NotOnFly DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP \n"); - pMACHeader = (PS802_11Header) (pbyFrame); - TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); + pMACHeader = (struct ieee80211_hdr *) (pbyFrame); + TKIPvMixKey(pKey->abyKey, pMACHeader->addr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { @@ -1297,11 +1262,10 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; u16 wAID; - if (FrameSize > CB_MAX_BUF_SIZE) return false; // check DA - if (is_multicast_ether_addr((PBYTE)(skb->data+cbHeaderOffset))) { + if (is_multicast_ether_addr((u8 *)(skb->data+cbHeaderOffset))) { if (pMgmt->sNodeDBTable[0].bPSEnable) { skbcpy = dev_alloc_skb((int)pDevice->rx_buf_sz); @@ -1326,7 +1290,7 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, } else { // check if relay - if (BSSbIsSTAInNodeDB(pDevice, (PBYTE)(skb->data+cbHeaderOffset), &iDANodeIndex)) { + if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(skb->data+cbHeaderOffset), &iDANodeIndex)) { if (pMgmt->sNodeDBTable[iDANodeIndex].eNodeState >= NODE_ASSOC) { if (pMgmt->sNodeDBTable[iDANodeIndex].bPSEnable) { // queue this skb until next PS tx, and then release. @@ -1356,7 +1320,7 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, iDANodeIndex = 0; if ((pDevice->uAssocCount > 1) && (iDANodeIndex >= 0)) { - bRelayPacketSend(pDevice, (PBYTE) (skb->data + cbHeaderOffset), + bRelayPacketSend(pDevice, (u8 *) (skb->data + cbHeaderOffset), FrameSize, (unsigned int) iDANodeIndex); } @@ -1370,9 +1334,6 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, return true; } - - - void RXvWorkItem(struct vnt_private *pDevice) { int ntStatus; @@ -1395,12 +1356,10 @@ void RXvWorkItem(struct vnt_private *pDevice) } - void RXvFreeRCB(PRCB pRCB, int bReAllocSkb) { struct vnt_private *pDevice = pRCB->pDevice; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->RXvFreeRCB\n"); ASSERT(!pRCB->Ref); // should be 0 @@ -1426,7 +1385,6 @@ void RXvFreeRCB(PRCB pRCB, int bReAllocSkb) EnqueueRCB(pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList, pRCB); pDevice->NumRecvFreeList++; - if ((pDevice->Flags & fMP_POST_READS) && MP_IS_READY(pDevice) && (pDevice->bIsRxWorkItemQueued == false) ) { @@ -1436,7 +1394,6 @@ void RXvFreeRCB(PRCB pRCB, int bReAllocSkb) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----RXFreeRCB %d %d\n",pDevice->NumRecvFreeList, pDevice->NumRecvMngList); } - void RXvMngWorkItem(struct vnt_private *pDevice) { PRCB pRCB = NULL; @@ -1471,4 +1428,3 @@ void RXvMngWorkItem(struct vnt_private *pDevice) } - diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h index 786c523f5479..876468f2c3d2 100644 --- a/drivers/staging/vt6656/dpc.h +++ b/drivers/staging/vt6656/dpc.h @@ -29,18 +29,9 @@ #ifndef __DPC_H__ #define __DPC_H__ -#include "ttype.h" #include "device.h" #include "wcmd.h" -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - void RXvWorkItem(void *Context); void RXvMngWorkItem(void *Context); diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index 4371a77e9adc..a1dc3a4cfd9c 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -35,8 +35,6 @@ #include "control.h" #include "rndis.h" -/*--------------------- Static Definitions -------------------------*/ - static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; @@ -45,17 +43,6 @@ static int msglevel =MSG_LEVEL_INFO; #define FIRMWARE_CHUNK_SIZE 0x400 -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - - int FIRMWAREbDownload(struct vnt_private *pDevice) { struct device *dev = &pDevice->usb->dev; @@ -66,7 +53,6 @@ int FIRMWAREbDownload(struct vnt_private *pDevice) u16 wLength; int ii, rc; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Download firmware\n"); spin_unlock_irq(&pDevice->lock); @@ -132,7 +118,6 @@ int FIRMWAREbBrach2Sram(struct vnt_private *pDevice) } } - int FIRMWAREbCheckVersion(struct vnt_private *pDevice) { int ntStatus; @@ -142,7 +127,7 @@ int FIRMWAREbCheckVersion(struct vnt_private *pDevice) 0, MESSAGE_REQUEST_VERSION, 2, - (PBYTE) &(pDevice->wFirmwareVersion)); + (u8 *) &(pDevice->wFirmwareVersion)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", pDevice->wFirmwareVersion); if (ntStatus != STATUS_SUCCESS) { diff --git a/drivers/staging/vt6656/firmware.h b/drivers/staging/vt6656/firmware.h index ebab3a6351b3..e3b08db6a734 100644 --- a/drivers/staging/vt6656/firmware.h +++ b/drivers/staging/vt6656/firmware.h @@ -30,17 +30,8 @@ #ifndef __FIRMWARE_H__ #define __FIRMWARE_H__ -#include "ttype.h" #include "device.h" -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - int FIRMWAREbDownload(struct vnt_private *); int FIRMWAREbBrach2Sram(struct vnt_private *); int FIRMWAREbCheckVersion(struct vnt_private *); diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index bc5e9da47586..f4f1bf7a30fd 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -142,7 +142,6 @@ static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked) return 0; } - /* * Description: * Set enable/disable hostapd mode @@ -174,7 +173,6 @@ int vt6656_hostap_set_hostapd(struct vnt_private *pDevice, return hostap_disable_hostapd(pDevice, rtnl_locked); } - /* * Description: * remove station function supported for hostap daemon @@ -193,7 +191,6 @@ static int hostap_remove_sta(struct vnt_private *pDevice, { unsigned int uNodeIndex; - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { BSSvRemoveOneNode(pDevice, uNodeIndex); } @@ -242,7 +239,7 @@ static int hostap_add_sta(struct vnt_private *pDevice, pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(pMgmt->sNodeDBTable[uNodeIndex].wCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].wAID = (WORD)param->u.add_sta.aid; + pMgmt->sNodeDBTable[uNodeIndex].wAID = (u16)param->u.add_sta.aid; pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies; @@ -294,7 +291,6 @@ static int hostap_get_info_sta(struct vnt_private *pDevice, return 0; } - /* * Description: * set station flag @@ -327,8 +323,6 @@ static int hostap_set_flags_sta(struct vnt_private *pDevice, return 0; } - - /* * Description: * set generic element (wpa ie) @@ -347,8 +341,6 @@ static int hostap_set_generic_element(struct vnt_private *pDevice, { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - - memcpy( pMgmt->abyWPAIE, param->u.generic_elem.data, param->u.generic_elem.len @@ -425,13 +417,11 @@ static int hostap_set_encryption(struct vnt_private *pDevice, int bKeyTableFull = false; u16 wKeyCtl = 0; - param->u.crypt.err = 0; if (param->u.crypt.alg > WPA_ALG_CCMP) return -EINVAL; - if ((param->u.crypt.idx > 3) || (param->u.crypt.key_len > MAX_KEY_LEN)) { param->u.crypt.err = HOSTAP_CRYPT_ERR_KEY_SET_FAILED; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n"); @@ -489,9 +479,9 @@ static int hostap_set_encryption(struct vnt_private *pDevice, param->u.crypt.key_len ); - dwKeyIndex = (DWORD)(param->u.crypt.idx); + dwKeyIndex = (u32)(param->u.crypt.idx); if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) { - pDevice->byKeyIndex = (BYTE)dwKeyIndex; + pDevice->byKeyIndex = (u8)dwKeyIndex; pDevice->bTransmitKey = true; dwKeyIndex |= (1 << 31); } @@ -515,11 +505,10 @@ static int hostap_set_encryption(struct vnt_private *pDevice, ¶m->sta_addr[0], dwKeyIndex & ~(USE_KEYRSC), param->u.crypt.key_len, - &KeyRSC, (PBYTE)abyKey, + &KeyRSC, (u8 *)abyKey, KEY_CTL_WEP ) == true) { - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { @@ -565,7 +554,6 @@ static int hostap_set_encryption(struct vnt_private *pDevice, pMgmt->byCSSGK = KEY_CTL_CCMP; } - if (iNodeIndex == 0) { KeybSetDefaultKey( pDevice, &(pDevice->sKey), @@ -585,7 +573,7 @@ static int hostap_set_encryption(struct vnt_private *pDevice, dwKeyIndex, param->u.crypt.key_len, &KeyRSC, - (PBYTE)abyKey, + (u8 *)abyKey, byKeyDecMode ) == true) { @@ -631,8 +619,6 @@ static int hostap_set_encryption(struct vnt_private *pDevice, return ret; } - - /* * Description: * get each stations encryption key @@ -655,7 +641,6 @@ static int hostap_get_encryption(struct vnt_private *pDevice, int ii; s32 iNodeIndex = 0; - param->u.crypt.err = 0; if (is_broadcast_ether_addr(param->sta_addr)) { @@ -670,13 +655,12 @@ static int hostap_get_encryption(struct vnt_private *pDevice, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: %d\n", iNodeIndex); memset(param->u.crypt.seq, 0, 8); for (ii = 0 ; ii < 8 ; ii++) { - param->u.crypt.seq[ii] = (BYTE)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8); + param->u.crypt.seq[ii] = (u8)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8); } return ret; } - /* * Description: * vt6656_hostap_ioctl main function supported for hostap daemon. @@ -779,7 +763,6 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) goto out; } - if ((ret == 0) && ap_ioctl) { if (copy_to_user(p->pointer, param, p->length)) { ret = -EFAULT; diff --git a/drivers/staging/vt6656/hostap.h b/drivers/staging/vt6656/hostap.h index f5656cd96a8f..6a68f7e69cff 100644 --- a/drivers/staging/vt6656/hostap.h +++ b/drivers/staging/vt6656/hostap.h @@ -31,8 +31,6 @@ #include "device.h" -/*--------------------- Export Definitions -------------------------*/ - #define WLAN_RATE_1M BIT0 #define WLAN_RATE_2M BIT1 #define WLAN_RATE_5M5 BIT2 @@ -46,13 +44,6 @@ #define WLAN_RATE_48M BIT10 #define WLAN_RATE_54M BIT11 - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - #ifndef ETH_P_PAE #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ #endif /* ETH_P_PAE */ diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index 51990bd3dd45..a2b4ba6d4f01 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -40,19 +40,8 @@ #include "bssdb.h" #include "usbpipe.h" -/*--------------------- Static Definitions -------------------------*/ static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */ -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - /*+ * * Function: InterruptPollingThread @@ -98,8 +87,8 @@ void INTnsProcessData(struct vnt_private *pDevice) pINTData = (PSINTData) pDevice->intBuf.pDataBuf; if (pINTData->byTSR0 & TSR_VALID) { STAvUpdateTDStatCounter(&(pDevice->scStatistic), - (BYTE)(pINTData->byPkt0 & 0x0F), - (BYTE)(pINTData->byPkt0>>4), + (u8)(pINTData->byPkt0 & 0x0F), + (u8)(pINTData->byPkt0>>4), pINTData->byTSR0); BSSvUpdateNodeTxCounter(pDevice, &(pDevice->scStatistic), @@ -109,8 +98,8 @@ void INTnsProcessData(struct vnt_private *pDevice) } if (pINTData->byTSR1 & TSR_VALID) { STAvUpdateTDStatCounter(&(pDevice->scStatistic), - (BYTE)(pINTData->byPkt1 & 0x0F), - (BYTE)(pINTData->byPkt1>>4), + (u8)(pINTData->byPkt1 & 0x0F), + (u8)(pINTData->byPkt1>>4), pINTData->byTSR1); BSSvUpdateNodeTxCounter(pDevice, &(pDevice->scStatistic), @@ -120,8 +109,8 @@ void INTnsProcessData(struct vnt_private *pDevice) } if (pINTData->byTSR2 & TSR_VALID) { STAvUpdateTDStatCounter(&(pDevice->scStatistic), - (BYTE)(pINTData->byPkt2 & 0x0F), - (BYTE)(pINTData->byPkt2>>4), + (u8)(pINTData->byPkt2 & 0x0F), + (u8)(pINTData->byPkt2>>4), pINTData->byTSR2); BSSvUpdateNodeTxCounter(pDevice, &(pDevice->scStatistic), @@ -131,8 +120,8 @@ void INTnsProcessData(struct vnt_private *pDevice) } if (pINTData->byTSR3 & TSR_VALID) { STAvUpdateTDStatCounter(&(pDevice->scStatistic), - (BYTE)(pINTData->byPkt3 & 0x0F), - (BYTE)(pINTData->byPkt3>>4), + (u8)(pINTData->byPkt3 & 0x0F), + (u8)(pINTData->byPkt3>>4), pINTData->byTSR3); BSSvUpdateNodeTxCounter(pDevice, &(pDevice->scStatistic), diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h index 27c725f1ce11..8e6e217ba4ff 100644 --- a/drivers/staging/vt6656/int.h +++ b/drivers/staging/vt6656/int.h @@ -30,40 +30,32 @@ #ifndef __INT_H__ #define __INT_H__ -#include "ttype.h" #include "device.h" -/*--------------------- Export Definitions -------------------------*/ typedef struct tagSINTData { - BYTE byTSR0; - BYTE byPkt0; - WORD wTime0; - BYTE byTSR1; - BYTE byPkt1; - WORD wTime1; - BYTE byTSR2; - BYTE byPkt2; - WORD wTime2; - BYTE byTSR3; - BYTE byPkt3; - WORD wTime3; + u8 byTSR0; + u8 byPkt0; + u16 wTime0; + u8 byTSR1; + u8 byPkt1; + u16 wTime1; + u8 byTSR2; + u8 byPkt2; + u16 wTime2; + u8 byTSR3; + u8 byPkt3; + u16 wTime3; u64 qwTSF; - BYTE byISR0; - BYTE byISR1; - BYTE byRTSSuccess; - BYTE byRTSFail; - BYTE byACKFail; - BYTE byFCSErr; - BYTE abySW[2]; + u8 byISR0; + u8 byISR1; + u8 byRTSSuccess; + u8 byRTSFail; + u8 byACKFail; + u8 byFCSErr; + u8 abySW[2]; } __attribute__ ((__packed__)) SINTData, *PSINTData; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - void INTvWorkItem(struct vnt_private *); void INTnsProcessData(struct vnt_private *); diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h index c354a77964d8..f3406da7336e 100644 --- a/drivers/staging/vt6656/iocmd.h +++ b/drivers/staging/vt6656/iocmd.h @@ -29,10 +29,6 @@ #ifndef __IOCMD_H__ #define __IOCMD_H__ -#include "ttype.h" - -/*--------------------- Export Definitions -------------------------*/ - // ioctl Command code #define MAGIC_CODE 0x3142 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0) @@ -181,14 +177,12 @@ typedef struct tagSBSSIDItem { } __packed SBSSIDItem; - typedef struct tagSBSSIDList { u32 uItem; SBSSIDItem sBSSIDList[0]; } __packed SBSSIDList, *PSBSSIDList; - typedef struct tagSNodeItem { // STA info u16 wAID; @@ -209,7 +203,6 @@ typedef struct tagSNodeItem { } __packed SNodeItem; - typedef struct tagSNodeList { u32 uItem; @@ -217,7 +210,6 @@ typedef struct tagSNodeList { } __packed SNodeList, *PSNodeList; - typedef struct tagSCmdLinkStatus { bool bLink; @@ -248,8 +240,6 @@ typedef struct tagSDot11MIBCount { u32 FCSErrorCount; } __packed SDot11MIBCount, *PSDot11MIBCount; - - // // statistic counter // @@ -432,12 +422,4 @@ struct viawget_hostapd_param { } u; } __packed; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - #endif /* __IOCMD_H__ */ diff --git a/drivers/staging/vt6656/iowpa.h b/drivers/staging/vt6656/iowpa.h index 2522ddec718d..97af32e1fa44 100644 --- a/drivers/staging/vt6656/iowpa.h +++ b/drivers/staging/vt6656/iowpa.h @@ -29,8 +29,6 @@ #ifndef __IOWPA_H__ #define __IOWPA_H__ -/*--------------------- Export Definitions -------------------------*/ - #define WPA_IE_LEN 64 //WPA related @@ -55,7 +53,6 @@ enum { VIAWGET_SET_DISASSOCIATE = 10 }; - enum { VIAWGET_ASSOC_MSG = 1, VIAWGET_DISASSOC_MSG = 2, @@ -65,8 +62,6 @@ enum { VIAWGET_DEVICECLOSE_MSG = 6 }; - - typedef struct viawget_wpa_header { u8 type; u16 req_ie_len; @@ -130,12 +125,4 @@ struct viawget_scan_result { int maxrate; } __packed; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - #endif /* __IOWPA_H__ */ diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 69971f35e490..c335808211ee 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -42,7 +42,6 @@ #include "control.h" #include "rndis.h" - static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980, @@ -61,8 +60,8 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) pDevice->wstats.status = pDevice->eOPMode; if (pDevice->scStatistic.LinkQuality > 100) pDevice->scStatistic.LinkQuality = 100; - pDevice->wstats.qual.qual =(BYTE)pDevice->scStatistic.LinkQuality; - RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); + pDevice->wstats.qual.qual =(u8)pDevice->scStatistic.LinkQuality; + RFvRSSITodBm(pDevice, (u8)(pDevice->uCurrRSSI), &ldBm); pDevice->wstats.qual.level = ldBm; pDevice->wstats.qual.noise = 0; pDevice->wstats.qual.updated = 1; @@ -95,7 +94,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq = &wrqu->data; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_scan_req *req = (struct iw_scan_req *)extra; - BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + u8 abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; PWLAN_IE_SSID pItemSSID = NULL; if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) @@ -238,7 +237,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, // ADD quality memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVQUAL; - RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm); + RFvRSSITodBm(pDevice, (u8)(pBSS->uRSSI), &ldBm); iwe.u.qual.level = ldBm; iwe.u.qual.noise = 0; @@ -357,7 +356,6 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, if (pMgmt == NULL) return -EFAULT; - #ifdef WEXT_USECHANNELS wrq->m = (int)pMgmt->uCurrChannel; wrq->e = 0; @@ -482,7 +480,6 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, pDevice->bCommit = false; } - return rc; } @@ -532,7 +529,7 @@ int iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_range *range = (struct iw_range *)extra; int i; int k; - BYTE abySupportedRates[13] = { + u8 abySupportedRates[13] = { 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90 }; @@ -635,7 +632,7 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq = &wrqu->ap_addr; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int rc = 0; - BYTE ZeroBSSID[WLAN_BSSID_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + u8 ZeroBSSID[WLAN_BSSID_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; PRINT_K(" SIOCSIWAP\n"); @@ -819,7 +816,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, if (pDevice->bWPASuppWextEnabled == true) { /*******search if in hidden ssid mode ****/ PKnownBSS pCurr = NULL; - BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + u8 abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; unsigned ii; unsigned uSameBssidNum = 0; @@ -913,7 +910,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, int rc = 0; u8 brate = 0; int i; - BYTE abySupportedRates[13] = { + u8 abySupportedRates[13] = { 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90 }; @@ -996,7 +993,7 @@ int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, return -EFAULT; { - BYTE abySupportedRates[13] = { + u8 abySupportedRates[13] = { 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90 }; @@ -1227,7 +1224,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, KEY_CTL_WEP); spin_unlock_irq(&pDevice->lock); } - pDevice->byKeyIndex = (BYTE)dwKeyIndex; + pDevice->byKeyIndex = (u8)dwKeyIndex; pDevice->uKeyLength = wrq->length; pDevice->bTransmitKey = true; pDevice->bEncryptionEnable = true; @@ -1317,7 +1314,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); } - } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index, &pKey)) { + } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (u8)index, &pKey)) { wrq->length = pKey->uKeyLength; memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); @@ -1424,7 +1421,7 @@ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS\n"); if (pDevice->bLinkPass == true) { - RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); + RFvRSSITodBm(pDevice, (u8)(pDevice->uCurrRSSI), &ldBm); wrq->value = ldBm; } else { wrq->value = 0; diff --git a/drivers/staging/vt6656/iwctl.h b/drivers/staging/vt6656/iwctl.h index b594a10db318..dceda0dbdfe1 100644 --- a/drivers/staging/vt6656/iwctl.h +++ b/drivers/staging/vt6656/iwctl.h @@ -31,14 +31,6 @@ #include "device.h" -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev); int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 416175e8ba53..205590b0e9c8 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -42,24 +42,9 @@ #include "rndis.h" #include "control.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ static void s_vCheckKeyTableValid(struct vnt_private *pDevice, PSKeyManagement pTable) { @@ -79,7 +64,7 @@ static void s_vCheckKeyTableValid(struct vnt_private *pDevice, pTable->KeyTable[i].bInUse = false; pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].bSoftWEP = false; - pbyData[wLength++] = (BYTE) i; + pbyData[wLength++] = (u8) i; //MACvDisableKeyEntry(pDevice, i); } } @@ -95,10 +80,6 @@ static void s_vCheckKeyTableValid(struct vnt_private *pDevice, } - -/*--------------------- Export Functions --------------------------*/ - - /* * Description: Init Key management table * @@ -130,9 +111,9 @@ void KeyvInitTable(struct vnt_private *pDevice, PSKeyManagement pTable) pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].dwGTKeyIndex = 0; pTable->KeyTable[i].bSoftWEP = false; - pbyData[i] = (BYTE) i; + pbyData[i] = (u8) i; } - pbyData[i] = (BYTE) i; + pbyData[i] = (u8) i; CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_CLRKEYENTRY, 0, @@ -146,7 +127,6 @@ void KeyvInitTable(struct vnt_private *pDevice, PSKeyManagement pTable) return; } - /* * Description: Get Key from table * @@ -197,7 +177,6 @@ int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, return (false); } - /* * Description: Set Key to table * @@ -272,7 +251,7 @@ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, if (uKeyLength == WLAN_WEP104_KEYLEN) pKey->abyKey[15] |= 0x80; } - MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (PDWORD)pKey->abyKey); + MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (u32 *)pKey->abyKey); if ((dwKeyIndex & USE_KEYRSC) == 0) pKey->KeyRSC = 0; /* RSC set by NIC */ @@ -340,7 +319,7 @@ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, if (uKeyLength == WLAN_WEP104_KEYLEN) pKey->abyKey[15] |= 0x80; } - MACvSetKeyEntry(pDevice, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (PDWORD)pKey->abyKey); + MACvSetKeyEntry(pDevice, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (u32 *)pKey->abyKey); if ((dwKeyIndex & USE_KEYRSC) == 0) pKey->KeyRSC = 0; /* RSC set by NIC */ @@ -370,7 +349,6 @@ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, return (false); } - /* * Description: Remove Key from table * @@ -445,10 +423,8 @@ int KeybRemoveKey(struct vnt_private *pDevice, PSKeyManagement pTable, s_vCheckKeyTableValid(pDevice,pTable); return bReturnValue; - } - /* * Description: Remove Key from table * @@ -483,45 +459,6 @@ int KeybRemoveAllKey(struct vnt_private *pDevice, PSKeyManagement pTable, } /* - * Description: Remove WEP Key from table - * - * Parameters: - * In: - * pTable - Pointer to Key table - * Out: - * none - * - * Return Value: true if success otherwise false - * - */ -void KeyvRemoveWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable, - u32 dwKeyIndex) -{ - - if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == true) { - if (pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].byCipherSuite == KEY_CTL_WEP) { - pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; - if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex & 0x7FFFFFFF)) { - // remove Group transmit key - pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = 0; - } - } - } - s_vCheckKeyTableValid(pDevice, pTable); - } - return; -} - -void KeyvRemoveAllWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable) -{ - int i; - - for (i = 0; i < MAX_GROUP_KEY; i++) - KeyvRemoveWEPKey(pDevice, pTable, i); -} - -/* * Description: Get Transmit Key from table * * Parameters: @@ -557,7 +494,6 @@ int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - return (true); } else { @@ -599,35 +535,6 @@ int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, return (false); } - -/* - * Description: Check Pairwise Key - * - * Parameters: - * In: - * pTable - Pointer to Key table - * Out: - * none - * - * Return Value: true if found otherwise false - * - */ -int KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) -{ - int i; - - *pKey = NULL; - - for (i=0;i<MAX_KEY_TABLE;i++) { - if ((pTable->KeyTable[i].bInUse == true) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == true)) { - *pKey = &(pTable->KeyTable[i].PairwiseKey); - return (true); - } - } - return (false); -} - /* * Description: Set Key to table * @@ -707,18 +614,16 @@ int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, pKey->abyKey[15] |= 0x80; } - MACvSetKeyEntry(pDevice, pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl, MAX_KEY_TABLE-1, uKeyIdx, pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID, (PDWORD) pKey->abyKey); + MACvSetKeyEntry(pDevice, pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl, MAX_KEY_TABLE-1, uKeyIdx, pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID, (u32 *) pKey->abyKey); if ((dwKeyIndex & USE_KEYRSC) == 0) pKey->KeyRSC = 0; /* RSC set by NIC */ else pKey->KeyRSC = *KeyRSC; - pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(R): \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n", pKey->bKeyValid); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n", (int)pKey->uKeyLength); @@ -737,7 +642,6 @@ int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, return (true); } - /* * Description: Set Key to table * @@ -766,7 +670,6 @@ int KeybSetAllGroupKey(struct vnt_private *pDevice, PSKeyManagement pTable, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %X\n", dwKeyIndex); - if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key return (false); } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) { @@ -805,7 +708,7 @@ int KeybSetAllGroupKey(struct vnt_private *pDevice, PSKeyManagement pTable, pKey->abyKey[15] |= 0x80; } - MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pTable->KeyTable[i].abyBSSID, (PDWORD) pKey->abyKey); + MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pTable->KeyTable[i].abyBSSID, (u32 *) pKey->abyKey); if ((dwKeyIndex & USE_KEYRSC) == 0) pKey->KeyRSC = 0; /* RSC set by NIC */ diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h index 7ecddcd6bcfa..23e188d125ba 100644 --- a/drivers/staging/vt6656/key.h +++ b/drivers/staging/vt6656/key.h @@ -30,17 +30,14 @@ #ifndef __KEY_H__ #define __KEY_H__ -#include "ttype.h" #include "tether.h" #include "80211mgr.h" -/*--------------------- Export Definitions -------------------------*/ #define MAX_GROUP_KEY 4 #define MAX_KEY_TABLE 11 #define MAX_KEY_LEN 32 #define AES_KEY_LEN 16 - #define AUTHENTICATOR_KEY 0x10000000 #define USE_KEYRSC 0x20000000 #define PAIRWISE_KEY 0x40000000 @@ -54,32 +51,31 @@ #define KEY_CTL_CCMP 0x03 #define KEY_CTL_INVALID 0xFF - typedef struct tagSKeyItem { bool bKeyValid; u32 uKeyLength; - BYTE abyKey[MAX_KEY_LEN]; + u8 abyKey[MAX_KEY_LEN]; u64 KeyRSC; - DWORD dwTSC47_16; - WORD wTSC15_0; - BYTE byCipherSuite; - BYTE byReserved0; - DWORD dwKeyIndex; + u32 dwTSC47_16; + u16 wTSC15_0; + u8 byCipherSuite; + u8 byReserved0; + u32 dwKeyIndex; void *pvKeyTable; } SKeyItem, *PSKeyItem; //64 typedef struct tagSKeyTable { - BYTE abyBSSID[ETH_ALEN]; /* 6 */ - BYTE byReserved0[2]; //8 + u8 abyBSSID[ETH_ALEN]; /* 6 */ + u8 byReserved0[2]; //8 SKeyItem PairwiseKey; SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328 - DWORD dwGTKeyIndex; // GroupTransmitKey Index + u32 dwGTKeyIndex; // GroupTransmitKey Index bool bInUse; - WORD wKeyCtl; + u16 wKeyCtl; bool bSoftWEP; - BYTE byReserved1[6]; + u8 byReserved1[6]; } SKeyTable, *PSKeyTable; //352 typedef struct tagSKeyManagement @@ -87,16 +83,6 @@ typedef struct tagSKeyManagement SKeyTable KeyTable[MAX_KEY_TABLE]; } SKeyManagement, *PSKeyManagement; -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - void KeyvInitTable(struct vnt_private *, PSKeyManagement pTable); int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, @@ -112,16 +98,9 @@ int KeybRemoveKey(struct vnt_private *, PSKeyManagement pTable, int KeybRemoveAllKey(struct vnt_private *, PSKeyManagement pTable, u8 *pbyBSSID); -void KeyvRemoveWEPKey(struct vnt_private *, PSKeyManagement pTable, - u32 dwKeyIndex); - -void KeyvRemoveAllWEPKey(struct vnt_private *, PSKeyManagement pTable); - int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, PSKeyItem *pKey); -int KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey); - int KeybSetDefaultKey(struct vnt_private *, PSKeyManagement pTable, u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, u8 byKeyDecMode); diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 76d307b58d52..343db19283a2 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -38,63 +38,8 @@ #include "rndis.h" #include "control.h" -/*--------------------- Static Definitions -------------------------*/ //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - - - - - -/* - * Description: - * Set this hash index into multicast address register bit - * - * Parameters: - * In: - * byHashIdx - Hash index to set - * Out: - * none - * - * Return Value: none - * - */ -void MACvSetMultiAddrByHash(struct vnt_private *pDevice, u8 byHashIdx) -{ - u8 uByteIdx; - u8 byBitMask; - u8 pbyData[2]; - - - // calculate byte position - uByteIdx = byHashIdx / 8; - - // calculate bit position - byBitMask = 1; - byBitMask <<= (byHashIdx % 8); - // turn on the bit - - pbyData[0] = byBitMask; - pbyData[1] = byBitMask; - - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - (WORD) (MAC_REG_MAR0 + uByteIdx), - MESSAGE_REQUEST_MACREG, - 2, - pbyData); -} - - /* * Description: @@ -117,13 +62,12 @@ void MACvWriteMultiAddr(struct vnt_private *pDevice, u32 uByteIdx, u8 byData) byData1 = byData; CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, - (WORD) (MAC_REG_MAR0 + uByteIdx), + (u16) (MAC_REG_MAR0 + uByteIdx), MESSAGE_REQUEST_MACREG, 1, &byData1); } - /* * Description: * Shut Down MAC @@ -150,7 +94,6 @@ void MACvSetBBType(struct vnt_private *pDevice, u8 byType) { u8 pbyData[2]; - pbyData[0] = byType; pbyData[1] = EnCFG_BBType_MASK; @@ -163,26 +106,6 @@ void MACvSetBBType(struct vnt_private *pDevice, u8 byType) ); } -void MACvSetMISCFifo(struct vnt_private *pDevice, u16 wOffset, u32 dwData) -{ - u8 pbyData[4]; - - if (wOffset > 273) - return; - pbyData[0] = (BYTE)dwData; - pbyData[1] = (BYTE)(dwData>>8); - pbyData[2] = (BYTE)(dwData>>16); - pbyData[3] = (BYTE)(dwData>>24); - - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MISCFF, - wOffset, - 0, - 4, - pbyData - ); -} - /* * Description: * Disable the Key Entry by MISCFIFO @@ -202,8 +125,7 @@ void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) u16 wOffset; u8 byData; - - byData = (BYTE) uEntryIdx; + byData = (u8) uEntryIdx; wOffset = MISCFIFO_KEYETRY0; wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); @@ -222,7 +144,6 @@ void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) ); } - /* * Description: * Set the Key by MISCFIFO @@ -294,31 +215,29 @@ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); } */ - pbyKey = (PBYTE)pdwKey; - - pbyData[0] = (BYTE)dwData1; - pbyData[1] = (BYTE)(dwData1>>8); - pbyData[2] = (BYTE)(dwData1>>16); - pbyData[3] = (BYTE)(dwData1>>24); - pbyData[4] = (BYTE)dwData2; - pbyData[5] = (BYTE)(dwData2>>8); - pbyData[6] = (BYTE)(dwData2>>16); - pbyData[7] = (BYTE)(dwData2>>24); + pbyKey = (u8 *)pdwKey; + + pbyData[0] = (u8)dwData1; + pbyData[1] = (u8)(dwData1>>8); + pbyData[2] = (u8)(dwData1>>16); + pbyData[3] = (u8)(dwData1>>24); + pbyData[4] = (u8)dwData2; + pbyData[5] = (u8)(dwData2>>8); + pbyData[6] = (u8)(dwData2>>16); + pbyData[7] = (u8)(dwData2>>24); for (ii = 8; ii < 24; ii++) pbyData[ii] = *pbyKey++; CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SETKEY, wOffset, - (WORD)uKeyIdx, + (u16)uKeyIdx, 24, pbyData ); - } - void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { u8 pbyData[2]; @@ -335,12 +254,10 @@ void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) ); } - void MACvRegBitsOn(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { u8 pbyData[2]; - pbyData[0] = byBits; pbyData[1] = byBits; @@ -357,9 +274,8 @@ void MACvWriteWord(struct vnt_private *pDevice, u8 byRegOfs, u16 wData) { u8 pbyData[2]; - - pbyData[0] = (BYTE)(wData & 0xff); - pbyData[1] = (BYTE)(wData >> 8); + pbyData[0] = (u8)(wData & 0xff); + pbyData[1] = (u8)(wData >> 8); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, @@ -375,13 +291,12 @@ void MACvWriteBSSIDAddress(struct vnt_private *pDevice, u8 *pbyEtherAddr) { u8 pbyData[6]; - - pbyData[0] = *((PBYTE)pbyEtherAddr); - pbyData[1] = *((PBYTE)pbyEtherAddr+1); - pbyData[2] = *((PBYTE)pbyEtherAddr+2); - pbyData[3] = *((PBYTE)pbyEtherAddr+3); - pbyData[4] = *((PBYTE)pbyEtherAddr+4); - pbyData[5] = *((PBYTE)pbyEtherAddr+5); + pbyData[0] = *((u8 *)pbyEtherAddr); + pbyData[1] = *((u8 *)pbyEtherAddr+1); + pbyData[2] = *((u8 *)pbyEtherAddr+2); + pbyData[3] = *((u8 *)pbyEtherAddr+3); + pbyData[4] = *((u8 *)pbyEtherAddr+4); + pbyData[5] = *((u8 *)pbyEtherAddr+5); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, @@ -396,7 +311,6 @@ void MACvEnableProtectMD(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = EnCFG_ProtectMd; pbyData[1] = EnCFG_ProtectMd; @@ -413,7 +327,6 @@ void MACvDisableProtectMD(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = 0; pbyData[1] = EnCFG_ProtectMd; @@ -430,7 +343,6 @@ void MACvEnableBarkerPreambleMd(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = EnCFG_BarkerPream; pbyData[1] = EnCFG_BarkerPream; @@ -447,7 +359,6 @@ void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = 0; pbyData[1] = EnCFG_BarkerPream; @@ -460,7 +371,6 @@ void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice) ); } - void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval) { u8 pbyData[2]; diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h index 6e28500ae5f8..0db1be5b01c8 100644 --- a/drivers/staging/vt6656/mac.h +++ b/drivers/staging/vt6656/mac.h @@ -34,12 +34,9 @@ #ifndef __MAC_H__ #define __MAC_H__ -#include "ttype.h" #include "device.h" #include "tmacro.h" -/*--------------------- Export Definitions -------------------------*/ - #define REV_ID_VT3253_A0 0x00 #define REV_ID_VT3253_A1 0x01 #define REV_ID_VT3253_B0 0x08 @@ -156,7 +153,6 @@ #define MAC_REG_RSPINF_A_54 0xFA #define MAC_REG_RSPINF_A_72 0xFC - // // Bits in the I2MCFG EEPROM register // @@ -281,7 +277,6 @@ #define TCR_SYNCDCFOPT 0x02 // #define TCR_AUTOBCNTX 0x01 // Beacon automatically transmit enable - //ISR1 #define ISR_GPIO3 0x40 #define ISR_RXNOBUF 0x08 @@ -377,7 +372,6 @@ // #define MISCFFCTL_WRITE 0x0001 // - // Loopback mode #define MAC_LB_EXT 0x02 // #define MAC_LB_INTERNAL 0x01 // @@ -409,22 +403,9 @@ #define MAC_REVISION_A0 0x00 #define MAC_REVISION_A1 0x01 - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - -void MACvSetMultiAddrByHash(struct vnt_private *, u8); void MACvWriteMultiAddr(struct vnt_private *, u32, u8); void MACbShutdown(struct vnt_private *); void MACvSetBBType(struct vnt_private *, u8); -void MACvSetMISCFifo(struct vnt_private *pDevice, u16, u32); void MACvDisableKeyEntry(struct vnt_private *, u32); void MACvSetKeyEntry(struct vnt_private *, u16, u32, u32, u8 *, u32 *); void MACvRegBitsOff(struct vnt_private *, u8, u8); diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index d5f53e1a74a2..2161af83eaa0 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -72,7 +72,6 @@ #include "int.h" #include "iowpa.h" -/*--------------------- Static Definitions -------------------------*/ /* static int msglevel = MSG_LEVEL_DEBUG; */ static int msglevel =MSG_LEVEL_INFO; @@ -95,14 +94,12 @@ MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); #define RX_DESC_DEF0 64 DEVICE_PARAM(RxDescriptors0,"Number of receive usb desc buffer"); - #define TX_DESC_DEF0 64 DEVICE_PARAM(TxDescriptors0,"Number of transmit usb desc buffer"); #define CHANNEL_DEF 6 DEVICE_PARAM(Channel, "Channel number"); - /* PreambleType[] is the preamble length used for transmit. 0: indicate allows long preamble type 1: indicate allows short preamble type @@ -118,7 +115,6 @@ DEVICE_PARAM(RTSThreshold, "RTS threshold"); #define FRAG_THRESH_DEF 2346 DEVICE_PARAM(FragThreshold, "Fragmentation threshold"); - #define DATA_RATE_DEF 13 /* datarate[] index 0: indicate 1 Mbps 0x02 @@ -148,7 +144,6 @@ DEVICE_PARAM(OPMode, "Infrastruct, adhoc, AP mode "); 2: indicate AP mode used */ - /* PSMode[] 0: indicate disable power saving mode 1: indicate enable power saving mode @@ -157,7 +152,6 @@ DEVICE_PARAM(OPMode, "Infrastruct, adhoc, AP mode "); #define PS_MODE_DEF 0 DEVICE_PARAM(PSMode, "Power saving mode"); - #define SHORT_RETRY_DEF 8 DEVICE_PARAM(ShortRetryLimit, "Short frame retry limits"); @@ -173,8 +167,6 @@ DEVICE_PARAM(LongRetryLimit, "long frame retry limits"); #define BBP_TYPE_DEF 2 DEVICE_PARAM(BasebandType, "baseband type"); - - /* 80211hEnable[] 0: indicate disable 802.11h 1: indicate enable 802.11h @@ -184,7 +176,6 @@ DEVICE_PARAM(BasebandType, "baseband type"); DEVICE_PARAM(b80211hEnable, "802.11h mode"); - /* * Static vars definitions */ @@ -204,12 +195,9 @@ static const long frequency_list[] = { 5700, 5745, 5765, 5785, 5805, 5825 }; - 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); @@ -245,21 +233,13 @@ static int Config_FileGetParameter(unsigned char *string, unsigned char *dest, unsigned char *source); - static void usb_device_reset(struct vnt_private *pDevice); - - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - - static void device_set_options(struct vnt_private *pDevice) { - BYTE abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - BYTE abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; + 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}; memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN); @@ -293,7 +273,6 @@ device_set_options(struct vnt_private *pDevice) { pDevice->bDiversityRegCtlON = false; } - static void device_init_diversity_timer(struct vnt_private *pDevice) { init_timer(&pDevice->TimerSQ3Tmax1); @@ -314,7 +293,6 @@ static void device_init_diversity_timer(struct vnt_private *pDevice) return; } - /* * initialization of MAC & BBP registers */ @@ -366,8 +344,8 @@ static int device_init_registers(struct vnt_private *pDevice, } } - sInitCmd.byInitClass = (BYTE)InitType; - sInitCmd.bExistSWNetAddr = (BYTE) pDevice->bExistSWNetAddr; + sInitCmd.byInitClass = (u8)InitType; + sInitCmd.bExistSWNetAddr = (u8) pDevice->bExistSWNetAddr; for (ii = 0; ii < 6; ii++) sInitCmd.bySWNetAddr[ii] = pDevice->abyCurrentNetAddr[ii]; sInitCmd.byShortRetryLimit = pDevice->byShortRetryLimit; @@ -379,7 +357,7 @@ static int device_init_registers(struct vnt_private *pDevice, 0, 0, sizeof(CMD_CARD_INIT), - (PBYTE) &(sInitCmd)); + (u8 *) &(sInitCmd)); if ( ntStatus != STATUS_SUCCESS ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Issue Card init fail \n"); @@ -388,7 +366,7 @@ static int device_init_registers(struct vnt_private *pDevice, } if (InitType == DEVICE_INIT_COLD) { - ntStatus = CONTROLnsRequestIn(pDevice,MESSAGE_TYPE_INIT_RSP,0,0,sizeof(RSP_CARD_INIT), (PBYTE) &(sInitRsp)); + ntStatus = CONTROLnsRequestIn(pDevice,MESSAGE_TYPE_INIT_RSP,0,0,sizeof(RSP_CARD_INIT), (u8 *) &(sInitRsp)); if (ntStatus != STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Cardinit request in status fail!\n"); @@ -418,7 +396,7 @@ static int device_init_registers(struct vnt_private *pDevice, pDevice->bNonERPPresent = false; pDevice->bBarkerPreambleMd = false; if ( pDevice->bFixRate ) { - pDevice->wCurrentRate = (WORD) pDevice->uConnectionRate; + pDevice->wCurrentRate = (u16) pDevice->uConnectionRate; } else { if ( pDevice->byBBType == BB_TYPE_11B ) pDevice->wCurrentRate = RATE_11M; @@ -669,8 +647,6 @@ static int vt6656_suspend(struct usb_interface *intf, pm_message_t message) if (device->flags & DEVICE_FLAGS_OPENED) device_close(device->dev); - usb_put_dev(interface_to_usbdev(intf)); - return 0; } @@ -681,8 +657,6 @@ static int vt6656_resume(struct usb_interface *intf) if (!device || !device->dev) return -ENODEV; - usb_get_dev(interface_to_usbdev(intf)); - if (!(device->flags & DEVICE_FLAGS_OPENED)) device_open(device->dev); @@ -775,7 +749,6 @@ static void device_free_tx_bufs(struct vnt_private *pDevice) return; } - static void device_free_rx_bufs(struct vnt_private *pDevice) { PRCB pRCB; @@ -813,7 +786,6 @@ static void device_free_int_bufs(struct vnt_private *pDevice) return; } - static bool device_alloc_bufs(struct vnt_private *pDevice) { @@ -821,7 +793,6 @@ static bool device_alloc_bufs(struct vnt_private *pDevice) PRCB pRCB; int ii; - for (ii = 0; ii < pDevice->cbTD; ii++) { pTxContext = kmalloc(sizeof(USB_SEND_CONTEXT), GFP_KERNEL); @@ -847,7 +818,6 @@ static bool device_alloc_bufs(struct vnt_private *pDevice) goto free_tx; } - pDevice->FirstRecvFreeList = NULL; pDevice->LastRecvFreeList = NULL; pDevice->FirstRecvMngList = NULL; @@ -878,7 +848,6 @@ static bool device_alloc_bufs(struct vnt_private *pDevice) pRCB++; } - pDevice->pControlURB = usb_alloc_urb(0, GFP_ATOMIC); if (pDevice->pControlURB == NULL) { DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc control urb\n"); @@ -911,9 +880,6 @@ free_tx: return false; } - - - static bool device_init_defrag_cb(struct vnt_private *pDevice) { int i; @@ -937,8 +903,6 @@ free_frag: return false; } - - static void device_free_frag_bufs(struct vnt_private *pDevice) { PSDeFragControlBlock pDeF; @@ -953,8 +917,6 @@ static void device_free_frag_bufs(struct vnt_private *pDevice) } } - - int device_alloc_frag_buf(struct vnt_private *pDevice, PSDeFragControlBlock pDeF) { @@ -968,9 +930,6 @@ int device_alloc_frag_buf(struct vnt_private *pDevice, return true; } - -/*-----------------------------------------------------------------*/ - static int device_open(struct net_device *dev) { struct vnt_private *pDevice = netdev_priv(dev); @@ -979,7 +938,6 @@ static int device_open(struct net_device *dev) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_open...\n"); - pDevice->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS; if (device_alloc_bufs(pDevice) == false) { @@ -1065,7 +1023,6 @@ static int device_open(struct net_device *dev) else bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); - netif_stop_queue(pDevice->dev); pDevice->flags |= DEVICE_FLAGS_OPENED; @@ -1087,8 +1044,6 @@ free_rx_tx: return -ENOMEM; } - - static int device_close(struct net_device *dev) { struct vnt_private *pDevice = netdev_priv(dev); @@ -1104,7 +1059,6 @@ static int device_close(struct net_device *dev) mdelay(30); } - memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pMgmt->bShareKeyAlgorithm = false; pDevice->bEncryptionEnable = false; @@ -1169,7 +1123,6 @@ static void vt6656_disconnect(struct usb_interface *intf) if (!device) return; - usb_set_intfdata(intf, NULL); usb_put_dev(interface_to_usbdev(intf)); @@ -1434,7 +1387,6 @@ static void device_set_multi(struct net_device *dev) u8 byTmpMode = 0; int rc; - spin_lock_irq(&pDevice->lock); rc = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, @@ -1470,8 +1422,8 @@ static void device_set_multi(struct net_device *dev) mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31)); } for (ii = 0; ii < 4; ii++) { - MACvWriteMultiAddr(pDevice, ii, *((PBYTE)&mc_filter[0] + ii)); - MACvWriteMultiAddr(pDevice, ii+ 4, *((PBYTE)&mc_filter[1] + ii)); + MACvWriteMultiAddr(pDevice, ii, *((u8 *)&mc_filter[0] + ii)); + MACvWriteMultiAddr(pDevice, ii+ 4, *((u8 *)&mc_filter[1] + ii)); } pDevice->byRxMode &= ~(RCR_UNICAST); pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST); @@ -1522,7 +1474,6 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return rc; } - static int ethtool_ioctl(struct net_device *dev, void *useraddr) { u32 ethcmd; diff --git a/drivers/staging/vt6656/mib.c b/drivers/staging/vt6656/mib.c index d4c7b0cc7ecd..12333cdcbc6a 100644 --- a/drivers/staging/vt6656/mib.c +++ b/drivers/staging/vt6656/mib.c @@ -25,10 +25,8 @@ * Date: May 21, 1996 * * Functions: - * STAvClearAllCounter - Clear All MIB Counter * STAvUpdateIstStatCounter - Update ISR statistic counter * STAvUpdateRDStatCounter - Update Rx statistic counter - * STAvUpdateRDStatCounterEx - Update Rx statistic counter and copy rcv data * STAvUpdateTDStatCounter - Update Tx statistic counter * STAvUpdateTDStatCounterEx - Update Tx statistic counter and copy tx data * STAvUpdate802_11Counter - Update 802.11 mib counter @@ -43,38 +41,7 @@ #include "wctl.h" #include "baseband.h" -/*--------------------- Static Definitions -------------------------*/ static int msglevel =MSG_LEVEL_INFO; -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - - - -/* - * Description: Clear All Statistic Counter - * - * Parameters: - * In: - * pStatistic - Pointer to Statistic Counter Data Structure - * Out: - * none - * - * Return Value: none - * - */ -void STAvClearAllCounter (PSStatCounter pStatistic) -{ - // set memory to zero - memset(pStatistic, 0, sizeof(SStatCounter)); -} - /* * Description: Update Isr Statistic Counter @@ -89,7 +56,7 @@ void STAvClearAllCounter (PSStatCounter pStatistic) * Return Value: none * */ -void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, BYTE byIsr0, BYTE byIsr1) +void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, u8 byIsr0, u8 byIsr1) { /**********************/ /* ABNORMAL interrupt */ @@ -100,7 +67,6 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, BYTE byIsr0, BYTE byIsr return; } - if (byIsr0 & ISR_ACTX) // ISR, bit0 pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful @@ -119,7 +85,6 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, BYTE byIsr0, BYTE byIsr if (byIsr0 & ISR_WATCHDOG) // ISR, bit7 pStatistic->ISRStat.dwIsrWatchDog++; - if (byIsr1 & ISR_FETALERR) // ISR, bit8 pStatistic->ISRStat.dwIsrUnrecoverableError++; @@ -134,7 +99,6 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, BYTE byIsr0, BYTE byIsr } - /* * Description: Update Rx Statistic Counter * @@ -152,12 +116,12 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, BYTE byIsr0, BYTE byIsr * */ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, - BYTE byRSR, BYTE byNewRSR, - BYTE byRxSts, BYTE byRxRate, - PBYTE pbyBuffer, unsigned int cbFrameLength) + u8 byRSR, u8 byNewRSR, + u8 byRxSts, u8 byRxRate, + u8 * pbyBuffer, unsigned int cbFrameLength) { /* need change */ - PS802_11Header pHeader = (PS802_11Header)pbyBuffer; + struct ieee80211_hdr *pHeader = (struct ieee80211_hdr *)pbyBuffer; if (byRSR & RSR_ADDROK) pStatistic->dwRsrADDROk++; @@ -327,7 +291,6 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, pStatistic->dwRsrRxPacket++; pStatistic->dwRsrRxOctet += cbFrameLength; - if (IS_TYPE_DATA(pbyBuffer)) { pStatistic->dwRsrRxData++; } else if (IS_TYPE_MGMT(pbyBuffer)){ @@ -343,7 +306,7 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, else pStatistic->dwRsrDirected++; - if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl)) + if (WLAN_GET_FC_MOREFRAG(pHeader->frame_control)) pStatistic->dwRsrRxFragment++; if (cbFrameLength < ETH_ZLEN + 4) { @@ -371,51 +334,6 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, } /* - * Description: Update Rx Statistic Counter and copy Rx buffer - * - * Parameters: - * In: - * pStatistic - Pointer to Statistic Counter Data Structure - * byRSR - Rx Status - * byNewRSR - Rx Status - * pbyBuffer - Rx Buffer - * cbFrameLength - Rx Length - * Out: - * none - * - * Return Value: none - * - */ - -void -STAvUpdateRDStatCounterEx ( - PSStatCounter pStatistic, - BYTE byRSR, - BYTE byNewRSR, - BYTE byRxSts, - BYTE byRxRate, - PBYTE pbyBuffer, - unsigned int cbFrameLength - ) -{ - STAvUpdateRDStatCounter( - pStatistic, - byRSR, - byNewRSR, - byRxSts, - byRxRate, - pbyBuffer, - cbFrameLength - ); - - // rx length - pStatistic->dwCntRxFrmLength = cbFrameLength; - // rx pattern, we just see 10 bytes for sample - memcpy(pStatistic->abyCntRxPattern, (PBYTE)pbyBuffer, 10); -} - - -/* * Description: Update Tx Statistic Counter * * Parameters: @@ -435,12 +353,12 @@ STAvUpdateRDStatCounterEx ( void STAvUpdateTDStatCounter ( PSStatCounter pStatistic, - BYTE byPktNum, - BYTE byRate, - BYTE byTSR + u8 byPktNum, + u8 byRate, + u8 byTSR ) { - BYTE byRetyCnt; + u8 byRetyCnt; // increase tx packet count pStatistic->dwTsrTxPacket++; @@ -504,8 +422,6 @@ STAvUpdateTDStatCounter ( } } - - /* * Description: Update 802.11 mib counter * @@ -524,10 +440,10 @@ void STAvUpdate802_11Counter( PSDot11Counters p802_11Counter, PSStatCounter pStatistic, - BYTE byRTSSuccess, - BYTE byRTSFail, - BYTE byACKFail, - BYTE byFCSErr + u8 byRTSSuccess, + u8 byRTSFail, + u8 byACKFail, + u8 byFCSErr ) { //p802_11Counter->TransmittedFragmentCount @@ -554,25 +470,6 @@ STAvUpdate802_11Counter( * * Parameters: * In: - * p802_11Counter - Pointer to 802.11 mib counter - * Out: - * none - * - * Return Value: none - * - */ -void -STAvClear802_11Counter(PSDot11Counters p802_11Counter) -{ - // set memory to zero - memset(p802_11Counter, 0, sizeof(SDot11Counters)); -} - -/* - * Description: Clear 802.11 mib counter - * - * Parameters: - * In: * pUsbCounter - Pointer to USB mib counter * ntStatus - URB status * Out: diff --git a/drivers/staging/vt6656/mib.h b/drivers/staging/vt6656/mib.h index 85c28e923663..35375325a777 100644 --- a/drivers/staging/vt6656/mib.h +++ b/drivers/staging/vt6656/mib.h @@ -29,28 +29,21 @@ #ifndef __MIB_H__ #define __MIB_H__ -#include "ttype.h" #include "tether.h" #include "desc.h" -/*--------------------- Export Definitions -------------------------*/ - - // // USB counter // typedef struct tagSUSBCounter { - DWORD dwCrc; + u32 dwCrc; } SUSBCounter, *PSUSBCounter; - - // // 802.11 counter // - typedef struct tagSDot11Counters { /* unsigned long Length; // Length of structure */ unsigned long long TransmittedFragmentCount; @@ -81,7 +74,6 @@ typedef struct tagSDot11Counters { */ } SDot11Counters, *PSDot11Counters; - // // MIB2 counter // @@ -91,24 +83,24 @@ typedef struct tagSMib2Counter { // e.g. "interface 1" signed long ifType; signed long ifMtu; - DWORD ifSpeed; - BYTE ifPhysAddress[ETH_ALEN]; + u32 ifSpeed; + u8 ifPhysAddress[ETH_ALEN]; signed long ifAdminStatus; signed long ifOperStatus; - DWORD ifLastChange; - DWORD ifInOctets; - DWORD ifInUcastPkts; - DWORD ifInNUcastPkts; - DWORD ifInDiscards; - DWORD ifInErrors; - DWORD ifInUnknownProtos; - DWORD ifOutOctets; - DWORD ifOutUcastPkts; - DWORD ifOutNUcastPkts; - DWORD ifOutDiscards; - DWORD ifOutErrors; - DWORD ifOutQLen; - DWORD ifSpecific; + u32 ifLastChange; + u32 ifInOctets; + u32 ifInUcastPkts; + u32 ifInNUcastPkts; + u32 ifInDiscards; + u32 ifInErrors; + u32 ifInUnknownProtos; + u32 ifOutOctets; + u32 ifOutUcastPkts; + u32 ifOutNUcastPkts; + u32 ifOutDiscards; + u32 ifOutErrors; + u32 ifOutQLen; + u32 ifSpecific; } SMib2Counter, *PSMib2Counter; // Value in the ifType entry @@ -119,32 +111,31 @@ typedef struct tagSMib2Counter { #define DOWN 2 // #define TESTING 3 // - // // RMON counter // typedef struct tagSRmonCounter { signed long etherStatsIndex; - DWORD etherStatsDataSource; - DWORD etherStatsDropEvents; - DWORD etherStatsOctets; - DWORD etherStatsPkts; - DWORD etherStatsBroadcastPkts; - DWORD etherStatsMulticastPkts; - DWORD etherStatsCRCAlignErrors; - DWORD etherStatsUndersizePkts; - DWORD etherStatsOversizePkts; - DWORD etherStatsFragments; - DWORD etherStatsJabbers; - DWORD etherStatsCollisions; - DWORD etherStatsPkt64Octets; - DWORD etherStatsPkt65to127Octets; - DWORD etherStatsPkt128to255Octets; - DWORD etherStatsPkt256to511Octets; - DWORD etherStatsPkt512to1023Octets; - DWORD etherStatsPkt1024to1518Octets; - DWORD etherStatsOwners; - DWORD etherStatsStatus; + u32 etherStatsDataSource; + u32 etherStatsDropEvents; + u32 etherStatsOctets; + u32 etherStatsPkts; + u32 etherStatsBroadcastPkts; + u32 etherStatsMulticastPkts; + u32 etherStatsCRCAlignErrors; + u32 etherStatsUndersizePkts; + u32 etherStatsOversizePkts; + u32 etherStatsFragments; + u32 etherStatsJabbers; + u32 etherStatsCollisions; + u32 etherStatsPkt64Octets; + u32 etherStatsPkt65to127Octets; + u32 etherStatsPkt128to255Octets; + u32 etherStatsPkt256to511Octets; + u32 etherStatsPkt512to1023Octets; + u32 etherStatsPkt1024to1518Octets; + u32 etherStatsOwners; + u32 etherStatsStatus; } SRmonCounter, *PSRmonCounter; // @@ -185,56 +176,52 @@ typedef struct tagSCustomCounters { } SCustomCounters, *PSCustomCounters; - // // Custom counter // typedef struct tagSISRCounters { unsigned long Length; - DWORD dwIsrTx0OK; - DWORD dwIsrAC0TxOK; - DWORD dwIsrBeaconTxOK; - DWORD dwIsrRx0OK; - DWORD dwIsrTBTTInt; - DWORD dwIsrSTIMERInt; - DWORD dwIsrWatchDog; - DWORD dwIsrUnrecoverableError; - DWORD dwIsrSoftInterrupt; - DWORD dwIsrMIBNearfull; - DWORD dwIsrRxNoBuf; - - DWORD dwIsrUnknown; // unknown interrupt count - - DWORD dwIsrRx1OK; - DWORD dwIsrATIMTxOK; - DWORD dwIsrSYNCTxOK; - DWORD dwIsrCFPEnd; - DWORD dwIsrATIMEnd; - DWORD dwIsrSYNCFlushOK; - DWORD dwIsrSTIMER1Int; + u32 dwIsrTx0OK; + u32 dwIsrAC0TxOK; + u32 dwIsrBeaconTxOK; + u32 dwIsrRx0OK; + u32 dwIsrTBTTInt; + u32 dwIsrSTIMERInt; + u32 dwIsrWatchDog; + u32 dwIsrUnrecoverableError; + u32 dwIsrSoftInterrupt; + u32 dwIsrMIBNearfull; + u32 dwIsrRxNoBuf; + + u32 dwIsrUnknown; // unknown interrupt count + + u32 dwIsrRx1OK; + u32 dwIsrATIMTxOK; + u32 dwIsrSYNCTxOK; + u32 dwIsrCFPEnd; + u32 dwIsrATIMEnd; + u32 dwIsrSYNCFlushOK; + u32 dwIsrSTIMER1Int; ///////////////////////////////////// } SISRCounters, *PSISRCounters; - // Value in the etherStatsStatus entry #define VALID 1 // #define CREATE_REQUEST 2 // #define UNDER_CREATION 3 // #define INVALID 4 // - // // Tx packet information // typedef struct tagSTxPktInfo { - BYTE byBroadMultiUni; - WORD wLength; - WORD wFIFOCtl; - BYTE abyDestAddr[ETH_ALEN]; + u8 byBroadMultiUni; + u16 wLength; + u16 wFIFOCtl; + u8 abyDestAddr[ETH_ALEN]; } STxPktInfo, *PSTxPktInfo; - #define MAX_RATE 12 // // statistic counter @@ -248,34 +235,34 @@ typedef struct tagSStatCounter { // RSR status count // - DWORD dwRsrFrmAlgnErr; - DWORD dwRsrErr; - DWORD dwRsrCRCErr; - DWORD dwRsrCRCOk; - DWORD dwRsrBSSIDOk; - DWORD dwRsrADDROk; - DWORD dwRsrBCNSSIDOk; - DWORD dwRsrLENErr; - DWORD dwRsrTYPErr; - - DWORD dwNewRsrDECRYPTOK; - DWORD dwNewRsrCFP; - DWORD dwNewRsrUTSF; - DWORD dwNewRsrHITAID; - DWORD dwNewRsrHITAID0; - - DWORD dwRsrLong; - DWORD dwRsrRunt; - - DWORD dwRsrRxControl; - DWORD dwRsrRxData; - DWORD dwRsrRxManage; - - DWORD dwRsrRxPacket; - DWORD dwRsrRxOctet; - DWORD dwRsrBroadcast; - DWORD dwRsrMulticast; - DWORD dwRsrDirected; + u32 dwRsrFrmAlgnErr; + u32 dwRsrErr; + u32 dwRsrCRCErr; + u32 dwRsrCRCOk; + u32 dwRsrBSSIDOk; + u32 dwRsrADDROk; + u32 dwRsrBCNSSIDOk; + u32 dwRsrLENErr; + u32 dwRsrTYPErr; + + u32 dwNewRsrDECRYPTOK; + u32 dwNewRsrCFP; + u32 dwNewRsrUTSF; + u32 dwNewRsrHITAID; + u32 dwNewRsrHITAID0; + + u32 dwRsrLong; + u32 dwRsrRunt; + + u32 dwRsrRxControl; + u32 dwRsrRxData; + u32 dwRsrRxManage; + + u32 dwRsrRxPacket; + u32 dwRsrRxOctet; + u32 dwRsrBroadcast; + u32 dwRsrMulticast; + u32 dwRsrDirected; // 64-bit OID unsigned long long ullRsrOK; @@ -287,47 +274,44 @@ typedef struct tagSStatCounter { unsigned long long ullRxMulticastFrames; unsigned long long ullRxDirectedFrames; - DWORD dwRsrRxFragment; - DWORD dwRsrRxFrmLen64; - DWORD dwRsrRxFrmLen65_127; - DWORD dwRsrRxFrmLen128_255; - DWORD dwRsrRxFrmLen256_511; - DWORD dwRsrRxFrmLen512_1023; - DWORD dwRsrRxFrmLen1024_1518; + u32 dwRsrRxFragment; + u32 dwRsrRxFrmLen64; + u32 dwRsrRxFrmLen65_127; + u32 dwRsrRxFrmLen128_255; + u32 dwRsrRxFrmLen256_511; + u32 dwRsrRxFrmLen512_1023; + u32 dwRsrRxFrmLen1024_1518; // TSR status count // - DWORD dwTsrTotalRetry; // total collision retry count - DWORD dwTsrOnceRetry; // this packet only occur one collision - DWORD dwTsrMoreThanOnceRetry; // this packet occur more than one collision - DWORD dwTsrRetry; // this packet has ever occur collision, + u32 dwTsrTotalRetry; // total collision retry count + u32 dwTsrOnceRetry; // this packet only occur one collision + u32 dwTsrMoreThanOnceRetry; // this packet occur more than one collision + u32 dwTsrRetry; // this packet has ever occur collision, // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0) - DWORD dwTsrACKData; - DWORD dwTsrErr; - DWORD dwAllTsrOK; - DWORD dwTsrRetryTimeout; - DWORD dwTsrTransmitTimeout; - - DWORD dwTsrTxPacket; - DWORD dwTsrTxOctet; - DWORD dwTsrBroadcast; - DWORD dwTsrMulticast; - DWORD dwTsrDirected; + u32 dwTsrACKData; + u32 dwTsrErr; + u32 dwAllTsrOK; + u32 dwTsrRetryTimeout; + u32 dwTsrTransmitTimeout; + + u32 dwTsrTxPacket; + u32 dwTsrTxOctet; + u32 dwTsrBroadcast; + u32 dwTsrMulticast; + u32 dwTsrDirected; // RD/TD count - DWORD dwCntRxFrmLength; - DWORD dwCntTxBufLength; - - BYTE abyCntRxPattern[16]; - BYTE abyCntTxPattern[16]; - + u32 dwCntRxFrmLength; + u32 dwCntTxBufLength; + u8 abyCntRxPattern[16]; + u8 abyCntTxPattern[16]; // Software check.... - DWORD dwCntRxDataErr; // rx buffer data software compare CRC err count - DWORD dwCntDecryptErr; // rx buffer data software compare CRC err count - DWORD dwCntRxICVErr; // rx buffer data software compare CRC err count - + 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 // 64-bit OID unsigned long long ullTsrOK; @@ -341,9 +325,9 @@ typedef struct tagSStatCounter { unsigned long long ullTxDirectedBytes; // for autorate - DWORD dwTxOk[MAX_RATE+1]; - DWORD dwTxFail[MAX_RATE+1]; - DWORD dwTxRetryCount[8]; + u32 dwTxOk[MAX_RATE+1]; + u32 dwTxFail[MAX_RATE+1]; + u32 dwTxRetryCount[8]; STxPktInfo abyTxPktInfo[16]; @@ -367,42 +351,28 @@ typedef struct tagSStatCounter { } SStatCounter, *PSStatCounter; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - -void STAvClearAllCounter(PSStatCounter pStatistic); - void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, - BYTE byIsr0, - BYTE byIsr1); + u8 byIsr0, + u8 byIsr1); void STAvUpdateRDStatCounter(PSStatCounter pStatistic, - BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, - BYTE byRxRate, PBYTE pbyBuffer, + u8 byRSR, u8 byNewRSR, u8 byRxSts, + u8 byRxRate, u8 * pbyBuffer, unsigned int cbFrameLength); -void STAvUpdateRDStatCounterEx(PSStatCounter pStatistic, - BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, - BYTE byRxRate, PBYTE pbyBuffer, - unsigned int cbFrameLength); - -void STAvUpdateTDStatCounter(PSStatCounter pStatistic, BYTE byPktNum, - BYTE byRate, BYTE byTSR); +void STAvUpdateTDStatCounter(PSStatCounter pStatistic, u8 byPktNum, + u8 byRate, u8 byTSR); void STAvUpdate802_11Counter( PSDot11Counters p802_11Counter, PSStatCounter pStatistic, - BYTE byRTSSuccess, - BYTE byRTSFail, - BYTE byACKFail, - BYTE byFCSErr + u8 byRTSSuccess, + u8 byRTSFail, + u8 byACKFail, + u8 byFCSErr ); -void STAvClear802_11Counter(PSDot11Counters p802_11Counter); void STAvUpdateUSBCounter(PSUSBCounter pUsbCounter, int ntStatus); #endif /* __MIB_H__ */ diff --git a/drivers/staging/vt6656/michael.c b/drivers/staging/vt6656/michael.c index 4d419814f27f..9a5a0b6761ed 100644 --- a/drivers/staging/vt6656/michael.c +++ b/drivers/staging/vt6656/michael.c @@ -26,8 +26,8 @@ * Date: Sep 4, 2002 * * Functions: - * s_dwGetUINT32 - Convert from BYTE[] to DWORD in a portable way - * s_vPutUINT32 - Convert from DWORD to BYTE[] in a portable way + * s_dwGetUINT32 - Convert from u8[] to u32 in a portable way + * s_vPutUINT32 - Convert from u32 to u8[] in a portable way * s_vClear - Reset the state to the empty message. * s_vSetKey - Set the key. * MIC_vInit - Set the key. @@ -42,49 +42,41 @@ #include "tmacro.h" #include "michael.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ /* - * static DWORD s_dwGetUINT32(BYTE * p); Get DWORD from + * static u32 s_dwGetUINT32(u8 * p); Get u32 from * 4 bytes LSByte first - * static void s_vPutUINT32(BYTE* p, DWORD val); Put DWORD into + * static void s_vPutUINT32(u8* p, u32 val); Put u32 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 +static void s_vSetKey(u32 dwK0, u32 dwK1); +static void s_vAppendByte(u8 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 u32 L, R; /* Current state */ +static u32 K0, K1; /* Key */ +static u32 M; /* Message accumulator (single word) */ static unsigned int nBytesInM; /* # bytes in M */ -/*--------------------- Export Functions --------------------------*/ - /* -static DWORD s_dwGetUINT32 (BYTE * p) -// Convert from BYTE[] to DWORD in a portable way +static u32 s_dwGetUINT32 (u8 * p) +// Convert from u8[] to u32 in a portable way { - DWORD res = 0; + u32 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) -// Convert from DWORD to BYTE[] in a portable way +static void s_vPutUINT32(u8 *p, u32 val) +// Convert from u32 to u8[] in a portable way { unsigned int i; for (i = 0; i < 4; i++) { - *p++ = (BYTE) (val & 0xff); + *p++ = (u8) (val & 0xff); val >>= 8; } } @@ -99,7 +91,7 @@ static void s_vClear(void) M = 0; } -static void s_vSetKey(DWORD dwK0, DWORD dwK1) +static void s_vSetKey(u32 dwK0, u32 dwK1) { /* Set the key */ K0 = dwK0; @@ -108,7 +100,7 @@ static void s_vSetKey(DWORD dwK0, DWORD dwK1) s_vClear(); } -static void s_vAppendByte(BYTE b) +static void s_vAppendByte(u8 b) { /* Append the byte to our word-sized buffer */ M |= b << (8*nBytesInM); @@ -130,13 +122,12 @@ static void s_vAppendByte(BYTE b) } } -void MIC_vInit(DWORD dwK0, DWORD dwK1) +void MIC_vInit(u32 dwK0, u32 dwK1) { /* Set the key */ s_vSetKey(dwK0, dwK1); } - void MIC_vUnInit(void) { /* Wipe the key material */ @@ -148,7 +139,7 @@ void MIC_vUnInit(void) s_vClear(); } -void MIC_vAppend(PBYTE src, unsigned int nBytes) +void MIC_vAppend(u8 * src, unsigned int nBytes) { /* This is simple */ while (nBytes > 0) { @@ -157,7 +148,7 @@ void MIC_vAppend(PBYTE src, unsigned int nBytes) } } -void MIC_vGetMIC(PDWORD pdwL, PDWORD pdwR) +void MIC_vGetMIC(u32 * pdwL, u32 * pdwR) { /* Append the minimum padding */ s_vAppendByte(0x5a); diff --git a/drivers/staging/vt6656/michael.h b/drivers/staging/vt6656/michael.h index 81351f506232..9c69a42640a7 100644 --- a/drivers/staging/vt6656/michael.h +++ b/drivers/staging/vt6656/michael.h @@ -31,22 +31,18 @@ #ifndef __MICHAEL_H__ #define __MICHAEL_H__ -/*--------------------- Export Definitions -------------------------*/ +#include <linux/types.h> -/*--------------------- Export Types ------------------------------*/ - -void MIC_vInit(DWORD dwK0, DWORD dwK1); +void MIC_vInit(u32 dwK0, u32 dwK1); void MIC_vUnInit(void); // Append bytes to the message to be MICed -void MIC_vAppend(PBYTE src, unsigned int nBytes); +void MIC_vAppend(u8 * 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); - -/*--------------------- Export Macros ------------------------------*/ +void MIC_vGetMIC(u32 * pdwL, u32 * pdwR); // Rotation functions on 32 bit values #define ROL32(A, n) \ diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c index 527c259f6758..edc8975b2e2a 100644 --- a/drivers/staging/vt6656/power.c +++ b/drivers/staging/vt6656/power.c @@ -37,7 +37,6 @@ * */ -#include "ttype.h" #include "mac.h" #include "device.h" #include "wmgr.h" @@ -48,17 +47,7 @@ #include "control.h" #include "rndis.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ static int msglevel = MSG_LEVEL_INFO; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ /* * @@ -290,7 +279,7 @@ int PSbSendNullPacket(struct vnt_private *pDevice) pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(flags); if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) - pTxPacket->p80211Header->sA3.wFrameCtl |= cpu_to_le16((WORD)WLAN_SET_FC_TODS(1)); + pTxPacket->p80211Header->sA3.wFrameCtl |= cpu_to_le16((u16)WLAN_SET_FC_TODS(1)); memcpy(pTxPacket->p80211Header->sA3.abyAddr1, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN); memcpy(pTxPacket->p80211Header->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); diff --git a/drivers/staging/vt6656/power.h b/drivers/staging/vt6656/power.h index 879b10c0d42e..778358239437 100644 --- a/drivers/staging/vt6656/power.h +++ b/drivers/staging/vt6656/power.h @@ -29,22 +29,10 @@ #ifndef __POWER_H__ #define __POWER_H__ - -/*--------------------- Export Definitions -------------------------*/ #define C_PWBT 1000 // micro sec. power up before TBTT #define PS_FAST_INTERVAL 1 // Fast power saving listen interval #define PS_MAX_INTERVAL 4 // MAX power saving listen interval -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - - -/*--------------------- Export Types ------------------------------*/ - - -/*--------------------- Export Functions --------------------------*/ - /* PSDevice pDevice */ /* PSDevice hDeviceContext */ diff --git a/drivers/staging/vt6656/rc4.c b/drivers/staging/vt6656/rc4.c index 5c3c2d0552b4..2fd836f07536 100644 --- a/drivers/staging/vt6656/rc4.c +++ b/drivers/staging/vt6656/rc4.c @@ -32,27 +32,27 @@ #include "rc4.h" -void rc4_init(PRC4Ext pRC4, PBYTE pbyKey, unsigned int cbKey_len) +void rc4_init(PRC4Ext pRC4, u8 * pbyKey, unsigned int cbKey_len) { unsigned int ust1, ust2; unsigned int keyindex; unsigned int stateindex; - PBYTE pbyst; + u8 * pbyst; unsigned int idx; pbyst = pRC4->abystate; pRC4->ux = 0; pRC4->uy = 0; for (idx = 0; idx < 256; idx++) - pbyst[idx] = (BYTE)idx; + pbyst[idx] = (u8)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; + pbyst[stateindex] = (u8)ust1; + pbyst[idx] = (u8)ust2; if (++keyindex >= cbKey_len) keyindex = 0; } @@ -63,7 +63,7 @@ unsigned int rc4_byte(PRC4Ext pRC4) unsigned int ux; unsigned int uy; unsigned int ustx, usty; - PBYTE pbyst; + u8 * pbyst; pbyst = pRC4->abystate; ux = (pRC4->ux + 1) & 0xff; @@ -72,16 +72,16 @@ unsigned int rc4_byte(PRC4Ext pRC4) usty = pbyst[uy]; pRC4->ux = ux; pRC4->uy = uy; - pbyst[uy] = (BYTE)ustx; - pbyst[ux] = (BYTE)usty; + pbyst[uy] = (u8)ustx; + pbyst[ux] = (u8)usty; return pbyst[(ustx + usty) & 0xff]; } -void rc4_encrypt(PRC4Ext pRC4, PBYTE pbyDest, - PBYTE pbySrc, unsigned int cbData_len) +void rc4_encrypt(PRC4Ext pRC4, u8 * pbyDest, + u8 * pbySrc, unsigned int cbData_len) { unsigned int ii; for (ii = 0; ii < cbData_len; ii++) - pbyDest[ii] = (BYTE)(pbySrc[ii] ^ rc4_byte(pRC4)); + pbyDest[ii] = (u8)(pbySrc[ii] ^ rc4_byte(pRC4)); } diff --git a/drivers/staging/vt6656/rc4.h b/drivers/staging/vt6656/rc4.h index d447879c8f99..d376e1adcc1c 100644 --- a/drivers/staging/vt6656/rc4.h +++ b/drivers/staging/vt6656/rc4.h @@ -30,19 +30,17 @@ #ifndef __RC4_H__ #define __RC4_H__ -#include "ttype.h" +#include <linux/types.h> -/*--------------------- Export Definitions -------------------------*/ -/*--------------------- Export Types ------------------------------*/ typedef struct { unsigned int ux; unsigned int uy; - BYTE abystate[256]; + u8 abystate[256]; } RC4Ext, *PRC4Ext; -void rc4_init(PRC4Ext pRC4, PBYTE pbyKey, unsigned int cbKey_len); +void rc4_init(PRC4Ext pRC4, u8 * pbyKey, unsigned int cbKey_len); unsigned int rc4_byte(PRC4Ext pRC4); -void rc4_encrypt(PRC4Ext pRC4, PBYTE pbyDest, PBYTE pbySrc, +void rc4_encrypt(PRC4Ext pRC4, u8 * pbyDest, u8 * pbySrc, unsigned int cbData_len); #endif /* __RC4_H__ */ diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index a415705297b2..44cfe0b14180 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -41,7 +41,6 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -/*--------------------- Static Definitions -------------------------*/ #define BY_AL2230_REG_LEN 23 //24bit #define CB_AL2230_INIT_SEQ 15 #define AL2230_PWR_IDX_LEN 64 @@ -62,13 +61,6 @@ static int msglevel =MSG_LEVEL_INFO; #define VT3342_PWR_IDX_LEN 64 //}} -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - - - - u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { {0x03, 0xF7, 0x90}, {0x03, 0x33, 0x31}, @@ -388,7 +380,6 @@ u8 abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x02, 0x01, 0xAA} //RobertYu:20060523 }; - u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x01, 0x97, 0x83}, // channel = 1, Tf = 2412MHz {0x01, 0x97, 0x83}, // channel = 2, Tf = 2417MHz @@ -424,7 +415,6 @@ u8 abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { }; ///}}RobertYu - //{{RobertYu:20060502, TWIF 1.14, LO Current for 11b mode u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz @@ -444,7 +434,6 @@ u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { }; //}} - //{{RobertYu:20060609 u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */ {0x03, 0xFF, 0x80}, //update for mode// @@ -599,7 +588,6 @@ u8 abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { {0x03, 0x00, 0x04} // channel = 165, Tf = 5825MHz (56), TBD }; - /*+ * * Power Table @@ -673,10 +661,6 @@ const u32 dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { 0x0407F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW }; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - //{{ RobertYu:20050103, Channel 11a Number To Index // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, @@ -708,8 +692,6 @@ const u8 RFaby11aChannelIndex[200] = { }; //}} RobertYu -/*--------------------- Export Functions --------------------------*/ - /* * Description: Write to IF/RF, by embedded programming * @@ -734,11 +716,9 @@ int IFRFbWriteEmbedded(struct vnt_private *pDevice, u32 dwData) CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE_IFRF, 0, 0, 4, pbyData); - return true; } - /* * Description: Set Tx power * @@ -790,7 +770,6 @@ int RFbSetPower(struct vnt_private *pDevice, u32 uRATE, u32 uCH) return bResult; } - /* * Description: Set Tx power * @@ -839,10 +818,9 @@ int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE) } break; - case RF_AIROHA7230: { - DWORD dwMax7230Pwr; + u32 dwMax7230Pwr; if (uRATE <= RATE_11M) { //RobertYu:20060426, for better 11b mask bResult &= IFRFbWriteEmbedded(pDevice, 0x111BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW); @@ -864,7 +842,7 @@ int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE) case RF_VT3226: //RobertYu:20051111, VT3226C0 and before { - DWORD dwVT3226Pwr; + u32 dwVT3226Pwr; if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN) return false; @@ -876,7 +854,7 @@ int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE) case RF_VT3226D0: //RobertYu:20051228 { - DWORD dwVT3226Pwr; + u32 dwVT3226Pwr; if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN) return false; @@ -921,7 +899,7 @@ int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE) //{{RobertYu:20060609 case RF_VT3342A0: { - DWORD dwVT3342Pwr; + u32 dwVT3342Pwr; if (pDevice->byCurPwr >= VT3342_PWR_IDX_LEN) return false; @@ -976,8 +954,6 @@ void RFvRSSITodBm(struct vnt_private *pDevice, u8 byCurrRSSI, long *pldBm) *pldBm = -1 * (a + b * 2); } - - void RFbRFTableDownload(struct vnt_private *pDevice) { u16 wLength1 = 0, wLength2 = 0, wLength3 = 0; @@ -1121,20 +1097,3 @@ void RFbRFTableDownload(struct vnt_private *pDevice) } } - -int s_bVT3226D0_11bLoCurrentAdjust(struct vnt_private *pDevice, u8 byChannel, - int b11bMode) -{ - int bResult = true; - - if (b11bMode) - bResult &= IFRFbWriteEmbedded(pDevice, - dwVT3226D0LoCurrentTable[byChannel-1]); - else - bResult &= IFRFbWriteEmbedded(pDevice, 0x016bc600 + - (BY_VT3226_REG_LEN << 3) + IFREGCTL_REGW); - - return bResult; -} - - diff --git a/drivers/staging/vt6656/rf.h b/drivers/staging/vt6656/rf.h index 9f70cf740bae..de5c613b4ef9 100644 --- a/drivers/staging/vt6656/rf.h +++ b/drivers/staging/vt6656/rf.h @@ -30,10 +30,8 @@ #ifndef __RF_H__ #define __RF_H__ -#include "ttype.h" #include "device.h" -/*--------------------- Export Definitions -------------------------*/ // // Baseband RF pair definition in eeprom (Bits 6..0) // @@ -55,20 +53,12 @@ #define RF_EMU 0x80 #define RF_MASK 0x7F - - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ extern const u8 RFaby11aChannelIndex[200]; -/*--------------------- Export Functions --------------------------*/ int IFRFbWriteEmbedded(struct vnt_private *, u32 dwData); int RFbSetPower(struct vnt_private *, u32 uRATE, u32 uCH); int RFbRawSetPower(struct vnt_private *, u8 byPwr, u32 uRATE); void RFvRSSITodBm(struct vnt_private *, u8 byCurrRSSI, long *pldBm); void RFbRFTableDownload(struct vnt_private *pDevice); -int s_bVT3226D0_11bLoCurrentAdjust(struct vnt_private *, u8 byChannel, - int b11bMode); #endif /* __RF_H__ */ diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h index fccf7e98eb68..5e073062017a 100644 --- a/drivers/staging/vt6656/rndis.h +++ b/drivers/staging/vt6656/rndis.h @@ -27,11 +27,9 @@ * */ - #ifndef __RNDIS_H__ #define __RNDIS_H__ -/*--------------------- Export Definitions -------------------------*/ #define MESSAGE_TYPE_READ 0x01 #define MESSAGE_TYPE_WRITE 0x00 #define MESSAGE_TYPE_LOCK_OR 0x02 @@ -66,96 +64,86 @@ #define MESSAGE_REQUEST_RF_CH1 0x0C #define MESSAGE_REQUEST_RF_CH2 0x0D - #define VIAUSB20_PACKET_HEADER 0x04 - -/*--------------------- Export Classes ----------------------------*/ - typedef struct _CMD_MESSAGE { - BYTE byData[256]; + u8 byData[256]; } CMD_MESSAGE, *PCMD_MESSAGE; typedef struct _CMD_WRITE_MASK { - BYTE byData; - BYTE byMask; + u8 byData; + u8 byMask; } CMD_WRITE_MASK, *PCMD_WRITE_MASK; typedef struct _CMD_CARD_INIT { - BYTE byInitClass; - BYTE bExistSWNetAddr; - BYTE bySWNetAddr[6]; - BYTE byShortRetryLimit; - BYTE byLongRetryLimit; + u8 byInitClass; + u8 bExistSWNetAddr; + u8 bySWNetAddr[6]; + u8 byShortRetryLimit; + u8 byLongRetryLimit; } CMD_CARD_INIT, *PCMD_CARD_INIT; typedef struct _RSP_CARD_INIT { - BYTE byStatus; - BYTE byNetAddr[6]; - BYTE byRFType; - BYTE byMinChannel; - BYTE byMaxChannel; + u8 byStatus; + u8 byNetAddr[6]; + u8 byRFType; + u8 byMinChannel; + u8 byMaxChannel; } RSP_CARD_INIT, *PRSP_CARD_INIT; typedef struct _CMD_SET_KEY { - WORD wKCTL; - BYTE abyMacAddr[6]; - BYTE abyKey[16]; + u16 wKCTL; + u8 abyMacAddr[6]; + u8 abyKey[16]; } CMD_SET_KEY, *PCMD_SET_KEY; typedef struct _CMD_CLRKEY_ENTRY { - BYTE abyKeyEntry[11]; + u8 abyKeyEntry[11]; } CMD_CLRKEY_ENTRY, *PCMD_CLRKEY_ENTRY; typedef struct _CMD_WRITE_MISCFF { - DWORD adwMiscFFData[22][4]; //a key entry has only 22 dwords + u32 adwMiscFFData[22][4]; //a key entry has only 22 dwords } CMD_WRITE_MISCFF, *PCMD_WRITE_MISCFF; typedef struct _CMD_SET_TSFTBTT { - BYTE abyTSF_TBTT[8]; + u8 abyTSF_TBTT[8]; } CMD_SET_TSFTBTT, *PCMD_SET_TSFTBTT; typedef struct _CMD_SET_SSTIFS { - BYTE bySIFS; - BYTE byDIFS; - BYTE byEIFS; - BYTE bySlotTime; - BYTE byCwMax_Min; - BYTE byBBCR10; + u8 bySIFS; + u8 byDIFS; + u8 byEIFS; + u8 bySlotTime; + u8 byCwMax_Min; + u8 byBBCR10; } CMD_SET_SSTIFS, *PCMD_SET_SSTIFS; typedef struct _CMD_CHANGE_BBTYPE { - BYTE bySIFS; - BYTE byDIFS; - BYTE byEIFS; - BYTE bySlotTime; - BYTE byCwMax_Min; - BYTE byBBCR10; - BYTE byBB_BBType; //CR88 - BYTE byMAC_BBType; - DWORD dwRSPINF_b_1; - DWORD dwRSPINF_b_2; - DWORD dwRSPINF_b_55; - DWORD dwRSPINF_b_11; - WORD wRSPINF_a[9]; + u8 bySIFS; + u8 byDIFS; + u8 byEIFS; + u8 bySlotTime; + u8 byCwMax_Min; + u8 byBBCR10; + u8 byBB_BBType; //CR88 + u8 byMAC_BBType; + u32 dwRSPINF_b_1; + u32 dwRSPINF_b_2; + u32 dwRSPINF_b_55; + u32 dwRSPINF_b_11; + u16 wRSPINF_a[9]; } CMD_CHANGE_BBTYPE, *PCMD_CHANGE_BBTYPE; -/*--------------------- Export Macros -------------------------*/ - -#define EXCH_WORD(w) ((WORD)((WORD)(w)<<8) | (WORD)((WORD)(w)>>8)) - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ +#define EXCH_WORD(w) ((u16)((u16)(w)<<8) | (u16)((u16)(w)>>8)) #endif /* _RNDIS_H_ */ diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index b939dcf689d6..9bf2f8d562c3 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -63,32 +63,22 @@ #include "usbpipe.h" #include "iocmd.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ static int msglevel = MSG_LEVEL_INFO; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Static Definitions -------------------------*/ - -const WORD wTimeStampOff[2][MAX_RATE] = { +const u16 wTimeStampOff[2][MAX_RATE] = { {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble }; -const WORD wFB_Opt0[2][5] = { +const u16 wFB_Opt0[2][5] = { {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, // fallback_rate0 {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, // fallback_rate1 }; -const WORD wFB_Opt1[2][5] = { +const u16 wFB_Opt1[2][5] = { {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, // fallback_rate0 {RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1 }; - #define RTSDUR_BB 0 #define RTSDUR_BA 1 #define RTSDUR_AA 2 @@ -104,8 +94,6 @@ const WORD wFB_Opt1[2][5] = { #define DATADUR_A_F0 12 #define DATADUR_A_F1 13 -/*--------------------- Static Functions --------------------------*/ - static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl); @@ -114,16 +102,15 @@ static void *s_vGetFreeContext(struct vnt_private *pDevice); static void s_vGenerateTxParameter(struct vnt_private *pDevice, u8 byPktType, u16 wCurrentRate, void *pTxBufHead, void *pvRrvTime, void *pvRTS, void *pvCTS, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx, - PSEthernetHeader psEthHeader); + struct ethhdr *psEthHeader); static u32 s_uFillDataHead(struct vnt_private *pDevice, u8 byPktType, u16 wCurrentRate, void *pTxDataHead, u32 cbFrameLength, u32 uDMAIdx, int bNeedAck, u32 uFragIdx, u32 cbLastFragmentSize, u32 uMACfragNum, u8 byFBOption); - static void s_vGenerateMACHeader(struct vnt_private *pDevice, - u8 *pbyBufferAddr, u16 wDuration, PSEthernetHeader psEthHeader, + u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx); static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, @@ -145,7 +132,7 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, void *pvRTS, u32 cbFrameLength, int bNeedAck, int bDisCRC, - PSEthernetHeader psEthHeader, u16 wCurrentRate, u8 byFBOption); + struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption); static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, @@ -156,9 +143,6 @@ static unsigned int s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, u8 byFBOption); - -/*--------------------- Export Variables --------------------------*/ - static void *s_vGetFreeContext(struct vnt_private *pDevice) { PUSB_SEND_CONTEXT pContext = NULL; @@ -181,7 +165,6 @@ static void *s_vGetFreeContext(struct vnt_private *pDevice) return (void *) pReturnContext; } - static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl) { @@ -208,10 +191,9 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, u32 *pdwIV = (u32 *)pbyIVHead; u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4); u16 wValue; - PS802_11Header pMACHeader = (PS802_11Header)pbyHdrBuf; + struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf; u32 dwRevIVCounter; - //Fill TXKEY if (pTransmitKey == NULL) return; @@ -222,13 +204,13 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN ){ - memcpy(pDevice->abyPRNG, (PBYTE)&(dwRevIVCounter), 3); + memcpy(pDevice->abyPRNG, (u8 *)&(dwRevIVCounter), 3); memcpy(pDevice->abyPRNG+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength); } else { - memcpy(pbyBuf, (PBYTE)&(dwRevIVCounter), 3); + memcpy(pbyBuf, (u8 *)&(dwRevIVCounter), 3); memcpy(pbyBuf+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength); if(pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) { - memcpy(pbyBuf+8, (PBYTE)&(dwRevIVCounter), 3); + memcpy(pbyBuf+8, (u8 *)&(dwRevIVCounter), 3); memcpy(pbyBuf+11, pTransmitKey->abyKey, pTransmitKey->uKeyLength); } memcpy(pDevice->abyPRNG, pbyBuf, 16); @@ -252,7 +234,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, // Make IV memcpy(pdwIV, pDevice->abyPRNG, 3); - *(pbyIVHead+3) = (BYTE)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV + *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV // Append IV&ExtIV after Mac Header *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %x\n", @@ -267,49 +249,48 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, // Make IV *pdwIV = 0; - *(pbyIVHead+3) = (BYTE)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV - *pdwIV |= cpu_to_le16((WORD)(pTransmitKey->wTSC15_0)); + *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV + *pdwIV |= cpu_to_le16((u16)(pTransmitKey->wTSC15_0)); //Append IV&ExtIV after Mac Header *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); //Fill MICHDR0 *pMICHDR = 0x59; - *((PBYTE)(pMICHDR+1)) = 0; // TxPriority - memcpy(pMICHDR+2, &(pMACHeader->abyAddr2[0]), 6); - *((PBYTE)(pMICHDR+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16)); - *((PBYTE)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16)); - *((PBYTE)(pMICHDR+10)) = HIBYTE(LOWORD(pTransmitKey->dwTSC47_16)); - *((PBYTE)(pMICHDR+11)) = LOBYTE(LOWORD(pTransmitKey->dwTSC47_16)); - *((PBYTE)(pMICHDR+12)) = HIBYTE(pTransmitKey->wTSC15_0); - *((PBYTE)(pMICHDR+13)) = LOBYTE(pTransmitKey->wTSC15_0); - *((PBYTE)(pMICHDR+14)) = HIBYTE(wPayloadLen); - *((PBYTE)(pMICHDR+15)) = LOBYTE(wPayloadLen); + *((u8 *)(pMICHDR+1)) = 0; // TxPriority + memcpy(pMICHDR+2, &(pMACHeader->addr2[0]), 6); + *((u8 *)(pMICHDR+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16)); + *((u8 *)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16)); + *((u8 *)(pMICHDR+10)) = HIBYTE(LOWORD(pTransmitKey->dwTSC47_16)); + *((u8 *)(pMICHDR+11)) = LOBYTE(LOWORD(pTransmitKey->dwTSC47_16)); + *((u8 *)(pMICHDR+12)) = HIBYTE(pTransmitKey->wTSC15_0); + *((u8 *)(pMICHDR+13)) = LOBYTE(pTransmitKey->wTSC15_0); + *((u8 *)(pMICHDR+14)) = HIBYTE(wPayloadLen); + *((u8 *)(pMICHDR+15)) = LOBYTE(wPayloadLen); //Fill MICHDR1 - *((PBYTE)(pMICHDR+16)) = 0; // HLEN[15:8] + *((u8 *)(pMICHDR+16)) = 0; // HLEN[15:8] if (pDevice->bLongHeader) { - *((PBYTE)(pMICHDR+17)) = 28; // HLEN[7:0] + *((u8 *)(pMICHDR+17)) = 28; // HLEN[7:0] } else { - *((PBYTE)(pMICHDR+17)) = 22; // HLEN[7:0] + *((u8 *)(pMICHDR+17)) = 22; // HLEN[7:0] } - wValue = cpu_to_le16(pMACHeader->wFrameCtl & 0xC78F); - memcpy(pMICHDR+18, (PBYTE)&wValue, 2); // MSKFRACTL - memcpy(pMICHDR+20, &(pMACHeader->abyAddr1[0]), 6); - memcpy(pMICHDR+26, &(pMACHeader->abyAddr2[0]), 6); + wValue = cpu_to_le16(pMACHeader->frame_control & 0xC78F); + memcpy(pMICHDR+18, (u8 *)&wValue, 2); // MSKFRACTL + memcpy(pMICHDR+20, &(pMACHeader->addr1[0]), 6); + memcpy(pMICHDR+26, &(pMACHeader->addr2[0]), 6); //Fill MICHDR2 - memcpy(pMICHDR+32, &(pMACHeader->abyAddr3[0]), 6); - wValue = pMACHeader->wSeqCtl; + memcpy(pMICHDR+32, &(pMACHeader->addr3[0]), 6); + wValue = pMACHeader->seq_ctrl; wValue &= 0x000F; wValue = cpu_to_le16(wValue); - memcpy(pMICHDR+38, (PBYTE)&wValue, 2); // MSKSEQCTL + memcpy(pMICHDR+38, (u8 *)&wValue, 2); // MSKSEQCTL if (pDevice->bLongHeader) { - memcpy(pMICHDR+40, &(pMACHeader->abyAddr4[0]), 6); + memcpy(pMICHDR+40, &(pMACHeader->addr4[0]), 6); } } } - static void s_vSWencryption(struct vnt_private *pDevice, PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize) { @@ -324,7 +305,7 @@ static void s_vSWencryption(struct vnt_private *pDevice, //======================================================================= // Append ICV after payload dwICV = CRCdwGetCrc32Ex(pbyPayloadHead, wPayloadSize, dwICV);//ICV(Payload) - pdwICV = (PDWORD)(pbyPayloadHead + wPayloadSize); + pdwICV = (u32 *)(pbyPayloadHead + wPayloadSize); // finally, we must invert dwCRC to get the correct answer *pdwICV = cpu_to_le32(~dwICV); // RC4 encryption @@ -335,7 +316,7 @@ static void s_vSWencryption(struct vnt_private *pDevice, //======================================================================= //Append ICV after payload dwICV = CRCdwGetCrc32Ex(pbyPayloadHead, wPayloadSize, dwICV);//ICV(Payload) - pdwICV = (PDWORD)(pbyPayloadHead + wPayloadSize); + pdwICV = (u32 *)(pbyPayloadHead + wPayloadSize); // finally, we must invert dwCRC to get the correct answer *pdwICV = cpu_to_le32(~dwICV); // RC4 encryption @@ -345,9 +326,6 @@ static void s_vSWencryption(struct vnt_private *pDevice, } } - - - /*byPktType : PK_TYPE_11A 0 PK_TYPE_11B 1 PK_TYPE_11GB 2 @@ -360,9 +338,9 @@ static u32 s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType, uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wRate); if (byPktType == PK_TYPE_11B) {//llb,CCK mode - uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (WORD)pDevice->byTopCCKBasicRate); + uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (u16)pDevice->byTopCCKBasicRate); } else {//11g 2.4G OFDM mode & 11a 5G OFDM mode - uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (WORD)pDevice->byTopOFDMBasicRate); + uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (u16)pDevice->byTopOFDMBasicRate); } if (bNeedAck) { @@ -381,7 +359,6 @@ static u32 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice, uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0; - uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wCurrentRate); if (byRTSRsvType == 0) { //RTSTxRrvTime_bb uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate); @@ -447,7 +424,6 @@ static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType, } break; - case DATADUR_A: //DATADUR_A if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag if(bNeedAck){ @@ -566,7 +542,6 @@ static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType, return 0; } - //byFreqType: 0=>5GHZ 1=>2.4GHZ static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, @@ -574,7 +549,6 @@ static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, { u32 uCTSTime = 0, uDurTime = 0; - switch (byDurType) { case RTSDUR_BB: //RTSDuration_bb @@ -671,10 +645,10 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice, PSTxDataHead_ab pBuf = (PSTxDataHead_ab) pTxDataHead; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (PWORD)&(pBuf->wTransmitLength), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) + (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField) ); //Get Duration and TimeStampOff - pBuf->wDuration = (WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, + pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz @@ -688,17 +662,17 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice, PSTxDataHead_g pBuf = (PSTxDataHead_g)pTxDataHead; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (PWORD)&(pBuf->wTransmitLength_a), (PBYTE)&(pBuf->byServiceField_a), (PBYTE)&(pBuf->bySignalField_a) + (u16 *)&(pBuf->wTransmitLength_a), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a) ); BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (PWORD)&(pBuf->wTransmitLength_b), (PBYTE)&(pBuf->byServiceField_b), (PBYTE)&(pBuf->bySignalField_b) + (u16 *)&(pBuf->wTransmitLength_b), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b) ); //Get Duration and TimeStamp - pBuf->wDuration_a = (WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, + pBuf->wDuration_a = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz - pBuf->wDuration_b = (WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, + pBuf->wDuration_b = (u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz @@ -711,19 +685,19 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice, PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (PWORD)&(pBuf->wTransmitLength_a), (PBYTE)&(pBuf->byServiceField_a), (PBYTE)&(pBuf->bySignalField_a) + (u16 *)&(pBuf->wTransmitLength_a), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a) ); BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (PWORD)&(pBuf->wTransmitLength_b), (PBYTE)&(pBuf->byServiceField_b), (PBYTE)&(pBuf->bySignalField_b) + (u16 *)&(pBuf->wTransmitLength_b), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b) ); //Get Duration and TimeStamp - pBuf->wDuration_a = (WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, + pBuf->wDuration_a = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz - pBuf->wDuration_b = (WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B, + pBuf->wDuration_b = (u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz - pBuf->wDuration_a_f0 = (WORD)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, + pBuf->wDuration_a_f0 = (u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz - pBuf->wDuration_a_f1 = (WORD)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, + pBuf->wDuration_a_f1 = (u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz pBuf->wTimeStampOff_a = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; pBuf->wTimeStampOff_b = wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]; @@ -737,14 +711,14 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice, PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (PWORD)&(pBuf->wTransmitLength), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) + (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField) ); //Get Duration and TimeStampOff - pBuf->wDuration = (WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, + pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //0: 5GHz - pBuf->wDuration_f0 = (WORD)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, + pBuf->wDuration_f0 = (u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //0: 5GHz - pBuf->wDuration_f1 = (WORD)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, + pBuf->wDuration_f1 = (u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //0: 5GHz if(uDMAIdx!=TYPE_ATIMDMA) { pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; @@ -754,10 +728,10 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice, PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (PWORD)&(pBuf->wTransmitLength), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) + (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField) ); //Get Duration and TimeStampOff - pBuf->wDuration = (WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, + pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); @@ -772,10 +746,10 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice, PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, - (PWORD)&(pBuf->wTransmitLength), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) + (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField) ); //Get Duration and TimeStampOff - pBuf->wDuration = (WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType, + pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); @@ -789,7 +763,7 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice, static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, void *pvRTS, u32 cbFrameLength, int bNeedAck, int bDisCRC, - PSEthernetHeader psEthHeader, u16 wCurrentRate, u8 byFBOption) + struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption) { u32 uRTSFrameLen = 20; u16 wLen = 0; @@ -810,17 +784,17 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, PSRTS_g pBuf = (PSRTS_g)pvRTS; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_b), (PBYTE)&(pBuf->bySignalField_b) + (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b) ); pBuf->wTransmitLength_b = cpu_to_le16(wLen); BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, - (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_a), (PBYTE)&(pBuf->bySignalField_a) + (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a) ); pBuf->wTransmitLength_a = cpu_to_le16(wLen); //Get Duration - pBuf->wDuration_bb = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData - pBuf->wDuration_aa = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData - pBuf->wDuration_ba = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wDuration_bb = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData + pBuf->wDuration_aa = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData + pBuf->wDuration_ba = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data pBuf->Data.wDurationID = pBuf->wDuration_aa; //Get RTS Frame body @@ -829,7 +803,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { memcpy(&(pBuf->Data.abyRA[0]), - &(psEthHeader->abyDstAddr[0]), + &(psEthHeader->h_dest[0]), ETH_ALEN); } else { @@ -844,7 +818,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, } else { memcpy(&(pBuf->Data.abyTA[0]), - &(psEthHeader->abySrcAddr[0]), + &(psEthHeader->h_source[0]), ETH_ALEN); } } @@ -852,21 +826,21 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_b), (PBYTE)&(pBuf->bySignalField_b) + (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b) ); pBuf->wTransmitLength_b = cpu_to_le16(wLen); BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, - (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_a), (PBYTE)&(pBuf->bySignalField_a) + (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a) ); pBuf->wTransmitLength_a = cpu_to_le16(wLen); //Get Duration - pBuf->wDuration_bb = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData - pBuf->wDuration_aa = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData - pBuf->wDuration_ba = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData - pBuf->wRTSDuration_ba_f0 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData - pBuf->wRTSDuration_aa_f0 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData - pBuf->wRTSDuration_ba_f1 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData - pBuf->wRTSDuration_aa_f1 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData + pBuf->wDuration_bb = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData + pBuf->wDuration_aa = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData + pBuf->wDuration_ba = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData + pBuf->wRTSDuration_ba_f0 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData + pBuf->wRTSDuration_aa_f0 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData + pBuf->wRTSDuration_ba_f1 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData + pBuf->wRTSDuration_aa_f1 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData pBuf->Data.wDurationID = pBuf->wDuration_aa; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 @@ -874,7 +848,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { memcpy(&(pBuf->Data.abyRA[0]), - &(psEthHeader->abyDstAddr[0]), + &(psEthHeader->h_dest[0]), ETH_ALEN); } else { @@ -890,7 +864,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, } else { memcpy(&(pBuf->Data.abyTA[0]), - &(psEthHeader->abySrcAddr[0]), + &(psEthHeader->h_source[0]), ETH_ALEN); } @@ -901,11 +875,11 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, PSRTS_ab pBuf = (PSRTS_ab)pvRTS; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, - (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) + (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField) ); pBuf->wTransmitLength = cpu_to_le16(wLen); //Get Duration - pBuf->wDuration = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData + pBuf->wDuration = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData pBuf->Data.wDurationID = pBuf->wDuration; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 @@ -913,7 +887,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { memcpy(&(pBuf->Data.abyRA[0]), - &(psEthHeader->abyDstAddr[0]), + &(psEthHeader->h_dest[0]), ETH_ALEN); } else { memcpy(&(pBuf->Data.abyRA[0]), @@ -927,7 +901,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, ETH_ALEN); } else { memcpy(&(pBuf->Data.abyTA[0]), - &(psEthHeader->abySrcAddr[0]), + &(psEthHeader->h_source[0]), ETH_ALEN); } @@ -936,13 +910,13 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, - (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) + (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField) ); pBuf->wTransmitLength = cpu_to_le16(wLen); //Get Duration - pBuf->wDuration = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData - pBuf->wRTSDuration_f0 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData - pBuf->wRTSDuration_f1 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0: + pBuf->wDuration = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData + pBuf->wRTSDuration_f0 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData + pBuf->wRTSDuration_f1 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0: pBuf->Data.wDurationID = pBuf->wDuration; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 @@ -950,7 +924,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { memcpy(&(pBuf->Data.abyRA[0]), - &(psEthHeader->abyDstAddr[0]), + &(psEthHeader->h_dest[0]), ETH_ALEN); } else { memcpy(&(pBuf->Data.abyRA[0]), @@ -963,7 +937,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, ETH_ALEN); } else { memcpy(&(pBuf->Data.abyTA[0]), - &(psEthHeader->abySrcAddr[0]), + &(psEthHeader->h_source[0]), ETH_ALEN); } } @@ -972,11 +946,11 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, PSRTS_ab pBuf = (PSRTS_ab)pvRTS; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) + (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField) ); pBuf->wTransmitLength = cpu_to_le16(wLen); //Get Duration - pBuf->wDuration = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData + pBuf->wDuration = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData pBuf->Data.wDurationID = pBuf->wDuration; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 @@ -984,7 +958,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { memcpy(&(pBuf->Data.abyRA[0]), - &(psEthHeader->abyDstAddr[0]), + &(psEthHeader->h_dest[0]), ETH_ALEN); } else { @@ -999,7 +973,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, ETH_ALEN); } else { memcpy(&(pBuf->Data.abyTA[0]), - &(psEthHeader->abySrcAddr[0]), + &(psEthHeader->h_source[0]), ETH_ALEN); } } @@ -1028,18 +1002,18 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, PSCTS_FB pBuf = (PSCTS_FB)pvCTS; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_b), (PBYTE)&(pBuf->bySignalField_b) + (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b) ); pBuf->wTransmitLength_b = cpu_to_le16(wLen); - pBuf->wDuration_ba = (WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wDuration_ba = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data pBuf->wDuration_ba += pDevice->wCTSDuration; pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba); //Get CTSDuration_ba_f0 - pBuf->wCTSDuration_ba_f0 = (WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wCTSDuration_ba_f0 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data pBuf->wCTSDuration_ba_f0 += pDevice->wCTSDuration; pBuf->wCTSDuration_ba_f0 = cpu_to_le16(pBuf->wCTSDuration_ba_f0); //Get CTSDuration_ba_f1 - pBuf->wCTSDuration_ba_f1 = (WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wCTSDuration_ba_f1 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data pBuf->wCTSDuration_ba_f1 += pDevice->wCTSDuration; pBuf->wCTSDuration_ba_f1 = cpu_to_le16(pBuf->wCTSDuration_ba_f1); //Get CTS Frame body @@ -1053,11 +1027,11 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, PSCTS pBuf = (PSCTS)pvCTS; //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, - (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_b), (PBYTE)&(pBuf->bySignalField_b) + (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b) ); pBuf->wTransmitLength_b = cpu_to_le16(wLen); //Get CTSDuration_ba - pBuf->wDuration_ba = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wDuration_ba = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data pBuf->wDuration_ba += pDevice->wCTSDuration; pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba); @@ -1098,7 +1072,7 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, static void s_vGenerateTxParameter(struct vnt_private *pDevice, u8 byPktType, u16 wCurrentRate, void *pTxBufHead, void *pvRrvTime, void *pvRTS, void *pvCTS, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx, - PSEthernetHeader psEthHeader) + struct ethhdr *psEthHeader) { u32 cbMACHdLen = WLAN_HDR_ADDR3_LEN; /* 24 */ u16 wFifoCtl; @@ -1130,11 +1104,11 @@ static void s_vGenerateTxParameter(struct vnt_private *pDevice, //Fill RsvTime if (pvRrvTime) { PSRrvTime_gRTS pBuf = (PSRrvTime_gRTS)pvRrvTime; - pBuf->wRTSTxRrvTime_aa = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 1:2.4GHz - pBuf->wRTSTxRrvTime_ba = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));//1:RTSTxRrvTime_ba, 1:2.4GHz - pBuf->wRTSTxRrvTime_bb = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz - pBuf->wTxRrvTime_a = cpu_to_le16((WORD) s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM - pBuf->wTxRrvTime_b = cpu_to_le16((WORD) s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK + pBuf->wRTSTxRrvTime_aa = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 1:2.4GHz + pBuf->wRTSTxRrvTime_ba = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));//1:RTSTxRrvTime_ba, 1:2.4GHz + pBuf->wRTSTxRrvTime_bb = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz + pBuf->wTxRrvTime_a = cpu_to_le16((u16) s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM + pBuf->wTxRrvTime_b = cpu_to_le16((u16) s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK } //Fill RTS s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); @@ -1144,9 +1118,9 @@ static void s_vGenerateTxParameter(struct vnt_private *pDevice, //Fill RsvTime if (pvRrvTime) { PSRrvTime_gCTS pBuf = (PSRrvTime_gCTS)pvRrvTime; - pBuf->wTxRrvTime_a = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM - pBuf->wTxRrvTime_b = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK - pBuf->wCTSTxRrvTime_ba = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));//3:CTSTxRrvTime_Ba, 1:2.4GHz + pBuf->wTxRrvTime_a = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM + pBuf->wTxRrvTime_b = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK + pBuf->wCTSTxRrvTime_ba = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));//3:CTSTxRrvTime_Ba, 1:2.4GHz } //Fill CTS s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption); @@ -1158,8 +1132,8 @@ static void s_vGenerateTxParameter(struct vnt_private *pDevice, //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; - pBuf->wRTSTxRrvTime = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 0:5GHz - pBuf->wTxRrvTime = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//0:OFDM + pBuf->wRTSTxRrvTime = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 0:5GHz + pBuf->wTxRrvTime = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//0:OFDM } //Fill RTS s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); @@ -1168,7 +1142,7 @@ static void s_vGenerateTxParameter(struct vnt_private *pDevice, //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; - pBuf->wTxRrvTime = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK)); //0:OFDM + pBuf->wTxRrvTime = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK)); //0:OFDM } } } @@ -1178,8 +1152,8 @@ static void s_vGenerateTxParameter(struct vnt_private *pDevice, //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; - pBuf->wRTSTxRrvTime = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz - pBuf->wTxRrvTime = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));//1:CCK + pBuf->wRTSTxRrvTime = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz + pBuf->wTxRrvTime = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));//1:CCK } //Fill RTS s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); @@ -1188,21 +1162,21 @@ static void s_vGenerateTxParameter(struct vnt_private *pDevice, //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; - pBuf->wTxRrvTime = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK)); //1:CCK + pBuf->wTxRrvTime = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK)); //1:CCK } } } //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter END.\n"); } /* - PBYTE pbyBuffer,//point to pTxBufHead - WORD wFragType,//00:Non-Frag, 01:Start, 02:Mid, 03:Last + u8 * pbyBuffer,//point to pTxBufHead + u16 wFragType,//00:Non-Frag, 01:Start, 02:Mid, 03:Last unsigned int cbFragmentSize,//Hdr+payoad+FCS */ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, u8 *usbPacketBuf, int bNeedEncryption, u32 uSkbPacketLen, u32 uDMAIdx, - PSEthernetHeader psEthHeader, u8 *pPacket, PSKeyItem pTransmitKey, + struct ethhdr *psEthHeader, u8 *pPacket, PSKeyItem pTransmitKey, u32 uNodeIndex, u16 wCurrentRate, u32 *pcbHeaderLen, u32 *pcbTotalLen) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -1240,7 +1214,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, memset(pTxBufHead, 0, sizeof(TX_BUFFER)); // Get pkt type - if (ntohs(psEthHeader->wType) > ETH_DATA_LEN) { + if (ntohs(psEthHeader->h_proto) > ETH_DATA_LEN) { if (pDevice->dwDiagRefCount == 0) { cb802_1_H_len = 8; } else { @@ -1253,7 +1227,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, cbFrameBodySize = uSkbPacketLen - ETH_HLEN + cb802_1_H_len; //Set packet type - pTxBufHead->wFIFOCtl |= (WORD)(byPktType<<8); + pTxBufHead->wFIFOCtl |= (u16)(byPktType<<8); if (pDevice->dwDiagRefCount != 0) { bNeedACK = false; @@ -1261,7 +1235,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, } else { //if (pDevice->dwDiagRefCount != 0) { if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { - if (is_multicast_ether_addr(psEthHeader->abyDstAddr)) { + if (is_multicast_ether_addr(psEthHeader->h_dest)) { bNeedACK = false; pTxBufHead->wFIFOCtl = pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK); @@ -1293,7 +1267,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, } else { cbMACHdLen = WLAN_HDR_ADDR3_LEN; } - pTxBufHead->wFragCtl |= (WORD)(cbMACHdLen << 10); + pTxBufHead->wFragCtl |= (u16)(cbMACHdLen << 10); //Set FIFOCTL_GrpAckPolicy if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 @@ -1326,7 +1300,6 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, } } - if ((bNeedEncryption) && (pTransmitKey != NULL)) { if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { cbIVlen = 4; @@ -1358,7 +1331,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, pTxBufHead->wFIFOCtl |= (FIFOCTL_RTS | FIFOCTL_LRETRY); } - pbyTxBufferAddr = (PBYTE) &(pTxBufHead->adwTxKey[0]); + pbyTxBufferAddr = (u8 *) &(pTxBufHead->adwTxKey[0]); wTxBufSize = sizeof(STxBufHead); if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet if (byFBOption == AUTO_FB_NONE) { @@ -1437,10 +1410,9 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, } // Auto Fall Back } - pbyMacHdr = (PBYTE)(pbyTxBufferAddr + cbHeaderLength); - pbyIVHead = (PBYTE)(pbyMacHdr + cbMACHdLen + uPadding); - pbyPayloadHead = (PBYTE)(pbyMacHdr + cbMACHdLen + uPadding + cbIVlen); - + pbyMacHdr = (u8 *)(pbyTxBufferAddr + cbHeaderLength); + pbyIVHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding); + pbyPayloadHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding + cbIVlen); //========================= // No Fragmentation @@ -1450,7 +1422,6 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, //uDMAIdx = TYPE_AC0DMA; //pTxBufHead = (PSTxBufHead) &(pTxBufHead->adwTxKey[0]); - //Fill FIFO,RrvTime,RTS,and CTS s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, (void *)pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS, @@ -1459,13 +1430,13 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK, 0, 0, 1/*uMACfragNum*/, byFBOption); // Generate TX MAC Header - s_vGenerateMACHeader(pDevice, pbyMacHdr, (WORD)uDuration, psEthHeader, bNeedEncryption, + s_vGenerateMACHeader(pDevice, pbyMacHdr, (u16)uDuration, psEthHeader, bNeedEncryption, byFragType, uDMAIdx, 0); if (bNeedEncryption == true) { //Fill TXKEY - s_vFillTxKey(pDevice, (PBYTE)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, - pbyMacHdr, (WORD)cbFrameBodySize, (PBYTE)pMICHDR); + s_vFillTxKey(pDevice, (u8 *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, + pbyMacHdr, (u16)cbFrameBodySize, (u8 *)pMICHDR); if (pDevice->bEnableHostWEP) { pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; @@ -1474,25 +1445,24 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, } // 802.1H - if (ntohs(psEthHeader->wType) > ETH_DATA_LEN) { + if (ntohs(psEthHeader->h_proto) > ETH_DATA_LEN) { if (pDevice->dwDiagRefCount == 0) { - if ((psEthHeader->wType == cpu_to_be16(ETH_P_IPX)) || - (psEthHeader->wType == cpu_to_le16(0xF380))) { - memcpy((PBYTE) (pbyPayloadHead), + if ((psEthHeader->h_proto == cpu_to_be16(ETH_P_IPX)) || + (psEthHeader->h_proto == cpu_to_le16(0xF380))) { + memcpy((u8 *) (pbyPayloadHead), abySNAP_Bridgetunnel, 6); } else { - memcpy((PBYTE) (pbyPayloadHead), &abySNAP_RFC1042[0], 6); + memcpy((u8 *) (pbyPayloadHead), &abySNAP_RFC1042[0], 6); } - pbyType = (PBYTE) (pbyPayloadHead + 6); - memcpy(pbyType, &(psEthHeader->wType), sizeof(WORD)); + pbyType = (u8 *) (pbyPayloadHead + 6); + memcpy(pbyType, &(psEthHeader->h_proto), sizeof(u16)); } else { - memcpy((PBYTE) (pbyPayloadHead), &(psEthHeader->wType), sizeof(WORD)); + memcpy((u8 *) (pbyPayloadHead), &(psEthHeader->h_proto), sizeof(u16)); } } - if (pPacket != NULL) { // Copy the Packet into a tx Buffer memcpy((pbyPayloadHead + cb802_1_H_len), @@ -1502,7 +1472,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, } else { // while bRelayPacketSend psEthHeader is point to header+payload - memcpy((pbyPayloadHead + cb802_1_H_len), ((PBYTE)psEthHeader) + ETH_HLEN, uSkbPacketLen - ETH_HLEN); + memcpy((pbyPayloadHead + cb802_1_H_len), ((u8 *)psEthHeader) + ETH_HLEN, uSkbPacketLen - ETH_HLEN); } ASSERT(uLength == cbNdisBodySize); @@ -1516,18 +1486,18 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); } else if ((pTransmitKey->dwKeyIndex & AUTHENTICATOR_KEY) != 0) { - dwMICKey0 = *(PDWORD)(&pTransmitKey->abyKey[16]); - dwMICKey1 = *(PDWORD)(&pTransmitKey->abyKey[20]); + dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16]); + dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); } else { - dwMICKey0 = *(PDWORD)(&pTransmitKey->abyKey[24]); - dwMICKey1 = *(PDWORD)(&pTransmitKey->abyKey[28]); + dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[24]); + dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[28]); } // DO Software Michael MIC_vInit(dwMICKey0, dwMICKey1); - MIC_vAppend((PBYTE)&(psEthHeader->abyDstAddr[0]), 12); + MIC_vAppend((u8 *)&(psEthHeader->h_dest[0]), 12); dwMIC_Priority = 0; - MIC_vAppend((PBYTE)&dwMIC_Priority, 4); + MIC_vAppend((u8 *)&dwMIC_Priority, 4); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %X, %X\n", dwMICKey0, dwMICKey1); @@ -1535,14 +1505,14 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, //DBG_PRN_GRP12(("Length:%d, %d\n", cbFrameBodySize, uFromHDtoPLDLength)); //for (ii = 0; ii < cbFrameBodySize; ii++) { - // DBG_PRN_GRP12(("%02x ", *((PBYTE)((pbyPayloadHead + cb802_1_H_len) + ii)))); + // DBG_PRN_GRP12(("%02x ", *((u8 *)((pbyPayloadHead + cb802_1_H_len) + ii)))); //} //DBG_PRN_GRP12(("\n\n\n")); MIC_vAppend(pbyPayloadHead, cbFrameBodySize); - pdwMIC_L = (PDWORD)(pbyPayloadHead + cbFrameBodySize); - pdwMIC_R = (PDWORD)(pbyPayloadHead + cbFrameBodySize + 4); + pdwMIC_L = (u32 *)(pbyPayloadHead + cbFrameBodySize); + pdwMIC_R = (u32 *)(pbyPayloadHead + cbFrameBodySize + 4); MIC_vGetMIC(pdwMIC_L, pdwMIC_R); MIC_vUnInit(); @@ -1557,10 +1527,9 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R); } - if (bSoftWEP == true) { - s_vSWencryption(pDevice, pTransmitKey, (pbyPayloadHead), (WORD)(cbFrameBodySize + cbMIClen)); + s_vSWencryption(pDevice, pTransmitKey, (pbyPayloadHead), (u16)(cbFrameBodySize + cbMIClen)); } else if ( ((pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) && (bNeedEncryption == true)) || ((pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) && (bNeedEncryption == true)) || @@ -1570,13 +1539,13 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, if (pDevice->bSoftwareGenCrcErr == true) { unsigned int cbLen; - PDWORD pdwCRC; + u32 * pdwCRC; dwCRC = 0xFFFFFFFFL; cbLen = cbFrameSize - cbFCSlen; // calculate CRC, and wrtie CRC value to end of TD dwCRC = CRCdwGetCrc32Ex(pbyMacHdr, cbLen, dwCRC); - pdwCRC = (PDWORD)(pbyMacHdr + cbLen); + pdwCRC = (u32 *)(pbyMacHdr + cbLen); // finally, we must invert dwCRC to get the correct answer *pdwCRC = ~dwCRC; // Force Error @@ -1588,16 +1557,13 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, *pcbHeaderLen = cbHeaderLength; *pcbTotalLen = cbHeaderLength + cbFrameSize ; - //Set FragCtl in TxBufferHead - pTxBufHead->wFragCtl |= (WORD)byFragType; - + pTxBufHead->wFragCtl |= (u16)byFragType; return true; } - /*+ * * Description: @@ -1618,67 +1584,67 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, -*/ static void s_vGenerateMACHeader(struct vnt_private *pDevice, - u8 *pbyBufferAddr, u16 wDuration, PSEthernetHeader psEthHeader, + u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx) { - PS802_11Header pMACHeader = (PS802_11Header)pbyBufferAddr; + struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyBufferAddr; - memset(pMACHeader, 0, (sizeof(S802_11Header))); //- sizeof(pMACHeader->dwIV))); + memset(pMACHeader, 0, (sizeof(struct ieee80211_hdr))); if (uDMAIdx == TYPE_ATIMDMA) { - pMACHeader->wFrameCtl = TYPE_802_11_ATIM; + pMACHeader->frame_control = TYPE_802_11_ATIM; } else { - pMACHeader->wFrameCtl = TYPE_802_11_DATA; + pMACHeader->frame_control = TYPE_802_11_DATA; } if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pMACHeader->abyAddr1[0]), - &(psEthHeader->abyDstAddr[0]), + memcpy(&(pMACHeader->addr1[0]), + &(psEthHeader->h_dest[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr3[0]), - &(psEthHeader->abySrcAddr[0]), + memcpy(&(pMACHeader->addr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + memcpy(&(pMACHeader->addr3[0]), + &(psEthHeader->h_source[0]), ETH_ALEN); - pMACHeader->wFrameCtl |= FC_FROMDS; + pMACHeader->frame_control |= FC_FROMDS; } else { if (pDevice->eOPMode == OP_MODE_ADHOC) { - memcpy(&(pMACHeader->abyAddr1[0]), - &(psEthHeader->abyDstAddr[0]), + memcpy(&(pMACHeader->addr1[0]), + &(psEthHeader->h_dest[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr2[0]), - &(psEthHeader->abySrcAddr[0]), + memcpy(&(pMACHeader->addr2[0]), + &(psEthHeader->h_source[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr3[0]), + memcpy(&(pMACHeader->addr3[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); } else { - memcpy(&(pMACHeader->abyAddr3[0]), - &(psEthHeader->abyDstAddr[0]), + memcpy(&(pMACHeader->addr3[0]), + &(psEthHeader->h_dest[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr2[0]), - &(psEthHeader->abySrcAddr[0]), + memcpy(&(pMACHeader->addr2[0]), + &(psEthHeader->h_source[0]), ETH_ALEN); - memcpy(&(pMACHeader->abyAddr1[0]), + memcpy(&(pMACHeader->addr1[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); - pMACHeader->wFrameCtl |= FC_TODS; + pMACHeader->frame_control |= FC_TODS; } } if (bNeedEncrypt) - pMACHeader->wFrameCtl |= cpu_to_le16((WORD)WLAN_SET_FC_ISWEP(1)); + pMACHeader->frame_control |= cpu_to_le16((u16)WLAN_SET_FC_ISWEP(1)); - pMACHeader->wDurationID = cpu_to_le16(wDuration); + pMACHeader->duration_id = cpu_to_le16(wDuration); if (pDevice->bLongHeader) { PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr; - pMACHeader->wFrameCtl |= (FC_TODS | FC_FROMDS); + pMACHeader->frame_control |= (FC_TODS | FC_FROMDS); memcpy(pMACA4Header->abyAddr4, pDevice->abyBSSID, WLAN_ADDR_LEN); } - pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); + pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); //Set FragNumber in Sequence Control - pMACHeader->wSeqCtl |= cpu_to_le16((WORD)uFragIdx); + pMACHeader->seq_ctrl |= cpu_to_le16((u16)uFragIdx); if ((wFragType == FRAGCTL_ENDFRAG) || (wFragType == FRAGCTL_NONFRAG)) { pDevice->wSeqCounter++; @@ -1687,12 +1653,10 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice, } if ((wFragType == FRAGCTL_STAFRAG) || (wFragType == FRAGCTL_MIDFRAG)) { //StartFrag or MidFrag - pMACHeader->wFrameCtl |= FC_MOREFRAG; + pMACHeader->frame_control |= FC_MOREFRAG; } } - - /*+ * * Description: @@ -1717,9 +1681,9 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PTX_BUFFER pTX_Buffer; PSTxBufHead pTxBufHead; PUSB_SEND_CONTEXT pContext; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; PSCTS pCTS; - SEthernetHeader sEthHeader; + struct ethhdr sEthHeader; u8 byPktType, *pbyTxBufferAddr; void *pvRTS, *pvTxDataHd, *pvRrvTime, *pMICHDR; u32 uDuration, cbReqCount, cbHeaderSize, cbFrameBodySize, cbFrameSize; @@ -1730,8 +1694,6 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, u32 cbMacHdLen; u16 wCurrentRate = RATE_1M; - - pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice); if (NULL == pContext) { @@ -1740,7 +1702,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, } pTX_Buffer = (PTX_BUFFER) (&pContext->Data[0]); - pbyTxBufferAddr = (PBYTE)&(pTX_Buffer->adwTxKey[0]); + pbyTxBufferAddr = (u8 *)&(pTX_Buffer->adwTxKey[0]); cbFrameBodySize = pPacket->cbPayloadLen; pTxBufHead = (PSTxBufHead) pbyTxBufferAddr; wTxBufSize = sizeof(STxBufHead); @@ -1765,7 +1727,6 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, } pDevice->wCurrentRate = wCurrentRate; - //Set packet type if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 pTxBufHead->wFIFOCtl = 0; @@ -1814,7 +1775,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, } //Set FRAGCTL_MACHDCNT - pTxBufHead->wFragCtl |= cpu_to_le16((WORD)(cbMacHdLen << 10)); + pTxBufHead->wFragCtl |= cpu_to_le16((u16)(cbMacHdLen << 10)); // Notes: // Although spec says MMPDU can be fragmented; In most case, @@ -1877,17 +1838,16 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize)); - memcpy(&(sEthHeader.abyDstAddr[0]), + memcpy(&(sEthHeader.h_dest[0]), &(pPacket->p80211Header->sA3.abyAddr1[0]), ETH_ALEN); - memcpy(&(sEthHeader.abySrcAddr[0]), + memcpy(&(sEthHeader.h_source[0]), &(pPacket->p80211Header->sA3.abyAddr2[0]), ETH_ALEN); //========================= // No Fragmentation //========================= - pTxBufHead->wFragCtl |= (WORD)FRAGCTL_NONFRAG; - + pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; //Fill FIFO,RrvTime,RTS,and CTS s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, pbyTxBufferAddr, pvRrvTime, pvRTS, pCTS, @@ -1897,18 +1857,18 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, 0, 0, 1, AUTO_FB_NONE); - pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + cbFrameBodySize; if (WLAN_GET_FC_ISWEP(pPacket->p80211Header->sA4.wFrameCtl) != 0) { - PBYTE pbyIVHead; - PBYTE pbyPayloadHead; - PBYTE pbyBSSID; + u8 * pbyIVHead; + u8 * pbyPayloadHead; + u8 * pbyBSSID; PSKeyItem pTransmitKey = NULL; - pbyIVHead = (PBYTE)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding); - pbyPayloadHead = (PBYTE)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding + cbIVlen); + pbyIVHead = (u8 *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding); + pbyPayloadHead = (u8 *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding + cbIVlen); do { if ((pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) && (pDevice->bLinkPass == true)) { @@ -1935,11 +1895,11 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, } } while(false); //Fill TXKEY - s_vFillTxKey(pDevice, (PBYTE)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, - (PBYTE)pMACHeader, (WORD)cbFrameBodySize, NULL); + s_vFillTxKey(pDevice, (u8 *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, + (u8 *)pMACHeader, (u16)cbFrameBodySize, NULL); memcpy(pMACHeader, pPacket->p80211Header, cbMacHdLen); - memcpy(pbyPayloadHead, ((PBYTE)(pPacket->p80211Header) + cbMacHdLen), + memcpy(pbyPayloadHead, ((u8 *)(pPacket->p80211Header) + cbMacHdLen), cbFrameBodySize); } else { @@ -1947,7 +1907,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); } - pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); + pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); pDevice->wSeqCounter++ ; if (pDevice->wSeqCounter > 0x0fff) pDevice->wSeqCounter = 0; @@ -1966,27 +1926,25 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, } } - - pTX_Buffer->wTxByteCount = cpu_to_le16((WORD)(cbReqCount)); - pTX_Buffer->byPKTNO = (BYTE) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); + pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount)); + pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); pTX_Buffer->byType = 0x00; pContext->pPacket = NULL; pContext->Type = CONTEXT_MGMT_PACKET; - pContext->uBufLen = (WORD)cbReqCount + 4; //USB header + pContext->uBufLen = (u16)cbReqCount + 4; //USB header - if (WLAN_GET_FC_TODS(pMACHeader->wFrameCtl) == 0) { - s_vSaveTxPktInfo(pDevice, (BYTE) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr1[0]),(WORD)cbFrameSize,pTX_Buffer->wFIFOCtl); + if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr1[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } else { - s_vSaveTxPktInfo(pDevice, (BYTE) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr3[0]),(WORD)cbFrameSize,pTX_Buffer->wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr3[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } PIPEnsSendBulkOut(pDevice,pContext); return CMD_STATUS_PENDING; } - CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, struct vnt_tx_mgmt *pPacket) { @@ -1994,7 +1952,7 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, u32 cbHeaderSize = 0; u16 wTxBufSize = sizeof(STxShortBufHead); PSTxShortBufHead pTxBufHead; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; PSTxDataHead_ab pTxDataHead; u16 wCurrentRate; u32 cbFrameBodySize; @@ -2004,7 +1962,6 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, PUSB_SEND_CONTEXT pContext; CMD_STATUS status; - pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice); if (NULL == pContext) { status = CMD_STATUS_RESOURCES; @@ -2012,7 +1969,7 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, return status ; } pTX_Buffer = (PBEACON_BUFFER) (&pContext->Data[0]); - pbyTxBufferAddr = (PBYTE)&(pTX_Buffer->wFIFOCtl); + pbyTxBufferAddr = (u8 *)&(pTX_Buffer->wFIFOCtl); cbFrameBodySize = pPacket->cbPayloadLen; @@ -2025,10 +1982,10 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, pTxDataHead = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize); //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11A, - (PWORD)&(pTxDataHead->wTransmitLength), (PBYTE)&(pTxDataHead->byServiceField), (PBYTE)&(pTxDataHead->bySignalField) + (u16 *)&(pTxDataHead->wTransmitLength), (u8 *)&(pTxDataHead->byServiceField), (u8 *)&(pTxDataHead->bySignalField) ); //Get Duration and TimeStampOff - pTxDataHead->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, PK_TYPE_11A, + pTxDataHead->wDuration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, PK_TYPE_11A, wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE)); pTxDataHead->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab); @@ -2038,41 +1995,40 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, pTxDataHead = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize); //Get SignalField,ServiceField,Length BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11B, - (PWORD)&(pTxDataHead->wTransmitLength), (PBYTE)&(pTxDataHead->byServiceField), (PBYTE)&(pTxDataHead->bySignalField) + (u16 *)&(pTxDataHead->wTransmitLength), (u8 *)&(pTxDataHead->byServiceField), (u8 *)&(pTxDataHead->bySignalField) ); //Get Duration and TimeStampOff - pTxDataHead->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, PK_TYPE_11B, + pTxDataHead->wDuration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, PK_TYPE_11B, wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE)); pTxDataHead->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab); } //Generate Beacon Header - pMACHeader = (PS802_11Header)(pbyTxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *)(pbyTxBufferAddr + cbHeaderSize); memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); - pMACHeader->wDurationID = 0; - pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); + pMACHeader->duration_id = 0; + pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); pDevice->wSeqCounter++ ; if (pDevice->wSeqCounter > 0x0fff) pDevice->wSeqCounter = 0; cbReqCount = cbHeaderSize + WLAN_HDR_ADDR3_LEN + cbFrameBodySize; - pTX_Buffer->wTxByteCount = (WORD)cbReqCount; - pTX_Buffer->byPKTNO = (BYTE) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); + pTX_Buffer->wTxByteCount = (u16)cbReqCount; + pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); pTX_Buffer->byType = 0x01; pContext->pPacket = NULL; pContext->Type = CONTEXT_MGMT_PACKET; - pContext->uBufLen = (WORD)cbReqCount + 4; //USB header + pContext->uBufLen = (u16)cbReqCount + 4; //USB header PIPEnsSendBulkOut(pDevice,pContext); return CMD_STATUS_PENDING; } - void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -2080,7 +2036,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) u8 *pbyTxBufferAddr; void *pvRTS, *pvCTS, *pvTxDataHd; u32 uDuration, cbReqCount; - PS802_11Header pMACHeader; + struct ieee80211_hdr *pMACHeader; u32 cbHeaderSize, cbFrameBodySize; int bNeedACK, bIsPSPOLL = false; PSTxBufHead pTxBufHead; @@ -2093,7 +2049,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) u32 *pdwMIC_L, *pdwMIC_R; u16 wTxBufSize; u32 cbMacHdLen; - SEthernetHeader sEthHeader; + struct ethhdr sEthHeader; void *pvRrvTime, *pMICHDR; u32 wCurrentRate = RATE_1M; PUWLAN_80211HDR p80211Header; @@ -2106,7 +2062,6 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) PTX_BUFFER pTX_Buffer; PUSB_SEND_CONTEXT pContext; - pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL; if(skb->len <= WLAN_HDR_ADDR3_LEN) { @@ -2126,7 +2081,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } pTX_Buffer = (PTX_BUFFER)(&pContext->Data[0]); - pbyTxBufferAddr = (PBYTE)(&pTX_Buffer->adwTxKey[0]); + pbyTxBufferAddr = (u8 *)(&pTX_Buffer->adwTxKey[0]); pTxBufHead = (PSTxBufHead) pbyTxBufferAddr; wTxBufSize = sizeof(STxBufHead); memset(pTxBufHead, 0, wTxBufSize); @@ -2177,7 +2132,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } else { if (pDevice->bEnableHostWEP) { - if (BSSbIsSTAInNodeDB(pDevice, (PBYTE)(p80211Header->sA3.abyAddr1), &uNodeIndex)) + if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(p80211Header->sA3.abyAddr1), &uNodeIndex)) bNodeExist = true; } bNeedACK = true; @@ -2223,16 +2178,14 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } } - //Set FRAGCTL_MACHDCNT - pTxBufHead->wFragCtl |= cpu_to_le16((WORD)cbMacHdLen << 10); + pTxBufHead->wFragCtl |= cpu_to_le16((u16)cbMacHdLen << 10); // Notes: // Although spec says MMPDU can be fragmented; In most case, // no one will send a MMPDU under fragmentation. With RTS may occur. pDevice->bAES = false; //Set FRAGCTL_WEPTYP - if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) { if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) { cbIVlen = 4; @@ -2268,7 +2221,6 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() - if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize); @@ -2290,17 +2242,16 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize)); - memcpy(&(sEthHeader.abyDstAddr[0]), + memcpy(&(sEthHeader.h_dest[0]), &(p80211Header->sA3.abyAddr1[0]), ETH_ALEN); - memcpy(&(sEthHeader.abySrcAddr[0]), + memcpy(&(sEthHeader.h_source[0]), &(p80211Header->sA3.abyAddr2[0]), ETH_ALEN); //========================= // No Fragmentation //========================= - pTxBufHead->wFragCtl |= (WORD)FRAGCTL_NONFRAG; - + pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; //Fill FIFO,RrvTime,RTS,and CTS s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS, @@ -2310,19 +2261,19 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, 0, 0, 1, AUTO_FB_NONE); - pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen) + cbExtSuppRate; - pbyMacHdr = (PBYTE)(pbyTxBufferAddr + cbHeaderSize); - pbyPayloadHead = (PBYTE)(pbyMacHdr + cbMacHdLen + uPadding + cbIVlen); - pbyIVHead = (PBYTE)(pbyMacHdr + cbMacHdLen + uPadding); + pbyMacHdr = (u8 *)(pbyTxBufferAddr + cbHeaderSize); + pbyPayloadHead = (u8 *)(pbyMacHdr + cbMacHdLen + uPadding + cbIVlen); + pbyIVHead = (u8 *)(pbyMacHdr + cbMacHdLen + uPadding); // Copy the Packet into a tx Buffer memcpy(pbyMacHdr, skb->data, cbMacHdLen); // version set to 0, patch for hostapd deamon - pMACHeader->wFrameCtl &= cpu_to_le16(0xfffc); + pMACHeader->frame_control &= cpu_to_le16(0xfffc); memcpy(pbyPayloadHead, (skb->data + cbMacHdLen), cbFrameBodySize); // replace support rate, patch for hostapd daemon( only support 11M) @@ -2359,14 +2310,14 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) if ((pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { - dwMICKey0 = *(PDWORD)(&pTransmitKey->abyKey[16]); - dwMICKey1 = *(PDWORD)(&pTransmitKey->abyKey[20]); + dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16]); + dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); // DO Software Michael MIC_vInit(dwMICKey0, dwMICKey1); - MIC_vAppend((PBYTE)&(sEthHeader.abyDstAddr[0]), 12); + MIC_vAppend((u8 *)&(sEthHeader.h_dest[0]), 12); dwMIC_Priority = 0; - MIC_vAppend((PBYTE)&dwMIC_Priority, 4); + MIC_vAppend((u8 *)&dwMIC_Priority, 4); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY:"\ " %X, %X\n", dwMICKey0, dwMICKey1); @@ -2374,8 +2325,8 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) MIC_vAppend((pbyTxBufferAddr + uLength), cbFrameBodySize); - pdwMIC_L = (PDWORD)(pbyTxBufferAddr + uLength + cbFrameBodySize); - pdwMIC_R = (PDWORD)(pbyTxBufferAddr + uLength + cbFrameBodySize + 4); + pdwMIC_L = (u32 *)(pbyTxBufferAddr + uLength + cbFrameBodySize); + pdwMIC_R = (u32 *)(pbyTxBufferAddr + uLength + cbFrameBodySize + 4); MIC_vGetMIC(pdwMIC_L, pdwMIC_R); MIC_vUnInit(); @@ -2393,8 +2344,8 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } - s_vFillTxKey(pDevice, (PBYTE)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, - pbyMacHdr, (WORD)cbFrameBodySize, (PBYTE)pMICHDR); + s_vFillTxKey(pDevice, (u8 *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, + pbyMacHdr, (u16)cbFrameBodySize, (u8 *)pMICHDR); if (pDevice->bEnableHostWEP) { pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; @@ -2402,16 +2353,15 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) { - s_vSWencryption(pDevice, pTransmitKey, pbyPayloadHead, (WORD)(cbFrameBodySize + cbMIClen)); + s_vSWencryption(pDevice, pTransmitKey, pbyPayloadHead, (u16)(cbFrameBodySize + cbMIClen)); } } - pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); + pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); pDevice->wSeqCounter++ ; if (pDevice->wSeqCounter > 0x0fff) pDevice->wSeqCounter = 0; - if (bIsPSPOLL) { // The MAC will automatically replace the Duration-field of MAC header by Duration-field // of FIFO control header. @@ -2426,28 +2376,25 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } } - pTX_Buffer->wTxByteCount = cpu_to_le16((WORD)(cbReqCount)); - pTX_Buffer->byPKTNO = (BYTE) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); + pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount)); + pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); pTX_Buffer->byType = 0x00; pContext->pPacket = skb; pContext->Type = CONTEXT_MGMT_PACKET; - pContext->uBufLen = (WORD)cbReqCount + 4; //USB header + pContext->uBufLen = (u16)cbReqCount + 4; //USB header - if (WLAN_GET_FC_TODS(pMACHeader->wFrameCtl) == 0) { - s_vSaveTxPktInfo(pDevice, (BYTE) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr1[0]),(WORD)cbFrameSize,pTX_Buffer->wFIFOCtl); + if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr1[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } else { - s_vSaveTxPktInfo(pDevice, (BYTE) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->abyAddr3[0]),(WORD)cbFrameSize,pTX_Buffer->wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pMACHeader->addr3[0]), (u16)cbFrameSize, pTX_Buffer->wFIFOCtl); } PIPEnsSendBulkOut(pDevice,pContext); return ; } - - - //TYPE_AC0DMA data tx /* * Description: @@ -2488,7 +2435,6 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, u16 wKeepRate = pDevice->wCurrentRate; int bTxeapol_key = false; - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (pDevice->uAssocCount == 0) { @@ -2496,7 +2442,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, return 0; } - if (is_multicast_ether_addr((PBYTE)(skb->data))) { + if (is_multicast_ether_addr((u8 *)(skb->data))) { uNodeIndex = 0; bNodeExist = true; if (pMgmt->sNodeDBTable[0].bPSEnable) { @@ -2518,7 +2464,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, }else { - if (BSSbIsSTAInNodeDB(pDevice, (PBYTE)(skb->data), &uNodeIndex)) { + if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(skb->data), &uNodeIndex)) { if (pMgmt->sNodeDBTable[uNodeIndex].bPSEnable) { @@ -2562,20 +2508,20 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, return STATUS_RESOURCES; } - memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(skb->data), ETH_HLEN); + memcpy(pDevice->sTxEthHeader.h_dest, (u8 *)(skb->data), ETH_HLEN); //mike add:station mode check eapol-key challenge---> { - BYTE Protocol_Version; //802.1x Authentication - BYTE Packet_Type; //802.1x Authentication - BYTE Descriptor_type; - WORD Key_info; + u8 Protocol_Version; //802.1x Authentication + u8 Packet_Type; //802.1x Authentication + u8 Descriptor_type; + u16 Key_info; 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 == cpu_to_be16(ETH_P_PAE)) { + if (pDevice->sTxEthHeader.h_proto == cpu_to_be16(ETH_P_PAE)) { /* 802.1x OR eapol-key challenge frame transfer */ if (((Protocol_Version == 1) || (Protocol_Version == 2)) && (Packet_Type == 3)) { @@ -2622,8 +2568,8 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, break; } }else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - - pbyBSSID = pDevice->sTxEthHeader.abyDstAddr; //TO_DS = 0 and FROM_DS = 0 --> 802.11 MAC Address1 + /* TO_DS = 0 and FROM_DS = 0 --> 802.11 MAC Address1 */ + pbyBSSID = pDevice->sTxEthHeader.h_dest; DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS Serach Key: \n"); for (ii = 0; ii< 6; ii++) DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"%x \n", *(pbyBSSID+ii)); @@ -2665,14 +2611,14 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, } } - byPktType = (BYTE)pDevice->byPacketType; + byPktType = (u8)pDevice->byPacketType; if (pDevice->bFixRate) { if (pDevice->byBBType == BB_TYPE_11B) { if (pDevice->uConnectionRate >= RATE_11M) { pDevice->wCurrentRate = RATE_11M; } else { - pDevice->wCurrentRate = (WORD)pDevice->uConnectionRate; + pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; } } else { if ((pDevice->byBBType == BB_TYPE_11A) && @@ -2682,21 +2628,21 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, if (pDevice->uConnectionRate >= RATE_54M) pDevice->wCurrentRate = RATE_54M; else - pDevice->wCurrentRate = (WORD)pDevice->uConnectionRate; + pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; } } } else { if (pDevice->eOPMode == OP_MODE_ADHOC) { // Adhoc Tx rate decided from node DB - if (is_multicast_ether_addr(pDevice->sTxEthHeader.abyDstAddr)) { + if (is_multicast_ether_addr(pDevice->sTxEthHeader.h_dest)) { // Multicast use highest data rate pDevice->wCurrentRate = pMgmt->sNodeDBTable[0].wTxDataRate; // preamble type pDevice->byPreambleType = pDevice->byShortPreamble; } else { - if(BSSbIsSTAInNodeDB(pDevice, &(pDevice->sTxEthHeader.abyDstAddr[0]), &uNodeIndex)) { + if (BSSbIsSTAInNodeDB(pDevice, &(pDevice->sTxEthHeader.h_dest[0]), &uNodeIndex)) { pDevice->wCurrentRate = pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate; if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) { pDevice->byPreambleType = pDevice->byShortPreamble; @@ -2724,7 +2670,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, } } - if (pDevice->sTxEthHeader.wType == cpu_to_be16(ETH_P_PAE)) { + if (pDevice->sTxEthHeader.h_proto == cpu_to_be16(ETH_P_PAE)) { if (pDevice->byBBType != BB_TYPE_11A) { pDevice->wCurrentRate = RATE_1M; pDevice->byACKRate = RATE_1M; @@ -2751,10 +2697,10 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, } if (bNeedEncryption == true) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType)); - if ((pDevice->sTxEthHeader.wType) == cpu_to_be16(ETH_P_PAE)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.h_proto)); + if ((pDevice->sTxEthHeader.h_proto) == cpu_to_be16(ETH_P_PAE)) { bNeedEncryption = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Pkt Type=%04x\n", (pDevice->sTxEthHeader.wType)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Pkt Type=%04x\n", (pDevice->sTxEthHeader.h_proto)); if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { if (pTransmitKey == NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Don't Find TX KEY\n"); @@ -2793,9 +2739,9 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, } fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType, - (PBYTE)(&pContext->Data[0]), bNeedEncryption, + (u8 *)(&pContext->Data[0]), bNeedEncryption, skb->len, uDMAIdx, &pDevice->sTxEthHeader, - (PBYTE)skb->data, pTransmitKey, uNodeIndex, + (u8 *)skb->data, pTransmitKey, uNodeIndex, pDevice->wCurrentRate, &uHeaderLen, &BytesToWrite ); @@ -2816,21 +2762,21 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, } pTX_Buffer = (PTX_BUFFER)&(pContext->Data[0]); - pTX_Buffer->byPKTNO = (BYTE) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); - pTX_Buffer->wTxByteCount = (WORD)BytesToWrite; + pTX_Buffer->byPKTNO = (u8) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); + pTX_Buffer->wTxByteCount = (u16)BytesToWrite; pContext->pPacket = skb; pContext->Type = CONTEXT_DATA_PACKET; - pContext->uBufLen = (WORD)BytesToWrite + 4 ; //USB header + pContext->uBufLen = (u16)BytesToWrite + 4 ; //USB header - s_vSaveTxPktInfo(pDevice, (BYTE) (pTX_Buffer->byPKTNO & 0x0F), &(pContext->sEthHeader.abyDstAddr[0]),(WORD) (BytesToWrite-uHeaderLen),pTX_Buffer->wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pContext->sEthHeader.h_dest[0]), (u16) (BytesToWrite-uHeaderLen), pTX_Buffer->wFIFOCtl); status = PIPEnsSendBulkOut(pDevice,pContext); if (bNeedDeAuth == true) { - WORD wReason = WLAN_MGMT_REASON_MIC_FAILURE; + u16 wReason = WLAN_MGMT_REASON_MIC_FAILURE; - bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (PBYTE) &wReason); + bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (u8 *) &wReason); } if(status!=STATUS_PENDING) { @@ -2843,8 +2789,6 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, } - - /* * Description: * Relay packet send (AC1DMA) from rx dpc. @@ -2877,15 +2821,13 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, u32 status; u16 wKeepRate = pDevice->wCurrentRate; - - pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice); if (NULL == pContext) { return false; } - memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)pbySkbData, ETH_HLEN); + memcpy(pDevice->sTxEthHeader.h_dest, (u8 *)pbySkbData, ETH_HLEN); if (pDevice->bEncryptionEnable == true) { bNeedEncryption = true; @@ -2919,14 +2861,14 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, return false; } - byPktTyp = (BYTE)pDevice->byPacketType; + byPktTyp = (u8)pDevice->byPacketType; if (pDevice->bFixRate) { if (pDevice->byBBType == BB_TYPE_11B) { if (pDevice->uConnectionRate >= RATE_11M) { pDevice->wCurrentRate = RATE_11M; } else { - pDevice->wCurrentRate = (WORD)pDevice->uConnectionRate; + pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; } } else { if ((pDevice->byBBType == BB_TYPE_11A) && @@ -2936,7 +2878,7 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, if (pDevice->uConnectionRate >= RATE_54M) pDevice->wCurrentRate = RATE_54M; else - pDevice->wCurrentRate = (WORD)pDevice->uConnectionRate; + pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; } } } @@ -2957,7 +2899,7 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, // and send the irp. fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType, - (PBYTE)(&pContext->Data[0]), bNeedEncryption, + (u8 *)(&pContext->Data[0]), bNeedEncryption, uDataLen, TYPE_AC0DMA, &pDevice->sTxEthHeader, pbySkbData, pTransmitKey, uNodeIndex, pDevice->wCurrentRate, @@ -2970,14 +2912,14 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, } pTX_Buffer = (PTX_BUFFER)&(pContext->Data[0]); - pTX_Buffer->byPKTNO = (BYTE) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); - pTX_Buffer->wTxByteCount = (WORD)BytesToWrite; + pTX_Buffer->byPKTNO = (u8) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); + pTX_Buffer->wTxByteCount = (u16)BytesToWrite; pContext->pPacket = NULL; pContext->Type = CONTEXT_DATA_PACKET; - pContext->uBufLen = (WORD)BytesToWrite + 4 ; //USB header + pContext->uBufLen = (u16)BytesToWrite + 4 ; //USB header - s_vSaveTxPktInfo(pDevice, (BYTE) (pTX_Buffer->byPKTNO & 0x0F), &(pContext->sEthHeader.abyDstAddr[0]),(WORD) (BytesToWrite-uHeaderLen),pTX_Buffer->wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8) (pTX_Buffer->byPKTNO & 0x0F), &(pContext->sEthHeader.h_dest[0]), (u16) (BytesToWrite-uHeaderLen), pTX_Buffer->wFIFOCtl); status = PIPEnsSendBulkOut(pDevice,pContext); diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h index 9f537022cdd1..dd7e85dde1a2 100644 --- a/drivers/staging/vt6656/rxtx.h +++ b/drivers/staging/vt6656/rxtx.h @@ -29,32 +29,27 @@ #ifndef __RXTX_H__ #define __RXTX_H__ -#include "ttype.h" #include "device.h" #include "wcmd.h" -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - // // RTS buffer header // typedef struct tagSRTSDataF { - WORD wFrameControl; - WORD wDurationID; - BYTE abyRA[ETH_ALEN]; - BYTE abyTA[ETH_ALEN]; + u16 wFrameControl; + u16 wDurationID; + u8 abyRA[ETH_ALEN]; + u8 abyTA[ETH_ALEN]; } SRTSDataF, *PSRTSDataF; // // CTS buffer header // typedef struct tagSCTSDataF { - WORD wFrameControl; - WORD wDurationID; - BYTE abyRA[ETH_ALEN]; - WORD wReserved; + u16 wFrameControl; + u16 wDurationID; + u8 abyRA[ETH_ALEN]; + u16 wReserved; } SCTSDataF, *PSCTSDataF; // @@ -66,534 +61,510 @@ typedef struct tagSMICHDR { u32 adwHDR2[4]; } SMICHDR, *PSMICHDR; - typedef struct tagSTX_NAF_G_RTS { //RsvTime - WORD wRTSTxRrvTime_ba; - WORD wRTSTxRrvTime_aa; - WORD wRTSTxRrvTime_bb; - WORD wReserved2; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; + u16 wRTSTxRrvTime_ba; + u16 wRTSTxRrvTime_aa; + u16 wRTSTxRrvTime_bb; + u16 wReserved2; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; //RTS - BYTE byRTSSignalField_b; - BYTE byRTSServiceField_b; - WORD wRTSTransmitLength_b; - BYTE byRTSSignalField_a; - BYTE byRTSServiceField_a; - WORD wRTSTransmitLength_a; - WORD wRTSDuration_ba; - WORD wRTSDuration_aa; - WORD wRTSDuration_bb; - WORD wReserved3; + u8 byRTSSignalField_b; + u8 byRTSServiceField_b; + u16 wRTSTransmitLength_b; + u8 byRTSSignalField_a; + u8 byRTSServiceField_a; + u16 wRTSTransmitLength_a; + u16 wRTSDuration_ba; + u16 wRTSDuration_aa; + u16 wRTSDuration_bb; + u16 wReserved3; SRTSDataF sRTS; //Data - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } TX_NAF_G_RTS, *PTX_NAF_G_RTS; typedef struct tagSTX_NAF_G_RTS_MIC { //RsvTime - WORD wRTSTxRrvTime_ba; - WORD wRTSTxRrvTime_aa; - WORD wRTSTxRrvTime_bb; - WORD wReserved2; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; + u16 wRTSTxRrvTime_ba; + u16 wRTSTxRrvTime_aa; + u16 wRTSTxRrvTime_bb; + u16 wReserved2; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; SMICHDR sMICHDR; //RTS - BYTE byRTSSignalField_b; - BYTE byRTSServiceField_b; - WORD wRTSTransmitLength_b; - BYTE byRTSSignalField_a; - BYTE byRTSServiceField_a; - WORD wRTSTransmitLength_a; - WORD wRTSDuration_ba; - WORD wRTSDuration_aa; - WORD wRTSDuration_bb; - WORD wReserved3; + u8 byRTSSignalField_b; + u8 byRTSServiceField_b; + u16 wRTSTransmitLength_b; + u8 byRTSSignalField_a; + u8 byRTSServiceField_a; + u16 wRTSTransmitLength_a; + u16 wRTSDuration_ba; + u16 wRTSDuration_aa; + u16 wRTSDuration_bb; + u16 wReserved3; SRTSDataF sRTS; //Data - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } TX_NAF_G_RTS_MIC, *PTX_NAF_G_RTS_MIC; typedef struct tagSTX_NAF_G_CTS { //RsvTime - WORD wCTSTxRrvTime_ba; - WORD wReserved2; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; + u16 wCTSTxRrvTime_ba; + u16 wReserved2; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; //CTS - BYTE byCTSSignalField_b; - BYTE byCTSServiceField_b; - WORD wCTSTransmitLength_b; - WORD wCTSDuration_ba; - WORD wReserved3; + u8 byCTSSignalField_b; + u8 byCTSServiceField_b; + u16 wCTSTransmitLength_b; + u16 wCTSDuration_ba; + u16 wReserved3; SCTSDataF sCTS; //Data - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } TX_NAF_G_CTS, *PTX_NAF_G_CTS; - typedef struct tagSTX_NAF_G_CTS_MIC { //RsvTime - WORD wCTSTxRrvTime_ba; - WORD wReserved2; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; - + u16 wCTSTxRrvTime_ba; + u16 wReserved2; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; SMICHDR sMICHDR; //CTS - BYTE byCTSSignalField_b; - BYTE byCTSServiceField_b; - WORD wCTSTransmitLength_b; - WORD wCTSDuration_ba; - WORD wReserved3; + u8 byCTSSignalField_b; + u8 byCTSServiceField_b; + u16 wCTSTransmitLength_b; + u16 wCTSDuration_ba; + u16 wReserved3; SCTSDataF sCTS; //Data - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } TX_NAF_G_CTS_MIC, *PTX_NAF_G_CTS_MIC; - typedef struct tagSTX_NAF_G_BEACON { - WORD wFIFOCtl; - WORD wTimeStamp; + u16 wFIFOCtl; + u16 wTimeStamp; //CTS - BYTE byCTSSignalField_b; - BYTE byCTSServiceField_b; - WORD wCTSTransmitLength_b; - WORD wCTSDuration_ba; - WORD wReserved1; + u8 byCTSSignalField_b; + u8 byCTSServiceField_b; + u16 wCTSTransmitLength_b; + u16 wCTSDuration_ba; + u16 wReserved1; SCTSDataF sCTS; //Data - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_a; - WORD wTimeStampOff_a; - + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_a; + u16 wTimeStampOff_a; } TX_NAF_G_BEACON, *PTX_NAF_G_BEACON; - typedef struct tagSTX_NAF_AB_RTS { //RsvTime - WORD wRTSTxRrvTime_ab; - WORD wTxRrvTime_ab; + u16 wRTSTxRrvTime_ab; + u16 wTxRrvTime_ab; //RTS - BYTE byRTSSignalField_ab; - BYTE byRTSServiceField_ab; - WORD wRTSTransmitLength_ab; - WORD wRTSDuration_ab; - WORD wReserved2; + u8 byRTSSignalField_ab; + u8 byRTSServiceField_ab; + u16 wRTSTransmitLength_ab; + u16 wRTSDuration_ab; + u16 wReserved2; SRTSDataF sRTS; //Data - BYTE bySignalField_ab; - BYTE byServiceField_ab; - WORD wTransmitLength_ab; - WORD wDuration_ab; - WORD wTimeStampOff_ab; - + u8 bySignalField_ab; + u8 byServiceField_ab; + u16 wTransmitLength_ab; + u16 wDuration_ab; + u16 wTimeStampOff_ab; } TX_NAF_AB_RTS, *PTX_NAF_AB_RTS; - typedef struct tagSTX_NAF_AB_RTS_MIC { //RsvTime - WORD wRTSTxRrvTime_ab; - WORD wTxRrvTime_ab; + u16 wRTSTxRrvTime_ab; + u16 wTxRrvTime_ab; SMICHDR sMICHDR; //RTS - BYTE byRTSSignalField_ab; - BYTE byRTSServiceField_ab; - WORD wRTSTransmitLength_ab; - WORD wRTSDuration_ab; - WORD wReserved2; + u8 byRTSSignalField_ab; + u8 byRTSServiceField_ab; + u16 wRTSTransmitLength_ab; + u16 wRTSDuration_ab; + u16 wReserved2; SRTSDataF sRTS; //Data - BYTE bySignalField_ab; - BYTE byServiceField_ab; - WORD wTransmitLength_ab; - WORD wDuration_ab; - WORD wTimeStampOff_ab; - + u8 bySignalField_ab; + u8 byServiceField_ab; + u16 wTransmitLength_ab; + u16 wDuration_ab; + u16 wTimeStampOff_ab; } TX_NAF_AB_RTS_MIC, *PTX_NAF_AB_RTS_MIC; - - typedef struct tagSTX_NAF_AB_CTS { //RsvTime - WORD wReserved2; - WORD wTxRrvTime_ab; + u16 wReserved2; + u16 wTxRrvTime_ab; //Data - BYTE bySignalField_ab; - BYTE byServiceField_ab; - WORD wTransmitLength_ab; - WORD wDuration_ab; - WORD wTimeStampOff_ab; + u8 bySignalField_ab; + u8 byServiceField_ab; + u16 wTransmitLength_ab; + u16 wDuration_ab; + u16 wTimeStampOff_ab; } TX_NAF_AB_CTS, *PTX_NAF_AB_CTS; typedef struct tagSTX_NAF_AB_CTS_MIC { //RsvTime - WORD wReserved2; - WORD wTxRrvTime_ab; + u16 wReserved2; + u16 wTxRrvTime_ab; SMICHDR sMICHDR; //Data - BYTE bySignalField_ab; - BYTE byServiceField_ab; - WORD wTransmitLength_ab; - WORD wDuration_ab; - WORD wTimeStampOff_ab; + u8 bySignalField_ab; + u8 byServiceField_ab; + u16 wTransmitLength_ab; + u16 wDuration_ab; + u16 wTimeStampOff_ab; } TX_NAF_AB_CTS_MIC, *PTX_NAF_AB_CTS_MIC; - typedef struct tagSTX_NAF_AB_BEACON { - WORD wFIFOCtl; - WORD wTimeStamp; + u16 wFIFOCtl; + u16 wTimeStamp; //Data - BYTE bySignalField_ab; - BYTE byServiceField_ab; - WORD wTransmitLength_ab; - WORD wDuration_ab; - WORD wTimeStampOff_ab; + u8 bySignalField_ab; + u8 byServiceField_ab; + u16 wTransmitLength_ab; + u16 wDuration_ab; + u16 wTimeStampOff_ab; } TX_NAF_AB_BEACON, *PTX_NAF_AB_BEACON; typedef struct tagSTX_AF_G_RTS { //RsvTime - WORD wRTSTxRrvTime_ba; - WORD wRTSTxRrvTime_aa; - WORD wRTSTxRrvTime_bb; - WORD wReserved2; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; + u16 wRTSTxRrvTime_ba; + u16 wRTSTxRrvTime_aa; + u16 wRTSTxRrvTime_bb; + u16 wReserved2; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; //RTS - BYTE byRTSSignalField_b; - BYTE byRTSServiceField_b; - WORD wRTSTransmitLength_b; - BYTE byRTSSignalField_a; - BYTE byRTSServiceField_a; - WORD wRTSTransmitLength_a; - WORD wRTSDuration_ba; - WORD wRTSDuration_aa; - WORD wRTSDuration_bb; - WORD wReserved3; - WORD wRTSDuration_ba_f0; - WORD wRTSDuration_aa_f0; - WORD wRTSDuration_ba_f1; - WORD wRTSDuration_aa_f1; + u8 byRTSSignalField_b; + u8 byRTSServiceField_b; + u16 wRTSTransmitLength_b; + u8 byRTSSignalField_a; + u8 byRTSServiceField_a; + u16 wRTSTransmitLength_a; + u16 wRTSDuration_ba; + u16 wRTSDuration_aa; + u16 wRTSDuration_bb; + u16 wReserved3; + u16 wRTSDuration_ba_f0; + u16 wRTSDuration_aa_f0; + u16 wRTSDuration_ba_f1; + u16 wRTSDuration_aa_f1; SRTSDataF sRTS; //Data - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wDuration_a_f0; - WORD wDuration_a_f1; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wDuration_a_f0; + u16 wDuration_a_f1; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } TX_AF_G_RTS, *PTX_AF_G_RTS; - typedef struct tagSTX_AF_G_RTS_MIC { //RsvTime - WORD wRTSTxRrvTime_ba; - WORD wRTSTxRrvTime_aa; - WORD wRTSTxRrvTime_bb; - WORD wReserved2; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; + u16 wRTSTxRrvTime_ba; + u16 wRTSTxRrvTime_aa; + u16 wRTSTxRrvTime_bb; + u16 wReserved2; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; SMICHDR sMICHDR; //RTS - BYTE byRTSSignalField_b; - BYTE byRTSServiceField_b; - WORD wRTSTransmitLength_b; - BYTE byRTSSignalField_a; - BYTE byRTSServiceField_a; - WORD wRTSTransmitLength_a; - WORD wRTSDuration_ba; - WORD wRTSDuration_aa; - WORD wRTSDuration_bb; - WORD wReserved3; - WORD wRTSDuration_ba_f0; - WORD wRTSDuration_aa_f0; - WORD wRTSDuration_ba_f1; - WORD wRTSDuration_aa_f1; + u8 byRTSSignalField_b; + u8 byRTSServiceField_b; + u16 wRTSTransmitLength_b; + u8 byRTSSignalField_a; + u8 byRTSServiceField_a; + u16 wRTSTransmitLength_a; + u16 wRTSDuration_ba; + u16 wRTSDuration_aa; + u16 wRTSDuration_bb; + u16 wReserved3; + u16 wRTSDuration_ba_f0; + u16 wRTSDuration_aa_f0; + u16 wRTSDuration_ba_f1; + u16 wRTSDuration_aa_f1; SRTSDataF sRTS; //Data - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wDuration_a_f0; - WORD wDuration_a_f1; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wDuration_a_f0; + u16 wDuration_a_f1; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } TX_AF_G_RTS_MIC, *PTX_AF_G_RTS_MIC; - - typedef struct tagSTX_AF_G_CTS { //RsvTime - WORD wCTSTxRrvTime_ba; - WORD wReserved2; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; + u16 wCTSTxRrvTime_ba; + u16 wReserved2; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; //CTS - BYTE byCTSSignalField_b; - BYTE byCTSServiceField_b; - WORD wCTSTransmitLength_b; - WORD wCTSDuration_ba; - WORD wReserved3; - WORD wCTSDuration_ba_f0; - WORD wCTSDuration_ba_f1; + u8 byCTSSignalField_b; + u8 byCTSServiceField_b; + u16 wCTSTransmitLength_b; + u16 wCTSDuration_ba; + u16 wReserved3; + u16 wCTSDuration_ba_f0; + u16 wCTSDuration_ba_f1; SCTSDataF sCTS; //Data - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wDuration_a_f0; - WORD wDuration_a_f1; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wDuration_a_f0; + u16 wDuration_a_f1; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } TX_AF_G_CTS, *PTX_AF_G_CTS; - typedef struct tagSTX_AF_G_CTS_MIC { //RsvTime - WORD wCTSTxRrvTime_ba; - WORD wReserved2; - WORD wTxRrvTime_b; - WORD wTxRrvTime_a; - + u16 wCTSTxRrvTime_ba; + u16 wReserved2; + u16 wTxRrvTime_b; + u16 wTxRrvTime_a; SMICHDR sMICHDR; //CTS - BYTE byCTSSignalField_b; - BYTE byCTSServiceField_b; - WORD wCTSTransmitLength_b; - WORD wCTSDuration_ba; - WORD wReserved3; - WORD wCTSDuration_ba_f0; - WORD wCTSDuration_ba_f1; + u8 byCTSSignalField_b; + u8 byCTSServiceField_b; + u16 wCTSTransmitLength_b; + u16 wCTSDuration_ba; + u16 wReserved3; + u16 wCTSDuration_ba_f0; + u16 wCTSDuration_ba_f1; SCTSDataF sCTS; //Data - BYTE bySignalField_b; - BYTE byServiceField_b; - WORD wTransmitLength_b; - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_b; - WORD wDuration_a; - WORD wDuration_a_f0; - WORD wDuration_a_f1; - WORD wTimeStampOff_b; - WORD wTimeStampOff_a; + u8 bySignalField_b; + u8 byServiceField_b; + u16 wTransmitLength_b; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_b; + u16 wDuration_a; + u16 wDuration_a_f0; + u16 wDuration_a_f1; + u16 wTimeStampOff_b; + u16 wTimeStampOff_a; } TX_AF_G_CTS_MIC, *PTX_AF_G_CTS_MIC; - - typedef struct tagSTX_AF_A_RTS { //RsvTime - WORD wRTSTxRrvTime_a; - WORD wTxRrvTime_a; + u16 wRTSTxRrvTime_a; + u16 wTxRrvTime_a; //RTS - BYTE byRTSSignalField_a; - BYTE byRTSServiceField_a; - WORD wRTSTransmitLength_a; - WORD wRTSDuration_a; - WORD wReserved2; - WORD wRTSDuration_a_f0; - WORD wRTSDuration_a_f1; + u8 byRTSSignalField_a; + u8 byRTSServiceField_a; + u16 wRTSTransmitLength_a; + u16 wRTSDuration_a; + u16 wReserved2; + u16 wRTSDuration_a_f0; + u16 wRTSDuration_a_f1; SRTSDataF sRTS; //Data - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_a; - WORD wTimeStampOff_a; - WORD wDuration_a_f0; - WORD wDuration_a_f1; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_a; + u16 wTimeStampOff_a; + u16 wDuration_a_f0; + u16 wDuration_a_f1; } TX_AF_A_RTS, *PTX_AF_A_RTS; - typedef struct tagSTX_AF_A_RTS_MIC { //RsvTime - WORD wRTSTxRrvTime_a; - WORD wTxRrvTime_a; + u16 wRTSTxRrvTime_a; + u16 wTxRrvTime_a; SMICHDR sMICHDR; //RTS - BYTE byRTSSignalField_a; - BYTE byRTSServiceField_a; - WORD wRTSTransmitLength_a; - WORD wRTSDuration_a; - WORD wReserved2; - WORD wRTSDuration_a_f0; - WORD wRTSDuration_a_f1; + u8 byRTSSignalField_a; + u8 byRTSServiceField_a; + u16 wRTSTransmitLength_a; + u16 wRTSDuration_a; + u16 wReserved2; + u16 wRTSDuration_a_f0; + u16 wRTSDuration_a_f1; SRTSDataF sRTS; //Data - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_a; - WORD wTimeStampOff_a; - WORD wDuration_a_f0; - WORD wDuration_a_f1; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_a; + u16 wTimeStampOff_a; + u16 wDuration_a_f0; + u16 wDuration_a_f1; } TX_AF_A_RTS_MIC, *PTX_AF_A_RTS_MIC; - - typedef struct tagSTX_AF_A_CTS { //RsvTime - WORD wReserved2; - WORD wTxRrvTime_a; + u16 wReserved2; + u16 wTxRrvTime_a; //Data - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_a; - WORD wTimeStampOff_a; - WORD wDuration_a_f0; - WORD wDuration_a_f1; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_a; + u16 wTimeStampOff_a; + u16 wDuration_a_f0; + u16 wDuration_a_f1; } TX_AF_A_CTS, *PTX_AF_A_CTS; - typedef struct tagSTX_AF_A_CTS_MIC { //RsvTime - WORD wReserved2; - WORD wTxRrvTime_a; + u16 wReserved2; + u16 wTxRrvTime_a; SMICHDR sMICHDR; //Data - BYTE bySignalField_a; - BYTE byServiceField_a; - WORD wTransmitLength_a; - WORD wDuration_a; - WORD wTimeStampOff_a; - WORD wDuration_a_f0; - WORD wDuration_a_f1; + u8 bySignalField_a; + u8 byServiceField_a; + u16 wTransmitLength_a; + u16 wDuration_a; + u16 wTimeStampOff_a; + u16 wDuration_a_f0; + u16 wDuration_a_f1; } TX_AF_A_CTS_MIC, *PTX_AF_A_CTS_MIC; - // // union with all of the TX Buffer Type // @@ -620,51 +591,43 @@ typedef union tagUTX_BUFFER_CONTAINER } TX_BUFFER_CONTAINER, *PTX_BUFFER_CONTAINER; - // // Remote NDIS message format // typedef struct tagSTX_BUFFER { - BYTE byType; - BYTE byPKTNO; - WORD wTxByteCount; + u8 byType; + u8 byPKTNO; + u16 wTxByteCount; u32 adwTxKey[4]; - WORD wFIFOCtl; - WORD wTimeStamp; - WORD wFragCtl; - WORD wReserved; - + u16 wFIFOCtl; + u16 wTimeStamp; + u16 wFragCtl; + u16 wReserved; // Actual message TX_BUFFER_CONTAINER BufferHeader; } TX_BUFFER, *PTX_BUFFER; - // // Remote NDIS message format // typedef struct tagSBEACON_BUFFER { - BYTE byType; - BYTE byPKTNO; - WORD wTxByteCount; + u8 byType; + u8 byPKTNO; + u16 wTxByteCount; - WORD wFIFOCtl; - WORD wTimeStamp; + u16 wFIFOCtl; + u16 wTimeStamp; // Actual message TX_BUFFER_CONTAINER BufferHeader; } BEACON_BUFFER, *PBEACON_BUFFER; - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb); int nsDMA_tx_packet(struct vnt_private *, u32 uDMAIdx, struct sk_buff *skb); CMD_STATUS csMgmt_xmit(struct vnt_private *, struct vnt_tx_mgmt *); diff --git a/drivers/staging/vt6656/srom.h b/drivers/staging/vt6656/srom.h index dba21a54414b..488192d79ac9 100644 --- a/drivers/staging/vt6656/srom.h +++ b/drivers/staging/vt6656/srom.h @@ -30,10 +30,6 @@ #ifndef __SROM_H__ #define __SROM_H__ -#include "ttype.h" - -/*--------------------- Export Definitions -------------------------*/ - #define EEP_MAX_CONTEXT_SIZE 256 #define CB_EEPROM_READBYTE_WAIT 900 //us @@ -56,7 +52,6 @@ #define EEP_OFS_SETPT_CCK 0x21 #define EEP_OFS_PWR_OFDMG 0x23 - #define EEP_OFS_CALIB_TX_IQ 0x24 #define EEP_OFS_CALIB_TX_DC 0x25 #define EEP_OFS_CALIB_RX_IQ 0x26 @@ -80,48 +75,38 @@ // #define EEP_RADIOCTL_ENABLE 0x80 -/*--------------------- Export Types ------------------------------*/ - // AT24C02 eeprom contents // 2048 bits = 256 bytes = 128 words // typedef struct tagSSromReg { - BYTE abyPAR[6]; // 0x00 (WORD) - - WORD wSUB_VID; // 0x03 (WORD) - WORD wSUB_SID; - - BYTE byBCFG0; // 0x05 (WORD) - BYTE byBCFG1; - - BYTE byFCR0; // 0x06 (WORD) - BYTE byFCR1; - BYTE byPMC0; // 0x07 (WORD) - BYTE byPMC1; - BYTE byMAXLAT; // 0x08 (WORD) - BYTE byMINGNT; - BYTE byCFG0; // 0x09 (WORD) - BYTE byCFG1; - WORD wCISPTR; // 0x0A (WORD) - WORD wRsv0; // 0x0B (WORD) - WORD wRsv1; // 0x0C (WORD) - BYTE byBBPAIR; // 0x0D (WORD) - BYTE byRFTYPE; - BYTE byMinChannel; // 0x0E (WORD) - BYTE byMaxChannel; - BYTE bySignature; // 0x0F (WORD) - BYTE byCheckSum; - - BYTE abyReserved0[96]; // 0x10 (WORD) - BYTE abyCIS[128]; // 0x80 (WORD) + u8 abyPAR[6]; // 0x00 (u16) + + u16 wSUB_VID; // 0x03 (u16) + u16 wSUB_SID; + + u8 byBCFG0; // 0x05 (u16) + u8 byBCFG1; + + u8 byFCR0; // 0x06 (u16) + u8 byFCR1; + u8 byPMC0; // 0x07 (u16) + u8 byPMC1; + u8 byMAXLAT; // 0x08 (u16) + u8 byMINGNT; + u8 byCFG0; // 0x09 (u16) + u8 byCFG1; + u16 wCISPTR; // 0x0A (u16) + u16 wRsv0; // 0x0B (u16) + u16 wRsv1; // 0x0C (u16) + u8 byBBPAIR; // 0x0D (u16) + u8 byRFTYPE; + u8 byMinChannel; // 0x0E (u16) + u8 byMaxChannel; + u8 bySignature; // 0x0F (u16) + u8 byCheckSum; + + u8 abyReserved0[96]; // 0x10 (u16) + u8 abyCIS[128]; // 0x80 (u16) } SSromReg, *PSSromReg; -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - #endif /* __EEPROM_H__ */ diff --git a/drivers/staging/vt6656/tcrc.c b/drivers/staging/vt6656/tcrc.c index 2237eeb5ec5b..7229f26c052c 100644 --- a/drivers/staging/vt6656/tcrc.c +++ b/drivers/staging/vt6656/tcrc.c @@ -35,14 +35,8 @@ #include "tcrc.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - /* 32-bit CRC table */ -static const DWORD s_adwCrc32Table[256] = { +static const u32 s_adwCrc32Table[256] = { 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, 0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L, @@ -109,13 +103,6 @@ static const DWORD s_adwCrc32Table[256] = { 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL }; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - - - - /*+ * * Description: @@ -132,13 +119,13 @@ static const DWORD s_adwCrc32Table[256] = { * Return Value: CRC-32 * -*/ -DWORD CRCdwCrc32(PBYTE pbyData, unsigned int cbByte, DWORD dwCrcSeed) +u32 CRCdwCrc32(u8 * pbyData, unsigned int cbByte, u32 dwCrcSeed) { - DWORD dwCrc; + u32 dwCrc; dwCrc = dwCrcSeed; while (cbByte--) { - dwCrc = s_adwCrc32Table[(BYTE)((dwCrc ^ (*pbyData)) & 0xFF)] ^ + dwCrc = s_adwCrc32Table[(u8)((dwCrc ^ (*pbyData)) & 0xFF)] ^ (dwCrc >> 8); pbyData++; } @@ -146,7 +133,6 @@ DWORD CRCdwCrc32(PBYTE pbyData, unsigned int cbByte, DWORD dwCrcSeed) return dwCrc; } - /*+ * * Description: @@ -165,12 +151,11 @@ DWORD CRCdwCrc32(PBYTE pbyData, unsigned int cbByte, DWORD dwCrcSeed) * Return Value: CRC-32 * -*/ -DWORD CRCdwGetCrc32(PBYTE pbyData, unsigned int cbByte) +u32 CRCdwGetCrc32(u8 * pbyData, unsigned int cbByte) { return ~CRCdwCrc32(pbyData, cbByte, 0xFFFFFFFFL); } - /*+ * * Description: @@ -191,9 +176,8 @@ DWORD CRCdwGetCrc32(PBYTE pbyData, unsigned int cbByte) * Return Value: CRC-32 * -*/ -DWORD CRCdwGetCrc32Ex(PBYTE pbyData, unsigned int cbByte, DWORD dwPreCRC) +u32 CRCdwGetCrc32Ex(u8 * pbyData, unsigned int cbByte, u32 dwPreCRC) { return CRCdwCrc32(pbyData, cbByte, dwPreCRC); } - diff --git a/drivers/staging/vt6656/tcrc.h b/drivers/staging/vt6656/tcrc.h index dc54bd8fc4fc..5b1f368964eb 100644 --- a/drivers/staging/vt6656/tcrc.h +++ b/drivers/staging/vt6656/tcrc.h @@ -29,22 +29,10 @@ #ifndef __TCRC_H__ #define __TCRC_H__ -#include "ttype.h" +#include <linux/types.h> -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - -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); +u32 CRCdwCrc32(u8 * pbyData, unsigned int cbByte, u32 dwCrcSeed); +u32 CRCdwGetCrc32(u8 * pbyData, unsigned int cbByte); +u32 CRCdwGetCrc32Ex(u8 * pbyData, unsigned int cbByte, u32 dwPreCRC); #endif /* __TCRC_H__ */ diff --git a/drivers/staging/vt6656/tether.c b/drivers/staging/vt6656/tether.c index 95286c4d5572..1db1e8419a9a 100644 --- a/drivers/staging/vt6656/tether.c +++ b/drivers/staging/vt6656/tether.c @@ -25,7 +25,6 @@ * Date: May 21, 1996 * * Functions: - * ETHbyGetHashIndexByCrc32 - Calculate multicast hash value by CRC32 * ETHbIsBufferCrc32Ok - Check CRC value of the buffer if Ok or not * * Revision History: @@ -37,52 +36,6 @@ #include "tcrc.h" #include "tether.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - - - -/* - * Description: Calculate multicast hash value by CRC32 - * - * Parameters: - * In: - * pbyMultiAddr - Multicast Address - * Out: - * none - * - * Return Value: Hash value - * - */ -BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr) -{ - int ii; - BYTE byTmpHash; - BYTE byHash = 0; - - /* 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; -} - - /* * Description: Check CRC value of the buffer if Ok or not * @@ -96,12 +49,12 @@ BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr) * Return Value: true if ok; false if error. * */ -bool ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, unsigned int cbFrameLength) +bool ETHbIsBufferCrc32Ok(u8 * pbyBuffer, unsigned int cbFrameLength) { - DWORD dwCRC; + u32 dwCRC; dwCRC = CRCdwGetCrc32(pbyBuffer, cbFrameLength - 4); - if (cpu_to_le32(*((PDWORD)(pbyBuffer + cbFrameLength - 4))) != dwCRC) + if (cpu_to_le32(*((u32 *)(pbyBuffer + cbFrameLength - 4))) != dwCRC) return false; return true; } diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h index 2f8f4853fd9d..24465cfe3e6d 100644 --- a/drivers/staging/vt6656/tether.h +++ b/drivers/staging/vt6656/tether.h @@ -30,9 +30,7 @@ #define __TETHER_H__ #include <linux/if_ether.h> -#include "ttype.h" -/*--------------------- Export Definitions -------------------------*/ // // constants // @@ -44,11 +42,6 @@ #define TYPE_MGMT_PROBE_RSP 0x5000 -// -// wFrameCtl field in the S802_11Header -// -// NOTE.... -// in network byte order, high byte is going first #define FC_TODS 0x0001 #define FC_FROMDS 0x0002 #define FC_MOREFRAG 0x0004 @@ -71,8 +64,6 @@ #define TYPE_CTL_CTS 0xc400 #define TYPE_CTL_ACK 0xd400 - - #else //if LITTLE_ENDIAN // // wType field in the SEthernetHeader @@ -82,11 +73,6 @@ #define TYPE_MGMT_PROBE_RSP 0x0050 -// -// wFrameCtl field in the S802_11Header -// -// NOTE.... -// in network byte order, high byte is going first #define FC_TODS 0x0100 #define FC_FROMDS 0x0200 #define FC_MOREFRAG 0x0400 @@ -109,58 +95,21 @@ #define TYPE_CTL_CTS 0x00c4 #define TYPE_CTL_ACK 0x00d4 - - #endif //#ifdef __BIG_ENDIAN #define WEP_IV_MASK 0x00FFFFFF -/*--------------------- Export Types ------------------------------*/ -// -// Ethernet packet -// -typedef struct tagSEthernetHeader { - BYTE abyDstAddr[ETH_ALEN]; - BYTE abySrcAddr[ETH_ALEN]; - WORD wType; -} __attribute__ ((__packed__)) -SEthernetHeader, *PSEthernetHeader; - - // // 802_3 packet // typedef struct tagS802_3Header { - BYTE abyDstAddr[ETH_ALEN]; - BYTE abySrcAddr[ETH_ALEN]; - WORD wLen; + u8 abyDstAddr[ETH_ALEN]; + u8 abySrcAddr[ETH_ALEN]; + u16 wLen; } __attribute__ ((__packed__)) S802_3Header, *PS802_3Header; -// -// 802_11 packet -// -typedef struct tagS802_11Header { - WORD wFrameCtl; - WORD wDurationID; - BYTE abyAddr1[ETH_ALEN]; - BYTE abyAddr2[ETH_ALEN]; - BYTE abyAddr3[ETH_ALEN]; - WORD wSeqCtl; - BYTE abyAddr4[ETH_ALEN]; -} __attribute__ ((__packed__)) -S802_11Header, *PS802_11Header; - -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - -BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr); -//BYTE ETHbyGetHashIndexByCrc(PBYTE pbyMultiAddr); -bool ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, unsigned int cbFrameLength); +//u8 ETHbyGetHashIndexByCrc(u8 * pbyMultiAddr); +bool ETHbIsBufferCrc32Ok(u8 * pbyBuffer, unsigned int cbFrameLength); #endif /* __TETHER_H__ */ diff --git a/drivers/staging/vt6656/tkip.c b/drivers/staging/vt6656/tkip.c index 282c08d65761..9d643e449ac3 100644 --- a/drivers/staging/vt6656/tkip.c +++ b/drivers/staging/vt6656/tkip.c @@ -35,27 +35,11 @@ #include "tmacro.h" #include "tkip.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - /* The Sbox is reduced to 2 16-bit wide tables, each with 256 entries. */ /* The 2nd table is the same as the 1st but with the upper and lower */ /* bytes swapped. To allow an endian tolerant implementation, the byte */ /* halves have been expressed independently here. */ -const BYTE TKIP_Sbox_Lower[256] = { +const u8 TKIP_Sbox_Lower[256] = { 0xA5,0x84,0x99,0x8D,0x0D,0xBD,0xB1,0x54, 0x50,0x03,0xA9,0x7D,0x19,0x62,0xE6,0x9A, 0x45,0x9D,0x40,0x87,0x15,0xEB,0xC9,0x0B, @@ -90,7 +74,7 @@ const BYTE TKIP_Sbox_Lower[256] = { 0xC3,0xB0,0x77,0x11,0xCB,0xFC,0xD6,0x3A }; -const BYTE TKIP_Sbox_Upper[256] = { +const u8 TKIP_Sbox_Upper[256] = { 0xC6,0xF8,0xEE,0xF6,0xFF,0xD6,0xDE,0x91, 0x60,0x02,0xCE,0x56,0xE7,0xB5,0x4D,0xEC, 0x8F,0x1F,0x89,0xFA,0xEF,0xB2,0x8E,0xFB, @@ -125,13 +109,8 @@ const BYTE TKIP_Sbox_Upper[256] = { 0x82,0x29,0x5A,0x1E,0x7B,0xA8,0x6D,0x2C }; - //STKIPKeyManagement sTKIPKeyTable[MAX_TKIP_KEY]; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - /************************************************************/ /* tkip_sbox() */ /* Returns a 16 bit value from a 64K entry table. The Table */ @@ -152,7 +131,6 @@ static unsigned int tkip_sbox(unsigned int index) return (left ^ right); }; - static unsigned int rotr1(unsigned int a) { unsigned int b; @@ -166,7 +144,6 @@ static unsigned int rotr1(unsigned int a) return b; } - /* * Description: Calculate RC4Key fom TK, TA, and TSC * @@ -182,11 +159,11 @@ static unsigned int rotr1(unsigned int a) * */ void TKIPvMixKey( - PBYTE pbyTKey, - PBYTE pbyTA, - WORD wTSC15_0, - DWORD dwTSC47_16, - PBYTE pbyRC4Key + u8 * pbyTKey, + u8 * pbyTA, + u16 wTSC15_0, + u32 dwTSC47_16, + u8 * pbyRC4Key ) { u32 p1k[5]; diff --git a/drivers/staging/vt6656/tkip.h b/drivers/staging/vt6656/tkip.h index 47c3a853b92a..4fba7ef38266 100644 --- a/drivers/staging/vt6656/tkip.h +++ b/drivers/staging/vt6656/tkip.h @@ -30,28 +30,16 @@ #ifndef __TKIP_H__ #define __TKIP_H__ -#include "ttype.h" #include "tether.h" -/*--------------------- Export Definitions -------------------------*/ #define TKIP_KEY_LEN 16 -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - void TKIPvMixKey( - PBYTE pbyTKey, - PBYTE pbyTA, - WORD wTSC15_0, - DWORD dwTSC47_16, - PBYTE pbyRC4Key + u8 * pbyTKey, + u8 * pbyTA, + u16 wTSC15_0, + u32 dwTSC47_16, + u8 * pbyRC4Key ); #endif /* __TKIP_H__ */ diff --git a/drivers/staging/vt6656/tmacro.h b/drivers/staging/vt6656/tmacro.h index 3c81e2b0791d..15cd5abb8004 100644 --- a/drivers/staging/vt6656/tmacro.h +++ b/drivers/staging/vt6656/tmacro.h @@ -29,32 +29,30 @@ #ifndef __TMACRO_H__ #define __TMACRO_H__ -#include "ttype.h" - /****** Common helper macros ***********************************************/ #if !defined(LOBYTE) -#define LOBYTE(w) ((BYTE)(w)) +#define LOBYTE(w) ((u8)(w)) #endif #if !defined(HIBYTE) -#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) +#define HIBYTE(w) ((u8)(((u16)(w) >> 8) & 0xFF)) #endif #if !defined(LOWORD) -#define LOWORD(d) ((WORD)(d)) +#define LOWORD(d) ((u16)(d)) #endif #if !defined(HIWORD) -#define HIWORD(d) ((WORD)((((DWORD)(d)) >> 16) & 0xFFFF)) +#define HIWORD(d) ((u16)((((u32)(d)) >> 16) & 0xFFFF)) #endif #define LODWORD(q) ((q).u.dwLowDword) #define HIDWORD(q) ((q).u.dwHighDword) #if !defined(MAKEWORD) -#define MAKEWORD(lb, hb) ((WORD)(((BYTE)(lb)) | (((WORD)((BYTE)(hb))) << 8))) +#define MAKEWORD(lb, hb) ((u16)(((u8)(lb)) | (((u16)((u8)(hb))) << 8))) #endif #if !defined(MAKEDWORD) -#define MAKEDWORD(lw, hw) ((DWORD)(((WORD)(lw)) | (((DWORD)((WORD)(hw))) << 16))) +#define MAKEDWORD(lw, hw) ((u32)(((u16)(lw)) | (((u32)((u16)(hw))) << 16))) #endif #endif /* __TMACRO_H__ */ diff --git a/drivers/staging/vt6656/ttype.h b/drivers/staging/vt6656/ttype.h deleted file mode 100644 index d7b648945316..000000000000 --- a/drivers/staging/vt6656/ttype.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * File: ttype.h - * - * Purpose: define basic common types and macros - * - * Author: Tevin Chen - * - * Date: May 21, 1996 - * - */ - -#ifndef __TTYPE_H__ -#define __TTYPE_H__ - -#include <linux/types.h> - -/******* Common definitions and typedefs ***********************************/ - -/****** Simple typedefs ***************************************************/ - -typedef u8 BYTE; -typedef u16 WORD; -typedef u32 DWORD; - -/****** Common pointer types ***********************************************/ - -typedef u32 ULONG_PTR; -typedef u32 DWORD_PTR; - -// boolean pointer - -typedef BYTE * PBYTE; - -typedef WORD * PWORD; - -typedef DWORD * PDWORD; - -#endif /* __TTYPE_H__ */ diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index 00fd0f8a58c2..098be609107c 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -45,7 +45,6 @@ #include "desc.h" #include "device.h" -/*--------------------- Static Definitions -------------------------*/ //endpoint def //endpoint 0: control //endpoint 1: interrupt @@ -55,28 +54,18 @@ //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; - #define USB_CTL_WAIT 500 //ms #ifndef URB_ASYNC_UNLINK #define URB_ASYNC_UNLINK 0 #endif -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ static void s_nsInterruptUsbIoCompleteRead(struct urb *urb); static void s_nsBulkInUsbIoCompleteRead(struct urb *urb); static void s_nsBulkOutIoCompleteWrite(struct urb *urb); static void s_nsControlInUsbIoCompleteRead(struct urb *urb); static void s_nsControlInUsbIoCompleteWrite(struct urb *urb); -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - int PIPEnsControlOutAsyn(struct vnt_private *pDevice, u8 byRequest, u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer) { @@ -251,8 +240,6 @@ static void s_nsControlInUsbIoCompleteWrite(struct urb *urb) MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); } - - /* * Description: * Complete function of usb Control callback @@ -288,9 +275,6 @@ static void s_nsControlInUsbIoCompleteRead(struct urb *urb) MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); } - - - /* * Description: * Allocates an usb interrupt in irp and calls USBD. @@ -341,7 +325,6 @@ usb_fill_bulk_urb(pDevice->pInterruptURB, return ntStatus; } - /* * Description: * Complete function of usb interrupt in irp. @@ -403,7 +386,6 @@ static void s_nsInterruptUsbIoCompleteRead(struct urb *urb) STAvUpdateUSBCounter(&pDevice->scStatistic.USB_InterruptStat, ntStatus); - if (pDevice->fKillEventPollingThread != true) { usb_fill_bulk_urb(pDevice->pInterruptURB, pDevice->usb, @@ -444,7 +426,6 @@ int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB) int ntStatus = 0; struct urb *pUrb; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartBulkInUsbRead\n"); if (pDevice->Flags & fMP_DISCONNECTED) @@ -452,7 +433,6 @@ int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB) pDevice->ulBulkInPosted++; - pUrb = pRCB->pUrb; // // Now that we have created the urb, we will send a @@ -482,9 +462,6 @@ int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB) return ntStatus; } - - - /* * Description: * Complete function of usb BulkIn irp. @@ -535,7 +512,6 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb) pDevice->scStatistic.RxOkCnt ++; } - STAvUpdateUSBCounter(&pDevice->scStatistic.USB_BulkInStat, status); if (bIndicateReceive) { @@ -553,7 +529,6 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb) spin_unlock(&pDevice->lock); } - return; } @@ -576,8 +551,6 @@ int PIPEnsSendBulkOut(struct vnt_private *pDevice, PUSB_SEND_CONTEXT pContext) int status; struct urb *pUrb; - - pDevice->bPWBitOn = false; /* @@ -657,7 +630,6 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb) unsigned long ulBufLen; PUSB_SEND_CONTEXT pContext; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n"); // // The context given to IoSetCompletionRoutine is an USB_CONTEXT struct @@ -705,7 +677,6 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb) pDevice->dev->trans_start = jiffies; - if (status == STATUS_SUCCESS) { pDevice->packetsSent++; } diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h index b3023559c15b..bb7a61111a62 100644 --- a/drivers/staging/vt6656/usbpipe.h +++ b/drivers/staging/vt6656/usbpipe.h @@ -30,17 +30,8 @@ #ifndef __USBPIPE_H__ #define __USBPIPE_H__ -#include "ttype.h" #include "device.h" -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - int PIPEnsControlOut(struct vnt_private *, u8 byRequest, u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer); int PIPEnsControlOutAsyn(struct vnt_private *, u8 byRequest, diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 4bb652bf7cf6..0013cb73d83b 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -38,7 +38,6 @@ * */ -#include "ttype.h" #include "tmacro.h" #include "device.h" #include "mac.h" @@ -56,17 +55,8 @@ #include "channel.h" #include "iowpa.h" -/*--------------------- Static Definitions -------------------------*/ - - - - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -/*--------------------- Static Functions --------------------------*/ static void s_vProbeChannel(struct vnt_private *); @@ -74,16 +64,10 @@ static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *, struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); - static int s_bCommandComplete(struct vnt_private *); - static int s_bClearBSSID_SCAN(struct vnt_private *); -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - /* * Description: * Stop AdHoc beacon during scan process @@ -138,7 +122,6 @@ static void vAdHocBeaconStop(struct vnt_private *pDevice) } /* vAdHocBeaconStop */ - /* * Description: * Restart AdHoc beacon after scan process complete @@ -171,7 +154,6 @@ static void vAdHocBeaconRestart(struct vnt_private *pDevice) } - /*+ * * Routine Description: @@ -200,7 +182,6 @@ static void s_vProbeChannel(struct vnt_private *pDevice) u8 *pbyRate; int ii; - if (pDevice->byBBType == BB_TYPE_11A) { pbyRate = &abyCurrSuppRatesA[0]; } else if (pDevice->byBBType == BB_TYPE_11B) { @@ -232,9 +213,6 @@ static void s_vProbeChannel(struct vnt_private *pDevice) } - - - /*+ * * Routine Description: @@ -246,7 +224,6 @@ static void s_vProbeChannel(struct vnt_private *pDevice) * -*/ - struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates) @@ -254,13 +231,12 @@ struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_PROBEREQ sFrame; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_PROBEREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_PROBEREQ_FR_MAXLEN; vMgrEncodeProbeRequest(&sFrame); sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( @@ -316,7 +292,6 @@ void vRunCommand(struct vnt_private *pDevice) u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; u8 byData; - if (pDevice->dwDiagRefCount != 0) return; if (pDevice->bCmdRunning != true) @@ -347,29 +322,7 @@ void vRunCommand(struct vnt_private *pDevice) pMgmt->uScanChannel = pDevice->byMinChannel; } if (pMgmt->uScanChannel > pDevice->byMaxChannel) { - pMgmt->eScanState = WMAC_NO_SCANNING; - - if (pDevice->byBBType != pDevice->byScanBBType) { - pDevice->byBBType = pDevice->byScanBBType; - CARDvSetBSSMode(pDevice); - } - - if (pDevice->bUpdateBBVGA) { - BBvSetShortSlotTime(pDevice); - BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); - BBvUpdatePreEDThreshold(pDevice, false); - } - // Set channel back - vAdHocBeaconRestart(pDevice); - // Set channel back - CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); - // Set Filter - if (pMgmt->bCurrBSSIDFilterOn) { - MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); - pDevice->byRxMode |= RCR_BSSID; - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); - pDevice->bStopDataPkt = false; + pDevice->eCommandState = WLAN_CMD_SCAN_END; s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -377,6 +330,7 @@ void vRunCommand(struct vnt_private *pDevice) } else { if (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n",pMgmt->uScanChannel); + pMgmt->uScanChannel++; s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -473,6 +427,7 @@ void vRunCommand(struct vnt_private *pDevice) pDevice->byRxMode |= RCR_BSSID; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); + pMgmt->uScanChannel = 0; pMgmt->eScanState = WMAC_NO_SCANNING; pDevice->bStopDataPkt = false; @@ -523,7 +478,6 @@ void vRunCommand(struct vnt_private *pDevice) s_bCommandComplete(pDevice); break; - case WLAN_CMD_SSID_START: pDevice->byReAssocCount = 0; @@ -845,7 +799,7 @@ void vRunCommand(struct vnt_private *pDevice) { int ntStatus = STATUS_SUCCESS; - BYTE byTmp; + u8 byTmp; ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, @@ -930,7 +884,6 @@ void vRunCommand(struct vnt_private *pDevice) s_bCommandComplete(pDevice); break; - case WLAN_CMD_CHANGE_BBSENSITIVITY_START: pDevice->bStopDataPkt = true; @@ -981,7 +934,6 @@ void vRunCommand(struct vnt_private *pDevice) s_bCommandComplete(pDevice); break; - case WLAN_CMD_MAC_DISPOWERSAVING_START: ControlvReadByte (pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); if ( (byData & PSCTL_PS) != 0 ) { @@ -1014,7 +966,6 @@ void vRunCommand(struct vnt_private *pDevice) return; } - static int s_bCommandComplete(struct vnt_private *pDevice) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -1022,7 +973,6 @@ static int s_bCommandComplete(struct vnt_private *pDevice) int bRadioCmd = false; int bForceSCAN = true; - pDevice->eCommandState = WLAN_CMD_IDLE; if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { //Command Queue Empty @@ -1147,7 +1097,7 @@ int bScheduleCommand(struct vnt_private *pDevice, break; /* case WLAN_CMD_DEAUTH: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((PWORD)pbyItem0); + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((u16 *)pbyItem0); break; */ @@ -1203,7 +1153,6 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) return true; } - //mike add:reset command timer void vResetCommandTimer(struct vnt_private *pDevice) { diff --git a/drivers/staging/vt6656/wcmd.h b/drivers/staging/vt6656/wcmd.h index c40e6baa0b5d..db8b4cf7fd60 100644 --- a/drivers/staging/vt6656/wcmd.h +++ b/drivers/staging/vt6656/wcmd.h @@ -28,18 +28,13 @@ #ifndef __WCMD_H__ #define __WCMD_H__ -#include "ttype.h" + #include "80211hdr.h" #include "80211mgr.h" -/*--------------------- Export Definitions -------------------------*/ - - - #define AUTHENTICATE_TIMEOUT 1000 //ms #define ASSOCIATE_TIMEOUT 1000 //ms - // Command code typedef enum tagCMD_CODE { WLAN_CMD_BSSID_SCAN, @@ -73,11 +68,11 @@ typedef enum tagCMD_STATUS { typedef struct tagCMD_ITEM { CMD_CODE eCmd; - BYTE abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + u8 abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; bool bNeedRadioOFF; bool bRadioCmd; bool bForceSCAN; - WORD wDeAuthenReason; + u16 wDeAuthenReason; } CMD_ITEM, *PCMD_ITEM; // Command state @@ -104,13 +99,6 @@ typedef enum tagCMD_STATE { WLAN_CMD_IDLE } CMD_STATE, *PCMD_STATE; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ struct vnt_private; void vResetCommandTimer(struct vnt_private *); diff --git a/drivers/staging/vt6656/wctl.c b/drivers/staging/vt6656/wctl.c index baa48a1f0d36..47a655db51ef 100644 --- a/drivers/staging/vt6656/wctl.c +++ b/drivers/staging/vt6656/wctl.c @@ -39,17 +39,7 @@ #include "card.h" #include "tmacro.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ // static int msglevel =MSG_LEVEL_INFO; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - - /* * Description: @@ -67,7 +57,7 @@ * */ -bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) +bool WCTLbIsDuplicate (PSCache pCache, struct ieee80211_hdr *pMACHeader) { unsigned int uIndex; unsigned int ii; @@ -78,10 +68,10 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) uIndex = pCache->uInPtr; for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) { pCacheEntry = &(pCache->asCacheEntry[uIndex]); - if ((pCacheEntry->wFmSequence == pMACHeader->wSeqCtl) && + if ((pCacheEntry->wFmSequence == pMACHeader->seq_ctrl) && (!compare_ether_addr(&(pCacheEntry->abyAddr2[0]), - &(pMACHeader->abyAddr2[0]))) && - (LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->wFrameCtl)) + &(pMACHeader->addr2[0]))) && + (LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->frame_control)) ) { /* Duplicate match */ return true; @@ -91,9 +81,9 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) } /* Not found in cache - insert */ pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr]; - pCacheEntry->wFmSequence = pMACHeader->wSeqCtl; - memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN); - pCacheEntry->wFrameCtl = pMACHeader->wFrameCtl; + pCacheEntry->wFmSequence = pMACHeader->seq_ctrl; + memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->addr2[0]), ETH_ALEN); + pCacheEntry->wFrameCtl = pMACHeader->frame_control; ADD_ONE_WITH_WRAP_AROUND(pCache->uInPtr, DUPLICATE_RX_CACHE_LENGTH); return false; } @@ -114,14 +104,14 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) */ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, - PS802_11Header pMACHeader) + struct ieee80211_hdr *pMACHeader) { unsigned int ii; for (ii = 0; ii < pDevice->cbDFCB; ii++) { if ((pDevice->sRxDFCB[ii].bInUse == true) && (!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]), - &(pMACHeader->abyAddr2[0])))) { + &(pMACHeader->addr2[0])))) { return ii; } } @@ -143,7 +133,7 @@ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, * */ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, - PS802_11Header pMACHeader) + struct ieee80211_hdr *pMACHeader) { unsigned int ii; @@ -154,10 +144,10 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, pDevice->cbFreeDFCB--; pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime; pDevice->sRxDFCB[ii].bInUse = true; - pDevice->sRxDFCB[ii].wSequence = (pMACHeader->wSeqCtl >> 4); - pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F); + pDevice->sRxDFCB[ii].wSequence = (pMACHeader->seq_ctrl >> 4); + pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->seq_ctrl & 0x000F); memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), - &(pMACHeader->abyAddr2[0]), + &(pMACHeader->addr2[0]), ETH_ALEN); return(ii); } @@ -165,7 +155,6 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, return(pDevice->cbDFCB); } - /* * Description: * Handle received fragment packet @@ -182,12 +171,10 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, * Return Value: true if it is valid fragment packet and we have resource to defragment; otherwise false * */ -bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, - unsigned int cbFrameLength, bool bWEP, bool bExtIV) +bool WCTLbHandleFragment(struct vnt_private *pDevice, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV) { unsigned int uHeaderSize; - if (bWEP == true) { uHeaderSize = 28; if (bExtIV) @@ -203,8 +190,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, if (pDevice->uCurrentDFCBIdx < pDevice->cbDFCB) { // duplicate, we must flush previous DCB pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].uLifetime = pDevice->dwMaxReceiveLifetime; - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence = (pMACHeader->wSeqCtl >> 4); - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->wSeqCtl & 0x000F); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence = (pMACHeader->seq_ctrl >> 4); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->seq_ctrl & 0x000F); } else { pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader); @@ -213,8 +200,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, } } // reserve 8 byte to match MAC RX Buffer - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (PBYTE) (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb->data + 8); -// pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (PBYTE) (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb->data + 4); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (u8 *) (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb->data + 8); +// pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (u8 *) (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb->data + 4); memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, pMACHeader, cbFrameLength); pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength = cbFrameLength; pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer += cbFrameLength; @@ -225,11 +212,11 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, else { pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, pMACHeader); if (pDevice->uCurrentDFCBIdx != pDevice->cbDFCB) { - if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->wSeqCtl >> 4)) && - (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->wSeqCtl & 0x000F)) && + if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->seq_ctrl >> 4)) && + (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->seq_ctrl & 0x000F)) && ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength + cbFrameLength - uHeaderSize) < 2346)) { - memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, ((PBYTE) (pMACHeader) + uHeaderSize), (cbFrameLength - uHeaderSize)); + memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, ((u8 *) (pMACHeader) + uHeaderSize), (cbFrameLength - uHeaderSize)); pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength += (cbFrameLength - uHeaderSize); pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer += (cbFrameLength - uHeaderSize); pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum++; @@ -256,4 +243,3 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, } } - diff --git a/drivers/staging/vt6656/wctl.h b/drivers/staging/vt6656/wctl.h index 1b21e32e99e5..14cb41177045 100644 --- a/drivers/staging/vt6656/wctl.h +++ b/drivers/staging/vt6656/wctl.h @@ -29,59 +29,55 @@ #ifndef __WCTL_H__ #define __WCTL_H__ -#include "ttype.h" #include "tether.h" #include "device.h" -/*--------------------- Export Definitions -------------------------*/ - #define IS_TYPE_DATA(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_DATA) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_DATA) #define IS_TYPE_MGMT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_MGMT) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_MGMT) #define IS_TYPE_CONTROL(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_CTL) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_CTL) #define IS_FC_MOREDATA(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREDATA) == FC_MOREDATA) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREDATA) == FC_MOREDATA) #define IS_FC_POWERMGT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_POWERMGT) == FC_POWERMGT) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_POWERMGT) == FC_POWERMGT) #define IS_FC_RETRY(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_RETRY) == FC_RETRY) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_RETRY) == FC_RETRY) #define IS_FC_WEP(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_WEP) == FC_WEP) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_WEP) == FC_WEP) #ifdef __BIG_ENDIAN #define IS_FRAGMENT_PKT(pMACHeader) \ - (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ - ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) != 0)) + (((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \ + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) != 0)) #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) == 0) + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) == 0) #else #define IS_FRAGMENT_PKT(pMACHeader) \ - (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ - ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) != 0)) + (((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \ + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) != 0)) #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) == 0) + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) == 0) #endif//#ifdef __BIG_ENDIAN #define IS_LAST_FRAGMENT_PKT(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) == 0) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) == 0) #define IS_CTL_PSPOLL(pMACHeader) \ - ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) - + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ if ((uVar) >= ((uModulo) - 1)) \ @@ -90,16 +86,9 @@ (uVar)++; \ } -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - -bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); -bool WCTLbHandleFragment(struct vnt_private *, PS802_11Header pMACHeader, - unsigned int cbFrameLength, bool bWEP, bool bExtIV); -unsigned int WCTLuSearchDFCB(struct vnt_private *, PS802_11Header pMACHeader); -unsigned int WCTLuInsertDFCB(struct vnt_private *, PS802_11Header pMACHeader); +bool WCTLbIsDuplicate(PSCache pCache, struct ieee80211_hdr *pMACHeader); +bool WCTLbHandleFragment(struct vnt_private *, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV); +unsigned int WCTLuSearchDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader); +unsigned int WCTLuInsertDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader); #endif /* __WCTL_H__ */ diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index 5dced0a43797..6d1ff5eeafa9 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -81,18 +81,9 @@ #include "control.h" #include "rndis.h" -/*--------------------- Static Definitions -------------------------*/ - - - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -/*--------------------- Static Functions --------------------------*/ - static int ChannelExceedZoneType(struct vnt_private *, u8 byCurrChannel); /* Association/diassociation functions */ @@ -158,7 +149,6 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); - /* Association response */ static struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *, struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, @@ -182,25 +172,19 @@ static struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *, /* received status */ static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus); - static void s_vMgrSynchBSS(struct vnt_private *, u32 uBSSMode, PKnownBSS pCurr, PCMD_STATUS pStatus); - static bool s_bCipherMatch ( PKnownBSS pBSSNode, NDIS_802_11_ENCRYPTION_STATUS EncStatus, - PBYTE pbyCCSPK, - PBYTE pbyCCSGK + u8 * pbyCCSPK, + u8 * pbyCCSGK ); static void Encyption_Rebuild(struct vnt_private *, PKnownBSS pCurr); -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - /*+ * * Routine Description: @@ -216,7 +200,6 @@ void vMgrObjectInit(struct vnt_private *pDevice) struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int ii; - pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0]; pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0]; pMgmt->uCurrChannel = pDevice->uChannel; @@ -274,7 +257,6 @@ void vMgrAssocBeginSta(struct vnt_private *pDevice, { struct vnt_tx_mgmt *pTxPacket; - pMgmt->wCurrCapInfo = 0; pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); if (pDevice->bEncryptionEnable) { @@ -329,7 +311,6 @@ void vMgrAssocBeginSta(struct vnt_private *pDevice, return ; } - /*+ * * Routine Description: @@ -359,7 +340,6 @@ void vMgrReAssocBeginSta(struct vnt_private *pDevice, if (pMgmt->wListenInterval == 0) pMgmt->wListenInterval = 1; // at least one. - // ERP Phy (802.11g) should support short preamble. if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); @@ -374,7 +354,6 @@ void vMgrReAssocBeginSta(struct vnt_private *pDevice, if (pMgmt->b11hEnable == true) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); - pTxPacket = s_MgrMakeReAssocRequest ( pDevice, @@ -398,7 +377,6 @@ void vMgrReAssocBeginSta(struct vnt_private *pDevice, } } - return ; } @@ -426,7 +404,7 @@ void vMgrDisassocBeginSta(struct vnt_private *pDevice, + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_DISASSOC_FR_MAXLEN; // format fixed field frame structure @@ -458,8 +436,6 @@ void vMgrDisassocBeginSta(struct vnt_private *pDevice, return; } - - /*+ * * Routine Description:(AP function) @@ -483,7 +459,6 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) return; // node index not found @@ -496,7 +471,7 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, memset(abyCurrSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); memset(abyCurrExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; vMgrDecodeAssocRequest(&sFrame); @@ -523,7 +498,6 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, abyCurrExtSuppRates[1] = 0; } - RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, @@ -543,9 +517,9 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].wAID = (WORD)uNodeIndex; + pMgmt->sNodeDBTable[uNodeIndex].wAID = (u16)uNodeIndex; wAssocStatus = WLAN_MGMT_STATUS_SUCCESS; - wAssocAID = (WORD)uNodeIndex; + wAssocAID = (u16)uNodeIndex; // check if ERP support if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; @@ -572,7 +546,6 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); } - // assoc response reply.. pTxPacket = s_MgrMakeAssocResponse ( @@ -604,7 +577,6 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, return; } - /*+ * * Description:(AP function) @@ -643,7 +615,7 @@ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, //decode the frame memset(&sFrame, 0, sizeof(WLAN_FR_REASSOCREQ)); sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; vMgrDecodeReassocRequest(&sFrame); if (pMgmt->sNodeDBTable[uNodeIndex].eNodeState >= NODE_AUTH) { @@ -671,7 +643,6 @@ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, abyCurrExtSuppRates[1] = 0; } - RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, @@ -691,9 +662,9 @@ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].wAID = (WORD)uNodeIndex; + pMgmt->sNodeDBTable[uNodeIndex].wAID = (u16)uNodeIndex; wAssocStatus = WLAN_MGMT_STATUS_SUCCESS; - wAssocAID = (WORD)uNodeIndex; + wAssocAID = (u16)uNodeIndex; // if suppurt ERP if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) @@ -722,7 +693,6 @@ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, } - // assoc response reply.. pTxPacket = s_MgrMakeReAssocResponse ( @@ -752,7 +722,6 @@ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, return; } - /*+ * * Routine Description: @@ -771,13 +740,11 @@ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice, PWLAN_IE_SSID pItemSSID; u8 *pbyIEs; - - if (pMgmt->eCurrState == WMAC_STATE_ASSOCPENDING || pMgmt->eCurrState == WMAC_STATE_ASSOC) { sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; // decode the frame vMgrDecodeAssocResponse(&sFrame); if ((sFrame.pwCapInfo == NULL) @@ -820,7 +787,7 @@ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice, //if(pDevice->bWPASuppWextEnabled == true) { - BYTE buf[512]; + u8 buf[512]; size_t len; union iwreq_data wrqu; int we_event; @@ -906,7 +873,7 @@ void vMgrAuthenBeginSta(struct vnt_private *pDevice, + WLAN_AUTHEN_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; vMgrEncodeAuthen(&sFrame); /* insert values */ @@ -960,7 +927,7 @@ void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, + WLAN_DEAUTHEN_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_DEAUTHEN_FR_MAXLEN; vMgrEncodeDeauthen(&sFrame); /* insert values */ @@ -984,11 +951,9 @@ void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, *pStatus = CMD_STATUS_SUCCESS; } - return ; } - /*+ * * Routine Description: @@ -1012,7 +977,7 @@ static void s_vMgrRxAuthentication(struct vnt_private *pDevice, // decode the frame sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; vMgrDecodeAuthen(&sFrame); switch (cpu_to_le16((*(sFrame.pwAuthSequence )))){ case 1: @@ -1037,8 +1002,6 @@ static void s_vMgrRxAuthentication(struct vnt_private *pDevice, return; } - - /*+ * * Routine Description: @@ -1051,7 +1014,6 @@ static void s_vMgrRxAuthentication(struct vnt_private *pDevice, * -*/ - static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { @@ -1082,7 +1044,7 @@ static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, + WLAN_AUTHEN_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; // format buffer structure vMgrEncodeAuthen(&sFrame); @@ -1142,8 +1104,6 @@ static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, return; } - - /*+ * * Routine Description: @@ -1162,7 +1122,6 @@ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, WLAN_FR_AUTHEN sFrame; struct vnt_tx_mgmt *pTxPacket = NULL; - switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) { case WLAN_AUTH_ALG_OPENSYSTEM: @@ -1193,7 +1152,7 @@ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; // format buffer structure vMgrEncodeAuthen(&sFrame); @@ -1241,8 +1200,6 @@ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, return; } - - /*+ * * Routine Description: @@ -1297,7 +1254,7 @@ reply: + WLAN_AUTHEN_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; // format buffer structure vMgrEncodeAuthen(&sFrame); @@ -1329,8 +1286,6 @@ reply: } - - /*+ * * Routine Description: @@ -1385,7 +1340,7 @@ static void s_vMgrRxDisassociation(struct vnt_private *pDevice, // if is acting an AP.. // a STA is leaving this BSS.. sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) { BSSvRemoveOneNode(pDevice, uNodeIndex); } @@ -1395,7 +1350,7 @@ static void s_vMgrRxDisassociation(struct vnt_private *pDevice, } else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA ){ sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; vMgrDecodeDisassociation(&sFrame); DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason))); @@ -1430,7 +1385,6 @@ static void s_vMgrRxDisassociation(struct vnt_private *pDevice, return; } - /*+ * * Routine Description: @@ -1448,13 +1402,12 @@ static void s_vMgrRxDeauthentication(struct vnt_private *pDevice, WLAN_FR_DEAUTHEN sFrame; u32 uNodeIndex = 0; - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){ //Todo: // if is acting an AP.. // a STA is leaving this BSS.. sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) { BSSvRemoveOneNode(pDevice, uNodeIndex); } @@ -1465,7 +1418,7 @@ static void s_vMgrRxDeauthentication(struct vnt_private *pDevice, else { if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA ) { sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; vMgrDecodeDeauthen(&sFrame); pDevice->fWPA_Authened = false; DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason)))); @@ -1569,14 +1522,12 @@ static void s_vMgrRxBeacon(struct vnt_private *pDevice, int bChannelHit = false; u8 byOldPreambleType; - - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) return; memset(&sFrame, 0, sizeof(WLAN_FR_BEACON)); sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; // decode the beacon frame vMgrDecodeBeacon(&sFrame); @@ -1672,7 +1623,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) return; } - if(byCurrChannel == (BYTE)pMgmt->uCurrChannel) + if(byCurrChannel == (u8)pMgmt->uCurrChannel) bIsChannelEqual = true; if (bIsChannelEqual && (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { @@ -1785,7 +1736,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) pDevice->byPreambleType = 0; } if (pDevice->byPreambleType != byOldPreambleType) - CARDvSetRSPINF(pDevice, (BYTE)pDevice->byBBType); + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); // // Basic Rate Set may change dynamically // @@ -1839,7 +1790,6 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) if (qwTSFOffset > TRIVIAL_SYNC_DIFFERENCE) bTSFLargeDiff = true; - // if infra mode if (bIsAPBeacon == true) { @@ -2009,8 +1959,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) pDevice->byPreambleType = 0; } if (pDevice->byPreambleType != byOldPreambleType) - CARDvSetRSPINF(pDevice, (BYTE)pDevice->byBBType); - + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); // MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID); // set highest basic rate @@ -2061,8 +2010,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) u8 abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; u16 wSuppRate; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) { @@ -2101,7 +2048,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) pMgmt->abyCurrSuppRates[2+ii] = abyRATE[ii]; } - if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->abyCurrSuppRates[1] = 8; pMgmt->abyCurrExtSuppRates[1] = 4; @@ -2113,7 +2059,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) pMgmt->abyCurrExtSuppRates[2+ii] = abyOFDM_RATE[ii+4]; } - // Disable Protect Mode pDevice->bProtectMode = 0; MACvDisableProtectMD(pDevice); @@ -2156,8 +2101,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, &byTopCCKBasicRate, &byTopOFDMBasicRate); - - if (pDevice->byBBType == BB_TYPE_11A) { pDevice->bShortSlotTime = true; } else { @@ -2221,7 +2164,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) pMgmt->abyCurrBSSID[0] &= ~IEEE_ADDR_GROUP; pMgmt->abyCurrBSSID[0] |= IEEE_ADDR_UNIVERSAL; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"Adhoc beacon created bssid:" "%pM\n", pMgmt->abyCurrBSSID); } @@ -2313,7 +2255,6 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) u8 byTopOFDMBasicRate = RATE_1M; u8 bShortSlotTime = false; - for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive == true) break; @@ -2411,9 +2352,9 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) if (pItemExtRates->len <= ii) break; } - pItemRates->len += (BYTE)ii; + pItemRates->len += (u8)ii; if (pItemExtRates->len - ii > 0) { - pItemExtRates->len -= (BYTE)ii; + pItemExtRates->len -= (u8)ii; for (uu = 0; uu < pItemExtRates->len; uu ++) { pItemExtRates->abyRates[uu] = pItemExtRates->abyRates[uu + ii]; } @@ -2466,7 +2407,7 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) pDevice->byPreambleType = 0; } // Change PreambleType must set RSPINF again - CARDvSetRSPINF(pDevice, (BYTE)pDevice->byBBType); + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join ESS\n"); @@ -2519,7 +2460,6 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) pMgmt->eCurrState = WMAC_STATE_IDLE; }; - } else { // ad-hoc mode BSS @@ -2559,7 +2499,6 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) // TODO: check if CapInfo privacy on, but we don't.. pMgmt->uCurrChannel = pCurr->uChannel; - // Parse Support Rate IE pMgmt->abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES; pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abySuppRates, @@ -2597,7 +2536,7 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) pDevice->byPreambleType = 0; } // Change PreambleType must set RSPINF again - CARDvSetRSPINF(pDevice, (BYTE)pDevice->byBBType); + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); // Prepare beacon bMgrPrepareBeaconToSend((void *) pDevice, pMgmt); @@ -2609,8 +2548,6 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) return; } - - /*+ * * Routine Description: @@ -2806,7 +2743,6 @@ static void Encyption_Rebuild(struct vnt_private *pDevice, PKnownBSS pCurr) return; } - /*+ * * Routine Description: @@ -2828,7 +2764,6 @@ static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) u16 wStartIndex = 0; u16 wEndIndex = 0; - // Find size of partial virtual bitmap for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { byMap = pMgmt->abyPSTxMap[ii]; @@ -2843,13 +2778,12 @@ static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) if (byMap) { if (!bStartFound) { bStartFound = true; - wStartIndex = (WORD)ii; + wStartIndex = (u16)ii; } - wEndIndex = (WORD)ii; + wEndIndex = (u16)ii; } } - // Round start index down to nearest even number wStartIndex &= ~BIT0; @@ -2876,7 +2810,6 @@ static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) pTIM->byVirtBitMap[0] &= ~BIT0; } - /*+ * * Routine Description: @@ -2898,7 +2831,6 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, WLAN_FR_BEACON sFrame; u8 abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - /* prepare beacon frame */ pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) @@ -2906,7 +2838,7 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure. - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_BEACON_FR_MAXLEN; vMgrEncodeBeacon(&sFrame); // Setup the header @@ -2917,7 +2849,7 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, )); if (pDevice->bEnablePSMode) { - sFrame.pHdr->sA3.wFrameCtl |= cpu_to_le16((WORD)WLAN_SET_FC_PWRMGT(1)); + sFrame.pHdr->sA3.wFrameCtl |= cpu_to_le16((u16)WLAN_SET_FC_PWRMGT(1)); } memcpy( sFrame.pHdr->sA3.abyAddr1, abyBroadcastAddr, WLAN_ADDR_LEN); @@ -2945,7 +2877,7 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, sFrame.len += (1) + WLAN_IEHDR_LEN; sFrame.pDSParms->byElementID = WLAN_EID_DS_PARMS; sFrame.pDSParms->len = 1; - sFrame.pDSParms->byCurrChannel = (BYTE)uCurrChannel; + sFrame.pDSParms->byCurrChannel = (u8)uCurrChannel; } // TIM field if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { @@ -2988,17 +2920,16 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, // Pairwise Key Cipher Suite sFrame.pRSNWPA->wPKCount = 0; // Auth Key Management Suite - *((PWORD)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len))=0; + *((u16 *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len))=0; sFrame.pRSNWPA->len +=2; // RSN Capabilites - *((PWORD)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len))=0; + *((u16 *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len))=0; sFrame.pRSNWPA->len +=2; sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; } } - if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { sFrame.pERP = (PWLAN_IE_ERP)(sFrame.pBuf + sFrame.len); sFrame.len += 1 + WLAN_IEHDR_LEN; @@ -3038,10 +2969,6 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, return pTxPacket; } - - - - /*+ * * Routine Description: @@ -3053,9 +2980,6 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, * -*/ - - - struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, @@ -3066,14 +2990,13 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_PROBERESP sFrame; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_PROBERESP_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure. - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_PROBERESP_FR_MAXLEN; vMgrEncodeProbeResponse(&sFrame); // Setup the header @@ -3089,7 +3012,7 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); if (byPHYType == BB_TYPE_11B) { - *sFrame.pwCapInfo &= cpu_to_le16((WORD)~(WLAN_SET_CAP_INFO_SHORTSLOTTIME(1))); + *sFrame.pwCapInfo &= cpu_to_le16((u16)~(WLAN_SET_CAP_INFO_SHORTSLOTTIME(1))); } // Copy SSID @@ -3114,7 +3037,7 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, sFrame.len += (1) + WLAN_IEHDR_LEN; sFrame.pDSParms->byElementID = WLAN_EID_DS_PARMS; sFrame.pDSParms->len = 1; - sFrame.pDSParms->byCurrChannel = (BYTE)uCurrChannel; + sFrame.pDSParms->byCurrChannel = (u8)uCurrChannel; } if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) { @@ -3166,8 +3089,6 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, return pTxPacket; } - - /*+ * * Routine Description: @@ -3179,7 +3100,6 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, * -*/ - struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, u16 wListenInterval, @@ -3192,14 +3112,13 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, u8 *pbyIEs; u8 *pbyRSN; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_ASSOCREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure. - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_ASSOCREQ_FR_MAXLEN; // format fixed field frame structure vMgrEncodeAssocRequest(&sFrame); @@ -3247,7 +3166,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, memcpy(pbyIEs, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); pbyIEs += pCurrRates->len + WLAN_IEHDR_LEN; - if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE)) && @@ -3287,7 +3205,7 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_NONE; } // Auth Key Management Suite - pbyRSN = (PBYTE)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len); + pbyRSN = (u8 *)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len); *pbyRSN++=0x01; *pbyRSN++=0x00; *pbyRSN++=0x00; @@ -3322,7 +3240,7 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && (pMgmt->pCurrBSS != NULL)) { unsigned int ii; - PWORD pwPMKID; + u16 * pwPMKID; // WPA IE sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); @@ -3387,7 +3305,7 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pbyRSN = &sFrame.pRSN->abyRSN[18]; - pwPMKID = (PWORD)pbyRSN; // Point to PMKID count + pwPMKID = (u16 *)pbyRSN; // Point to PMKID count *pwPMKID = 0; // Initialize PMKID count pbyRSN += 2; // Point to PMKID list for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { @@ -3413,20 +3331,12 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN; } - // Adjust the length fields pTxPacket->cbMPDULen = sFrame.len; pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; return pTxPacket; } - - - - - - - /*+ * * Routine Description: @@ -3438,7 +3348,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, * -*/ - struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, @@ -3450,14 +3359,13 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, u8 *pbyIEs; u8 *pbyRSN; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_REASSOCREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); /* Setup the sFrame structure. */ - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_REASSOCREQ_FR_MAXLEN; // format fixed field frame structure @@ -3546,7 +3454,7 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_NONE; } // Auth Key Management Suite - pbyRSN = (PBYTE)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len); + pbyRSN = (u8 *)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len); *pbyRSN++=0x01; *pbyRSN++=0x00; *pbyRSN++=0x00; @@ -3578,7 +3486,7 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && (pMgmt->pCurrBSS != NULL)) { unsigned int ii; - PWORD pwPMKID; + u16 * pwPMKID; /* WPA IE */ sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); @@ -3643,7 +3551,7 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pbyRSN = &sFrame.pRSN->abyRSN[18]; - pwPMKID = (PWORD)pbyRSN; // Point to PMKID count + pwPMKID = (u16 *)pbyRSN; // Point to PMKID count *pwPMKID = 0; // Initialize PMKID count pbyRSN += 2; // Point to PMKID list for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { @@ -3669,8 +3577,6 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN; } - - /* Adjust the length fields */ pTxPacket->cbMPDULen = sFrame.len; pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; @@ -3697,14 +3603,13 @@ struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_ASSOCRESP sFrame; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_ASSOCREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; vMgrEncodeAssocResponse(&sFrame); // Setup the header @@ -3719,7 +3624,7 @@ struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); *sFrame.pwStatus = cpu_to_le16(wAssocStatus); - *sFrame.pwAid = cpu_to_le16((WORD)(wAssocAID | BIT14 | BIT15)); + *sFrame.pwAid = cpu_to_le16((u16)(wAssocAID | BIT14 | BIT15)); // Copy the rate set sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); @@ -3745,7 +3650,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, return pTxPacket; } - /*+ * * Routine Description: @@ -3757,7 +3661,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, * -*/ - struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, @@ -3766,14 +3669,13 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_REASSOCRESP sFrame; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_ASSOCREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure - sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; vMgrEncodeReassocResponse(&sFrame); // Setup the header @@ -3788,7 +3690,7 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); *sFrame.pwStatus = cpu_to_le16(wAssocStatus); - *sFrame.pwAid = cpu_to_le16((WORD)(wAssocAID | BIT14 | BIT15)); + *sFrame.pwAid = cpu_to_le16((u16)(wAssocAID | BIT14 | BIT15)); // Copy the rate set sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); @@ -3814,7 +3716,6 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, return pTxPacket; } - /*+ * * Routine Description: @@ -3835,11 +3736,10 @@ static void s_vMgrRxProbeResponse(struct vnt_private *pDevice, ERPObject sERP; int bChannelHit = true; - memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP)); // decode the frame sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; vMgrDecodeProbeResponse(&sFrame); if ((sFrame.pqwTimestamp == NULL) @@ -3857,7 +3757,6 @@ static void s_vMgrRxProbeResponse(struct vnt_private *pDevice, if(sFrame.pSSID->len == 0) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n"); - //{{ RobertYu:20050201, 11a byCurrChannel != sFrame.pDSParms->byCurrChannel mapping if( byCurrChannel > CB_MAX_CHANNEL_24G ) { @@ -3892,7 +3791,6 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) sERP.byERP = 0; } - // update or insert the bss pBSSList = BSSpAddrIsInBSSList((void *) pDevice, sFrame.pHdr->sA3.abyAddr3, @@ -3952,7 +3850,6 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) * -*/ - static void s_vMgrRxProbeRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { @@ -3969,7 +3866,7 @@ static void s_vMgrRxProbeRequest(struct vnt_private *pDevice, memset(&sFrame, 0, sizeof(WLAN_FR_PROBEREQ)); // decode the frame sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; vMgrDecodeProbeRequest(&sFrame); /* DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request rx:MAC addr:%pM\n", @@ -4000,7 +3897,7 @@ static void s_vMgrRxProbeRequest(struct vnt_private *pDevice, 0, sFrame.pHdr->sA3.abyAddr2, (PWLAN_IE_SSID)pMgmt->abyCurrSSID, - (PBYTE)pMgmt->abyCurrBSSID, + (u8 *)pMgmt->abyCurrBSSID, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, byPHYType @@ -4042,7 +3939,6 @@ void vMgrRxManagePacket(struct vnt_private *pDevice, struct vnt_manager *pMgmt, NODE_STATE eNodeState = 0; CMD_STATUS Status; - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) eNodeState = pMgmt->sNodeDBTable[uNodeIndex].eNodeState; @@ -4199,7 +4095,7 @@ int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, pMgmt->uCurrChannel, pMgmt->wCurrATIMWindow, //0, (PWLAN_IE_SSID)pMgmt->abyCurrSSID, - (PBYTE)pMgmt->abyCurrBSSID, + (u8 *)pMgmt->abyCurrBSSID, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates ); @@ -4214,9 +4110,6 @@ int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, return true; } - - - /*+ * * Routine Description: @@ -4308,8 +4201,6 @@ int bAdd_PMKID_Candidate(struct vnt_private *pDevice, u8 *pbyBSSID, if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) return false; - - // Update Old Candidate for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; @@ -4368,12 +4259,12 @@ static bool s_bCipherMatch ( PKnownBSS pBSSNode, NDIS_802_11_ENCRYPTION_STATUS EncStatus, - PBYTE pbyCCSPK, - PBYTE pbyCCSGK + u8 * pbyCCSPK, + u8 * pbyCCSGK ) { - BYTE byMulticastCipher = KEY_CTL_INVALID; - BYTE byCipherMask = 0x00; + u8 byMulticastCipher = KEY_CTL_INVALID; + u8 byCipherMask = 0x00; int i; if (pBSSNode == NULL) @@ -4515,4 +4406,3 @@ s_bCipherMatch ( return true; } - diff --git a/drivers/staging/vt6656/wmgr.h b/drivers/staging/vt6656/wmgr.h index 83aed45f68a3..5424c7f820ad 100644 --- a/drivers/staging/vt6656/wmgr.h +++ b/drivers/staging/vt6656/wmgr.h @@ -34,7 +34,6 @@ #ifndef __WMGR_H__ #define __WMGR_H__ -#include "ttype.h" #include "80211mgr.h" #include "80211hdr.h" #include "wcmd.h" @@ -42,10 +41,6 @@ #include "wpa2.h" #include "card.h" -/*--------------------- Export Definitions -------------------------*/ - - - // Scan time #define PROBE_DELAY 100 // (us) #define SWITCH_CHANNEL_DELAY 200 // (us) @@ -57,7 +52,6 @@ #define WCMD_ACTIVE_SCAN_TIME 20 //(ms) #define WCMD_PASSIVE_SCAN_TIME 100 //(ms) - #define DEFAULT_MSDU_LIFETIME 512 // ms #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us @@ -66,7 +60,6 @@ #define MAKE_BEACON_RESERVED 10 //(us) - #define TIM_MULTICAST_MASK 0x01 #define TIM_BITMAPOFFSET_MASK 0xFE #define DEFAULT_DTIM_PERIOD 1 @@ -75,18 +68,11 @@ #define DEFAULT_IBSS_CHANNEL 6 //2.4G - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ //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)(unsigned long); - //+++ NDIS related typedef u8 NDIS_802_11_MAC_ADDRESS[ETH_ALEN]; @@ -117,8 +103,6 @@ typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION u32 OffsetResponseIEs; } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION; - - typedef struct tagSAssocInfo { NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; u8 abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN]; @@ -127,9 +111,6 @@ typedef struct tagSAssocInfo { u8 abyReqIEs[WLAN_BEACON_FR_MAXLEN]; } SAssocInfo, *PSAssocInfo; - - - typedef enum tagWMAC_AUTHENTICATION_MODE { WMAC_AUTH_OPEN, @@ -143,8 +124,6 @@ typedef enum tagWMAC_AUTHENTICATION_MODE { WMAC_AUTH_MAX // Not a real mode, defined as upper bound } WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE; - - // Pre-configured Mode (from XP) typedef enum tagWMAC_CONFIG_MODE { @@ -155,7 +134,6 @@ typedef enum tagWMAC_CONFIG_MODE { } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE; - typedef enum tagWMAC_SCAN_TYPE { WMAC_SCAN_ACTIVE, @@ -164,7 +142,6 @@ typedef enum tagWMAC_SCAN_TYPE { } WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE; - typedef enum tagWMAC_SCAN_STATE { WMAC_NO_SCANNING, @@ -173,8 +150,6 @@ typedef enum tagWMAC_SCAN_STATE { } WMAC_SCAN_STATE, *PWMAC_SCAN_STATE; - - // Notes: // Basic Service Set state explained as following: // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra) @@ -207,7 +182,6 @@ typedef enum tagWMAC_CURRENT_MODE { } WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE; - typedef enum tagWMAC_POWER_MODE { WMAC_POWER_CAM, @@ -216,8 +190,6 @@ typedef enum tagWMAC_POWER_MODE { } WMAC_POWER_MODE, *PWMAC_POWER_MODE; - - /* Tx Management Packet descriptor */ struct vnt_tx_mgmt { PUWLAN_80211HDR p80211Header; @@ -225,7 +197,6 @@ struct vnt_tx_mgmt { u32 cbPayloadLen; }; - /* Rx Management Packet descriptor */ struct vnt_rx_mgmt { PUWLAN_80211HDR p80211Header; @@ -238,7 +209,6 @@ struct vnt_rx_mgmt { u8 byRxChannel; }; - struct vnt_manager { void *pAdapter; @@ -340,7 +310,6 @@ struct vnt_manager { u8 byMgmtPacketPool[sizeof(struct vnt_tx_mgmt) + WLAN_A3FR_MAXLEN]; - /* One second callback timer */ struct timer_list sTimerSecondCallback; @@ -384,10 +353,6 @@ struct vnt_manager { }; -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - void vMgrObjectInit(struct vnt_private *pDevice); void vMgrAssocBeginSta(struct vnt_private *pDevice, diff --git a/drivers/staging/vt6656/wpa.c b/drivers/staging/vt6656/wpa.c index f037be3aa164..01db4e7154da 100644 --- a/drivers/staging/vt6656/wpa.c +++ b/drivers/staging/vt6656/wpa.c @@ -32,7 +32,6 @@ * */ -#include "ttype.h" #include "tmacro.h" #include "tether.h" #include "device.h" @@ -42,16 +41,14 @@ #include "wpa.h" #include "80211mgr.h" -/*--------------------- Static Variables --------------------------*/ static int msglevel =MSG_LEVEL_INFO; -const BYTE abyOUI00[4] = { 0x00, 0x50, 0xf2, 0x00 }; -const BYTE abyOUI01[4] = { 0x00, 0x50, 0xf2, 0x01 }; -const BYTE abyOUI02[4] = { 0x00, 0x50, 0xf2, 0x02 }; -const BYTE abyOUI03[4] = { 0x00, 0x50, 0xf2, 0x03 }; -const BYTE abyOUI04[4] = { 0x00, 0x50, 0xf2, 0x04 }; -const BYTE abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 }; - +const u8 abyOUI00[4] = { 0x00, 0x50, 0xf2, 0x00 }; +const u8 abyOUI01[4] = { 0x00, 0x50, 0xf2, 0x01 }; +const u8 abyOUI02[4] = { 0x00, 0x50, 0xf2, 0x02 }; +const u8 abyOUI03[4] = { 0x00, 0x50, 0xf2, 0x03 }; +const u8 abyOUI04[4] = { 0x00, 0x50, 0xf2, 0x04 }; +const u8 abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 }; /*+ * @@ -88,7 +85,6 @@ WPA_ClearRSN( pBSSList->bWPAValid = false; } - /*+ * * Description: @@ -112,7 +108,7 @@ WPA_ParseRSN( { PWLAN_IE_RSN_AUTH pIE_RSN_Auth = NULL; int i, j, m, n = 0; - PBYTE pbyCaps; + u8 * pbyCaps; WPA_ClearRSN(pBSSList); @@ -167,7 +163,7 @@ WPA_ParseRSN( break; //DBG_PRN_GRP14(("abyPKType[%d]: %X\n", j-1, pBSSList->abyPKType[j-1])); } //for - pBSSList->wPKCount = (WORD)j; + pBSSList->wPKCount = (u16)j; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d\n", pBSSList->wPKCount); } @@ -197,7 +193,7 @@ WPA_ParseRSN( //DBG_PRN_GRP14(("abyAuthType[%d]: %X\n", j-1, pBSSList->abyAuthType[j-1])); } if(j > 0) - pBSSList->wAuthCount = (WORD)j; + pBSSList->wAuthCount = (u16)j; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d\n", pBSSList->wAuthCount); } @@ -209,11 +205,11 @@ WPA_ParseRSN( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"14+4+(m+n)*4: %d\n", 14+4+(m+n)*4); if(pRSN->len+2 >= 14+4+(m+n)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*n)+Cap(2) - pbyCaps = (PBYTE)pIE_RSN_Auth->AuthKSList[n].abyOUI; + pbyCaps = (u8 *)pIE_RSN_Auth->AuthKSList[n].abyOUI; pBSSList->byDefaultK_as_PK = (*pbyCaps) & WPA_GROUPFLAG; pBSSList->byReplayIdx = 2 << ((*pbyCaps >> WPA_REPLAYBITSSHIFT) & WPA_REPLAYBITS); pBSSList->sRSNCapObj.bRSNCapExist = true; - pBSSList->sRSNCapObj.wRSNCap = *(PWORD)pbyCaps; + pBSSList->sRSNCapObj.wRSNCap = *(u16 *)pbyCaps; //DBG_PRN_GRP14(("pbyCaps: %X\n", *pbyCaps)); //DBG_PRN_GRP14(("byDefaultK_as_PK: %X\n", pBSSList->byDefaultK_as_PK)); //DBG_PRN_GRP14(("byReplayIdx: %X\n", pBSSList->byReplayIdx)); @@ -241,13 +237,13 @@ WPA_ParseRSN( -*/ bool WPA_SearchRSN( - BYTE byCmd, - BYTE byEncrypt, + u8 byCmd, + u8 byEncrypt, PKnownBSS pBSSList ) { int ii; - BYTE byPKType = WPA_NONE; + u8 byPKType = WPA_NONE; if (pBSSList->bWPAValid == false) return false; diff --git a/drivers/staging/vt6656/wpa.h b/drivers/staging/vt6656/wpa.h index 0369cbf32c49..2a724c064e59 100644 --- a/drivers/staging/vt6656/wpa.h +++ b/drivers/staging/vt6656/wpa.h @@ -31,11 +31,8 @@ #ifndef __WPA_H__ #define __WPA_H__ -#include "ttype.h" #include "80211hdr.h" -/*--------------------- Export Definitions -------------------------*/ - #define WPA_NONE 0 #define WPA_WEP40 1 #define WPA_TKIP 2 @@ -49,15 +46,6 @@ #define WPA_REPLAYBITSSHIFT 2 #define WPA_REPLAYBITS 0x03 -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - - -/*--------------------- Export Functions --------------------------*/ - void WPA_ClearRSN( PKnownBSS pBSSList @@ -71,8 +59,8 @@ WPA_ParseRSN( bool WPA_SearchRSN( - BYTE byCmd, - BYTE byEncrypt, + u8 byCmd, + u8 byEncrypt, PKnownBSS pBSSList ); diff --git a/drivers/staging/vt6656/wpa2.c b/drivers/staging/vt6656/wpa2.c index a89456a9137a..aa2216184345 100644 --- a/drivers/staging/vt6656/wpa2.c +++ b/drivers/staging/vt6656/wpa2.c @@ -34,28 +34,17 @@ #include "device.h" #include "wpa2.h" -/*--------------------- Static Definitions -------------------------*/ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -/*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ +const u8 abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 }; +const u8 abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +const u8 abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; +const u8 abyOUITKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +const u8 abyOUICCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; -const BYTE abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 }; -const BYTE abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -const BYTE abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; -const BYTE abyOUITKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; -const BYTE abyOUICCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; - -const BYTE abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -const BYTE abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; - - -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ +const u8 abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +const u8 abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; /*+ * @@ -113,8 +102,8 @@ WPA2vParseRSN ( ) { int i, j; - WORD m = 0, n = 0; - PBYTE pbyOUI; + u16 m = 0, n = 0; + u8 * pbyOUI; bool bUseGK = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA2_ParseRSN: [%d]\n", pRSN->len); @@ -163,11 +152,11 @@ WPA2vParseRSN ( } if (pRSN->len >= 8) { // ver(2) + GK(4) + PK count(2) - pBSSNode->wCSSPKCount = *((PWORD) &(pRSN->abyRSN[4])); + pBSSNode->wCSSPKCount = *((u16 *) &(pRSN->abyRSN[4])); j = 0; pbyOUI = &(pRSN->abyRSN[6]); - for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(BYTE)); i++) { + for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(u8)); i++) { if (pRSN->len >= 8+i*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*i) if ( !memcmp(pbyOUI, abyOUIGK, 4)) { @@ -208,17 +197,17 @@ WPA2vParseRSN ( // invalid CSS, No valid PK. return; } - pBSSNode->wCSSPKCount = (WORD)j; + pBSSNode->wCSSPKCount = (u16)j; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wCSSPKCount: %d\n", pBSSNode->wCSSPKCount); } - m = *((PWORD) &(pRSN->abyRSN[4])); + m = *((u16 *) &(pRSN->abyRSN[4])); if (pRSN->len >= 10+m*4) { // ver(2) + GK(4) + PK count(2) + PKS(4*m) + AKMSS count(2) - pBSSNode->wAKMSSAuthCount = *((PWORD) &(pRSN->abyRSN[6+4*m])); + pBSSNode->wAKMSSAuthCount = *((u16 *) &(pRSN->abyRSN[6+4*m])); j = 0; pbyOUI = &(pRSN->abyRSN[8+4*m]); - for (i = 0; (i < pBSSNode->wAKMSSAuthCount) && (j < sizeof(pBSSNode->abyAKMSSAuthType)/sizeof(BYTE)); i++) { + for (i = 0; (i < pBSSNode->wAKMSSAuthCount) && (j < sizeof(pBSSNode->abyAKMSSAuthType)/sizeof(u8)); i++) { if (pRSN->len >= 10+(m+i)*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSS(2)+AKS(4*i) if ( !memcmp(pbyOUI, abyOUI8021X, 4)) pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_802_1X; @@ -231,134 +220,16 @@ WPA2vParseRSN ( } else break; } - pBSSNode->wAKMSSAuthCount = (WORD)j; + pBSSNode->wAKMSSAuthCount = (u16)j; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount); - n = *((PWORD) &(pRSN->abyRSN[6+4*m])); + n = *((u16 *) &(pRSN->abyRSN[6+4*m])); if (pRSN->len >= 12+4*m+4*n) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSSCnt(2)+AKMSS(4*n)+Cap(2) pBSSNode->sRSNCapObj.bRSNCapExist = true; - pBSSNode->sRSNCapObj.wRSNCap = *((PWORD) &(pRSN->abyRSN[8+4*m+4*n])); + pBSSNode->sRSNCapObj.wRSNCap = *((u16 *) &(pRSN->abyRSN[8+4*m+4*n])); } } //ignore PMKID lists bcs only (Re)Assocrequest has this field pBSSNode->bWPA2Valid = true; } } - - -/*+ - * - * Description: - * Set WPA IEs - * - * Parameters: - * In: - * pMgmtHandle - Pointer to management object - * Out: - * pRSNIEs - Pointer to the RSN IE to set. - * - * Return Value: length of IEs. - * --*/ -unsigned int WPA2uSetIEs(void *pMgmtHandle, PWLAN_IE_RSN pRSNIEs) -{ - struct vnt_manager *pMgmt = (struct vnt_manager *)pMgmtHandle; - u8 *pbyBuffer = NULL; - int ii = 0; - u16 *pwPMKID = NULL; - - if (pRSNIEs == NULL) - return 0; - - if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && - (pMgmt->pCurrBSS != NULL)) { - /* WPA2 IE */ - pbyBuffer = (PBYTE) pRSNIEs; - pRSNIEs->byElementID = WLAN_EID_RSN; - pRSNIEs->len = 6; //Version(2)+GK(4) - pRSNIEs->wVersion = 1; - //Group Key Cipher Suite - pRSNIEs->abyRSN[0] = 0x00; - pRSNIEs->abyRSN[1] = 0x0F; - pRSNIEs->abyRSN[2] = 0xAC; - if (pMgmt->byCSSGK == KEY_CTL_WEP) { - pRSNIEs->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK; - } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { - pRSNIEs->abyRSN[3] = WLAN_11i_CSS_TKIP; - } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { - pRSNIEs->abyRSN[3] = WLAN_11i_CSS_CCMP; - } else { - pRSNIEs->abyRSN[3] = WLAN_11i_CSS_UNKNOWN; - } - - // Pairwise Key Cipher Suite - pRSNIEs->abyRSN[4] = 1; - pRSNIEs->abyRSN[5] = 0; - pRSNIEs->abyRSN[6] = 0x00; - pRSNIEs->abyRSN[7] = 0x0F; - pRSNIEs->abyRSN[8] = 0xAC; - if (pMgmt->byCSSPK == KEY_CTL_TKIP) { - pRSNIEs->abyRSN[9] = WLAN_11i_CSS_TKIP; - } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { - pRSNIEs->abyRSN[9] = WLAN_11i_CSS_CCMP; - } else if (pMgmt->byCSSPK == KEY_CTL_NONE) { - pRSNIEs->abyRSN[9] = WLAN_11i_CSS_USE_GROUP; - } else { - pRSNIEs->abyRSN[9] = WLAN_11i_CSS_UNKNOWN; - } - pRSNIEs->len += 6; - - // Auth Key Management Suite - pRSNIEs->abyRSN[10] = 1; - pRSNIEs->abyRSN[11] = 0; - pRSNIEs->abyRSN[12] = 0x00; - pRSNIEs->abyRSN[13] = 0x0F; - pRSNIEs->abyRSN[14] = 0xAC; - if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) { - pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_PSK; - } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { - pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_802_1X; - } else { - pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN; - } - pRSNIEs->len +=6; - - // RSN Capabilites - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { - memcpy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); - } else { - pRSNIEs->abyRSN[16] = 0; - pRSNIEs->abyRSN[17] = 0; - } - pRSNIEs->len +=2; - - if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && - (pMgmt->bRoaming == true) && - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { - /* 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 { - pbyBuffer = &pRSNIEs->abyRSN[18]; - } - } - return(pRSNIEs->len + WLAN_IEHDR_LEN); - } - return(0); -} diff --git a/drivers/staging/vt6656/wpa2.h b/drivers/staging/vt6656/wpa2.h index c359252a6b0e..dc505ce7a7e4 100644 --- a/drivers/staging/vt6656/wpa2.h +++ b/drivers/staging/vt6656/wpa2.h @@ -31,17 +31,15 @@ #ifndef __WPA2_H__ #define __WPA2_H__ -#include "ttype.h" #include "80211mgr.h" #include "80211hdr.h" #include "bssdb.h" -/*--------------------- Export Definitions -------------------------*/ #define MAX_PMKID_CACHE 16 typedef struct tagsPMKIDInfo { - BYTE abyBSSID[6]; - BYTE abyPMKID[16]; + u8 abyBSSID[6]; + u8 abyPMKID[16]; } PMKIDInfo, *PPMKIDInfo; typedef struct tagSPMKIDCache { @@ -49,18 +47,7 @@ typedef struct tagSPMKIDCache { PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE]; } SPMKIDCache, *PSPMKIDCache; - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - void WPA2_ClearRSN(PKnownBSS pBSSNode); void WPA2vParseRSN(PKnownBSS pBSSNode, PWLAN_IE_RSN pRSN); -unsigned int WPA2uSetIEs(void *pMgmtHandle, PWLAN_IE_RSN pRSNIEs); - #endif /* __WPA2_H__ */ diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c index 53629b26f24d..9f1b413ce86f 100644 --- a/drivers/staging/vt6656/wpactl.c +++ b/drivers/staging/vt6656/wpactl.c @@ -42,18 +42,8 @@ #include "rndis.h" #include "rf.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ static int msglevel = MSG_LEVEL_INFO; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - - /* * Description: * Set WPA algorithm & keys @@ -71,11 +61,11 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) { struct viawget_wpa_param *param = ctx; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - DWORD dwKeyIndex = 0; - BYTE abyKey[MAX_KEY_LEN]; - BYTE abySeq[MAX_KEY_LEN]; + u32 dwKeyIndex = 0; + u8 abyKey[MAX_KEY_LEN]; + u8 abySeq[MAX_KEY_LEN]; u64 KeyRSC; - BYTE byKeyDecMode = KEY_CTL_WEP; + u8 byKeyDecMode = KEY_CTL_WEP; int ret = 0; int uu; int ii; @@ -101,14 +91,14 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) memcpy(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len); - dwKeyIndex = (DWORD)(param->u.wpa_key.key_index); + dwKeyIndex = (u32)(param->u.wpa_key.key_index); if (param->u.wpa_key.alg_name == WPA_ALG_WEP) { if (dwKeyIndex > 3) { return -EINVAL; } else { if (param->u.wpa_key.set_tx) { - pDevice->byKeyIndex = (BYTE)dwKeyIndex; + pDevice->byKeyIndex = (u8)dwKeyIndex; pDevice->bTransmitKey = true; dwKeyIndex |= (1 << 31); } @@ -127,7 +117,6 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) return ret; } - if (param->u.wpa_key.seq && param->u.wpa_key.seq_len > sizeof(abySeq)) return -EINVAL; @@ -159,7 +148,6 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) if (param->u.wpa_key.set_tx) dwKeyIndex |= (1 << 31); - if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) byKeyDecMode = KEY_CTL_CCMP; else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) @@ -204,7 +192,7 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) if ((KeybSetAllGroupKey(pDevice, &(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, &KeyRSC, - (PBYTE)abyKey, + (u8 *)abyKey, byKeyDecMode ) == true) && (KeybSetDefaultKey(pDevice, @@ -212,7 +200,7 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) dwKeyIndex, param->u.wpa_key.key_len, &KeyRSC, - (PBYTE)abyKey, + (u8 *)abyKey, byKeyDecMode ) == true) ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n"); @@ -234,7 +222,7 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) } if (KeybSetKey(pDevice, &(pDevice->sKey), ¶m->addr[0], dwKeyIndex, param->u.wpa_key.key_len, - &KeyRSC, (PBYTE)abyKey, byKeyDecMode + &KeyRSC, (u8 *)abyKey, byKeyDecMode ) == true) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); } else { @@ -250,7 +238,7 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) } } // BSSID not 0xffffffffffff if ((ret == 0) && ((param->u.wpa_key.set_tx) != 0)) { - pDevice->byKeyIndex = (BYTE)param->u.wpa_key.key_index; + pDevice->byKeyIndex = (u8)param->u.wpa_key.key_index; pDevice->bTransmitKey = true; } pDevice->bEncryptionEnable = true; @@ -258,4 +246,3 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) return ret; } - diff --git a/drivers/staging/vt6656/wpactl.h b/drivers/staging/vt6656/wpactl.h index 2235ee97012e..e032a1b94ae8 100644 --- a/drivers/staging/vt6656/wpactl.h +++ b/drivers/staging/vt6656/wpactl.h @@ -32,9 +32,6 @@ #include "device.h" #include "iowpa.h" -/*--------------------- Export Definitions -------------------------*/ - - //WPA related typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg; @@ -43,15 +40,8 @@ typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg; #define AUTH_ALG_SHARED_KEY 0x02 #define AUTH_ALG_LEAP 0x04 - typedef unsigned long long NDIS_802_11_KEY_RSC; -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - int wpa_set_keys(struct vnt_private *, void *ctx); #endif /* __WPACL_H__ */ |