- Fix indentation (was mix of \t and 4-spaces). - Run scripts/cleanfile. - Fix "unnecessary whitespace before a quoted newline" checkpath warnings. Signed-off-by: Nicolas Thery <nthery@xxxxxxxxx> --- drivers/staging/vt6656/80211hdr.h | 50 +- drivers/staging/vt6656/80211mgr.c | 1004 ++--- drivers/staging/vt6656/80211mgr.h | 630 ++-- drivers/staging/vt6656/aes_ccmp.c | 2 +- drivers/staging/vt6656/baseband.c | 2851 ++++++++------- drivers/staging/vt6656/baseband.h | 12 +- drivers/staging/vt6656/bssdb.c | 2221 ++++++----- drivers/staging/vt6656/bssdb.h | 308 +- drivers/staging/vt6656/card.c | 800 ++-- drivers/staging/vt6656/card.h | 10 +- drivers/staging/vt6656/channel.c | 754 ++-- drivers/staging/vt6656/channel.h | 6 +- drivers/staging/vt6656/control.c | 8 +- drivers/staging/vt6656/control.h | 12 +- drivers/staging/vt6656/country.h | 238 +- drivers/staging/vt6656/datarate.c | 24 +- drivers/staging/vt6656/datarate.h | 20 +- drivers/staging/vt6656/desc.h | 8 +- drivers/staging/vt6656/device.h | 132 +- drivers/staging/vt6656/device_cfg.h | 8 +- drivers/staging/vt6656/dpc.c | 2085 ++++++----- drivers/staging/vt6656/dpc.h | 2 +- drivers/staging/vt6656/firmware.c | 40 +- drivers/staging/vt6656/hostap.c | 595 ++- drivers/staging/vt6656/int.c | 26 +- drivers/staging/vt6656/iocmd.h | 328 +- drivers/staging/vt6656/iowpa.h | 12 +- drivers/staging/vt6656/iwctl.c | 76 +- drivers/staging/vt6656/key.c | 962 ++--- drivers/staging/vt6656/key.h | 56 +- drivers/staging/vt6656/mac.c | 264 +- drivers/staging/vt6656/main_usb.c | 798 ++-- drivers/staging/vt6656/michael.c | 28 +- drivers/staging/vt6656/michael.h | 2 +- drivers/staging/vt6656/power.c | 47 +- drivers/staging/vt6656/power.h | 2 +- drivers/staging/vt6656/rc4.c | 2 +- drivers/staging/vt6656/rc4.h | 8 +- drivers/staging/vt6656/rf.c | 1212 +++--- drivers/staging/vt6656/rndis.h | 56 +- drivers/staging/vt6656/rxtx.c | 2831 +++++++------- drivers/staging/vt6656/rxtx.h | 2 +- drivers/staging/vt6656/srom.h | 56 +- drivers/staging/vt6656/tcrc.c | 141 +- drivers/staging/vt6656/tether.c | 1 - drivers/staging/vt6656/tether.h | 2 +- drivers/staging/vt6656/tkip.c | 248 +- drivers/staging/vt6656/tkip.h | 12 +- drivers/staging/vt6656/usbpipe.c | 218 +- drivers/staging/vt6656/usbpipe.h | 6 +- drivers/staging/vt6656/wcmd.c | 190 +- drivers/staging/vt6656/wcmd.h | 96 +- drivers/staging/vt6656/wctl.c | 223 +- drivers/staging/vt6656/wctl.h | 38 +- drivers/staging/vt6656/wmgr.c | 6913 +++++++++++++++++------------------ drivers/staging/vt6656/wmgr.h | 108 +- drivers/staging/vt6656/wpa.c | 345 +- drivers/staging/vt6656/wpa.h | 22 +- drivers/staging/vt6656/wpa2.c | 306 +- drivers/staging/vt6656/wpa2.h | 4 +- drivers/staging/vt6656/wpactl.c | 45 +- 61 files changed, 13747 insertions(+), 13759 deletions(-) diff --git a/drivers/staging/vt6656/80211hdr.h b/drivers/staging/vt6656/80211hdr.h index 1e778ba..75ba2bd 100644 --- a/drivers/staging/vt6656/80211hdr.h +++ b/drivers/staging/vt6656/80211hdr.h @@ -79,8 +79,8 @@ #define WLAN_RSN_MAXLEN 32 #define WLAN_DATA_MAXLEN 2312 #define WLAN_A3FR_MAXLEN (WLAN_HDR_ADDR3_LEN \ - + WLAN_DATA_MAXLEN \ - + WLAN_CRC_LEN) + + WLAN_DATA_MAXLEN \ + + WLAN_CRC_LEN) #define WLAN_BEACON_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0) @@ -154,7 +154,7 @@ #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) + & (BIT4|BIT5|BIT6|BIT7)) >> 4) #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) @@ -167,7 +167,7 @@ /* Sequence Field bit */ #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) + & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) /* Capability Field bit */ #define WLAN_GET_CAP_INFO_ESS(n) (((n) >> 8) & BIT0) @@ -273,51 +273,51 @@ #define IEEE_ADDR_GROUP 0x01 typedef struct { - u8 abyAddr[6]; + u8 abyAddr[6]; } IEEE_ADDR, *PIEEE_ADDR; /* 802.11 Header Format */ typedef struct tagWLAN_80211HDR_A2 { - u16 wFrameCtl; - u16 wDurationID; - u8 abyAddr1[WLAN_ADDR_LEN]; - u8 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 { - u16 wFrameCtl; - u16 wDurationID; - u8 abyAddr1[WLAN_ADDR_LEN]; - u8 abyAddr2[WLAN_ADDR_LEN]; - u8 abyAddr3[WLAN_ADDR_LEN]; - u16 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 { - 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]; + 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; typedef union tagUWLAN_80211HDR { - WLAN_80211HDR_A2 sA2; - WLAN_80211HDR_A3 sA3; - WLAN_80211HDR_A4 sA4; + WLAN_80211HDR_A2 sA2; + WLAN_80211HDR_A3 sA3; + WLAN_80211HDR_A4 sA4; } UWLAN_80211HDR, *PUWLAN_80211HDR; diff --git a/drivers/staging/vt6656/80211mgr.c b/drivers/staging/vt6656/80211mgr.c index 61edb51..cc655eb 100644 --- a/drivers/staging/vt6656/80211mgr.c +++ b/drivers/staging/vt6656/80211mgr.c @@ -67,27 +67,27 @@ static int msglevel = MSG_LEVEL_INFO; * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeBeacon( - PWLAN_FR_BEACON pFrame - ) + PWLAN_FR_BEACON pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ pFrame->pqwTimestamp = - (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + - WLAN_BEACON_OFF_TS); - pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_BEACON_OFF_BCN_INT); - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_BEACON_OFF_CAPINFO); + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_BEACON_OFF_TS); + pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_BEACON_OFF_BCN_INT); + 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; + pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID; - return; + return; } /*+ @@ -99,112 +99,112 @@ vMgrEncodeBeacon( * Return Value: * None. * --*/ + -*/ -void + void vMgrDecodeBeacon( - PWLAN_FR_BEACON pFrame - ) + PWLAN_FR_BEACON pFrame + ) { - PWLAN_IE pItem; + PWLAN_IE pItem; - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ pFrame->pqwTimestamp = - (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + - WLAN_BEACON_OFF_TS); - pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_BEACON_OFF_BCN_INT); - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_BEACON_OFF_CAPINFO); - - /* Information elements */ - pItem = (PWLAN_IE)((u8 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))) - + WLAN_BEACON_OFF_SSID); - while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { - - switch (pItem->byElementID) { - case WLAN_EID_SSID: - if (pFrame->pSSID == NULL) - pFrame->pSSID = (PWLAN_IE_SSID)pItem; - break; - case WLAN_EID_SUPP_RATES: - if (pFrame->pSuppRates == NULL) - pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; - case WLAN_EID_FH_PARMS: - /* pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem; */ - break; - case WLAN_EID_DS_PARMS: - if (pFrame->pDSParms == NULL) - pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem; - break; - case WLAN_EID_CF_PARMS: - if (pFrame->pCFParms == NULL) - pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem; - break; - case WLAN_EID_IBSS_PARMS: - if (pFrame->pIBSSParms == NULL) - pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem; - break; - case WLAN_EID_TIM: - if (pFrame->pTIM == NULL) - pFrame->pTIM = (PWLAN_IE_TIM)pItem; - break; - - case WLAN_EID_RSN: - if (pFrame->pRSN == NULL) - pFrame->pRSN = (PWLAN_IE_RSN)pItem; - break; - case WLAN_EID_RSN_WPA: - if (pFrame->pRSNWPA == NULL) { - if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) - pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; - } - break; - - case WLAN_EID_ERP: - if (pFrame->pERP == NULL) - pFrame->pERP = (PWLAN_IE_ERP)pItem; - break; - case WLAN_EID_EXTSUPP_RATES: - if (pFrame->pExtSuppRates == NULL) - pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; - - case WLAN_EID_COUNTRY: /* 7 */ - if (pFrame->pIE_Country == NULL) - pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem; - break; - - case WLAN_EID_PWR_CONSTRAINT: /* 32 */ - if (pFrame->pIE_PowerConstraint == NULL) - pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem; - break; - - case WLAN_EID_CH_SWITCH: /* 37 */ - if (pFrame->pIE_CHSW == NULL) - pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem; - break; - - case WLAN_EID_QUIET: /* 40 */ - if (pFrame->pIE_Quiet == NULL) - pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem; - break; - - case WLAN_EID_IBSS_DFS: - if (pFrame->pIE_IBSSDFS == NULL) - pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem; - break; - - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", pItem->byElementID); - break; - - } - pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); - } + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_BEACON_OFF_TS); + pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_BEACON_OFF_BCN_INT); + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_BEACON_OFF_CAPINFO); + + /* Information elements */ + pItem = (PWLAN_IE)((u8 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))) + + WLAN_BEACON_OFF_SSID); + while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { + + switch (pItem->byElementID) { + case WLAN_EID_SSID: + if (pFrame->pSSID == NULL) + pFrame->pSSID = (PWLAN_IE_SSID)pItem; + break; + case WLAN_EID_SUPP_RATES: + if (pFrame->pSuppRates == NULL) + pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; + case WLAN_EID_FH_PARMS: + /* pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem; */ + break; + case WLAN_EID_DS_PARMS: + if (pFrame->pDSParms == NULL) + pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem; + break; + case WLAN_EID_CF_PARMS: + if (pFrame->pCFParms == NULL) + pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem; + break; + case WLAN_EID_IBSS_PARMS: + if (pFrame->pIBSSParms == NULL) + pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem; + break; + case WLAN_EID_TIM: + if (pFrame->pTIM == NULL) + pFrame->pTIM = (PWLAN_IE_TIM)pItem; + break; + + case WLAN_EID_RSN: + if (pFrame->pRSN == NULL) + pFrame->pRSN = (PWLAN_IE_RSN)pItem; + break; + case WLAN_EID_RSN_WPA: + if (pFrame->pRSNWPA == NULL) { + if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) + pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; + } + break; + + case WLAN_EID_ERP: + if (pFrame->pERP == NULL) + pFrame->pERP = (PWLAN_IE_ERP)pItem; + break; + case WLAN_EID_EXTSUPP_RATES: + if (pFrame->pExtSuppRates == NULL) + pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; + + case WLAN_EID_COUNTRY: /* 7 */ + if (pFrame->pIE_Country == NULL) + pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem; + break; + + case WLAN_EID_PWR_CONSTRAINT: /* 32 */ + if (pFrame->pIE_PowerConstraint == NULL) + pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem; + break; + + case WLAN_EID_CH_SWITCH: /* 37 */ + if (pFrame->pIE_CHSW == NULL) + pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem; + break; + + case WLAN_EID_QUIET: /* 40 */ + if (pFrame->pIE_Quiet == NULL) + pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem; + break; + + case WLAN_EID_IBSS_DFS: + if (pFrame->pIE_IBSSDFS == NULL) + pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem; + break; + + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", pItem->byElementID); + break; + + } + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); + } } /*+ @@ -216,19 +216,19 @@ vMgrDecodeBeacon( * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeDisassociation( - PWLAN_FR_DISASSOC pFrame - ) + PWLAN_FR_DISASSOC pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - 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)); + /* Fixed Fields */ + 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)); } /*+ @@ -240,18 +240,18 @@ vMgrEncodeDisassociation( * Return Value: * None. * --*/ + -*/ -void + void vMgrDecodeDisassociation( - PWLAN_FR_DISASSOC pFrame - ) + PWLAN_FR_DISASSOC pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_DISASSOC_OFF_REASON); + /* Fixed Fields */ + pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_DISASSOC_OFF_REASON); } /*+ @@ -263,20 +263,20 @@ vMgrDecodeDisassociation( * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeAssocRequest( - PWLAN_FR_ASSOCREQ pFrame - ) + PWLAN_FR_ASSOCREQ pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_ASSOCREQ_OFF_CAP_INFO); - 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)); + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + /* Fixed Fields */ + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_ASSOCREQ_OFF_CAP_INFO); + 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)); } /*+ @@ -288,59 +288,59 @@ vMgrEncodeAssocRequest( * Return Value: * None. * --*/ + -*/ -void + void vMgrDecodeAssocRequest( - PWLAN_FR_ASSOCREQ pFrame - ) + PWLAN_FR_ASSOCREQ pFrame + ) { - PWLAN_IE pItem; - - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_ASSOCREQ_OFF_CAP_INFO); - 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 (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { - switch (pItem->byElementID) { - case WLAN_EID_SSID: - if (pFrame->pSSID == NULL) - pFrame->pSSID = (PWLAN_IE_SSID)pItem; - break; - case WLAN_EID_SUPP_RATES: - if (pFrame->pSuppRates == NULL) - pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; - - case WLAN_EID_RSN: - if (pFrame->pRSN == NULL) - pFrame->pRSN = (PWLAN_IE_RSN)pItem; - break; - case WLAN_EID_RSN_WPA: - if (pFrame->pRSNWPA == NULL) { - if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) - pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; - } - break; - case WLAN_EID_EXTSUPP_RATES: - if (pFrame->pExtSuppRates == NULL) - pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; - - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n", - pItem->byElementID); - break; - } - pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); - } + PWLAN_IE pItem; + + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + /* Fixed Fields */ + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_ASSOCREQ_OFF_CAP_INFO); + 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 (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { + switch (pItem->byElementID) { + case WLAN_EID_SSID: + if (pFrame->pSSID == NULL) + pFrame->pSSID = (PWLAN_IE_SSID)pItem; + break; + case WLAN_EID_SUPP_RATES: + if (pFrame->pSuppRates == NULL) + pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; + + case WLAN_EID_RSN: + if (pFrame->pRSN == NULL) + pFrame->pRSN = (PWLAN_IE_RSN)pItem; + break; + case WLAN_EID_RSN_WPA: + if (pFrame->pRSNWPA == NULL) { + if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) + pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; + } + break; + case WLAN_EID_EXTSUPP_RATES: + if (pFrame->pExtSuppRates == NULL) + pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; + + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n", + pItem->byElementID); + break; + } + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); + } } /*+ @@ -352,24 +352,24 @@ vMgrDecodeAssocRequest( * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeAssocResponse( - PWLAN_FR_ASSOCRESP pFrame - ) + PWLAN_FR_ASSOCRESP pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - - /* Fixed Fields */ - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_ASSOCRESP_OFF_CAP_INFO); - pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_ASSOCRESP_OFF_STATUS); - 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)); + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + + /* Fixed Fields */ + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_ASSOCRESP_OFF_CAP_INFO); + pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_ASSOCRESP_OFF_STATUS); + 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)); } /*+ @@ -381,37 +381,37 @@ vMgrEncodeAssocResponse( * Return Value: * None. * --*/ + -*/ -void + void vMgrDecodeAssocResponse( - PWLAN_FR_ASSOCRESP pFrame - ) + PWLAN_FR_ASSOCRESP pFrame + ) { - PWLAN_IE pItem; - - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - - /* Fixed Fields */ - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_ASSOCRESP_OFF_CAP_INFO); - pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_ASSOCRESP_OFF_STATUS); - pFrame->pwAid = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_ASSOCRESP_OFF_AID); + PWLAN_IE pItem; - /* Information elements */ - pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_ASSOCRESP_OFF_SUPP_RATES); + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - pItem = (PWLAN_IE)(pFrame->pSuppRates); - pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); - - 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); + /* Fixed Fields */ + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_ASSOCRESP_OFF_CAP_INFO); + pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_ASSOCRESP_OFF_STATUS); + pFrame->pwAid = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_ASSOCRESP_OFF_AID); + + /* Information elements */ + pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_ASSOCRESP_OFF_SUPP_RATES); + + pItem = (PWLAN_IE)(pFrame->pSuppRates); + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); + + 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; + pFrame->pExtSuppRates = NULL; } /*+ @@ -423,23 +423,23 @@ vMgrDecodeAssocResponse( * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeReassocRequest( - PWLAN_FR_REASSOCREQ pFrame - ) + PWLAN_FR_REASSOCREQ pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - - /* Fixed Fields */ - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCREQ_OFF_CAP_INFO); - 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)); + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + + /* Fixed Fields */ + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_REASSOCREQ_OFF_CAP_INFO); + 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)); } /*+ @@ -451,61 +451,61 @@ vMgrEncodeReassocRequest( * Return Value: * None. * --*/ + -*/ -void + void vMgrDecodeReassocRequest( - PWLAN_FR_REASSOCREQ pFrame - ) + PWLAN_FR_REASSOCREQ pFrame + ) { - PWLAN_IE pItem; - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - - /* Fixed Fields */ - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCREQ_OFF_CAP_INFO); - 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); - - /* Information elements */ - pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCREQ_OFF_SSID); - - while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { - - switch (pItem->byElementID) { - case WLAN_EID_SSID: - if (pFrame->pSSID == NULL) - pFrame->pSSID = (PWLAN_IE_SSID)pItem; - break; - case WLAN_EID_SUPP_RATES: - if (pFrame->pSuppRates == NULL) - pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; - - case WLAN_EID_RSN: - if (pFrame->pRSN == NULL) - pFrame->pRSN = (PWLAN_IE_RSN)pItem; - break; - case WLAN_EID_RSN_WPA: - if (pFrame->pRSNWPA == NULL) - if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) - pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; - break; - - case WLAN_EID_EXTSUPP_RATES: - if (pFrame->pExtSuppRates == NULL) - pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n", - pItem->byElementID); - break; - } - pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); - } + PWLAN_IE pItem; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + + /* Fixed Fields */ + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_REASSOCREQ_OFF_CAP_INFO); + 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); + + /* Information elements */ + pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_REASSOCREQ_OFF_SSID); + + while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { + + switch (pItem->byElementID) { + case WLAN_EID_SSID: + if (pFrame->pSSID == NULL) + pFrame->pSSID = (PWLAN_IE_SSID)pItem; + break; + case WLAN_EID_SUPP_RATES: + if (pFrame->pSuppRates == NULL) + pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; + + case WLAN_EID_RSN: + if (pFrame->pRSN == NULL) + pFrame->pRSN = (PWLAN_IE_RSN)pItem; + break; + case WLAN_EID_RSN_WPA: + if (pFrame->pRSNWPA == NULL) + if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) + pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; + break; + + case WLAN_EID_EXTSUPP_RATES: + if (pFrame->pExtSuppRates == NULL) + pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n", + pItem->byElementID); + break; + } + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); + } } /*+ @@ -517,15 +517,15 @@ vMgrDecodeReassocRequest( * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeProbeRequest( - PWLAN_FR_PROBEREQ pFrame - ) + PWLAN_FR_PROBEREQ pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - pFrame->len = WLAN_HDR_ADDR3_LEN; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + pFrame->len = WLAN_HDR_ADDR3_LEN; } /*+ @@ -537,45 +537,45 @@ vMgrEncodeProbeRequest( * Return Value: * None. * --*/ + -*/ -void + void vMgrDecodeProbeRequest( - PWLAN_FR_PROBEREQ pFrame - ) + PWLAN_FR_PROBEREQ pFrame + ) { - PWLAN_IE pItem; + PWLAN_IE pItem; - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Information elements */ - pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))); + /* Information elements */ + pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))); - while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { + while (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { - switch (pItem->byElementID) { - case WLAN_EID_SSID: - if (pFrame->pSSID == NULL) - pFrame->pSSID = (PWLAN_IE_SSID)pItem; - break; + switch (pItem->byElementID) { + case WLAN_EID_SSID: + if (pFrame->pSSID == NULL) + pFrame->pSSID = (PWLAN_IE_SSID)pItem; + break; - case WLAN_EID_SUPP_RATES: - if (pFrame->pSuppRates == NULL) - pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; + case WLAN_EID_SUPP_RATES: + if (pFrame->pSuppRates == NULL) + pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; - case WLAN_EID_EXTSUPP_RATES: - if (pFrame->pExtSuppRates == NULL) - pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; + case WLAN_EID_EXTSUPP_RATES: + if (pFrame->pExtSuppRates == NULL) + pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in probereq\n", pItem->byElementID); - break; - } + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in probereq\n", pItem->byElementID); + break; + } - pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); - } + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); + } } /*+ @@ -587,26 +587,26 @@ vMgrDecodeProbeRequest( * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeProbeResponse( - PWLAN_FR_PROBERESP pFrame - ) + PWLAN_FR_PROBERESP pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + 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 = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_PROBERESP_OFF_BCN_INT); - 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)); + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_PROBERESP_OFF_TS); + pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_PROBERESP_OFF_BCN_INT); + 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)); } /*+ @@ -618,106 +618,106 @@ vMgrEncodeProbeResponse( * Return Value: * None. * --*/ + -*/ -void + void vMgrDecodeProbeResponse( - PWLAN_FR_PROBERESP pFrame - ) + PWLAN_FR_PROBERESP pFrame + ) { - PWLAN_IE pItem; + PWLAN_IE pItem; - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + 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 = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_PROBERESP_OFF_BCN_INT); - 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 (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { - switch (pItem->byElementID) { - case WLAN_EID_SSID: - if (pFrame->pSSID == NULL) - pFrame->pSSID = (PWLAN_IE_SSID)pItem; - break; - case WLAN_EID_SUPP_RATES: - if (pFrame->pSuppRates == NULL) - pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; - case WLAN_EID_FH_PARMS: - break; - case WLAN_EID_DS_PARMS: - if (pFrame->pDSParms == NULL) - pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem; - break; - case WLAN_EID_CF_PARMS: - if (pFrame->pCFParms == NULL) - pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem; - break; - case WLAN_EID_IBSS_PARMS: - if (pFrame->pIBSSParms == NULL) - pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem; - break; - - case WLAN_EID_RSN: - if (pFrame->pRSN == NULL) - pFrame->pRSN = (PWLAN_IE_RSN)pItem; - break; - case WLAN_EID_RSN_WPA: - if (pFrame->pRSNWPA == NULL) { - if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) - pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; - } - break; - case WLAN_EID_ERP: - if (pFrame->pERP == NULL) - pFrame->pERP = (PWLAN_IE_ERP)pItem; - break; - case WLAN_EID_EXTSUPP_RATES: - if (pFrame->pExtSuppRates == NULL) - pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - break; - - case WLAN_EID_COUNTRY: /* 7 */ - if (pFrame->pIE_Country == NULL) - pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem; - break; - - case WLAN_EID_PWR_CONSTRAINT: /* 32 */ - if (pFrame->pIE_PowerConstraint == NULL) - pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem; - break; - - case WLAN_EID_CH_SWITCH: /* 37 */ - if (pFrame->pIE_CHSW == NULL) - pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem; - break; - - case WLAN_EID_QUIET: /* 40 */ - if (pFrame->pIE_Quiet == NULL) - pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem; - break; - - case WLAN_EID_IBSS_DFS: - if (pFrame->pIE_IBSSDFS == NULL) - pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem; - break; - - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in proberesp\n", pItem->byElementID); - break; - } - - pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); - } + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_PROBERESP_OFF_TS); + pFrame->pwBeaconInterval = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_PROBERESP_OFF_BCN_INT); + 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 (((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) { + switch (pItem->byElementID) { + case WLAN_EID_SSID: + if (pFrame->pSSID == NULL) + pFrame->pSSID = (PWLAN_IE_SSID)pItem; + break; + case WLAN_EID_SUPP_RATES: + if (pFrame->pSuppRates == NULL) + pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; + case WLAN_EID_FH_PARMS: + break; + case WLAN_EID_DS_PARMS: + if (pFrame->pDSParms == NULL) + pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem; + break; + case WLAN_EID_CF_PARMS: + if (pFrame->pCFParms == NULL) + pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem; + break; + case WLAN_EID_IBSS_PARMS: + if (pFrame->pIBSSParms == NULL) + pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem; + break; + + case WLAN_EID_RSN: + if (pFrame->pRSN == NULL) + pFrame->pRSN = (PWLAN_IE_RSN)pItem; + break; + case WLAN_EID_RSN_WPA: + if (pFrame->pRSNWPA == NULL) { + if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) + pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; + } + break; + case WLAN_EID_ERP: + if (pFrame->pERP == NULL) + pFrame->pERP = (PWLAN_IE_ERP)pItem; + break; + case WLAN_EID_EXTSUPP_RATES: + if (pFrame->pExtSuppRates == NULL) + pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; + break; + + case WLAN_EID_COUNTRY: /* 7 */ + if (pFrame->pIE_Country == NULL) + pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem; + break; + + case WLAN_EID_PWR_CONSTRAINT: /* 32 */ + if (pFrame->pIE_PowerConstraint == NULL) + pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem; + break; + + case WLAN_EID_CH_SWITCH: /* 37 */ + if (pFrame->pIE_CHSW == NULL) + pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem; + break; + + case WLAN_EID_QUIET: /* 40 */ + if (pFrame->pIE_Quiet == NULL) + pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem; + break; + + case WLAN_EID_IBSS_DFS: + if (pFrame->pIE_IBSSDFS == NULL) + pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem; + break; + + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in proberesp\n", pItem->byElementID); + break; + } + + pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); + } } /*+ @@ -729,23 +729,23 @@ vMgrDecodeProbeResponse( * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeAuthen( - PWLAN_FR_AUTHEN pFrame - ) + PWLAN_FR_AUTHEN pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - - /* Fixed Fields */ - pFrame->pwAuthAlgorithm = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_AUTHEN_OFF_AUTH_ALG); - pFrame->pwAuthSequence = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_AUTHEN_OFF_AUTH_SEQ); - 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)); + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + + /* Fixed Fields */ + pFrame->pwAuthAlgorithm = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_AUTHEN_OFF_AUTH_ALG); + pFrame->pwAuthSequence = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_AUTHEN_OFF_AUTH_SEQ); + 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)); } /*+ @@ -757,31 +757,31 @@ vMgrEncodeAuthen( * Return Value: * None. * --*/ + -*/ -void + void vMgrDecodeAuthen( - PWLAN_FR_AUTHEN pFrame - ) + PWLAN_FR_AUTHEN pFrame + ) { - PWLAN_IE pItem; - - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + PWLAN_IE pItem; - /* Fixed Fields */ - pFrame->pwAuthAlgorithm = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_AUTHEN_OFF_AUTH_ALG); - pFrame->pwAuthSequence = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_AUTHEN_OFF_AUTH_SEQ); - pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_AUTHEN_OFF_STATUS); + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Information elements */ - pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_AUTHEN_OFF_CHALLENGE); - - if ((((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE)) - pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem; + /* Fixed Fields */ + pFrame->pwAuthAlgorithm = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_AUTHEN_OFF_AUTH_ALG); + pFrame->pwAuthSequence = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_AUTHEN_OFF_AUTH_SEQ); + 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 ((((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE)) + pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem; } /*+ @@ -793,19 +793,19 @@ vMgrDecodeAuthen( * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeDeauthen( - PWLAN_FR_DEAUTHEN pFrame - ) + PWLAN_FR_DEAUTHEN pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - 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)); + /* Fixed Fields */ + 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)); } /*+ @@ -817,18 +817,18 @@ vMgrEncodeDeauthen( * Return Value: * None. * --*/ + -*/ -void + void vMgrDecodeDeauthen( - PWLAN_FR_DEAUTHEN pFrame - ) + PWLAN_FR_DEAUTHEN pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_DEAUTHEN_OFF_REASON); + /* Fixed Fields */ + pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_DEAUTHEN_OFF_REASON); } /*+ @@ -840,22 +840,22 @@ vMgrDecodeDeauthen( * Return Value: * None. * --*/ + -*/ -void + void vMgrEncodeReassocResponse( - PWLAN_FR_REASSOCRESP pFrame - ) + PWLAN_FR_REASSOCRESP pFrame + ) { - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - - /* Fixed Fields */ - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_CAP_INFO); - pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_STATUS); - pFrame->pwAid = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_AID); + pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid)); + /* Fixed Fields */ + pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_REASSOCRESP_OFF_CAP_INFO); + pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_REASSOCRESP_OFF_STATUS); + 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)); } diff --git a/drivers/staging/vt6656/80211mgr.h b/drivers/staging/vt6656/80211mgr.h index 39cde1a..668803e 100644 --- a/drivers/staging/vt6656/80211mgr.h +++ b/drivers/staging/vt6656/80211mgr.h @@ -214,99 +214,99 @@ #pragma pack(1) typedef struct tagWLAN_IE { - u8 byElementID; - u8 len; + u8 byElementID; + u8 len; } __attribute__ ((__packed__)) WLAN_IE, *PWLAN_IE; /* Service Set IDentity (SSID) */ #pragma pack(1) typedef struct tagWLAN_IE_SSID { - u8 byElementID; - u8 len; - u8 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 { - u8 byElementID; - u8 len; - u8 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 { - u8 byElementID; - u8 len; - u16 wDwellTime; - u8 byHopSet; - u8 byHopPattern; - u8 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 { - u8 byElementID; - u8 len; - u8 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 { - u8 byElementID; - u8 len; - u8 byCFPCount; - u8 byCFPPeriod; - u16 wCFPMaxDuration; - u16 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 { - u8 byElementID; - u8 len; - u8 byDTIMCount; - u8 byDTIMPeriod; - u8 byBitMapCtl; - u8 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 { - u8 byElementID; - u8 len; - u16 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 { - u8 byElementID; - u8 len; - u8 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 { - u8 byElementID; - u8 len; - u8 abyOUI[4]; - u16 wVersion; - u8 abyMulticast[4]; - u16 wPKCount; + u8 byElementID; + u8 len; + u8 abyOUI[4]; + u16 wVersion; + u8 abyMulticast[4]; + u16 wPKCount; struct { u8 abyOUI[4]; } PKSList[1]; @@ -315,170 +315,170 @@ typedef struct tagWLAN_IE_RSN_EXT { #pragma pack(1) typedef struct tagWLAN_IE_RSN_AUTH { - u16 wAuthCount; - struct { - u8 abyOUI[4]; - } AuthKSList[1]; + u16 wAuthCount; + struct { + u8 abyOUI[4]; + } AuthKSList[1]; } WLAN_IE_RSN_AUTH, *PWLAN_IE_RSN_AUTH; /* RSN Identity */ #pragma pack(1) typedef struct tagWLAN_IE_RSN { - u8 byElementID; - u8 len; - u16 wVersion; - u8 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 { -u8 byElementID; -u8 len; -u8 abyCCX[30]; + u8 byElementID; + u8 len; + u8 abyCCX[30]; } WLAN_IE_CCX, *PWLAN_IE_CCX; #pragma pack(1) typedef struct tagWLAN_IE_CCX_IP { -u8 byElementID; -u8 len; -u8 abyCCXOUI[4]; -u8 abyCCXIP[4]; -u8 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 { -u8 byElementID; -u8 len; -u8 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 { - u8 byElementID; - u8 len; - u8 byContext; + u8 byElementID; + u8 len; + u8 byContext; } __attribute__ ((__packed__)) WLAN_IE_ERP, *PWLAN_IE_ERP; #pragma pack(1) typedef struct _MEASEURE_REQ { - u8 byChannel; - u8 abyStartTime[8]; - u8 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; + MEASEURE_REQ_BASIC, *PMEASEURE_REQ_BASIC, + MEASEURE_REQ_CCA, *PMEASEURE_REQ_CCA, + MEASEURE_REQ_RPI, *PMEASEURE_REQ_RPI; typedef struct _MEASEURE_REP_BASIC { - u8 byChannel; - u8 abyStartTime[8]; - u8 abyDuration[2]; - u8 byMap; + u8 byChannel; + u8 abyStartTime[8]; + u8 abyDuration[2]; + u8 byMap; } MEASEURE_REP_BASIC, *PMEASEURE_REP_BASIC; typedef struct _MEASEURE_REP_CCA { - u8 byChannel; - u8 abyStartTime[8]; - u8 abyDuration[2]; - u8 byCCABusyFraction; + u8 byChannel; + u8 abyStartTime[8]; + u8 abyDuration[2]; + u8 byCCABusyFraction; } MEASEURE_REP_CCA, *PMEASEURE_REP_CCA; typedef struct _MEASEURE_REP_RPI { - u8 byChannel; - u8 abyStartTime[8]; - u8 abyDuration[2]; - u8 abyRPIdensity[8]; + u8 byChannel; + u8 abyStartTime[8]; + u8 abyDuration[2]; + u8 abyRPIdensity[8]; } MEASEURE_REP_RPI, *PMEASEURE_REP_RPI; typedef union _MEASEURE_REP { - MEASEURE_REP_BASIC sBasic; - MEASEURE_REP_CCA sCCA; - MEASEURE_REP_RPI sRPI; + MEASEURE_REP_BASIC sBasic; + MEASEURE_REP_CCA sCCA; + MEASEURE_REP_RPI sRPI; } MEASEURE_REP, *PMEASEURE_REP; typedef struct _WLAN_IE_MEASURE_REQ { - u8 byElementID; - u8 len; - u8 byToken; - u8 byMode; - u8 byType; - MEASEURE_REQ sReq; + 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 { - u8 byElementID; - u8 len; - u8 byToken; - u8 byMode; - u8 byType; - MEASEURE_REP sRep; + 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 { - u8 byElementID; - u8 len; - u8 byMode; - u8 byChannel; - u8 byCount; + u8 byElementID; + u8 len; + u8 byMode; + u8 byChannel; + u8 byCount; } WLAN_IE_CH_SW, *PWLAN_IE_CH_SW; typedef struct _WLAN_IE_QUIET { - u8 byElementID; - u8 len; - u8 byQuietCount; - u8 byQuietPeriod; - u8 abyQuietDuration[2]; - u8 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 { - u8 byElementID; - u8 len; - u8 abyCountryString[3]; - u8 abyCountryInfo[3]; + u8 byElementID; + u8 len; + u8 abyCountryString[3]; + u8 abyCountryInfo[3]; } WLAN_IE_COUNTRY, *PWLAN_IE_COUNTRY; typedef struct _WLAN_IE_PW_CONST { - u8 byElementID; - u8 len; - u8 byPower; + u8 byElementID; + u8 len; + u8 byPower; } WLAN_IE_PW_CONST, *PWLAN_IE_PW_CONST; typedef struct _WLAN_IE_PW_CAP { - u8 byElementID; - u8 len; - u8 byMinPower; - u8 byMaxPower; + u8 byElementID; + u8 len; + u8 byMinPower; + u8 byMaxPower; } WLAN_IE_PW_CAP, *PWLAN_IE_PW_CAP; typedef struct _WLAN_IE_SUPP_CH { - u8 byElementID; - u8 len; - u8 abyChannelTuple[2]; + u8 byElementID; + u8 len; + u8 abyChannelTuple[2]; } WLAN_IE_SUPP_CH, *PWLAN_IE_SUPP_CH; typedef struct _WLAN_IE_TPC_REQ { - u8 byElementID; - u8 len; + u8 byElementID; + u8 len; } WLAN_IE_TPC_REQ, *PWLAN_IE_TPC_REQ; typedef struct _WLAN_IE_TPC_REP { - u8 byElementID; - u8 len; - u8 byTxPower; - u8 byLinkMargin; + u8 byElementID; + u8 len; + u8 byTxPower; + u8 byLinkMargin; } WLAN_IE_TPC_REP, *PWLAN_IE_TPC_REP; typedef struct _WLAN_IE_IBSS_DFS { - u8 byElementID; - u8 len; - u8 abyDFSOwner[6]; - u8 byDFSRecovery; - u8 abyChannelMap[2]; + u8 byElementID; + u8 len; + u8 abyDFSOwner[6]; + u8 byDFSRecovery; + u8 abyChannelMap[2]; } WLAN_IE_IBSS_DFS, *PWLAN_IE_IBSS_DFS; #pragma pack() @@ -488,51 +488,51 @@ typedef struct _WLAN_IE_IBSS_DFS { /* prototype structure, all mgmt frame types will start with these members */ typedef struct tagWLAN_FR_MGMT { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; } WLAN_FR_MGMT, *PWLAN_FR_MGMT; /* beacon frame */ typedef struct tagWLAN_FR_BEACON { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; /* fixed fields */ u64 *pqwTimestamp; - u16 * pwBeaconInterval; - u16 * pwCapInfo; - /* info elements */ - PWLAN_IE_SSID pSSID; - PWLAN_IE_SUPP_RATES pSuppRates; -/* PWLAN_IE_FH_PARMS pFHParms; */ - PWLAN_IE_DS_PARMS pDSParms; - PWLAN_IE_CF_PARMS pCFParms; - PWLAN_IE_TIM pTIM; - PWLAN_IE_IBSS_PARMS pIBSSParms; - PWLAN_IE_RSN pRSN; - PWLAN_IE_RSN_EXT pRSNWPA; - PWLAN_IE_ERP pERP; - PWLAN_IE_SUPP_RATES pExtSuppRates; - PWLAN_IE_COUNTRY pIE_Country; - PWLAN_IE_PW_CONST pIE_PowerConstraint; - PWLAN_IE_CH_SW pIE_CHSW; - PWLAN_IE_IBSS_DFS pIE_IBSSDFS; - PWLAN_IE_QUIET pIE_Quiet; + u16 * pwBeaconInterval; + u16 * pwCapInfo; + /* info elements */ + PWLAN_IE_SSID pSSID; + PWLAN_IE_SUPP_RATES pSuppRates; + /* PWLAN_IE_FH_PARMS pFHParms; */ + PWLAN_IE_DS_PARMS pDSParms; + PWLAN_IE_CF_PARMS pCFParms; + PWLAN_IE_TIM pTIM; + PWLAN_IE_IBSS_PARMS pIBSSParms; + PWLAN_IE_RSN pRSN; + PWLAN_IE_RSN_EXT pRSNWPA; + PWLAN_IE_ERP pERP; + PWLAN_IE_SUPP_RATES pExtSuppRates; + PWLAN_IE_COUNTRY pIE_Country; + PWLAN_IE_PW_CONST pIE_PowerConstraint; + PWLAN_IE_CH_SW pIE_CHSW; + PWLAN_IE_IBSS_DFS pIE_IBSSDFS; + PWLAN_IE_QUIET pIE_Quiet; } WLAN_FR_BEACON, *PWLAN_FR_BEACON; /* IBSS ATIM frame */ typedef struct tagWLAN_FR_IBSSATIM { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; /* fixed fields */ /* info elements */ @@ -543,266 +543,266 @@ typedef struct tagWLAN_FR_IBSSATIM { /* disassociation */ typedef struct tagWLAN_FR_DISASSOC { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; - /* fixed fields */ - u16 * pwReason; - /* info elements */ + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; + /* fixed fields */ + u16 * pwReason; + /* info elements */ } WLAN_FR_DISASSOC, *PWLAN_FR_DISASSOC; /* association request */ typedef struct tagWLAN_FR_ASSOCREQ { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; - /* fixed fields */ - u16 * pwCapInfo; - u16 * pwListenInterval; - /* info elements */ - PWLAN_IE_SSID pSSID; - PWLAN_IE_SUPP_RATES pSuppRates; - PWLAN_IE_RSN pRSN; - PWLAN_IE_CCX pCCX; - PWLAN_IE_CCX_IP pCCXIP; - PWLAN_IE_CCX_Ver pCCXVER; - PWLAN_IE_RSN_EXT pRSNWPA; - PWLAN_IE_SUPP_RATES pExtSuppRates; - PWLAN_IE_PW_CAP pCurrPowerCap; - PWLAN_IE_SUPP_CH pCurrSuppCh; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; + /* fixed fields */ + u16 * pwCapInfo; + u16 * pwListenInterval; + /* info elements */ + PWLAN_IE_SSID pSSID; + PWLAN_IE_SUPP_RATES pSuppRates; + PWLAN_IE_RSN pRSN; + PWLAN_IE_CCX pCCX; + PWLAN_IE_CCX_IP pCCXIP; + PWLAN_IE_CCX_Ver pCCXVER; + PWLAN_IE_RSN_EXT pRSNWPA; + PWLAN_IE_SUPP_RATES pExtSuppRates; + PWLAN_IE_PW_CAP pCurrPowerCap; + PWLAN_IE_SUPP_CH pCurrSuppCh; } WLAN_FR_ASSOCREQ, *PWLAN_FR_ASSOCREQ; /* association response */ typedef struct tagWLAN_FR_ASSOCRESP { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; - /* fixed fields */ - u16 * pwCapInfo; - u16 * pwStatus; - u16 * pwAid; - /* info elements */ - PWLAN_IE_SUPP_RATES pSuppRates; - PWLAN_IE_SUPP_RATES pExtSuppRates; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; + /* fixed fields */ + u16 * pwCapInfo; + u16 * pwStatus; + u16 * pwAid; + /* info elements */ + PWLAN_IE_SUPP_RATES pSuppRates; + PWLAN_IE_SUPP_RATES pExtSuppRates; } WLAN_FR_ASSOCRESP, *PWLAN_FR_ASSOCRESP; /* reassociation request */ typedef struct tagWLAN_FR_REASSOCREQ { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; - - /* fixed fields */ - u16 * pwCapInfo; - u16 * pwListenInterval; - PIEEE_ADDR pAddrCurrAP; - - /* info elements */ - PWLAN_IE_SSID pSSID; - PWLAN_IE_SUPP_RATES pSuppRates; - PWLAN_IE_RSN pRSN; - PWLAN_IE_CCX pCCX; - PWLAN_IE_CCX_IP pCCXIP; - PWLAN_IE_CCX_Ver pCCXVER; - PWLAN_IE_RSN_EXT pRSNWPA; - PWLAN_IE_SUPP_RATES pExtSuppRates; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; + + /* fixed fields */ + u16 * pwCapInfo; + u16 * pwListenInterval; + PIEEE_ADDR pAddrCurrAP; + + /* info elements */ + PWLAN_IE_SSID pSSID; + PWLAN_IE_SUPP_RATES pSuppRates; + PWLAN_IE_RSN pRSN; + PWLAN_IE_CCX pCCX; + PWLAN_IE_CCX_IP pCCXIP; + PWLAN_IE_CCX_Ver pCCXVER; + PWLAN_IE_RSN_EXT pRSNWPA; + PWLAN_IE_SUPP_RATES pExtSuppRates; } WLAN_FR_REASSOCREQ, *PWLAN_FR_REASSOCREQ; /* reassociation response */ typedef struct tagWLAN_FR_REASSOCRESP { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; - /* fixed fields */ - u16 * pwCapInfo; - u16 * pwStatus; - u16 * pwAid; - /* info elements */ - PWLAN_IE_SUPP_RATES pSuppRates; - PWLAN_IE_SUPP_RATES pExtSuppRates; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; + /* fixed fields */ + u16 * pwCapInfo; + u16 * pwStatus; + u16 * pwAid; + /* info elements */ + PWLAN_IE_SUPP_RATES pSuppRates; + PWLAN_IE_SUPP_RATES pExtSuppRates; } WLAN_FR_REASSOCRESP, *PWLAN_FR_REASSOCRESP; /* probe request */ typedef struct tagWLAN_FR_PROBEREQ { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; - /* fixed fields */ - /* info elements */ - PWLAN_IE_SSID pSSID; - PWLAN_IE_SUPP_RATES pSuppRates; - PWLAN_IE_SUPP_RATES pExtSuppRates; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; + /* fixed fields */ + /* info elements */ + PWLAN_IE_SSID pSSID; + PWLAN_IE_SUPP_RATES pSuppRates; + PWLAN_IE_SUPP_RATES pExtSuppRates; } WLAN_FR_PROBEREQ, *PWLAN_FR_PROBEREQ; /* probe response */ typedef struct tagWLAN_FR_PROBERESP { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; - /* fixed fields */ + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; + /* fixed fields */ u64 *pqwTimestamp; - u16 * pwBeaconInterval; - u16 * pwCapInfo; - /* info elements */ - PWLAN_IE_SSID pSSID; - PWLAN_IE_SUPP_RATES pSuppRates; - PWLAN_IE_DS_PARMS pDSParms; - PWLAN_IE_CF_PARMS pCFParms; - PWLAN_IE_IBSS_PARMS pIBSSParms; - PWLAN_IE_RSN pRSN; - PWLAN_IE_RSN_EXT pRSNWPA; - PWLAN_IE_ERP pERP; - PWLAN_IE_SUPP_RATES pExtSuppRates; - PWLAN_IE_COUNTRY pIE_Country; - PWLAN_IE_PW_CONST pIE_PowerConstraint; - PWLAN_IE_CH_SW pIE_CHSW; - PWLAN_IE_IBSS_DFS pIE_IBSSDFS; - PWLAN_IE_QUIET pIE_Quiet; + u16 * pwBeaconInterval; + u16 * pwCapInfo; + /* info elements */ + PWLAN_IE_SSID pSSID; + PWLAN_IE_SUPP_RATES pSuppRates; + PWLAN_IE_DS_PARMS pDSParms; + PWLAN_IE_CF_PARMS pCFParms; + PWLAN_IE_IBSS_PARMS pIBSSParms; + PWLAN_IE_RSN pRSN; + PWLAN_IE_RSN_EXT pRSNWPA; + PWLAN_IE_ERP pERP; + PWLAN_IE_SUPP_RATES pExtSuppRates; + PWLAN_IE_COUNTRY pIE_Country; + PWLAN_IE_PW_CONST pIE_PowerConstraint; + PWLAN_IE_CH_SW pIE_CHSW; + PWLAN_IE_IBSS_DFS pIE_IBSSDFS; + PWLAN_IE_QUIET pIE_Quiet; } WLAN_FR_PROBERESP, *PWLAN_FR_PROBERESP; /* authentication */ typedef struct tagWLAN_FR_AUTHEN { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; - /* fixed fields */ - u16 * pwAuthAlgorithm; - u16 * pwAuthSequence; - u16 * pwStatus; - /* info elements */ - PWLAN_IE_CHALLENGE pChallenge; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; + /* fixed fields */ + u16 * pwAuthAlgorithm; + u16 * pwAuthSequence; + u16 * pwStatus; + /* info elements */ + PWLAN_IE_CHALLENGE pChallenge; } WLAN_FR_AUTHEN, *PWLAN_FR_AUTHEN; /* deauthentication */ typedef struct tagWLAN_FR_DEAUTHEN { - unsigned int uType; - unsigned int len; - u8 * pBuf; - PUWLAN_80211HDR pHdr; - /* fixed fields */ - u16 * pwReason; + unsigned int uType; + unsigned int len; + u8 * pBuf; + PUWLAN_80211HDR pHdr; + /* fixed fields */ + u16 * pwReason; - /* info elements */ + /* info elements */ } WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN; void vMgrEncodeBeacon( - PWLAN_FR_BEACON pFrame - ); + PWLAN_FR_BEACON pFrame + ); void vMgrDecodeBeacon( - PWLAN_FR_BEACON pFrame - ); + PWLAN_FR_BEACON pFrame + ); void vMgrEncodeDisassociation( - PWLAN_FR_DISASSOC pFrame - ); + PWLAN_FR_DISASSOC pFrame + ); void vMgrDecodeDisassociation( - PWLAN_FR_DISASSOC pFrame - ); + PWLAN_FR_DISASSOC pFrame + ); void vMgrEncodeAssocRequest( - PWLAN_FR_ASSOCREQ pFrame - ); + PWLAN_FR_ASSOCREQ pFrame + ); void vMgrDecodeAssocRequest( - PWLAN_FR_ASSOCREQ pFrame - ); + PWLAN_FR_ASSOCREQ pFrame + ); void vMgrEncodeAssocResponse( - PWLAN_FR_ASSOCRESP pFrame - ); + PWLAN_FR_ASSOCRESP pFrame + ); void vMgrDecodeAssocResponse( - PWLAN_FR_ASSOCRESP pFrame - ); + PWLAN_FR_ASSOCRESP pFrame + ); void vMgrEncodeReassocRequest( - PWLAN_FR_REASSOCREQ pFrame - ); + PWLAN_FR_REASSOCREQ pFrame + ); void vMgrDecodeReassocRequest( - PWLAN_FR_REASSOCREQ pFrame - ); + PWLAN_FR_REASSOCREQ pFrame + ); void vMgrEncodeProbeRequest( - PWLAN_FR_PROBEREQ pFrame - ); + PWLAN_FR_PROBEREQ pFrame + ); void vMgrDecodeProbeRequest( - PWLAN_FR_PROBEREQ pFrame - ); + PWLAN_FR_PROBEREQ pFrame + ); void vMgrEncodeProbeResponse( - PWLAN_FR_PROBERESP pFrame - ); + PWLAN_FR_PROBERESP pFrame + ); void vMgrDecodeProbeResponse( - PWLAN_FR_PROBERESP pFrame - ); + PWLAN_FR_PROBERESP pFrame + ); void vMgrEncodeAuthen( - PWLAN_FR_AUTHEN pFrame - ); + PWLAN_FR_AUTHEN pFrame + ); void vMgrDecodeAuthen( - PWLAN_FR_AUTHEN pFrame - ); + PWLAN_FR_AUTHEN pFrame + ); void vMgrEncodeDeauthen( - PWLAN_FR_DEAUTHEN pFrame - ); + PWLAN_FR_DEAUTHEN pFrame + ); void vMgrDecodeDeauthen( - PWLAN_FR_DEAUTHEN pFrame - ); + PWLAN_FR_DEAUTHEN pFrame + ); void vMgrEncodeReassocResponse( - PWLAN_FR_REASSOCRESP pFrame - ); + PWLAN_FR_REASSOCRESP pFrame + ); #endif /* __80211MGR_H__ */ diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c index e2bfa8d..05432a6 100644 --- a/drivers/staging/vt6656/aes_ccmp.c +++ b/drivers/staging/vt6656/aes_ccmp.c @@ -243,7 +243,7 @@ bool AESbGenCCMP(u8 *pbyRxKey, u8 *pbyFrame, u16 wFrameSize) pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; if (WLAN_GET_FC_TODS(*(u16 *) pbyFrame) && - WLAN_GET_FC_FROMDS(*(u16 *) pbyFrame)) { + WLAN_GET_FC_FROMDS(*(u16 *) pbyFrame)) { bA4 = true; pbyIV += 6; /* 6 is 802.11 address4 */ wHLen += 6; diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 3d4610e..c5048a2 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -49,607 +49,607 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; static u8 abyVT3184_AGC[] = { - 0x00, //0 - 0x00, //1 - 0x02, //2 - 0x02, //3 //RobertYu:20060505, 0x04, //3 - 0x04, //4 - 0x04, //5 //RobertYu:20060505, 0x06, //5 - 0x06, //6 - 0x06, //7 - 0x08, //8 - 0x08, //9 - 0x0A, //A - 0x0A, //B - 0x0C, //C - 0x0C, //D - 0x0E, //E - 0x0E, //F - 0x10, //10 - 0x10, //11 - 0x12, //12 - 0x12, //13 - 0x14, //14 - 0x14, //15 - 0x16, //16 - 0x16, //17 - 0x18, //18 - 0x18, //19 - 0x1A, //1A - 0x1A, //1B - 0x1C, //1C - 0x1C, //1D - 0x1E, //1E - 0x1E, //1F - 0x20, //20 - 0x20, //21 - 0x22, //22 - 0x22, //23 - 0x24, //24 - 0x24, //25 - 0x26, //26 - 0x26, //27 - 0x28, //28 - 0x28, //29 - 0x2A, //2A - 0x2A, //2B - 0x2C, //2C - 0x2C, //2D - 0x2E, //2E - 0x2E, //2F - 0x30, //30 - 0x30, //31 - 0x32, //32 - 0x32, //33 - 0x34, //34 - 0x34, //35 - 0x36, //36 - 0x36, //37 - 0x38, //38 - 0x38, //39 - 0x3A, //3A - 0x3A, //3B - 0x3C, //3C - 0x3C, //3D - 0x3E, //3E - 0x3E //3F + 0x00, //0 + 0x00, //1 + 0x02, //2 + 0x02, //3 //RobertYu:20060505, 0x04, //3 + 0x04, //4 + 0x04, //5 //RobertYu:20060505, 0x06, //5 + 0x06, //6 + 0x06, //7 + 0x08, //8 + 0x08, //9 + 0x0A, //A + 0x0A, //B + 0x0C, //C + 0x0C, //D + 0x0E, //E + 0x0E, //F + 0x10, //10 + 0x10, //11 + 0x12, //12 + 0x12, //13 + 0x14, //14 + 0x14, //15 + 0x16, //16 + 0x16, //17 + 0x18, //18 + 0x18, //19 + 0x1A, //1A + 0x1A, //1B + 0x1C, //1C + 0x1C, //1D + 0x1E, //1E + 0x1E, //1F + 0x20, //20 + 0x20, //21 + 0x22, //22 + 0x22, //23 + 0x24, //24 + 0x24, //25 + 0x26, //26 + 0x26, //27 + 0x28, //28 + 0x28, //29 + 0x2A, //2A + 0x2A, //2B + 0x2C, //2C + 0x2C, //2D + 0x2E, //2E + 0x2E, //2F + 0x30, //30 + 0x30, //31 + 0x32, //32 + 0x32, //33 + 0x34, //34 + 0x34, //35 + 0x36, //36 + 0x36, //37 + 0x38, //38 + 0x38, //39 + 0x3A, //3A + 0x3A, //3B + 0x3C, //3C + 0x3C, //3D + 0x3E, //3E + 0x3E //3F }; static u8 abyVT3184_AL2230[] = { - 0x31,//00 - 0x00, - 0x00, - 0x00, - 0x00, - 0x80, - 0x00, - 0x00, - 0x70, - 0x45,//tx //0x64 for FPGA - 0x2A, - 0x76, - 0x00, - 0x00, - 0x80, - 0x00, - 0x00,//10 - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x8e, //RobertYu:20060522, //0x8d, - 0x0a, //RobertYu:20060515, //0x09, - 0x00, - 0x00, - 0x00, - 0x00,//20 - 0x00, - 0x00, - 0x00, - 0x00, - 0x4a, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x4a, - 0x00, - 0x0c, //RobertYu:20060522, //0x10, - 0x26,//30 - 0x5b, - 0x00, - 0x00, - 0x00, - 0x00, - 0xaa, - 0xaa, - 0xff, - 0xff, - 0x79, - 0x00, - 0x00, - 0x0b, - 0x48, - 0x04, - 0x00,//40 - 0x08, - 0x00, - 0x08, - 0x08, - 0x14, - 0x05, - 0x09, - 0x00, - 0x00, - 0x00, - 0x00, - 0x09, - 0x73, - 0x00, - 0xc5, - 0x00,//50 //RobertYu:20060505, //0x15,//50 - 0x19, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xd0, //RobertYu:20060505, //0xb0, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xe4,//60 - 0x80, - 0x00, - 0x00, - 0x00, - 0x00, - 0x98, - 0x0a, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, //0x80 for FPGA - 0x03, - 0x01, - 0x00, - 0x00,//70 - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x8c,//80 - 0x01, - 0x09, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x08, - 0x00, - 0x1f, //RobertYu:20060516, //0x0f, - 0xb7, - 0x88, - 0x47, - 0xaa, - 0x00, //RobertYu:20060505, //0x02, - 0x20,//90 //RobertYu:20060505, //0x22,//90 - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xeb, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x01, - 0x00,//a0 - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x10, - 0x00, - 0x18, - 0x00, - 0x00, - 0x00, - 0x00, - 0x15, //RobertYu:20060516, //0x00, - 0x00, - 0x18, - 0x38,//b0 - 0x30, - 0x00, - 0x00, - 0xff, - 0x0f, - 0xe4, - 0xe2, - 0x00, - 0x00, - 0x00, - 0x03, - 0x01, - 0x00, - 0x00, - 0x00, - 0x18,//c0 - 0x20, - 0x07, - 0x18, - 0xff, - 0xff, //RobertYu:20060509, //0x2c, - 0x0e, //RobertYu:20060530, //0x0c, - 0x0a, - 0x0e, - 0x00, //RobertYu:20060505, //0x01, - 0x82, //RobertYu:20060516, //0x8f, - 0xa7, - 0x3c, - 0x10, - 0x30, //RobertYu:20060627, //0x0b, - 0x05, //RobertYu:20060516, //0x25, - 0x40,//d0 - 0x12, - 0x00, - 0x00, - 0x10, - 0x28, - 0x80, - 0x2A, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00,//e0 - 0xf3, //RobertYu:20060516, //0xd3, - 0x00, - 0x00, - 0x00, - 0x10, - 0x00, - 0x12, //RobertYu:20060627, //0x10, - 0x00, - 0xf4, - 0x00, - 0xff, - 0x79, - 0x20, - 0x30, - 0x05, //RobertYu:20060516, //0x0c, - 0x00,//f0 - 0x3e, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 + 0x31,//00 + 0x00, + 0x00, + 0x00, + 0x00, + 0x80, + 0x00, + 0x00, + 0x70, + 0x45,//tx //0x64 for FPGA + 0x2A, + 0x76, + 0x00, + 0x00, + 0x80, + 0x00, + 0x00,//10 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x8e, //RobertYu:20060522, //0x8d, + 0x0a, //RobertYu:20060515, //0x09, + 0x00, + 0x00, + 0x00, + 0x00,//20 + 0x00, + 0x00, + 0x00, + 0x00, + 0x4a, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x4a, + 0x00, + 0x0c, //RobertYu:20060522, //0x10, + 0x26,//30 + 0x5b, + 0x00, + 0x00, + 0x00, + 0x00, + 0xaa, + 0xaa, + 0xff, + 0xff, + 0x79, + 0x00, + 0x00, + 0x0b, + 0x48, + 0x04, + 0x00,//40 + 0x08, + 0x00, + 0x08, + 0x08, + 0x14, + 0x05, + 0x09, + 0x00, + 0x00, + 0x00, + 0x00, + 0x09, + 0x73, + 0x00, + 0xc5, + 0x00,//50 //RobertYu:20060505, //0x15,//50 + 0x19, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xd0, //RobertYu:20060505, //0xb0, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xe4,//60 + 0x80, + 0x00, + 0x00, + 0x00, + 0x00, + 0x98, + 0x0a, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, //0x80 for FPGA + 0x03, + 0x01, + 0x00, + 0x00,//70 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x8c,//80 + 0x01, + 0x09, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x08, + 0x00, + 0x1f, //RobertYu:20060516, //0x0f, + 0xb7, + 0x88, + 0x47, + 0xaa, + 0x00, //RobertYu:20060505, //0x02, + 0x20,//90 //RobertYu:20060505, //0x22,//90 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xeb, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x00,//a0 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x10, + 0x00, + 0x18, + 0x00, + 0x00, + 0x00, + 0x00, + 0x15, //RobertYu:20060516, //0x00, + 0x00, + 0x18, + 0x38,//b0 + 0x30, + 0x00, + 0x00, + 0xff, + 0x0f, + 0xe4, + 0xe2, + 0x00, + 0x00, + 0x00, + 0x03, + 0x01, + 0x00, + 0x00, + 0x00, + 0x18,//c0 + 0x20, + 0x07, + 0x18, + 0xff, + 0xff, //RobertYu:20060509, //0x2c, + 0x0e, //RobertYu:20060530, //0x0c, + 0x0a, + 0x0e, + 0x00, //RobertYu:20060505, //0x01, + 0x82, //RobertYu:20060516, //0x8f, + 0xa7, + 0x3c, + 0x10, + 0x30, //RobertYu:20060627, //0x0b, + 0x05, //RobertYu:20060516, //0x25, + 0x40,//d0 + 0x12, + 0x00, + 0x00, + 0x10, + 0x28, + 0x80, + 0x2A, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00,//e0 + 0xf3, //RobertYu:20060516, //0xd3, + 0x00, + 0x00, + 0x00, + 0x10, + 0x00, + 0x12, //RobertYu:20060627, //0x10, + 0x00, + 0xf4, + 0x00, + 0xff, + 0x79, + 0x20, + 0x30, + 0x05, //RobertYu:20060516, //0x0c, + 0x00,//f0 + 0x3e, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 }; //{{RobertYu:20060515, new BB setting for VT3226D0 static u8 abyVT3184_VT3226D0[] = { - 0x31,//00 - 0x00, - 0x00, - 0x00, - 0x00, - 0x80, - 0x00, - 0x00, - 0x70, - 0x45,//tx //0x64 for FPGA - 0x2A, - 0x76, - 0x00, - 0x00, - 0x80, - 0x00, - 0x00,//10 - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x8e, //RobertYu:20060525, //0x8d, - 0x0a, //RobertYu:20060515, //0x09, - 0x00, - 0x00, - 0x00, - 0x00,//20 - 0x00, - 0x00, - 0x00, - 0x00, - 0x4a, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x4a, - 0x00, - 0x0c, //RobertYu:20060525, //0x10, - 0x26,//30 - 0x5b, - 0x00, - 0x00, - 0x00, - 0x00, - 0xaa, - 0xaa, - 0xff, - 0xff, - 0x79, - 0x00, - 0x00, - 0x0b, - 0x48, - 0x04, - 0x00,//40 - 0x08, - 0x00, - 0x08, - 0x08, - 0x14, - 0x05, - 0x09, - 0x00, - 0x00, - 0x00, - 0x00, - 0x09, - 0x73, - 0x00, - 0xc5, - 0x00,//50 //RobertYu:20060505, //0x15,//50 - 0x19, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xd0, //RobertYu:20060505, //0xb0, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xe4,//60 - 0x80, - 0x00, - 0x00, - 0x00, - 0x00, - 0x98, - 0x0a, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, //0x80 for FPGA - 0x03, - 0x01, - 0x00, - 0x00,//70 - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x8c,//80 - 0x01, - 0x09, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x08, - 0x00, - 0x1f, //RobertYu:20060515, //0x0f, - 0xb7, - 0x88, - 0x47, - 0xaa, - 0x00, //RobertYu:20060505, //0x02, - 0x20,//90 //RobertYu:20060505, //0x22,//90 - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xeb, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x01, - 0x00,//a0 - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x10, - 0x00, - 0x18, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x18, - 0x38,//b0 - 0x30, - 0x00, - 0x00, - 0xff, - 0x0f, - 0xe4, - 0xe2, - 0x00, - 0x00, - 0x00, - 0x03, - 0x01, - 0x00, - 0x00, - 0x00, - 0x18,//c0 - 0x20, - 0x07, - 0x18, - 0xff, - 0xff, //RobertYu:20060509, //0x2c, - 0x10, //RobertYu:20060525, //0x0c, - 0x0a, - 0x0e, - 0x00, //RobertYu:20060505, //0x01, - 0x84, //RobertYu:20060525, //0x8f, - 0xa7, - 0x3c, - 0x10, - 0x24, //RobertYu:20060627, //0x18, - 0x05, //RobertYu:20060515, //0x25, - 0x40,//d0 - 0x12, - 0x00, - 0x00, - 0x10, - 0x28, - 0x80, - 0x2A, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00,//e0 - 0xf3, //RobertYu:20060515, //0xd3, - 0x00, - 0x00, - 0x00, - 0x10, - 0x00, - 0x10, //RobertYu:20060627, //0x0e, - 0x00, - 0xf4, - 0x00, - 0xff, - 0x79, - 0x20, - 0x30, - 0x08, //RobertYu:20060515, //0x0c, - 0x00,//f0 - 0x3e, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, + 0x31,//00 + 0x00, + 0x00, + 0x00, + 0x00, + 0x80, + 0x00, + 0x00, + 0x70, + 0x45,//tx //0x64 for FPGA + 0x2A, + 0x76, + 0x00, + 0x00, + 0x80, + 0x00, + 0x00,//10 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x8e, //RobertYu:20060525, //0x8d, + 0x0a, //RobertYu:20060515, //0x09, + 0x00, + 0x00, + 0x00, + 0x00,//20 + 0x00, + 0x00, + 0x00, + 0x00, + 0x4a, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x4a, + 0x00, + 0x0c, //RobertYu:20060525, //0x10, + 0x26,//30 + 0x5b, + 0x00, + 0x00, + 0x00, + 0x00, + 0xaa, + 0xaa, + 0xff, + 0xff, + 0x79, + 0x00, + 0x00, + 0x0b, + 0x48, + 0x04, + 0x00,//40 + 0x08, + 0x00, + 0x08, + 0x08, + 0x14, + 0x05, + 0x09, + 0x00, + 0x00, + 0x00, + 0x00, + 0x09, + 0x73, + 0x00, + 0xc5, + 0x00,//50 //RobertYu:20060505, //0x15,//50 + 0x19, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xd0, //RobertYu:20060505, //0xb0, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xe4,//60 + 0x80, + 0x00, + 0x00, + 0x00, + 0x00, + 0x98, + 0x0a, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, //0x80 for FPGA + 0x03, + 0x01, + 0x00, + 0x00,//70 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x8c,//80 + 0x01, + 0x09, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x08, + 0x00, + 0x1f, //RobertYu:20060515, //0x0f, + 0xb7, + 0x88, + 0x47, + 0xaa, + 0x00, //RobertYu:20060505, //0x02, + 0x20,//90 //RobertYu:20060505, //0x22,//90 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xeb, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x00,//a0 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x10, + 0x00, + 0x18, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x18, + 0x38,//b0 + 0x30, + 0x00, + 0x00, + 0xff, + 0x0f, + 0xe4, + 0xe2, + 0x00, + 0x00, + 0x00, + 0x03, + 0x01, + 0x00, + 0x00, + 0x00, + 0x18,//c0 + 0x20, + 0x07, + 0x18, + 0xff, + 0xff, //RobertYu:20060509, //0x2c, + 0x10, //RobertYu:20060525, //0x0c, + 0x0a, + 0x0e, + 0x00, //RobertYu:20060505, //0x01, + 0x84, //RobertYu:20060525, //0x8f, + 0xa7, + 0x3c, + 0x10, + 0x24, //RobertYu:20060627, //0x18, + 0x05, //RobertYu:20060515, //0x25, + 0x40,//d0 + 0x12, + 0x00, + 0x00, + 0x10, + 0x28, + 0x80, + 0x2A, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00,//e0 + 0xf3, //RobertYu:20060515, //0xd3, + 0x00, + 0x00, + 0x00, + 0x10, + 0x00, + 0x10, //RobertYu:20060627, //0x0e, + 0x00, + 0xf4, + 0x00, + 0xff, + 0x79, + 0x20, + 0x30, + 0x08, //RobertYu:20060515, //0x0c, + 0x00,//f0 + 0x3e, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, }; static const u16 awcFrameTime[MAX_RATE] = {10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216}; /* -static -unsigned long -s_ulGetLowSQ3(PSDevice pDevice); + static + unsigned long + s_ulGetLowSQ3(PSDevice pDevice); -static -unsigned long -s_ulGetRatio(PSDevice pDevice); + static + unsigned long + s_ulGetRatio(PSDevice pDevice); -static -void -s_vClearSQ3Value(PSDevice pDevice); -*/ + static + void + s_vClearSQ3Value(PSDevice pDevice); + */ /* * Description: Calculate data frame transmitting time @@ -665,53 +665,53 @@ s_vClearSQ3Value(PSDevice pDevice); * Return Value: FrameTime * */ -unsigned int + unsigned int BBuGetFrameTime( - u8 byPreambleType, - u8 byPktType, - unsigned int cbFrameLength, - u16 wRate - ) + u8 byPreambleType, + u8 byPktType, + unsigned int cbFrameLength, + u16 wRate + ) { - unsigned int uFrameTime; - unsigned int uPreamble; - unsigned int uTmp; - unsigned int uRateIdx = (unsigned int)wRate; - unsigned int uRate = 0; - - if (uRateIdx > RATE_54M) { - return 0; - } - - uRate = (unsigned int)awcFrameTime[uRateIdx]; - - if (uRateIdx <= 3) { //CCK mode - - if (byPreambleType == 1) {//Short - uPreamble = 96; - } else { - uPreamble = 192; - } - uFrameTime = (cbFrameLength * 80) / uRate; //????? - uTmp = (uFrameTime * uRate) / 80; - if (cbFrameLength != uTmp) { - uFrameTime ++; - } - - return (uPreamble + uFrameTime); - } - else { - uFrameTime = (cbFrameLength * 8 + 22) / uRate; //???????? - uTmp = ((uFrameTime * uRate) - 22) / 8; - if(cbFrameLength != uTmp) { - uFrameTime ++; - } - uFrameTime = uFrameTime * 4; //??????? - if(byPktType != PK_TYPE_11A) { - uFrameTime += 6; - } - return (20 + uFrameTime); //?????? - } + unsigned int uFrameTime; + unsigned int uPreamble; + unsigned int uTmp; + unsigned int uRateIdx = (unsigned int)wRate; + unsigned int uRate = 0; + + if (uRateIdx > RATE_54M) { + return 0; + } + + uRate = (unsigned int)awcFrameTime[uRateIdx]; + + if (uRateIdx <= 3) { //CCK mode + + if (byPreambleType == 1) {//Short + uPreamble = 96; + } else { + uPreamble = 192; + } + uFrameTime = (cbFrameLength * 80) / uRate; //????? + uTmp = (uFrameTime * uRate) / 80; + if (cbFrameLength != uTmp) { + uFrameTime ++; + } + + return (uPreamble + uFrameTime); + } + else { + uFrameTime = (cbFrameLength * 8 + 22) / uRate; //???????? + uTmp = ((uFrameTime * uRate) - 22) / 8; + if(cbFrameLength != uTmp) { + uFrameTime ++; + } + uFrameTime = uFrameTime * 4; //??????? + if(byPktType != PK_TYPE_11A) { + uFrameTime += 6; + } + return (20 + uFrameTime); //?????? + } } /* @@ -724,15 +724,15 @@ BBuGetFrameTime( * wRate - Tx Rate * Out: * struct vnt_phy_field *phy - * - pointer to Phy Length field + * - pointer to Phy Length field * - pointer to Phy Service field - * - pointer to Phy Signal field + * - pointer to Phy Signal field * * Return Value: none * */ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, - u16 wRate, u8 byPacketType, struct vnt_phy_field *phy) + u16 wRate, u8 byPacketType, struct vnt_phy_field *phy) { u32 cbBitCount; u32 cbUsCount = 0; @@ -741,134 +741,134 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, u8 byPreambleType = pDevice->byPreambleType; int bCCK = pDevice->bCCK; - cbBitCount = cbFrameLength * 8; - bExtBit = false; - - switch (wRate) { - case RATE_1M : - cbUsCount = cbBitCount; - phy->signal = 0x00; - break; - - case RATE_2M : - cbUsCount = cbBitCount / 2; - if (byPreambleType == 1) - phy->signal = 0x09; - else // long preamble - phy->signal = 0x01; - break; - - case RATE_5M : - if (bCCK == false) - cbBitCount ++; - cbUsCount = (cbBitCount * 10) / 55; - cbTmp = (cbUsCount * 55) / 10; - if (cbTmp != cbBitCount) - cbUsCount ++; - if (byPreambleType == 1) - phy->signal = 0x0a; - else // long preamble - phy->signal = 0x02; - break; - - case RATE_11M : - - if (bCCK == false) - cbBitCount ++; - cbUsCount = cbBitCount / 11; - cbTmp = cbUsCount * 11; - if (cbTmp != cbBitCount) { - cbUsCount ++; - if ((cbBitCount - cbTmp) <= 3) - bExtBit = true; - } - if (byPreambleType == 1) - phy->signal = 0x0b; - else // long preamble - phy->signal = 0x03; - break; - - case RATE_6M : - if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ - phy->signal = 0x9b; - } - else {//11g, 2.4GHZ - phy->signal = 0x8b; - } - break; - - case RATE_9M : - if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ - phy->signal = 0x9f; - } - else {//11g, 2.4GHZ - phy->signal = 0x8f; - } - break; - - case RATE_12M : - if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ - phy->signal = 0x9a; - } - else {//11g, 2.4GHZ - phy->signal = 0x8a; - } - break; - - case RATE_18M : - if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ - phy->signal = 0x9e; - } - else {//11g, 2.4GHZ - phy->signal = 0x8e; - } - break; - - case RATE_24M : - if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ - phy->signal = 0x99; - } - else {//11g, 2.4GHZ - phy->signal = 0x89; - } - break; - - case RATE_36M : - if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ - phy->signal = 0x9d; - } - else {//11g, 2.4GHZ - phy->signal = 0x8d; - } - break; - - case RATE_48M : - if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ - phy->signal = 0x98; - } - else {//11g, 2.4GHZ - phy->signal = 0x88; - } - break; - - case RATE_54M : - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - phy->signal = 0x9c; - } - else {//11g, 2.4GHZ - phy->signal = 0x8c; - } - break; - - default : - if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ - phy->signal = 0x9c; - } - else {//11g, 2.4GHZ - phy->signal = 0x8c; - } - break; - } + cbBitCount = cbFrameLength * 8; + bExtBit = false; + + switch (wRate) { + case RATE_1M : + cbUsCount = cbBitCount; + phy->signal = 0x00; + break; + + case RATE_2M : + cbUsCount = cbBitCount / 2; + if (byPreambleType == 1) + phy->signal = 0x09; + else // long preamble + phy->signal = 0x01; + break; + + case RATE_5M : + if (bCCK == false) + cbBitCount ++; + cbUsCount = (cbBitCount * 10) / 55; + cbTmp = (cbUsCount * 55) / 10; + if (cbTmp != cbBitCount) + cbUsCount ++; + if (byPreambleType == 1) + phy->signal = 0x0a; + else // long preamble + phy->signal = 0x02; + break; + + case RATE_11M : + + if (bCCK == false) + cbBitCount ++; + cbUsCount = cbBitCount / 11; + cbTmp = cbUsCount * 11; + if (cbTmp != cbBitCount) { + cbUsCount ++; + if ((cbBitCount - cbTmp) <= 3) + bExtBit = true; + } + if (byPreambleType == 1) + phy->signal = 0x0b; + else // long preamble + phy->signal = 0x03; + break; + + case RATE_6M : + if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ + phy->signal = 0x9b; + } + else {//11g, 2.4GHZ + phy->signal = 0x8b; + } + break; + + case RATE_9M : + if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ + phy->signal = 0x9f; + } + else {//11g, 2.4GHZ + phy->signal = 0x8f; + } + break; + + case RATE_12M : + if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ + phy->signal = 0x9a; + } + else {//11g, 2.4GHZ + phy->signal = 0x8a; + } + break; + + case RATE_18M : + if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ + phy->signal = 0x9e; + } + else {//11g, 2.4GHZ + phy->signal = 0x8e; + } + break; + + case RATE_24M : + if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ + phy->signal = 0x99; + } + else {//11g, 2.4GHZ + phy->signal = 0x89; + } + break; + + case RATE_36M : + if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ + phy->signal = 0x9d; + } + else {//11g, 2.4GHZ + phy->signal = 0x8d; + } + break; + + case RATE_48M : + if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ + phy->signal = 0x98; + } + else {//11g, 2.4GHZ + phy->signal = 0x88; + } + break; + + case RATE_54M : + if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ + phy->signal = 0x9c; + } + else {//11g, 2.4GHZ + phy->signal = 0x8c; + } + break; + + default : + if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ + phy->signal = 0x9c; + } + else {//11g, 2.4GHZ + phy->signal = 0x8c; + } + break; + } if (byPacketType == PK_TYPE_11B) { phy->service = 0x00; @@ -896,25 +896,25 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, */ void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode) { - switch (byAntennaMode) { - case ANT_TXA: - case ANT_TXB: - break; - case ANT_RXA: - pDevice->byBBRxConf &= 0xFC; - break; - case ANT_RXB: - pDevice->byBBRxConf &= 0xFE; - pDevice->byBBRxConf |= 0x02; - break; - } - - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_SET_ANTMD, - (u16) byAntennaMode, - 0, - 0, - NULL); + switch (byAntennaMode) { + case ANT_TXA: + case ANT_TXB: + break; + case ANT_RXA: + pDevice->byBBRxConf &= 0xFC; + break; + case ANT_RXB: + pDevice->byBBRxConf &= 0xFE; + pDevice->byBBRxConf |= 0x02; + break; + } + + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_SET_ANTMD, + (u16) byAntennaMode, + 0, + 0, + NULL); } /* @@ -942,8 +942,8 @@ int BBbVT3184Init(struct vnt_private *priv) u8 data; status = CONTROLnsRequestIn(priv, MESSAGE_TYPE_READ, 0, - MESSAGE_REQUEST_EEPROM, EEP_MAX_CONTEXT_SIZE, - priv->abyEEPROM); + MESSAGE_REQUEST_EEPROM, EEP_MAX_CONTEXT_SIZE, + priv->abyEEPROM); if (status != STATUS_SUCCESS) return false; @@ -952,34 +952,34 @@ int BBbVT3184Init(struct vnt_private *priv) if (priv->config_file.ZoneType >= 0) { if ((priv->config_file.ZoneType == 0) && - (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x00)) { + (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x00)) { priv->abyEEPROM[EEP_OFS_ZONETYPE] = 0; priv->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Init Zone Type :USA\n"); + "Init Zone Type :USA\n"); } else if ((priv->config_file.ZoneType == 1) && - (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) { + (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) { priv->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01; priv->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Init Zone Type :Japan\n"); + "Init Zone Type :Japan\n"); } else if ((priv->config_file.ZoneType == 2) && - (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) { + (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) { priv->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02; priv->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Init Zone Type :Europe\n"); + "Init Zone Type :Europe\n"); } else { if (priv->config_file.ZoneType != priv->abyEEPROM[EEP_OFS_ZONETYPE]) printk("zonetype in file[%02x]\ - mismatch with in EEPROM[%02x]\n", - priv->config_file.ZoneType, - priv->abyEEPROM[EEP_OFS_ZONETYPE]); + mismatch with in EEPROM[%02x]\n", + priv->config_file.ZoneType, + priv->abyEEPROM[EEP_OFS_ZONETYPE]); else printk("Read Zonetype file success,\ - use default zonetype setting[%02x]\n", - priv->config_file.ZoneType); + use default zonetype setting[%02x]\n", + priv->config_file.ZoneType); } } @@ -989,12 +989,12 @@ int BBbVT3184Init(struct vnt_private *priv) priv->byRFType = priv->abyEEPROM[EEP_OFS_RFTYPE]; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Zone Type %x\n", - priv->byZoneType); + priv->byZoneType); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RF Type %d\n", priv->byRFType); if ((priv->byRFType == RF_AL2230) || - (priv->byRFType == RF_AL2230S)) { + (priv->byRFType == RF_AL2230S)) { priv->byBBRxConf = abyVT3184_AL2230[10]; lenght = sizeof(abyVT3184_AL2230); addr = abyVT3184_AL2230; @@ -1068,21 +1068,21 @@ int BBbVT3184Init(struct vnt_private *priv) memcpy(array, addr, lenght); CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_BBREG, lenght, array); + MESSAGE_REQUEST_BBREG, lenght, array); memcpy(array, agc, lenght_agc); CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_BBAGC, lenght_agc, array); + MESSAGE_REQUEST_BBAGC, lenght_agc, array); if ((priv->byRFType == RF_VT3226) || - (priv->byRFType == RF_VT3342A0)) { + (priv->byRFType == RF_VT3342A0)) { ControlvWriteByte(priv, MESSAGE_REQUEST_MACREG, - MAC_REG_ITRTMSET, 0x23); + MAC_REG_ITRTMSET, 0x23); MACvRegBitsOn(priv, MAC_REG_PAPEDELAY, 0x01); } else if (priv->byRFType == RF_VT3226D0) { ControlvWriteByte(priv, MESSAGE_REQUEST_MACREG, - MAC_REG_ITRTMSET, 0x11); + MAC_REG_ITRTMSET, 0x11); MACvRegBitsOn(priv, MAC_REG_PAPEDELAY, 0x01); } @@ -1094,12 +1094,12 @@ int BBbVT3184Init(struct vnt_private *priv) /* Fix for TX USB resets from vendors driver */ CONTROLnsRequestIn(priv, MESSAGE_TYPE_READ, USB_REG4, - MESSAGE_REQUEST_MEM, sizeof(data), &data); + MESSAGE_REQUEST_MEM, sizeof(data), &data); data |= 0x2; CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, USB_REG4, - MESSAGE_REQUEST_MEM, sizeof(data), &data); + MESSAGE_REQUEST_MEM, sizeof(data), &data); return true; } @@ -1118,32 +1118,32 @@ int BBbVT3184Init(struct vnt_private *priv) */ void BBvSetShortSlotTime(struct vnt_private *pDevice) { - u8 byBBVGA=0; + u8 byBBVGA=0; if (pDevice->bShortSlotTime) - pDevice->byBBRxConf &= 0xDF;//1101 1111 + pDevice->byBBRxConf &= 0xDF;//1101 1111 else - pDevice->byBBRxConf |= 0x20;//0010 0000 + pDevice->byBBRxConf |= 0x20;//0010 0000 - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xE7, &byBBVGA); + ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xE7, &byBBVGA); if (byBBVGA == pDevice->abyBBVGA[0]) - pDevice->byBBRxConf |= 0x20;//0010 0000 + pDevice->byBBRxConf |= 0x20;//0010 0000 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf); + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf); } void BBvSetVGAGainOffset(struct vnt_private *pDevice, u8 byData) { - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData); + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData); - // patch for 3253B0 Baseband with Cardbus module + // patch for 3253B0 Baseband with Cardbus module if (pDevice->bShortSlotTime) pDevice->byBBRxConf &= 0xDF; /* 1101 1111 */ else pDevice->byBBRxConf |= 0x20; /* 0010 0000 */ - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);//CR10 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);//CR10 } /* @@ -1160,14 +1160,14 @@ void BBvSetVGAGainOffset(struct vnt_private *pDevice, u8 byData) */ void BBvSetDeepSleep(struct vnt_private *pDevice) { - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13 } void BBvExitDeepSleep(struct vnt_private *pDevice) { - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13 } static unsigned long s_ulGetLowSQ3(struct vnt_private *pDevice) @@ -1176,17 +1176,17 @@ static unsigned long s_ulGetLowSQ3(struct vnt_private *pDevice) unsigned long ulSQ3 = 0; unsigned long ulMaxPacket; - ulMaxPacket = pDevice->aulPktNum[RATE_54M]; + ulMaxPacket = pDevice->aulPktNum[RATE_54M]; if (pDevice->aulPktNum[RATE_54M] != 0) - ulSQ3 = pDevice->aulSQ3Val[RATE_54M] / pDevice->aulPktNum[RATE_54M]; + ulSQ3 = pDevice->aulSQ3Val[RATE_54M] / pDevice->aulPktNum[RATE_54M]; for (ii = RATE_48M; ii >= RATE_6M; ii--) if (pDevice->aulPktNum[ii] > ulMaxPacket) { - ulMaxPacket = pDevice->aulPktNum[ii]; - ulSQ3 = pDevice->aulSQ3Val[ii] / pDevice->aulPktNum[ii]; - } + ulMaxPacket = pDevice->aulPktNum[ii]; + ulSQ3 = pDevice->aulSQ3Val[ii] / pDevice->aulPktNum[ii]; + } - return ulSQ3; + return ulSQ3; } static unsigned long s_ulGetRatio(struct vnt_private *pDevice) @@ -1196,35 +1196,35 @@ static unsigned long s_ulGetRatio(struct vnt_private *pDevice) unsigned long ulMaxPacket; unsigned long ulPacketNum; - //This is a thousand-ratio - ulMaxPacket = pDevice->aulPktNum[RATE_54M]; - if ( pDevice->aulPktNum[RATE_54M] != 0 ) { - ulPacketNum = pDevice->aulPktNum[RATE_54M]; - ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt); - ulRatio += TOP_RATE_54M; - } + //This is a thousand-ratio + ulMaxPacket = pDevice->aulPktNum[RATE_54M]; + if ( pDevice->aulPktNum[RATE_54M] != 0 ) { + ulPacketNum = pDevice->aulPktNum[RATE_54M]; + ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt); + ulRatio += TOP_RATE_54M; + } for (ii = RATE_48M; ii >= RATE_1M; ii--) - if ( pDevice->aulPktNum[ii] > ulMaxPacket ) { - ulPacketNum = 0; - for ( jj=RATE_54M;jj>=ii;jj--) - ulPacketNum += pDevice->aulPktNum[jj]; - ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt); - ulRatio += TOP_RATE_48M; - ulMaxPacket = pDevice->aulPktNum[ii]; - } - - return ulRatio; + if ( pDevice->aulPktNum[ii] > ulMaxPacket ) { + ulPacketNum = 0; + for ( jj=RATE_54M;jj>=ii;jj--) + ulPacketNum += pDevice->aulPktNum[jj]; + ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt); + ulRatio += TOP_RATE_48M; + ulMaxPacket = pDevice->aulPktNum[ii]; + } + + return ulRatio; } static void s_vClearSQ3Value(struct vnt_private *pDevice) { - int ii; - pDevice->uDiversityCnt = 0; + int ii; + pDevice->uDiversityCnt = 0; - for ( ii=RATE_1M;ii<MAX_RATE;ii++) { - pDevice->aulPktNum[ii] = 0; - pDevice->aulSQ3Val[ii] = 0; - } + for ( ii=RATE_1M;ii<MAX_RATE;ii++) { + pDevice->aulPktNum[ii] = 0; + pDevice->aulSQ3Val[ii] = 0; + } } /* @@ -1243,119 +1243,119 @@ static void s_vClearSQ3Value(struct vnt_private *pDevice) */ void BBvAntennaDiversity(struct vnt_private *pDevice, - u8 byRxRate, u8 bySQ3) + u8 byRxRate, u8 bySQ3) { - pDevice->uDiversityCnt++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt); - - if (byRxRate == 2) { - pDevice->aulPktNum[RATE_1M]++; - } - else if (byRxRate==4) { - pDevice->aulPktNum[RATE_2M]++; - } - else if (byRxRate==11) { - pDevice->aulPktNum[RATE_5M]++; - } - else if (byRxRate==22) { - pDevice->aulPktNum[RATE_11M]++; - } - else if(byRxRate==12){ - pDevice->aulPktNum[RATE_6M]++; - pDevice->aulSQ3Val[RATE_6M] += bySQ3; - } - else if(byRxRate==18){ - pDevice->aulPktNum[RATE_9M]++; - pDevice->aulSQ3Val[RATE_9M] += bySQ3; - } - else if(byRxRate==24){ - pDevice->aulPktNum[RATE_12M]++; - pDevice->aulSQ3Val[RATE_12M] += bySQ3; - } - else if(byRxRate==36){ - pDevice->aulPktNum[RATE_18M]++; - pDevice->aulSQ3Val[RATE_18M] += bySQ3; - } - else if(byRxRate==48){ - pDevice->aulPktNum[RATE_24M]++; - pDevice->aulSQ3Val[RATE_24M] += bySQ3; - } - else if(byRxRate==72){ - pDevice->aulPktNum[RATE_36M]++; - pDevice->aulSQ3Val[RATE_36M] += bySQ3; - } - else if(byRxRate==96){ - pDevice->aulPktNum[RATE_48M]++; - pDevice->aulSQ3Val[RATE_48M] += bySQ3; - } - else if(byRxRate==108){ - pDevice->aulPktNum[RATE_54M]++; - pDevice->aulSQ3Val[RATE_54M] += bySQ3; - } - - if (pDevice->byAntennaState == 0) { - - if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ulDiversityNValue=[%d],54M-[%d]\n",(int)pDevice->ulDiversityNValue, (int)pDevice->aulPktNum[RATE_54M]); - - pDevice->ulSQ3_State0 = s_ulGetLowSQ3(pDevice); - pDevice->ulRatio_State0 = s_ulGetRatio(pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, SQ3= [%08x] rate = [%08x]\n",(int)pDevice->ulSQ3_State0,(int)pDevice->ulRatio_State0); - - if ( ((pDevice->aulPktNum[RATE_54M] < pDevice->ulDiversityNValue/2) && - (pDevice->ulSQ3_State0 > pDevice->ulSQ3TH) ) || - (pDevice->ulSQ3_State0 == 0 ) ) { - - if ( pDevice->byTMax == 0 ) - return; - - bScheduleCommand((void *) pDevice, - WLAN_CMD_CHANGE_ANTENNA, - NULL); - - pDevice->byAntennaState = 1; - - del_timer(&pDevice->TimerSQ3Tmax3); - del_timer(&pDevice->TimerSQ3Tmax2); - pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ); - add_timer(&pDevice->TimerSQ3Tmax1); - - } else { - pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); - add_timer(&pDevice->TimerSQ3Tmax3); - } - s_vClearSQ3Value(pDevice); - - } - } else { //byAntennaState == 1 - - if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) { - - del_timer(&pDevice->TimerSQ3Tmax1); - pDevice->ulSQ3_State1 = s_ulGetLowSQ3(pDevice); - pDevice->ulRatio_State1 = s_ulGetRatio(pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State1, rate0 = %08x,rate1 = %08x\n",(int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1); - - if ( ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 != 0)) || - ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 == 0) && (pDevice->ulRatio_State1 < pDevice->ulRatio_State0)) || - ((pDevice->ulSQ3_State1 != 0) && (pDevice->ulSQ3_State0 != 0) && (pDevice->ulSQ3_State0 < pDevice->ulSQ3_State1)) - ) { - - bScheduleCommand((void *) pDevice, - WLAN_CMD_CHANGE_ANTENNA, - NULL); - - pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); - pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ); - add_timer(&pDevice->TimerSQ3Tmax3); - add_timer(&pDevice->TimerSQ3Tmax2); - - } - pDevice->byAntennaState = 0; - s_vClearSQ3Value(pDevice); - } - } //byAntennaState + pDevice->uDiversityCnt++; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt); + + if (byRxRate == 2) { + pDevice->aulPktNum[RATE_1M]++; + } + else if (byRxRate==4) { + pDevice->aulPktNum[RATE_2M]++; + } + else if (byRxRate==11) { + pDevice->aulPktNum[RATE_5M]++; + } + else if (byRxRate==22) { + pDevice->aulPktNum[RATE_11M]++; + } + else if(byRxRate==12){ + pDevice->aulPktNum[RATE_6M]++; + pDevice->aulSQ3Val[RATE_6M] += bySQ3; + } + else if(byRxRate==18){ + pDevice->aulPktNum[RATE_9M]++; + pDevice->aulSQ3Val[RATE_9M] += bySQ3; + } + else if(byRxRate==24){ + pDevice->aulPktNum[RATE_12M]++; + pDevice->aulSQ3Val[RATE_12M] += bySQ3; + } + else if(byRxRate==36){ + pDevice->aulPktNum[RATE_18M]++; + pDevice->aulSQ3Val[RATE_18M] += bySQ3; + } + else if(byRxRate==48){ + pDevice->aulPktNum[RATE_24M]++; + pDevice->aulSQ3Val[RATE_24M] += bySQ3; + } + else if(byRxRate==72){ + pDevice->aulPktNum[RATE_36M]++; + pDevice->aulSQ3Val[RATE_36M] += bySQ3; + } + else if(byRxRate==96){ + pDevice->aulPktNum[RATE_48M]++; + pDevice->aulSQ3Val[RATE_48M] += bySQ3; + } + else if(byRxRate==108){ + pDevice->aulPktNum[RATE_54M]++; + pDevice->aulSQ3Val[RATE_54M] += bySQ3; + } + + if (pDevice->byAntennaState == 0) { + + if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ulDiversityNValue=[%d],54M-[%d]\n",(int)pDevice->ulDiversityNValue, (int)pDevice->aulPktNum[RATE_54M]); + + pDevice->ulSQ3_State0 = s_ulGetLowSQ3(pDevice); + pDevice->ulRatio_State0 = s_ulGetRatio(pDevice); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, SQ3= [%08x] rate = [%08x]\n",(int)pDevice->ulSQ3_State0,(int)pDevice->ulRatio_State0); + + if ( ((pDevice->aulPktNum[RATE_54M] < pDevice->ulDiversityNValue/2) && + (pDevice->ulSQ3_State0 > pDevice->ulSQ3TH) ) || + (pDevice->ulSQ3_State0 == 0 ) ) { + + if ( pDevice->byTMax == 0 ) + return; + + bScheduleCommand((void *) pDevice, + WLAN_CMD_CHANGE_ANTENNA, + NULL); + + pDevice->byAntennaState = 1; + + del_timer(&pDevice->TimerSQ3Tmax3); + del_timer(&pDevice->TimerSQ3Tmax2); + pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ); + add_timer(&pDevice->TimerSQ3Tmax1); + + } else { + pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); + add_timer(&pDevice->TimerSQ3Tmax3); + } + s_vClearSQ3Value(pDevice); + + } + } else { //byAntennaState == 1 + + if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) { + + del_timer(&pDevice->TimerSQ3Tmax1); + pDevice->ulSQ3_State1 = s_ulGetLowSQ3(pDevice); + pDevice->ulRatio_State1 = s_ulGetRatio(pDevice); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State1, rate0 = %08x,rate1 = %08x\n",(int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1); + + if ( ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 != 0)) || + ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 == 0) && (pDevice->ulRatio_State1 < pDevice->ulRatio_State0)) || + ((pDevice->ulSQ3_State1 != 0) && (pDevice->ulSQ3_State0 != 0) && (pDevice->ulSQ3_State0 < pDevice->ulSQ3_State1)) + ) { + + bScheduleCommand((void *) pDevice, + WLAN_CMD_CHANGE_ANTENNA, + NULL); + + pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); + pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ); + add_timer(&pDevice->TimerSQ3Tmax3); + add_timer(&pDevice->TimerSQ3Tmax2); + + } + pDevice->byAntennaState = 0; + s_vClearSQ3Value(pDevice); + } + } //byAntennaState } /*+ @@ -1374,23 +1374,23 @@ void BBvAntennaDiversity(struct vnt_private *pDevice, * * Return Value: none * --*/ + -*/ void TimerSQ3CallBack(struct vnt_private *pDevice) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack..."); - spin_lock_irq(&pDevice->lock); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack..."); + spin_lock_irq(&pDevice->lock); - bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); - pDevice->byAntennaState = 0; - s_vClearSQ3Value(pDevice); - pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); - pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ); - add_timer(&pDevice->TimerSQ3Tmax3); - add_timer(&pDevice->TimerSQ3Tmax2); + bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); + pDevice->byAntennaState = 0; + s_vClearSQ3Value(pDevice); + pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); + pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ); + add_timer(&pDevice->TimerSQ3Tmax3); + add_timer(&pDevice->TimerSQ3Tmax2); - spin_unlock_irq(&pDevice->lock); + spin_unlock_irq(&pDevice->lock); } /*+ @@ -1409,477 +1409,476 @@ void TimerSQ3CallBack(struct vnt_private *pDevice) * * Return Value: none * --*/ + -*/ void TimerSQ3Tmax3CallBack(struct vnt_private *pDevice) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3Tmax3CallBack..."); - spin_lock_irq(&pDevice->lock); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3Tmax3CallBack..."); + spin_lock_irq(&pDevice->lock); - pDevice->ulRatio_State0 = s_ulGetRatio(pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0 = [%08x]\n",(int)pDevice->ulRatio_State0); + pDevice->ulRatio_State0 = s_ulGetRatio(pDevice); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0 = [%08x]\n",(int)pDevice->ulRatio_State0); - s_vClearSQ3Value(pDevice); - if ( pDevice->byTMax == 0 ) { - pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); - add_timer(&pDevice->TimerSQ3Tmax3); - spin_unlock_irq(&pDevice->lock); - return; - } + s_vClearSQ3Value(pDevice); + if ( pDevice->byTMax == 0 ) { + pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); + add_timer(&pDevice->TimerSQ3Tmax3); + spin_unlock_irq(&pDevice->lock); + return; + } - bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); - pDevice->byAntennaState = 1; - del_timer(&pDevice->TimerSQ3Tmax3); - del_timer(&pDevice->TimerSQ3Tmax2); - pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ); - add_timer(&pDevice->TimerSQ3Tmax1); + bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); + pDevice->byAntennaState = 1; + del_timer(&pDevice->TimerSQ3Tmax3); + del_timer(&pDevice->TimerSQ3Tmax2); + pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ); + add_timer(&pDevice->TimerSQ3Tmax1); - spin_unlock_irq(&pDevice->lock); + spin_unlock_irq(&pDevice->lock); } void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning) { - switch(pDevice->byRFType) - { - case RF_AL2230: - case RF_AL2230S: - case RF_AIROHA7230: - //RobertYu:20060627, update new table - - if( bScanning ) - { // need Max sensitivity //RSSI -69, -70,.... - pDevice->byBBPreEDIndex = 0; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70, -71,...\n"); - break; - } - - if(pDevice->byBBPreEDRSSI <= 45) { // RSSI 0, -1,-2,....-45 - if(pDevice->byBBPreEDIndex == 20) break; - pDevice->byBBPreEDIndex = 20; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-45\n"); - } else if(pDevice->byBBPreEDRSSI <= 46) { //RSSI -46 - if(pDevice->byBBPreEDIndex == 19) break; - pDevice->byBBPreEDIndex = 19; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x1A); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46\n"); - } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -47 - if(pDevice->byBBPreEDIndex == 18) break; - pDevice->byBBPreEDIndex = 18; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x15); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -47\n"); - } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49 - if(pDevice->byBBPreEDIndex == 17) break; - pDevice->byBBPreEDIndex = 17; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0E); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n"); - } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51 - if(pDevice->byBBPreEDIndex == 16) break; - pDevice->byBBPreEDIndex = 16; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x09); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n"); - } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53 - if(pDevice->byBBPreEDIndex == 15) break; - pDevice->byBBPreEDIndex = 15; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x06); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n"); - } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55 - if(pDevice->byBBPreEDIndex == 14) break; - pDevice->byBBPreEDIndex = 14; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x03); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n"); - } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56 - if(pDevice->byBBPreEDIndex == 13) break; - pDevice->byBBPreEDIndex = 13; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n"); - } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57 - if(pDevice->byBBPreEDIndex == 12) break; - pDevice->byBBPreEDIndex = 12; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x20); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n"); - } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58 - if(pDevice->byBBPreEDIndex == 11) break; - pDevice->byBBPreEDIndex = 11; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n"); - } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59 - if(pDevice->byBBPreEDIndex == 10) break; - pDevice->byBBPreEDIndex = 10; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x54); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n"); - } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60 - if(pDevice->byBBPreEDIndex == 9) break; - pDevice->byBBPreEDIndex = 9; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x18); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n"); - } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61 - if(pDevice->byBBPreEDIndex == 8) break; - pDevice->byBBPreEDIndex = 8; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xE3); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n"); - } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62 - if(pDevice->byBBPreEDIndex == 7) break; - pDevice->byBBPreEDIndex = 7; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB9); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n"); - } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63 - if(pDevice->byBBPreEDIndex == 6) break; - pDevice->byBBPreEDIndex = 6; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x93); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n"); - } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64 - if(pDevice->byBBPreEDIndex == 5) break; - pDevice->byBBPreEDIndex = 5; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x79); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n"); - } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65 - if(pDevice->byBBPreEDIndex == 4) break; - pDevice->byBBPreEDIndex = 4; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x62); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n"); - } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66 - if(pDevice->byBBPreEDIndex == 3) break; - pDevice->byBBPreEDIndex = 3; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x51); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n"); - } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67 - if(pDevice->byBBPreEDIndex == 2) break; - pDevice->byBBPreEDIndex = 2; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n"); - } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68 - if(pDevice->byBBPreEDIndex == 1) break; - pDevice->byBBPreEDIndex = 1; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n"); - } else { //RSSI -69, -70,.... - if(pDevice->byBBPreEDIndex == 0) break; - pDevice->byBBPreEDIndex = 0; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,...\n"); - } - break; - - case RF_VT3226: - case RF_VT3226D0: - //RobertYu:20060627, update new table - - if( bScanning ) - { // need Max sensitivity //RSSI -69, -70, ... - pDevice->byBBPreEDIndex = 0; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n"); - break; - } - - if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41 - if(pDevice->byBBPreEDIndex == 22) break; - pDevice->byBBPreEDIndex = 22; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n"); - } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42 - if(pDevice->byBBPreEDIndex == 21) break; - pDevice->byBBPreEDIndex = 21; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n"); - } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43 - if(pDevice->byBBPreEDIndex == 20) break; - pDevice->byBBPreEDIndex = 20; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n"); - } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45 - if(pDevice->byBBPreEDIndex == 19) break; - pDevice->byBBPreEDIndex = 19; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n"); - } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47 - if(pDevice->byBBPreEDIndex == 18) break; - pDevice->byBBPreEDIndex = 18; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n"); - } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49 - if(pDevice->byBBPreEDIndex == 17) break; - pDevice->byBBPreEDIndex = 17; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n"); - } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51 - if(pDevice->byBBPreEDIndex == 16) break; - pDevice->byBBPreEDIndex = 16; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n"); - } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53 - if(pDevice->byBBPreEDIndex == 15) break; - pDevice->byBBPreEDIndex = 15; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n"); - } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55 - if(pDevice->byBBPreEDIndex == 14) break; - pDevice->byBBPreEDIndex = 14; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n"); - } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56 - if(pDevice->byBBPreEDIndex == 13) break; - pDevice->byBBPreEDIndex = 13; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n"); - } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57 - if(pDevice->byBBPreEDIndex == 12) break; - pDevice->byBBPreEDIndex = 12; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n"); - } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58 - if(pDevice->byBBPreEDIndex == 11) break; - pDevice->byBBPreEDIndex = 11; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n"); - } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59 - if(pDevice->byBBPreEDIndex == 10) break; - pDevice->byBBPreEDIndex = 10; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n"); - } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60 - if(pDevice->byBBPreEDIndex == 9) break; - pDevice->byBBPreEDIndex = 9; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n"); - } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61 - if(pDevice->byBBPreEDIndex == 8) break; - pDevice->byBBPreEDIndex = 8; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n"); - } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62 - if(pDevice->byBBPreEDIndex == 7) break; - pDevice->byBBPreEDIndex = 7; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n"); - } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63 - if(pDevice->byBBPreEDIndex == 6) break; - pDevice->byBBPreEDIndex = 6; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n"); - } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64 - if(pDevice->byBBPreEDIndex == 5) break; - pDevice->byBBPreEDIndex = 5; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n"); - } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65 - if(pDevice->byBBPreEDIndex == 4) break; - pDevice->byBBPreEDIndex = 4; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n"); - } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66 - if(pDevice->byBBPreEDIndex == 3) break; - pDevice->byBBPreEDIndex = 3; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n"); - } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67 - if(pDevice->byBBPreEDIndex == 2) break; - pDevice->byBBPreEDIndex = 2; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n"); - } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68 - if(pDevice->byBBPreEDIndex == 1) break; - pDevice->byBBPreEDIndex = 1; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x2D); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n"); - } else { //RSSI -69, -70, ... - if(pDevice->byBBPreEDIndex == 0) break; - pDevice->byBBPreEDIndex = 0; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n"); - } - break; - - case RF_VT3342A0: //RobertYu:20060627, testing table - if( bScanning ) - { // need Max sensitivity //RSSI -67, -68, ... - pDevice->byBBPreEDIndex = 0; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n"); - break; - } - - if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41 - if(pDevice->byBBPreEDIndex == 20) break; - pDevice->byBBPreEDIndex = 20; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n"); - } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42 - if(pDevice->byBBPreEDIndex == 19) break; - pDevice->byBBPreEDIndex = 19; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n"); - } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43 - if(pDevice->byBBPreEDIndex == 18) break; - pDevice->byBBPreEDIndex = 18; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n"); - } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45 - if(pDevice->byBBPreEDIndex == 17) break; - pDevice->byBBPreEDIndex = 17; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n"); - } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47 - if(pDevice->byBBPreEDIndex == 16) break; - pDevice->byBBPreEDIndex = 16; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n"); - } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49 - if(pDevice->byBBPreEDIndex == 15) break; - pDevice->byBBPreEDIndex = 15; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n"); - } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51 - if(pDevice->byBBPreEDIndex == 14) break; - pDevice->byBBPreEDIndex = 14; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n"); - } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53 - if(pDevice->byBBPreEDIndex == 13) break; - pDevice->byBBPreEDIndex = 13; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n"); - } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55 - if(pDevice->byBBPreEDIndex == 12) break; - pDevice->byBBPreEDIndex = 12; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n"); - } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56 - if(pDevice->byBBPreEDIndex == 11) break; - pDevice->byBBPreEDIndex = 11; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n"); - } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57 - if(pDevice->byBBPreEDIndex == 10) break; - pDevice->byBBPreEDIndex = 10; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n"); - } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58 - if(pDevice->byBBPreEDIndex == 9) break; - pDevice->byBBPreEDIndex = 9; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n"); - } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59 - if(pDevice->byBBPreEDIndex == 8) break; - pDevice->byBBPreEDIndex = 8; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n"); - } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60 - if(pDevice->byBBPreEDIndex == 7) break; - pDevice->byBBPreEDIndex = 7; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n"); - } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61 - if(pDevice->byBBPreEDIndex == 6) break; - pDevice->byBBPreEDIndex = 6; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n"); - } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62 - if(pDevice->byBBPreEDIndex == 5) break; - pDevice->byBBPreEDIndex = 5; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n"); - } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63 - if(pDevice->byBBPreEDIndex == 4) break; - pDevice->byBBPreEDIndex = 4; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n"); - } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64 - if(pDevice->byBBPreEDIndex == 3) break; - pDevice->byBBPreEDIndex = 3; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n"); - } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65 - if(pDevice->byBBPreEDIndex == 2) break; - pDevice->byBBPreEDIndex = 2; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n"); - } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66 - if(pDevice->byBBPreEDIndex == 1) break; - pDevice->byBBPreEDIndex = 1; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n"); - } else { //RSSI -67, -68, ... - if(pDevice->byBBPreEDIndex == 0) break; - pDevice->byBBPreEDIndex = 0; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n"); - } - break; - - } + switch(pDevice->byRFType) + { + case RF_AL2230: + case RF_AL2230S: + case RF_AIROHA7230: + //RobertYu:20060627, update new table + + if( bScanning ) + { // need Max sensitivity //RSSI -69, -70,.... + pDevice->byBBPreEDIndex = 0; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70, -71,...\n"); + break; + } -} + if(pDevice->byBBPreEDRSSI <= 45) { // RSSI 0, -1,-2,....-45 + if(pDevice->byBBPreEDIndex == 20) break; + pDevice->byBBPreEDIndex = 20; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-45\n"); + } else if(pDevice->byBBPreEDRSSI <= 46) { //RSSI -46 + if(pDevice->byBBPreEDIndex == 19) break; + pDevice->byBBPreEDIndex = 19; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x1A); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46\n"); + } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -47 + if(pDevice->byBBPreEDIndex == 18) break; + pDevice->byBBPreEDIndex = 18; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x15); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -47\n"); + } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49 + if(pDevice->byBBPreEDIndex == 17) break; + pDevice->byBBPreEDIndex = 17; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0E); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n"); + } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51 + if(pDevice->byBBPreEDIndex == 16) break; + pDevice->byBBPreEDIndex = 16; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x09); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n"); + } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53 + if(pDevice->byBBPreEDIndex == 15) break; + pDevice->byBBPreEDIndex = 15; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x06); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n"); + } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55 + if(pDevice->byBBPreEDIndex == 14) break; + pDevice->byBBPreEDIndex = 14; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x03); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n"); + } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56 + if(pDevice->byBBPreEDIndex == 13) break; + pDevice->byBBPreEDIndex = 13; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n"); + } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57 + if(pDevice->byBBPreEDIndex == 12) break; + pDevice->byBBPreEDIndex = 12; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x20); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n"); + } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58 + if(pDevice->byBBPreEDIndex == 11) break; + pDevice->byBBPreEDIndex = 11; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n"); + } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59 + if(pDevice->byBBPreEDIndex == 10) break; + pDevice->byBBPreEDIndex = 10; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x54); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n"); + } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60 + if(pDevice->byBBPreEDIndex == 9) break; + pDevice->byBBPreEDIndex = 9; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x18); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n"); + } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61 + if(pDevice->byBBPreEDIndex == 8) break; + pDevice->byBBPreEDIndex = 8; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xE3); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n"); + } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62 + if(pDevice->byBBPreEDIndex == 7) break; + pDevice->byBBPreEDIndex = 7; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB9); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n"); + } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63 + if(pDevice->byBBPreEDIndex == 6) break; + pDevice->byBBPreEDIndex = 6; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x93); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n"); + } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64 + if(pDevice->byBBPreEDIndex == 5) break; + pDevice->byBBPreEDIndex = 5; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x79); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n"); + } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65 + if(pDevice->byBBPreEDIndex == 4) break; + pDevice->byBBPreEDIndex = 4; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x62); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n"); + } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66 + if(pDevice->byBBPreEDIndex == 3) break; + pDevice->byBBPreEDIndex = 3; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x51); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n"); + } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67 + if(pDevice->byBBPreEDIndex == 2) break; + pDevice->byBBPreEDIndex = 2; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n"); + } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68 + if(pDevice->byBBPreEDIndex == 1) break; + pDevice->byBBPreEDIndex = 1; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n"); + } else { //RSSI -69, -70,.... + if(pDevice->byBBPreEDIndex == 0) break; + pDevice->byBBPreEDIndex = 0; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,...\n"); + } + break; + + case RF_VT3226: + case RF_VT3226D0: + //RobertYu:20060627, update new table + + if( bScanning ) + { // need Max sensitivity //RSSI -69, -70, ... + pDevice->byBBPreEDIndex = 0; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n"); + break; + } + + if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41 + if(pDevice->byBBPreEDIndex == 22) break; + pDevice->byBBPreEDIndex = 22; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n"); + } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42 + if(pDevice->byBBPreEDIndex == 21) break; + pDevice->byBBPreEDIndex = 21; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n"); + } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43 + if(pDevice->byBBPreEDIndex == 20) break; + pDevice->byBBPreEDIndex = 20; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n"); + } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45 + if(pDevice->byBBPreEDIndex == 19) break; + pDevice->byBBPreEDIndex = 19; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n"); + } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47 + if(pDevice->byBBPreEDIndex == 18) break; + pDevice->byBBPreEDIndex = 18; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n"); + } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49 + if(pDevice->byBBPreEDIndex == 17) break; + pDevice->byBBPreEDIndex = 17; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n"); + } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51 + if(pDevice->byBBPreEDIndex == 16) break; + pDevice->byBBPreEDIndex = 16; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n"); + } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53 + if(pDevice->byBBPreEDIndex == 15) break; + pDevice->byBBPreEDIndex = 15; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n"); + } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55 + if(pDevice->byBBPreEDIndex == 14) break; + pDevice->byBBPreEDIndex = 14; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n"); + } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56 + if(pDevice->byBBPreEDIndex == 13) break; + pDevice->byBBPreEDIndex = 13; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n"); + } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57 + if(pDevice->byBBPreEDIndex == 12) break; + pDevice->byBBPreEDIndex = 12; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n"); + } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58 + if(pDevice->byBBPreEDIndex == 11) break; + pDevice->byBBPreEDIndex = 11; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n"); + } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59 + if(pDevice->byBBPreEDIndex == 10) break; + pDevice->byBBPreEDIndex = 10; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n"); + } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60 + if(pDevice->byBBPreEDIndex == 9) break; + pDevice->byBBPreEDIndex = 9; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n"); + } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61 + if(pDevice->byBBPreEDIndex == 8) break; + pDevice->byBBPreEDIndex = 8; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n"); + } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62 + if(pDevice->byBBPreEDIndex == 7) break; + pDevice->byBBPreEDIndex = 7; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n"); + } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63 + if(pDevice->byBBPreEDIndex == 6) break; + pDevice->byBBPreEDIndex = 6; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n"); + } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64 + if(pDevice->byBBPreEDIndex == 5) break; + pDevice->byBBPreEDIndex = 5; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n"); + } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65 + if(pDevice->byBBPreEDIndex == 4) break; + pDevice->byBBPreEDIndex = 4; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n"); + } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66 + if(pDevice->byBBPreEDIndex == 3) break; + pDevice->byBBPreEDIndex = 3; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n"); + } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67 + if(pDevice->byBBPreEDIndex == 2) break; + pDevice->byBBPreEDIndex = 2; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n"); + } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68 + if(pDevice->byBBPreEDIndex == 1) break; + pDevice->byBBPreEDIndex = 1; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x2D); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n"); + } else { //RSSI -69, -70, ... + if(pDevice->byBBPreEDIndex == 0) break; + pDevice->byBBPreEDIndex = 0; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n"); + } + break; + + case RF_VT3342A0: //RobertYu:20060627, testing table + if( bScanning ) + { // need Max sensitivity //RSSI -67, -68, ... + pDevice->byBBPreEDIndex = 0; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n"); + break; + } + if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41 + if(pDevice->byBBPreEDIndex == 20) break; + pDevice->byBBPreEDIndex = 20; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n"); + } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42 + if(pDevice->byBBPreEDIndex == 19) break; + pDevice->byBBPreEDIndex = 19; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n"); + } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43 + if(pDevice->byBBPreEDIndex == 18) break; + pDevice->byBBPreEDIndex = 18; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n"); + } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45 + if(pDevice->byBBPreEDIndex == 17) break; + pDevice->byBBPreEDIndex = 17; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n"); + } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47 + if(pDevice->byBBPreEDIndex == 16) break; + pDevice->byBBPreEDIndex = 16; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n"); + } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49 + if(pDevice->byBBPreEDIndex == 15) break; + pDevice->byBBPreEDIndex = 15; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n"); + } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51 + if(pDevice->byBBPreEDIndex == 14) break; + pDevice->byBBPreEDIndex = 14; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n"); + } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53 + if(pDevice->byBBPreEDIndex == 13) break; + pDevice->byBBPreEDIndex = 13; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n"); + } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55 + if(pDevice->byBBPreEDIndex == 12) break; + pDevice->byBBPreEDIndex = 12; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n"); + } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56 + if(pDevice->byBBPreEDIndex == 11) break; + pDevice->byBBPreEDIndex = 11; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n"); + } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57 + if(pDevice->byBBPreEDIndex == 10) break; + pDevice->byBBPreEDIndex = 10; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n"); + } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58 + if(pDevice->byBBPreEDIndex == 9) break; + pDevice->byBBPreEDIndex = 9; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n"); + } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59 + if(pDevice->byBBPreEDIndex == 8) break; + pDevice->byBBPreEDIndex = 8; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n"); + } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60 + if(pDevice->byBBPreEDIndex == 7) break; + pDevice->byBBPreEDIndex = 7; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n"); + } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61 + if(pDevice->byBBPreEDIndex == 6) break; + pDevice->byBBPreEDIndex = 6; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n"); + } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62 + if(pDevice->byBBPreEDIndex == 5) break; + pDevice->byBBPreEDIndex = 5; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n"); + } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63 + if(pDevice->byBBPreEDIndex == 4) break; + pDevice->byBBPreEDIndex = 4; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n"); + } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64 + if(pDevice->byBBPreEDIndex == 3) break; + pDevice->byBBPreEDIndex = 3; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n"); + } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65 + if(pDevice->byBBPreEDIndex == 2) break; + pDevice->byBBPreEDIndex = 2; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n"); + } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66 + if(pDevice->byBBPreEDIndex == 1) break; + pDevice->byBBPreEDIndex = 1; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n"); + } else { //RSSI -67, -68, ... + if(pDevice->byBBPreEDIndex == 0) break; + pDevice->byBBPreEDIndex = 0; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n"); + } + break; + + } + +} diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h index 79faedf4..ed55d9f 100644 --- a/drivers/staging/vt6656/baseband.h +++ b/drivers/staging/vt6656/baseband.h @@ -90,14 +90,14 @@ struct vnt_phy_field { unsigned int BBuGetFrameTime( - u8 byPreambleType, - u8 byFreqType, - unsigned int cbFrameLength, - u16 wRate - ); + u8 byPreambleType, + u8 byFreqType, + unsigned int cbFrameLength, + u16 wRate + ); void BBvCalculateParameter(struct vnt_private *, u32 cbFrameLength, - u16 wRate, u8 byPacketType, struct vnt_phy_field *); + u16 wRate, u8 byPacketType, struct vnt_phy_field *); /* timer for antenna diversity */ diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index 9c78dab..007901f 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -62,19 +62,19 @@ static int msglevel = MSG_LEVEL_INFO; /* static int msglevel = MSG_LEVEL_DEBUG; */ static 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} - }; + {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} +}; static 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}, - {RATE_48M, RATE_48M, RATE_24M, RATE_12M, RATE_12M}, - {RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M} - }; + {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}, + {RATE_48M, RATE_48M, RATE_24M, RATE_12M, RATE_12M}, + {RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M} +}; static void s_vCheckSensitivity(struct vnt_private *pDevice); static void s_vCheckPreEDThreshold(struct vnt_private *pDevice); @@ -88,8 +88,8 @@ static void s_uCalculateLinkQual(struct vnt_private *pDevice); * PTR to KnownBSS or NULL */ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, - u8 *pbyDesireBSSID, u8 *pbyDesireSSID, - CARD_PHY_TYPE ePhyType) + u8 *pbyDesireBSSID, u8 *pbyDesireSSID, + CARD_PHY_TYPE ePhyType) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; u8 *pbyBSSID = NULL; @@ -102,13 +102,13 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, if (pbyDesireBSSID) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID); + "BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID); if (!is_broadcast_ether_addr(pbyDesireBSSID) && - memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0) + memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0) pbyBSSID = pbyDesireBSSID; } if (pbyDesireSSID && - ((PWLAN_IE_SSID) pbyDesireSSID)->len != 0) + ((PWLAN_IE_SSID) pbyDesireSSID)->len != 0) pSSID = (PWLAN_IE_SSID) pbyDesireSSID; if (pbyBSSID && pDevice->bRoaming == false) { @@ -119,27 +119,27 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, pCurrBSS->bSelected = false; if (pCurrBSS->bActive && - pCurrBSS->bSelected == false && - ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) { + pCurrBSS->bSelected == false && + ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) { if (pSSID) { /* compare ssid */ if (!memcmp(pSSID->abySSID, - ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID, - pSSID->len) && - (pMgmt->eConfigMode == WMAC_CONFIG_AUTO || - (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA && - WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) || - (pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && - WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)))) { + ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID, + pSSID->len) && + (pMgmt->eConfigMode == WMAC_CONFIG_AUTO || + (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA && + WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) || + (pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && + WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)))) { pCurrBSS->bSelected = true; return pCurrBSS; } } else if (pMgmt->eConfigMode == WMAC_CONFIG_AUTO || - (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA && - WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) || - (pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && - WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) { + (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA && + WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) || + (pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && + WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) { pCurrBSS->bSelected = true; return pCurrBSS; } @@ -158,45 +158,45 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, if (pCurrBSS->bActive) { if (pSSID && - /* matched SSID */ - (memcmp(pSSID->abySSID, - ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID, - pSSID->len) || - pSSID->len != - ((PWLAN_IE_SSID) pCurrBSS->abySSID)->len)) { + /* matched SSID */ + (memcmp(pSSID->abySSID, + ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID, + pSSID->len) || + pSSID->len != + ((PWLAN_IE_SSID) pCurrBSS->abySSID)->len)) { /* SSID not match skip this BSS */ continue; } if ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA && - WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) || - (pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && - WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))) { + WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) || + (pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && + WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))) { /* Type not match skip this BSS */ DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "BSS type mismatch.... Config[%d] BSS[0x%04x]\n", - pMgmt->eConfigMode, - pCurrBSS->wCapInfo); + KERN_INFO "BSS type mismatch.... Config[%d] BSS[0x%04x]\n", + pMgmt->eConfigMode, + pCurrBSS->wCapInfo); continue; } if (ePhyType != PHY_TYPE_AUTO && - ((ePhyType == PHY_TYPE_11A && - PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse) || - (ePhyType != PHY_TYPE_11A && - PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) { + ((ePhyType == PHY_TYPE_11A && + PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse) || + (ePhyType != PHY_TYPE_11A && + PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) { /* PhyType not match skip this BSS */ DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Physical type mismatch.... ePhyType[%d] BSS[%d]\n", - ePhyType, - pCurrBSS->eNetworkTypeInUse); + KERN_INFO "Physical type mismatch.... ePhyType[%d] BSS[%d]\n", + ePhyType, + pCurrBSS->eNetworkTypeInUse); continue; } pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "BSSpSearchBSSList pSelect1[%pM]\n", - pCurrBSS->abyBSSID); + "BSSpSearchBSSList pSelect1[%pM]\n", + pCurrBSS->abyBSSID); jj++; if (!pSelect) @@ -214,89 +214,89 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, if (pDevice->bRoaming == false) { /* Einsn Add @20070907 */ memcpy(pbyDesireSSID, - pCurrBSS->abySSID, - WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + pCurrBSS->abySSID, + WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); } return pSelect; } + } + return NULL; + } - return NULL; -} + /* + * Routine Description: + * Clear BSS List + * + * Return Value: + * None. + */ + void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; -/* - * Routine Description: - * Clear BSS List - * - * Return Value: - * None. - */ -void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - int ii; - - for (ii = 0; ii < MAX_BSS_NUM; ii++) { - if (bKeepCurrBSSID && - pMgmt->sBSSList[ii].bActive && - ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, - pMgmt->abyCurrBSSID)) { - - /* mike mark: - * there are two BSSID's in list. If that AP is - * in hidden ssid mode, one SSID is null, but - * other's might not be obvious, so if it - * associate's with your STA, you must keep the - * two of them!! bKeepCurrBSSID = false; - */ - - continue; - } + for (ii = 0; ii < MAX_BSS_NUM; ii++) { + if (bKeepCurrBSSID && + pMgmt->sBSSList[ii].bActive && + ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, + pMgmt->abyCurrBSSID)) { + + /* mike mark: + * there are two BSSID's in list. If that AP is + * in hidden ssid mode, one SSID is null, but + * other's might not be obvious, so if it + * associate's with your STA, you must keep the + * two of them!! bKeepCurrBSSID = false; + */ + + continue; + } - pMgmt->sBSSList[ii].bActive = false; - memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS)); + pMgmt->sBSSList[ii].bActive = false; + memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS)); + } + BSSvClearAnyBSSJoinRecord(pDevice); } - BSSvClearAnyBSSJoinRecord(pDevice); -} -/* - * Routine Description: - * search BSS list by BSSID & SSID if matched - * - * Return Value: - * true if found. - */ -PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice, - u8 *abyBSSID, - PWLAN_IE_SSID pSSID) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - PKnownBSS pBSSList = NULL; - int ii; - - for (ii = 0; ii < MAX_BSS_NUM; ii++) { - pBSSList = &(pMgmt->sBSSList[ii]); - if (pBSSList->bActive && - ether_addr_equal(pBSSList->abyBSSID, abyBSSID) && - pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len && - memcmp(pSSID->abySSID, - ((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID, - pSSID->len) == 0) - return pBSSList; - } + /* + * Routine Description: + * search BSS list by BSSID & SSID if matched + * + * Return Value: + * true if found. + */ + PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice, + u8 *abyBSSID, + PWLAN_IE_SSID pSSID) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PKnownBSS pBSSList = NULL; + int ii; - return NULL; -} + for (ii = 0; ii < MAX_BSS_NUM; ii++) { + pBSSList = &(pMgmt->sBSSList[ii]); + if (pBSSList->bActive && + ether_addr_equal(pBSSList->abyBSSID, abyBSSID) && + pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len && + memcmp(pSSID->abySSID, + ((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID, + pSSID->len) == 0) + return pBSSList; + } -/* - * Routine Description: - * Insert a BSS set into known BSS list - * - * Return Value: - * true if success. - */ -int BSSbInsertToBSSList(struct vnt_private *pDevice, + return NULL; + } + + /* + * Routine Description: + * Insert a BSS set into known BSS list + * + * Return Value: + * true if success. + */ + int BSSbInsertToBSSList(struct vnt_private *pDevice, u8 *abyBSSIDAddr, u64 qwTimestamp, u16 wBeaconInterval, @@ -313,177 +313,177 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, u32 uIELength, u8 *pbyIEs, void *pRxPacketContext) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - struct vnt_rx_mgmt *pRxPacket = - (struct vnt_rx_mgmt *) pRxPacketContext; - PKnownBSS pBSSList = NULL; - unsigned int ii; - bool bParsingQuiet = false; - - pBSSList = (PKnownBSS) &(pMgmt->sBSSList[0]); - - for (ii = 0; ii < MAX_BSS_NUM; ii++) { - pBSSList = (PKnownBSS) &(pMgmt->sBSSList[ii]); - if (!pBSSList->bActive) - break; - } + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_rx_mgmt *pRxPacket = + (struct vnt_rx_mgmt *) pRxPacketContext; + PKnownBSS pBSSList = NULL; + unsigned int ii; + bool bParsingQuiet = false; - if (ii == MAX_BSS_NUM) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Get free KnowBSS node failed.\n"); - return false; - } - /* save the BSS info */ - pBSSList->bActive = true; - memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN); - pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); - pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); - pBSSList->wCapInfo = cpu_to_le16(wCapInfo); - pBSSList->uClearCount = 0; - - if (pSSID->len > WLAN_SSID_MAXLEN) - pSSID->len = WLAN_SSID_MAXLEN; - memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN); - - pBSSList->uChannel = byCurrChannel; - - if (pSuppRates->len > WLAN_RATES_MAXLEN) - pSuppRates->len = WLAN_RATES_MAXLEN; - memcpy(pBSSList->abySuppRates, pSuppRates, - pSuppRates->len + WLAN_IEHDR_LEN); - - if (pExtSuppRates) { - if (pExtSuppRates->len > WLAN_RATES_MAXLEN) - pExtSuppRates->len = WLAN_RATES_MAXLEN; - memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, - pExtSuppRates->len + WLAN_IEHDR_LEN); - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "BSSbInsertToBSSList: pExtSuppRates->len = %d\n", - pExtSuppRates->len); + pBSSList = (PKnownBSS) &(pMgmt->sBSSList[0]); - } else { - memset(pBSSList->abyExtSuppRates, 0, - WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); - } - pBSSList->sERP.byERP = psERP->byERP; - pBSSList->sERP.bERPExist = psERP->bERPExist; - - /* Check if BSS is 802.11a/b/g */ - if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) - pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; - else if (pBSSList->sERP.bERPExist == true) - pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; - else - pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; - - pBSSList->byRxRate = pRxPacket->byRxRate; - pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF; - pBSSList->uRSSI = pRxPacket->uRSSI; - pBSSList->bySQ = pRxPacket->bySQ; - - if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA && - pMgmt->eCurrState == WMAC_STATE_ASSOC && - /* assoc with BSS */ - pBSSList == pMgmt->pCurrBSS) - bParsingQuiet = true; - - WPA_ClearRSN(pBSSList); - - if (pRSNWPA) { - unsigned int uLen = pRSNWPA->len + 2; - - if (uLen <= (uIELength - - (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) { - pBSSList->wWPALen = uLen; - memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); - WPA_ParseRSN(pBSSList, pRSNWPA); + for (ii = 0; ii < MAX_BSS_NUM; ii++) { + pBSSList = (PKnownBSS) &(pMgmt->sBSSList[ii]); + if (!pBSSList->bActive) + break; } - } - WPA2_ClearRSN(pBSSList); + if (ii == MAX_BSS_NUM) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "Get free KnowBSS node failed.\n"); + return false; + } + /* save the BSS info */ + pBSSList->bActive = true; + memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN); + pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); + pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); + pBSSList->wCapInfo = cpu_to_le16(wCapInfo); + pBSSList->uClearCount = 0; + + if (pSSID->len > WLAN_SSID_MAXLEN) + pSSID->len = WLAN_SSID_MAXLEN; + memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN); + + pBSSList->uChannel = byCurrChannel; + + if (pSuppRates->len > WLAN_RATES_MAXLEN) + pSuppRates->len = WLAN_RATES_MAXLEN; + memcpy(pBSSList->abySuppRates, pSuppRates, + pSuppRates->len + WLAN_IEHDR_LEN); - if (pRSN) { - unsigned int uLen = pRSN->len + 2; + if (pExtSuppRates) { + if (pExtSuppRates->len > WLAN_RATES_MAXLEN) + pExtSuppRates->len = WLAN_RATES_MAXLEN; + memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, + pExtSuppRates->len + WLAN_IEHDR_LEN); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "BSSbInsertToBSSList: pExtSuppRates->len = %d\n", + pExtSuppRates->len); - if (uLen <= (uIELength - - (unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) { - pBSSList->wRSNLen = uLen; - memcpy(pBSSList->byRSNIE, pRSN, uLen); - WPA2vParseRSN(pBSSList, pRSN); + } else { + memset(pBSSList->abyExtSuppRates, 0, + WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); } - } + pBSSList->sERP.byERP = psERP->byERP; + pBSSList->sERP.bERPExist = psERP->bERPExist; + + /* Check if BSS is 802.11a/b/g */ + if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) + pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; + else if (pBSSList->sERP.bERPExist == true) + pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; + else + pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; - if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2 || - pBSSList->bWPA2Valid == true) { + pBSSList->byRxRate = pRxPacket->byRxRate; + pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF; + pBSSList->uRSSI = pRxPacket->uRSSI; + pBSSList->bySQ = pRxPacket->bySQ; - PSKeyItem pTransmitKey = NULL; - bool bIs802_1x = false; + if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA && + pMgmt->eCurrState == WMAC_STATE_ASSOC && + /* assoc with BSS */ + pBSSList == pMgmt->pCurrBSS) + bParsingQuiet = true; - for (ii = 0; ii < pBSSList->wAKMSSAuthCount; ii++) { - if (pBSSList->abyAKMSSAuthType[ii] == - WLAN_11i_AKMSS_802_1X) { - bIs802_1x = true; - break; + WPA_ClearRSN(pBSSList); + + if (pRSNWPA) { + unsigned int uLen = pRSNWPA->len + 2; + + if (uLen <= (uIELength - + (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) { + pBSSList->wWPALen = uLen; + memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); + WPA_ParseRSN(pBSSList, pRSNWPA); } } - if (bIs802_1x == true && - pSSID->len == ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->len && - !memcmp(pSSID->abySSID, - ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->abySSID, - pSSID->len)) { - - bAdd_PMKID_Candidate((void *) pDevice, - pBSSList->abyBSSID, - &pBSSList->sRSNCapObj); - - if (pDevice->bLinkPass == true && - pMgmt->eCurrState == WMAC_STATE_ASSOC && - (KeybGetTransmitKey(&(pDevice->sKey), - pDevice->abyBSSID, - PAIRWISE_KEY, - &pTransmitKey) == true || - KeybGetTransmitKey(&(pDevice->sKey), - pDevice->abyBSSID, - GROUP_KEY, - &pTransmitKey) == true)) { - pDevice->gsPMKIDCandidate.StatusType = - Ndis802_11StatusType_PMKID_CandidateList; - pDevice->gsPMKIDCandidate.Version = 1; + WPA2_ClearRSN(pBSSList); + + if (pRSN) { + unsigned int uLen = pRSN->len + 2; + if (uLen <= (uIELength - + (unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) { + pBSSList->wRSNLen = uLen; + memcpy(pBSSList->byRSNIE, pRSN, uLen); + WPA2vParseRSN(pBSSList, pRSN); } } - } - if (pDevice->bUpdateBBVGA) { - /* Monitor if RSSI is too strong. */ - pBSSList->byRSSIStatCnt = 0; - RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI), - &pBSSList->ldBmMAX); - pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX; - pBSSList->ldBmAverRange = pBSSList->ldBmMAX; - for (ii = 1; ii < RSSI_STAT_COUNT; ii++) - pBSSList->ldBmAverage[ii] = 0; - } + if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2 || + pBSSList->bWPA2Valid == true) { - pBSSList->uIELength = uIELength; - if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN) - pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN; - memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength); + PSKeyItem pTransmitKey = NULL; + bool bIs802_1x = false; - return true; -} + for (ii = 0; ii < pBSSList->wAKMSSAuthCount; ii++) { + if (pBSSList->abyAKMSSAuthType[ii] == + WLAN_11i_AKMSS_802_1X) { + bIs802_1x = true; + break; + } + } + if (bIs802_1x == true && + pSSID->len == ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->len && + !memcmp(pSSID->abySSID, + ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->abySSID, + pSSID->len)) { + + bAdd_PMKID_Candidate((void *) pDevice, + pBSSList->abyBSSID, + &pBSSList->sRSNCapObj); + + if (pDevice->bLinkPass == true && + pMgmt->eCurrState == WMAC_STATE_ASSOC && + (KeybGetTransmitKey(&(pDevice->sKey), + pDevice->abyBSSID, + PAIRWISE_KEY, + &pTransmitKey) == true || + KeybGetTransmitKey(&(pDevice->sKey), + pDevice->abyBSSID, + GROUP_KEY, + &pTransmitKey) == true)) { + pDevice->gsPMKIDCandidate.StatusType = + Ndis802_11StatusType_PMKID_CandidateList; + pDevice->gsPMKIDCandidate.Version = 1; -/* - * Routine Description: - * Update BSS set in known BSS list - * - * Return Value: - * true if success. - */ -/* TODO: input structure modify */ -int BSSbUpdateToBSSList(struct vnt_private *pDevice, + + } + } + } + + if (pDevice->bUpdateBBVGA) { + /* Monitor if RSSI is too strong. */ + pBSSList->byRSSIStatCnt = 0; + RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI), + &pBSSList->ldBmMAX); + pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX; + pBSSList->ldBmAverRange = pBSSList->ldBmMAX; + for (ii = 1; ii < RSSI_STAT_COUNT; ii++) + pBSSList->ldBmAverage[ii] = 0; + } + + pBSSList->uIELength = uIELength; + if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN) + pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN; + memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength); + + return true; + } + + /* + * Routine Description: + * Update BSS set in known BSS list + * + * Return Value: + * true if success. + */ + /* TODO: input structure modify */ + int BSSbUpdateToBSSList(struct vnt_private *pDevice, u64 qwTimestamp, u16 wBeaconInterval, u16 wCapInfo, @@ -501,977 +501,976 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, u32 uIELength, u8 *pbyIEs, void *pRxPacketContext) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - struct vnt_rx_mgmt *pRxPacket = - (struct vnt_rx_mgmt *) pRxPacketContext; - int ii, jj; - signed long ldBm, ldBmSum; - bool bParsingQuiet = false; - - if (!pBSSList) - return false; - - pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); - - pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); - pBSSList->wCapInfo = cpu_to_le16(wCapInfo); - pBSSList->uClearCount = 0; - pBSSList->uChannel = byCurrChannel; - - if (pSSID->len > WLAN_SSID_MAXLEN) - pSSID->len = WLAN_SSID_MAXLEN; - - if (pSSID->len != 0 && pSSID->abySSID[0] != 0) - memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN); - memcpy(pBSSList->abySuppRates, pSuppRates, - pSuppRates->len + WLAN_IEHDR_LEN); - - if (pExtSuppRates) - memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, - pExtSuppRates->len + WLAN_IEHDR_LEN); - else - memset(pBSSList->abyExtSuppRates, 0, - WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); - pBSSList->sERP.byERP = psERP->byERP; - pBSSList->sERP.bERPExist = psERP->bERPExist; - - /* Check if BSS is 802.11a/b/g */ - if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) - pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; - else if (pBSSList->sERP.bERPExist == true) - pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; - else - pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; - - pBSSList->byRxRate = pRxPacket->byRxRate; - pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF; - if (bChannelHit) - pBSSList->uRSSI = pRxPacket->uRSSI; - pBSSList->bySQ = pRxPacket->bySQ; - - if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA && - pMgmt->eCurrState == WMAC_STATE_ASSOC && - /* assoc with BSS */ - pBSSList == pMgmt->pCurrBSS) - bParsingQuiet = true; - - WPA_ClearRSN(pBSSList); /* mike update */ - - if (pRSNWPA) { - unsigned int uLen = pRSNWPA->len + 2; - if (uLen <= (uIELength - - (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) { - pBSSList->wWPALen = uLen; - memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); - WPA_ParseRSN(pBSSList, pRSNWPA); + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_rx_mgmt *pRxPacket = + (struct vnt_rx_mgmt *) pRxPacketContext; + int ii, jj; + signed long ldBm, ldBmSum; + bool bParsingQuiet = false; + + if (!pBSSList) + return false; + + pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); + + pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); + pBSSList->wCapInfo = cpu_to_le16(wCapInfo); + pBSSList->uClearCount = 0; + pBSSList->uChannel = byCurrChannel; + + if (pSSID->len > WLAN_SSID_MAXLEN) + pSSID->len = WLAN_SSID_MAXLEN; + + if (pSSID->len != 0 && pSSID->abySSID[0] != 0) + memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN); + memcpy(pBSSList->abySuppRates, pSuppRates, + pSuppRates->len + WLAN_IEHDR_LEN); + + if (pExtSuppRates) + memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, + pExtSuppRates->len + WLAN_IEHDR_LEN); + else + memset(pBSSList->abyExtSuppRates, 0, + WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); + pBSSList->sERP.byERP = psERP->byERP; + pBSSList->sERP.bERPExist = psERP->bERPExist; + + /* Check if BSS is 802.11a/b/g */ + if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) + pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; + else if (pBSSList->sERP.bERPExist == true) + pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; + else + pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; + + pBSSList->byRxRate = pRxPacket->byRxRate; + pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF; + if (bChannelHit) + pBSSList->uRSSI = pRxPacket->uRSSI; + pBSSList->bySQ = pRxPacket->bySQ; + + if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA && + pMgmt->eCurrState == WMAC_STATE_ASSOC && + /* assoc with BSS */ + pBSSList == pMgmt->pCurrBSS) + bParsingQuiet = true; + + WPA_ClearRSN(pBSSList); /* mike update */ + + if (pRSNWPA) { + unsigned int uLen = pRSNWPA->len + 2; + if (uLen <= (uIELength - + (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) { + pBSSList->wWPALen = uLen; + memcpy(pBSSList->byWPAIE, pRSNWPA, uLen); + WPA_ParseRSN(pBSSList, pRSNWPA); + } } - } - WPA2_ClearRSN(pBSSList); /* mike update */ + WPA2_ClearRSN(pBSSList); /* mike update */ - if (pRSN) { - unsigned int uLen = pRSN->len + 2; - if (uLen <= (uIELength - - (unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) { - pBSSList->wRSNLen = uLen; - memcpy(pBSSList->byRSNIE, pRSN, uLen); - WPA2vParseRSN(pBSSList, pRSN); + if (pRSN) { + unsigned int uLen = pRSN->len + 2; + if (uLen <= (uIELength - + (unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) { + pBSSList->wRSNLen = uLen; + memcpy(pBSSList->byRSNIE, pRSN, uLen); + WPA2vParseRSN(pBSSList, pRSN); + } } - } - if (pRxPacket->uRSSI != 0) { - RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI), &ldBm); - /* Monitor if RSSI is too strong. */ - pBSSList->byRSSIStatCnt++; - pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT; - pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm; - ldBmSum = 0; - for (ii = 0, jj = 0; ii < RSSI_STAT_COUNT; ii++) { - if (pBSSList->ldBmAverage[ii] != 0) { - pBSSList->ldBmMAX = - max(pBSSList->ldBmAverage[ii], ldBm); - ldBmSum += - pBSSList->ldBmAverage[ii]; - jj++; + if (pRxPacket->uRSSI != 0) { + RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI), &ldBm); + /* Monitor if RSSI is too strong. */ + pBSSList->byRSSIStatCnt++; + pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT; + pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm; + ldBmSum = 0; + for (ii = 0, jj = 0; ii < RSSI_STAT_COUNT; ii++) { + if (pBSSList->ldBmAverage[ii] != 0) { + pBSSList->ldBmMAX = + max(pBSSList->ldBmAverage[ii], ldBm); + ldBmSum += + pBSSList->ldBmAverage[ii]; + jj++; + } } + pBSSList->ldBmAverRange = ldBmSum / jj; } - pBSSList->ldBmAverRange = ldBmSum / jj; - } - pBSSList->uIELength = uIELength; - if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN) - pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN; - memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength); + pBSSList->uIELength = uIELength; + if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN) + pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN; + memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength); - return true; -} - -/* - * Routine Description: - * Search Node DB table to find the index of matched DstAddr - * - * Return Value: - * None - */ -int BSSbIsSTAInNodeDB(struct vnt_private *pDevice, - u8 *abyDstAddr, - u32 *puNodeIndex) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - unsigned int ii; + return true; + } - /* Index = 0 reserved for AP Node */ - for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { - if (pMgmt->sNodeDBTable[ii].bActive && - ether_addr_equal(abyDstAddr, - pMgmt->sNodeDBTable[ii].abyMACAddr)) { - *puNodeIndex = ii; - return true; + /* + * Routine Description: + * Search Node DB table to find the index of matched DstAddr + * + * Return Value: + * None + */ + int BSSbIsSTAInNodeDB(struct vnt_private *pDevice, + u8 *abyDstAddr, + u32 *puNodeIndex) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + unsigned int ii; + + /* Index = 0 reserved for AP Node */ + for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { + if (pMgmt->sNodeDBTable[ii].bActive && + ether_addr_equal(abyDstAddr, + pMgmt->sNodeDBTable[ii].abyMACAddr)) { + *puNodeIndex = ii; + return true; + } } - } - return false; -}; + return false; + }; + + /* + * Routine Description: + * Find an empty node and allocate it; if no empty node + * is found, then use the most inactive one. + * + * Return Value: + * None + */ + void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; + u32 BigestCount = 0; + u32 SelectIndex; + struct sk_buff *skb; + + /* Index = 0 reserved for AP Node (In STA mode) + Index = 0 reserved for Broadcast/MultiCast (In AP mode) */ + SelectIndex = 1; + for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { + if (pMgmt->sNodeDBTable[ii].bActive) { + if (pMgmt->sNodeDBTable[ii].uInActiveCount > BigestCount) { + BigestCount = + pMgmt->sNodeDBTable[ii].uInActiveCount; + SelectIndex = ii; + } + } else { + break; + } + } -/* - * Routine Description: - * Find an empty node and allocate it; if no empty node - * is found, then use the most inactive one. - * - * Return Value: - * None - */ -void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - int ii; - u32 BigestCount = 0; - u32 SelectIndex; - struct sk_buff *skb; - - /* Index = 0 reserved for AP Node (In STA mode) - Index = 0 reserved for Broadcast/MultiCast (In AP mode) */ - SelectIndex = 1; - for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { - if (pMgmt->sNodeDBTable[ii].bActive) { - if (pMgmt->sNodeDBTable[ii].uInActiveCount > BigestCount) { - BigestCount = - pMgmt->sNodeDBTable[ii].uInActiveCount; - SelectIndex = ii; + /* if not found replace uInActiveCount with the largest one. */ + if (ii == (MAX_NODE_NUM + 1)) { + *puNodeIndex = SelectIndex; + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "Replace inactive node = %d\n", SelectIndex); + /* clear ps buffer */ + if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next) { + while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue))) + dev_kfree_skb(skb); } } else { - break; + *puNodeIndex = ii; } - } - /* if not found replace uInActiveCount with the largest one. */ - if (ii == (MAX_NODE_NUM + 1)) { - *puNodeIndex = SelectIndex; - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Replace inactive node = %d\n", SelectIndex); - /* clear ps buffer */ - if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next) { - while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue))) - dev_kfree_skb(skb); - } - } else { - *puNodeIndex = ii; + memset(&pMgmt->sNodeDBTable[*puNodeIndex], 0, sizeof(KnownNodeDB)); + pMgmt->sNodeDBTable[*puNodeIndex].bActive = true; + pMgmt->sNodeDBTable[*puNodeIndex].uRatePollTimeout = FALLBACK_POLL_SECOND; + /* for AP mode PS queue */ + skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue); + pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0; + pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii); } - memset(&pMgmt->sNodeDBTable[*puNodeIndex], 0, sizeof(KnownNodeDB)); - pMgmt->sNodeDBTable[*puNodeIndex].bActive = true; - pMgmt->sNodeDBTable[*puNodeIndex].uRatePollTimeout = FALLBACK_POLL_SECOND; - /* for AP mode PS queue */ - skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue); - pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0; - pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii); -} - -/* - * Routine Description: - * Remove Node by NodeIndex - * - * - * Return Value: - * None - */ -void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; - struct sk_buff *skb; - - while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue))) - dev_kfree_skb(skb); - /* clear context */ - memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB)); - /* clear tx bit map */ - pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &= - ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7]; -} - -/* - * Routine Description: - * Update AP Node content in Index 0 of KnownNodeDB - * - * - * Return Value: - * None - */ -void BSSvUpdateAPNode(struct vnt_private *pDevice, - u16 *pwCapInfo, - PWLAN_IE_SUPP_RATES pSuppRates, - PWLAN_IE_SUPP_RATES pExtSuppRates) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - u32 uRateLen = WLAN_RATES_MAXLEN; - - memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); - - pMgmt->sNodeDBTable[0].bActive = true; - if (pDevice->byBBType == BB_TYPE_11B) - uRateLen = WLAN_RATES_MAXLEN_11B; - pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pSuppRates, - (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates, - uRateLen); - pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pExtSuppRates, - (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates, - uRateLen); - RATEvParseMaxRate((void *) pDevice, - (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates, - true, - &(pMgmt->sNodeDBTable[0].wMaxBasicRate), - &(pMgmt->sNodeDBTable[0].wMaxSuppRate), - &(pMgmt->sNodeDBTable[0].wSuppRate), - &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), - &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate)); - memcpy(pMgmt->sNodeDBTable[0].abyMACAddr, pMgmt->abyCurrBSSID, - WLAN_ADDR_LEN); - pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxSuppRate; - pMgmt->sNodeDBTable[0].bShortPreamble = - WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo); - pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND; - /* Auto rate fallback function initiation. - * RATEbInit(pDevice); */ - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d\n", - pMgmt->sNodeDBTable[0].wTxDataRate); - -} + /* + * Routine Description: + * Remove Node by NodeIndex + * + * + * Return Value: + * None + */ + void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; + struct sk_buff *skb; + + while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue))) + dev_kfree_skb(skb); + /* clear context */ + memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB)); + /* clear tx bit map */ + pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &= + ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7]; + } -/* - * Routine Description: - * Add Multicast Node content in Index 0 of KnownNodeDB - * - * - * Return Value: - * None - */ -void BSSvAddMulticastNode(struct vnt_private *pDevice) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + /* + * Routine Description: + * Update AP Node content in Index 0 of KnownNodeDB + * + * + * Return Value: + * None + */ + void BSSvUpdateAPNode(struct vnt_private *pDevice, + u16 *pwCapInfo, + PWLAN_IE_SUPP_RATES pSuppRates, + PWLAN_IE_SUPP_RATES pExtSuppRates) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u32 uRateLen = WLAN_RATES_MAXLEN; - if (!pDevice->bEnableHostWEP) memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); - memset(pMgmt->sNodeDBTable[0].abyMACAddr, 0xff, WLAN_ADDR_LEN); - pMgmt->sNodeDBTable[0].bActive = true; - pMgmt->sNodeDBTable[0].bPSEnable = false; - skb_queue_head_init(&pMgmt->sNodeDBTable[0].sTxPSQueue); - RATEvParseMaxRate((void *) pDevice, - (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates, - true, - &(pMgmt->sNodeDBTable[0].wMaxBasicRate), - &(pMgmt->sNodeDBTable[0].wMaxSuppRate), - &(pMgmt->sNodeDBTable[0].wSuppRate), - &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), - &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate)); - pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxBasicRate; - pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND; - -} - -/* - * Routine Description: - * - * - * Second call back function to update Node DB info & AP link status - * - * - * Return Value: - * none. - */ -void BSSvSecondCallBack(struct work_struct *work) -{ - struct vnt_private *pDevice = container_of(work, - struct vnt_private, second_callback_work.work); - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - int ii; - PWLAN_IE_SSID pItemSSID, pCurrSSID; - u32 uSleepySTACnt = 0; - u32 uNonShortSlotSTACnt = 0; - u32 uLongPreambleSTACnt = 0; - - if (pDevice->Flags & fMP_DISCONNECTED) - return; - - spin_lock_irq(&pDevice->lock); - pDevice->uAssocCount = 0; + pMgmt->sNodeDBTable[0].bActive = true; + if (pDevice->byBBType == BB_TYPE_11B) + uRateLen = WLAN_RATES_MAXLEN_11B; + pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pSuppRates, + (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates, + uRateLen); + pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pExtSuppRates, + (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates, + uRateLen); + RATEvParseMaxRate((void *) pDevice, + (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates, + true, + &(pMgmt->sNodeDBTable[0].wMaxBasicRate), + &(pMgmt->sNodeDBTable[0].wMaxSuppRate), + &(pMgmt->sNodeDBTable[0].wSuppRate), + &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), + &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate)); + memcpy(pMgmt->sNodeDBTable[0].abyMACAddr, pMgmt->abyCurrBSSID, + WLAN_ADDR_LEN); + pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxSuppRate; + pMgmt->sNodeDBTable[0].bShortPreamble = + WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo); + pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND; + /* Auto rate fallback function initiation. + * RATEbInit(pDevice); */ + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d\n", + pMgmt->sNodeDBTable[0].wTxDataRate); - /* Power Saving Mode Tx Burst */ - if (pDevice->bEnablePSMode == true) { - pDevice->ulPSModeWaitTx++; - if (pDevice->ulPSModeWaitTx >= 2) { - pDevice->ulPSModeWaitTx = 0; - pDevice->bPSModeTxBurst = false; - } } - pDevice->byERPFlag &= - ~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1)); + /* + * Routine Description: + * Add Multicast Node content in Index 0 of KnownNodeDB + * + * + * Return Value: + * None + */ + void BSSvAddMulticastNode(struct vnt_private *pDevice) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + + if (!pDevice->bEnableHostWEP) + memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); + memset(pMgmt->sNodeDBTable[0].abyMACAddr, 0xff, WLAN_ADDR_LEN); + pMgmt->sNodeDBTable[0].bActive = true; + pMgmt->sNodeDBTable[0].bPSEnable = false; + skb_queue_head_init(&pMgmt->sNodeDBTable[0].sTxPSQueue); + RATEvParseMaxRate((void *) pDevice, + (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates, + true, + &(pMgmt->sNodeDBTable[0].wMaxBasicRate), + &(pMgmt->sNodeDBTable[0].wMaxSuppRate), + &(pMgmt->sNodeDBTable[0].wSuppRate), + &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), + &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate)); + pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxBasicRate; + pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND; - if (pDevice->wUseProtectCntDown > 0) { - pDevice->wUseProtectCntDown--; - } else { - /* disable protect mode */ - pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1)); } - if (pDevice->byReAssocCount > 0) { - pDevice->byReAssocCount++; - if (pDevice->byReAssocCount > 10 && - pDevice->bLinkPass != true) { /* 10 sec timeout */ - printk("Re-association timeout!!!\n"); - pDevice->byReAssocCount = 0; - /* if (pDevice->bWPASuppWextEnabled == true) */ - { - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); - wireless_send_event(pDevice->dev, SIOCGIWAP, - &wrqu, NULL); + /* + * Routine Description: + * + * + * Second call back function to update Node DB info & AP link status + * + * + * Return Value: + * none. + */ + void BSSvSecondCallBack(struct work_struct *work) + { + struct vnt_private *pDevice = container_of(work, + struct vnt_private, second_callback_work.work); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; + PWLAN_IE_SSID pItemSSID, pCurrSSID; + u32 uSleepySTACnt = 0; + u32 uNonShortSlotSTACnt = 0; + u32 uLongPreambleSTACnt = 0; + + if (pDevice->Flags & fMP_DISCONNECTED) + return; + + spin_lock_irq(&pDevice->lock); + + pDevice->uAssocCount = 0; + + /* Power Saving Mode Tx Burst */ + if (pDevice->bEnablePSMode == true) { + pDevice->ulPSModeWaitTx++; + if (pDevice->ulPSModeWaitTx >= 2) { + pDevice->ulPSModeWaitTx = 0; + pDevice->bPSModeTxBurst = false; } - } else if (pDevice->bLinkPass == true) { - pDevice->byReAssocCount = 0; } - } - pMgmt->eLastState = pMgmt->eCurrState; + pDevice->byERPFlag &= + ~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1)); - s_uCalculateLinkQual(pDevice); + if (pDevice->wUseProtectCntDown > 0) { + pDevice->wUseProtectCntDown--; + } else { + /* disable protect mode */ + pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1)); + } - for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { + if (pDevice->byReAssocCount > 0) { + pDevice->byReAssocCount++; + if (pDevice->byReAssocCount > 10 && + pDevice->bLinkPass != true) { /* 10 sec timeout */ + printk("Re-association timeout!!!\n"); + pDevice->byReAssocCount = 0; + /* if (pDevice->bWPASuppWextEnabled == true) */ + { + union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); + wireless_send_event(pDevice->dev, SIOCGIWAP, + &wrqu, NULL); + } + } else if (pDevice->bLinkPass == true) { + pDevice->byReAssocCount = 0; + } + } - if (pMgmt->sNodeDBTable[ii].bActive) { - /* Increase in-activity counter */ - pMgmt->sNodeDBTable[ii].uInActiveCount++; + pMgmt->eLastState = pMgmt->eCurrState; - if (ii > 0) { - if (pMgmt->sNodeDBTable[ii].uInActiveCount > - MAX_INACTIVE_COUNT) { - BSSvRemoveOneNode(pDevice, ii); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Inactive timeout [%d] sec, STA index = [%d] remove\n", - MAX_INACTIVE_COUNT, ii); - continue; - } + s_uCalculateLinkQual(pDevice); - if (pMgmt->sNodeDBTable[ii].eNodeState >= - NODE_ASSOC) { + for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { - pDevice->uAssocCount++; + if (pMgmt->sNodeDBTable[ii].bActive) { + /* Increase in-activity counter */ + pMgmt->sNodeDBTable[ii].uInActiveCount++; - /* check if Non ERP exist */ - if (pMgmt->sNodeDBTable[ii].uInActiveCount < - ERP_RECOVER_COUNT) { - if (!pMgmt->sNodeDBTable[ii].bShortPreamble) { - pDevice->byERPFlag |= - WLAN_SET_ERP_BARKER_MODE(1); - uLongPreambleSTACnt++; - } - if (!pMgmt->sNodeDBTable[ii].bERPExist) { - pDevice->byERPFlag |= - WLAN_SET_ERP_NONERP_PRESENT(1); - pDevice->byERPFlag |= - WLAN_SET_ERP_USE_PROTECTION(1); - } - if (!pMgmt->sNodeDBTable[ii].bShortSlotTime) - uNonShortSlotSTACnt++; + if (ii > 0) { + if (pMgmt->sNodeDBTable[ii].uInActiveCount > + MAX_INACTIVE_COUNT) { + BSSvRemoveOneNode(pDevice, ii); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "Inactive timeout [%d] sec, STA index = [%d] remove\n", + MAX_INACTIVE_COUNT, ii); + continue; } - } - /* check if any STA in PS mode */ - if (pMgmt->sNodeDBTable[ii].bPSEnable) - uSleepySTACnt++; + if (pMgmt->sNodeDBTable[ii].eNodeState >= + NODE_ASSOC) { + + pDevice->uAssocCount++; + + /* check if Non ERP exist */ + if (pMgmt->sNodeDBTable[ii].uInActiveCount < + ERP_RECOVER_COUNT) { + if (!pMgmt->sNodeDBTable[ii].bShortPreamble) { + pDevice->byERPFlag |= + WLAN_SET_ERP_BARKER_MODE(1); + uLongPreambleSTACnt++; + } + if (!pMgmt->sNodeDBTable[ii].bERPExist) { + pDevice->byERPFlag |= + WLAN_SET_ERP_NONERP_PRESENT(1); + pDevice->byERPFlag |= + WLAN_SET_ERP_USE_PROTECTION(1); + } + if (!pMgmt->sNodeDBTable[ii].bShortSlotTime) + uNonShortSlotSTACnt++; + } + } - } + /* check if any STA in PS mode */ + if (pMgmt->sNodeDBTable[ii].bPSEnable) + uSleepySTACnt++; - /* Rate fallback check */ - if (!pDevice->bFixRate) { - if (ii > 0) { - /* ii = 0 for multicast node (AP & Adhoc) */ - RATEvTxRateFallBack((void *) pDevice, - &(pMgmt->sNodeDBTable[ii])); - } else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { - /* ii = 0 reserved for unicast AP node (Infra STA) */ - RATEvTxRateFallBack((void *) pDevice, - &(pMgmt->sNodeDBTable[ii])); } - } + /* Rate fallback check */ + if (!pDevice->bFixRate) { + if (ii > 0) { + /* ii = 0 for multicast node (AP & Adhoc) */ + RATEvTxRateFallBack((void *) pDevice, + &(pMgmt->sNodeDBTable[ii])); + } else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { + /* ii = 0 reserved for unicast AP node (Infra STA) */ + RATEvTxRateFallBack((void *) pDevice, + &(pMgmt->sNodeDBTable[ii])); + } - /* check if pending PS queue */ - if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Index= %d, Queue = %d pending\n", - ii, - pMgmt->sNodeDBTable[ii].wEnQueueCnt); - if (ii > 0 && - pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15) { - BSSvRemoveOneNode(pDevice, ii); - DBG_PRT(MSG_LEVEL_NOTICE, - KERN_INFO "Pending many queues PS STA Index = %d remove\n", - ii); - continue; + } + + /* check if pending PS queue */ + if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "Index= %d, Queue = %d pending\n", + ii, + pMgmt->sNodeDBTable[ii].wEnQueueCnt); + if (ii > 0 && + pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15) { + BSSvRemoveOneNode(pDevice, ii); + DBG_PRT(MSG_LEVEL_NOTICE, + KERN_INFO "Pending many queues PS STA Index = %d remove\n", + ii); + continue; + } } } - } - } + } - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && - pDevice->byBBType == BB_TYPE_11G) { + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && + pDevice->byBBType == BB_TYPE_11G) { - /* on/off protect mode */ - if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) { - if (!pDevice->bProtectMode) { - MACvEnableProtectMD(pDevice); - pDevice->bProtectMode = true; + /* on/off protect mode */ + if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) { + if (!pDevice->bProtectMode) { + MACvEnableProtectMD(pDevice); + pDevice->bProtectMode = true; + } + } else if (pDevice->bProtectMode) { + MACvDisableProtectMD(pDevice); + pDevice->bProtectMode = false; } - } else if (pDevice->bProtectMode) { - MACvDisableProtectMD(pDevice); - pDevice->bProtectMode = false; - } - /* on/off short slot time */ + /* on/off short slot time */ - if (uNonShortSlotSTACnt > 0) { - if (pDevice->bShortSlotTime) { - pDevice->bShortSlotTime = false; - BBvSetShortSlotTime(pDevice); - vUpdateIFS((void *) pDevice); - } - } else if (!pDevice->bShortSlotTime) { + if (uNonShortSlotSTACnt > 0) { + if (pDevice->bShortSlotTime) { + pDevice->bShortSlotTime = false; + BBvSetShortSlotTime(pDevice); + vUpdateIFS((void *) pDevice); + } + } else if (!pDevice->bShortSlotTime) { pDevice->bShortSlotTime = true; BBvSetShortSlotTime(pDevice); vUpdateIFS((void *) pDevice); - } + } - /* on/off barker long preamble mode */ + /* on/off barker long preamble mode */ - if (uLongPreambleSTACnt > 0) { - if (!pDevice->bBarkerPreambleMd) { - MACvEnableBarkerPreambleMd(pDevice); - pDevice->bBarkerPreambleMd = true; - } - } else if (pDevice->bBarkerPreambleMd) { + if (uLongPreambleSTACnt > 0) { + if (!pDevice->bBarkerPreambleMd) { + MACvEnableBarkerPreambleMd(pDevice); + pDevice->bBarkerPreambleMd = true; + } + } else if (pDevice->bBarkerPreambleMd) { MACvDisableBarkerPreambleMd(pDevice); pDevice->bBarkerPreambleMd = false; + } + } - } + /* Check if any STA in PS mode, enable DTIM multicast deliver */ + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + if (uSleepySTACnt > 0) + pMgmt->sNodeDBTable[0].bPSEnable = true; + else + pMgmt->sNodeDBTable[0].bPSEnable = false; + } - /* Check if any STA in PS mode, enable DTIM multicast deliver */ - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - if (uSleepySTACnt > 0) - pMgmt->sNodeDBTable[0].bPSEnable = true; - else - pMgmt->sNodeDBTable[0].bPSEnable = false; - } + pItemSSID = (PWLAN_IE_SSID) pMgmt->abyDesireSSID; + pCurrSSID = (PWLAN_IE_SSID) pMgmt->abyCurrSSID; - pItemSSID = (PWLAN_IE_SSID) pMgmt->abyDesireSSID; - pCurrSSID = (PWLAN_IE_SSID) pMgmt->abyCurrSSID; + if (pMgmt->eCurrMode == WMAC_MODE_STANDBY || + pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { - if (pMgmt->eCurrMode == WMAC_MODE_STANDBY || - pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { + if (pMgmt->sNodeDBTable[0].bActive) { /* Assoc with BSS */ - if (pMgmt->sNodeDBTable[0].bActive) { /* Assoc with BSS */ + if (pDevice->bUpdateBBVGA) { + s_vCheckSensitivity(pDevice); + s_vCheckPreEDThreshold(pDevice); + } - if (pDevice->bUpdateBBVGA) { - s_vCheckSensitivity(pDevice); - s_vCheckPreEDThreshold(pDevice); - } + if (pMgmt->sNodeDBTable[0].uInActiveCount >= + (LOST_BEACON_COUNT/2) && + pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) { + pDevice->byBBVGANew = pDevice->abyBBVGA[0]; + bScheduleCommand((void *) pDevice, + WLAN_CMD_CHANGE_BBSENSITIVITY, + NULL); + } - if (pMgmt->sNodeDBTable[0].uInActiveCount >= - (LOST_BEACON_COUNT/2) && - pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) { - pDevice->byBBVGANew = pDevice->abyBBVGA[0]; - bScheduleCommand((void *) pDevice, - WLAN_CMD_CHANGE_BBSENSITIVITY, - NULL); - } + if (pMgmt->sNodeDBTable[0].uInActiveCount >= + LOST_BEACON_COUNT) { + pMgmt->sNodeDBTable[0].bActive = false; + pMgmt->eCurrMode = WMAC_MODE_STANDBY; + pMgmt->eCurrState = WMAC_STATE_IDLE; + netif_stop_queue(pDevice->dev); + pDevice->bLinkPass = false; + ControlvMaskByte(pDevice, + MESSAGE_REQUEST_MACREG, + MAC_REG_PAPEDELAY, LEDSTS_STS, + LEDSTS_SLOW); + pDevice->bRoaming = true; + pDevice->bIsRoaming = false; - if (pMgmt->sNodeDBTable[0].uInActiveCount >= - LOST_BEACON_COUNT) { - pMgmt->sNodeDBTable[0].bActive = false; - pMgmt->eCurrMode = WMAC_MODE_STANDBY; - pMgmt->eCurrState = WMAC_STATE_IDLE; - netif_stop_queue(pDevice->dev); - pDevice->bLinkPass = false; - ControlvMaskByte(pDevice, - MESSAGE_REQUEST_MACREG, - MAC_REG_PAPEDELAY, LEDSTS_STS, - LEDSTS_SLOW); - pDevice->bRoaming = true; - pDevice->bIsRoaming = false; - - DBG_PRT(MSG_LEVEL_NOTICE, - KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", - pMgmt->sNodeDBTable[0].uInActiveCount); - /* let wpa supplicant know AP may disconnect */ - { - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof(wrqu)); + DBG_PRT(MSG_LEVEL_NOTICE, + KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", + pMgmt->sNodeDBTable[0].uInActiveCount); + /* let wpa supplicant know AP may disconnect */ + { + union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; - PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); - wireless_send_event(pDevice->dev, - SIOCGIWAP, - &wrqu, - NULL); + PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); + wireless_send_event(pDevice->dev, + SIOCGIWAP, + &wrqu, + NULL); + } } - } - } else if (pItemSSID->len != 0) { - /* Davidwang */ - if ((pDevice->bEnableRoaming == true) && - (!(pMgmt->Cisco_cckm))) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "bRoaming %d, !\n", - pDevice->bRoaming); - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "bIsRoaming %d, !\n", - pDevice->bIsRoaming); - if ((pDevice->bRoaming == true) && - (pDevice->bIsRoaming == true)) { + } else if (pItemSSID->len != 0) { + /* Davidwang */ + if ((pDevice->bEnableRoaming == true) && + (!(pMgmt->Cisco_cckm))) { DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Fast Roaming ...\n"); + KERN_INFO "bRoaming %d, !\n", + pDevice->bRoaming); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "bIsRoaming %d, !\n", + pDevice->bIsRoaming); + if ((pDevice->bRoaming == true) && + (pDevice->bIsRoaming == true)) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "Fast Roaming ...\n"); + BSSvClearBSSList((void *) pDevice, + pDevice->bLinkPass); + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, + pMgmt->abyDesireSSID); + pDevice->uAutoReConnectTime = 0; + pDevice->uIsroamingTime = 0; + pDevice->bRoaming = false; + } else if (pDevice->bRoaming == false && + pDevice->bIsRoaming == true) { + pDevice->uIsroamingTime++; + if (pDevice->uIsroamingTime >= 20) + pDevice->bIsRoaming = false; + } + } else if (pDevice->uAutoReConnectTime < 10) { + pDevice->uAutoReConnectTime++; + /* network manager support need not do Roaming scan??? */ + if (pDevice->bWPASuppWextEnabled == true) + pDevice->uAutoReConnectTime = 0; + } else { + /* mike use old encryption status for wpa reauthen */ + if (pDevice->bWPADEVUp) + pDevice->eEncryptionStatus = + pDevice->eOldEncryptionStatus; + + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "Roaming ...\n"); BSSvClearBSSList((void *) pDevice, - pDevice->bLinkPass); + pDevice->bLinkPass); + pMgmt->eScanType = WMAC_SCAN_ACTIVE; bScheduleCommand((void *) pDevice, - WLAN_CMD_BSSID_SCAN, - pMgmt->abyDesireSSID); + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); bScheduleCommand((void *) pDevice, - WLAN_CMD_SSID, - pMgmt->abyDesireSSID); + WLAN_CMD_SSID, + pMgmt->abyDesireSSID); pDevice->uAutoReConnectTime = 0; - pDevice->uIsroamingTime = 0; - pDevice->bRoaming = false; - } else if (pDevice->bRoaming == false && - pDevice->bIsRoaming == true) { - pDevice->uIsroamingTime++; - if (pDevice->uIsroamingTime >= 20) - pDevice->bIsRoaming = false; } - } else if (pDevice->uAutoReConnectTime < 10) { - pDevice->uAutoReConnectTime++; - /* network manager support need not do Roaming scan??? */ - if (pDevice->bWPASuppWextEnabled == true) - pDevice->uAutoReConnectTime = 0; - } else { - /* mike use old encryption status for wpa reauthen */ - if (pDevice->bWPADEVUp) - pDevice->eEncryptionStatus = - pDevice->eOldEncryptionStatus; - - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Roaming ...\n"); - BSSvClearBSSList((void *) pDevice, - pDevice->bLinkPass); - pMgmt->eScanType = WMAC_SCAN_ACTIVE; - bScheduleCommand((void *) pDevice, - WLAN_CMD_BSSID_SCAN, - pMgmt->abyDesireSSID); - bScheduleCommand((void *) pDevice, - WLAN_CMD_SSID, - pMgmt->abyDesireSSID); - pDevice->uAutoReConnectTime = 0; } } - } - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - /* if adhoc started which essid is NULL string, rescanning. */ - if (pMgmt->eCurrState == WMAC_STATE_STARTED && - pCurrSSID->len == 0) { - if (pDevice->uAutoReConnectTime < 10) { - pDevice->uAutoReConnectTime++; - } else { - DBG_PRT(MSG_LEVEL_NOTICE, - KERN_INFO "Adhoc re-scanning ...\n"); - pMgmt->eScanType = WMAC_SCAN_ACTIVE; - bScheduleCommand((void *) pDevice, - WLAN_CMD_BSSID_SCAN, NULL); - bScheduleCommand((void *) pDevice, - WLAN_CMD_SSID, NULL); - pDevice->uAutoReConnectTime = 0; + if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + /* if adhoc started which essid is NULL string, rescanning. */ + if (pMgmt->eCurrState == WMAC_STATE_STARTED && + pCurrSSID->len == 0) { + if (pDevice->uAutoReConnectTime < 10) { + pDevice->uAutoReConnectTime++; + } else { + DBG_PRT(MSG_LEVEL_NOTICE, + KERN_INFO "Adhoc re-scanning ...\n"); + pMgmt->eScanType = WMAC_SCAN_ACTIVE; + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, NULL); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, NULL); + pDevice->uAutoReConnectTime = 0; + } } - } - if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { + if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { - if (pDevice->bUpdateBBVGA) { - s_vCheckSensitivity(pDevice); - s_vCheckPreEDThreshold(pDevice); - } - if (pMgmt->sNodeDBTable[0].uInActiveCount >= + if (pDevice->bUpdateBBVGA) { + s_vCheckSensitivity(pDevice); + s_vCheckPreEDThreshold(pDevice); + } + if (pMgmt->sNodeDBTable[0].uInActiveCount >= ADHOC_LOST_BEACON_COUNT) { - DBG_PRT(MSG_LEVEL_NOTICE, - KERN_INFO "Lost other STA beacon [%d] sec, started !\n", - pMgmt->sNodeDBTable[0].uInActiveCount); - pMgmt->sNodeDBTable[0].uInActiveCount = 0; - pMgmt->eCurrState = WMAC_STATE_STARTED; - netif_stop_queue(pDevice->dev); - pDevice->bLinkPass = false; - ControlvMaskByte(pDevice, - MESSAGE_REQUEST_MACREG, - MAC_REG_PAPEDELAY, LEDSTS_STS, - LEDSTS_SLOW); + DBG_PRT(MSG_LEVEL_NOTICE, + KERN_INFO "Lost other STA beacon [%d] sec, started !\n", + pMgmt->sNodeDBTable[0].uInActiveCount); + pMgmt->sNodeDBTable[0].uInActiveCount = 0; + pMgmt->eCurrState = WMAC_STATE_STARTED; + netif_stop_queue(pDevice->dev); + pDevice->bLinkPass = false; + ControlvMaskByte(pDevice, + MESSAGE_REQUEST_MACREG, + MAC_REG_PAPEDELAY, LEDSTS_STS, + LEDSTS_SLOW); + } } } - } - if (pDevice->bLinkPass == true) { - if ((pMgmt->eAuthenMode < WMAC_AUTH_WPA || - pDevice->fWPA_Authened == true) && - (++pDevice->tx_data_time_out > 40)) { - pDevice->tx_trigger = true; + if (pDevice->bLinkPass == true) { + if ((pMgmt->eAuthenMode < WMAC_AUTH_WPA || + pDevice->fWPA_Authened == true) && + (++pDevice->tx_data_time_out > 40)) { + pDevice->tx_trigger = true; - PSbSendNullPacket(pDevice); + PSbSendNullPacket(pDevice); - pDevice->tx_trigger = false; - pDevice->tx_data_time_out = 0; - } + pDevice->tx_trigger = false; + pDevice->tx_data_time_out = 0; + } - if (netif_queue_stopped(pDevice->dev)) - netif_wake_queue(pDevice->dev); - } + if (netif_queue_stopped(pDevice->dev)) + netif_wake_queue(pDevice->dev); + } - spin_unlock_irq(&pDevice->lock); + spin_unlock_irq(&pDevice->lock); - schedule_delayed_work(&pDevice->second_callback_work, HZ); -} + schedule_delayed_work(&pDevice->second_callback_work, HZ); + } -/* - * Routine Description: - * - * - * Update Tx attemps, Tx failure counter in Node DB - * - * - * Return Value: - * none. - */ -void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - struct vnt_tx_pkt_info *pkt_info = pDevice->pkt_info; - u32 uNodeIndex = 0; - u8 byTxRetry; - u16 wRate; - u16 wFallBackRate = RATE_1M; - u8 byFallBack; - int ii; - u8 *pbyDestAddr; - u8 byPktNum; - u16 wFIFOCtl; - - byPktNum = (byPktNO & 0x0F) >> 4; - byTxRetry = (byTSR & 0xF0) >> 4; - wRate = (u16) (byPktNO & 0xF0) >> 4; - wFIFOCtl = pkt_info[byPktNum].fifo_ctl; - pbyDestAddr = pkt_info[byPktNum].dest_addr; - - if (wFIFOCtl & FIFOCTL_AUTO_FB_0) - byFallBack = AUTO_FB_0; - else if (wFIFOCtl & FIFOCTL_AUTO_FB_1) - byFallBack = AUTO_FB_1; - else - byFallBack = AUTO_FB_NONE; - - /* Only Unicast using support rates */ - if (wFIFOCtl & FIFOCTL_NEEDACK) { - if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { - pMgmt->sNodeDBTable[0].uTxAttempts += 1; - if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) { - /* transmit success, TxAttempts at least plus one */ - pMgmt->sNodeDBTable[0].uTxOk[MAX_RATE]++; - if ((byFallBack == AUTO_FB_NONE) || - (wRate < RATE_18M)) { - wFallBackRate = wRate; - } else if (byFallBack == AUTO_FB_0) { - if (byTxRetry < 5) - wFallBackRate = - awHWRetry0[wRate-RATE_18M][byTxRetry]; - else - wFallBackRate = - awHWRetry0[wRate-RATE_18M][4]; - } else if (byFallBack == AUTO_FB_1) { - if (byTxRetry < 5) - wFallBackRate = - awHWRetry1[wRate-RATE_18M][byTxRetry]; - else - wFallBackRate = awHWRetry1[wRate-RATE_18M][4]; - } - pMgmt->sNodeDBTable[0].uTxOk[wFallBackRate]++; - } else { - pMgmt->sNodeDBTable[0].uTxFailures++; - } - pMgmt->sNodeDBTable[0].uTxRetry += byTxRetry; - if (byTxRetry != 0) { - pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE] += byTxRetry; - if (byFallBack == AUTO_FB_NONE || - wRate < RATE_18M) { - pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry; - } else if (byFallBack == AUTO_FB_0) { - for (ii = 0; ii < byTxRetry; ii++) { - if (ii < 5) + /* + * Routine Description: + * + * + * Update Tx attemps, Tx failure counter in Node DB + * + * + * Return Value: + * none. + */ + void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_tx_pkt_info *pkt_info = pDevice->pkt_info; + u32 uNodeIndex = 0; + u8 byTxRetry; + u16 wRate; + u16 wFallBackRate = RATE_1M; + u8 byFallBack; + int ii; + u8 *pbyDestAddr; + u8 byPktNum; + u16 wFIFOCtl; + + byPktNum = (byPktNO & 0x0F) >> 4; + byTxRetry = (byTSR & 0xF0) >> 4; + wRate = (u16) (byPktNO & 0xF0) >> 4; + wFIFOCtl = pkt_info[byPktNum].fifo_ctl; + pbyDestAddr = pkt_info[byPktNum].dest_addr; + + if (wFIFOCtl & FIFOCTL_AUTO_FB_0) + byFallBack = AUTO_FB_0; + else if (wFIFOCtl & FIFOCTL_AUTO_FB_1) + byFallBack = AUTO_FB_1; + else + byFallBack = AUTO_FB_NONE; + + /* Only Unicast using support rates */ + if (wFIFOCtl & FIFOCTL_NEEDACK) { + if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { + pMgmt->sNodeDBTable[0].uTxAttempts += 1; + if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) { + /* transmit success, TxAttempts at least plus one */ + pMgmt->sNodeDBTable[0].uTxOk[MAX_RATE]++; + if ((byFallBack == AUTO_FB_NONE) || + (wRate < RATE_18M)) { + wFallBackRate = wRate; + } else if (byFallBack == AUTO_FB_0) { + if (byTxRetry < 5) wFallBackRate = - awHWRetry0[wRate-RATE_18M][ii]; + awHWRetry0[wRate-RATE_18M][byTxRetry]; else wFallBackRate = - awHWRetry0[wRate-RATE_18M][4]; - pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++; - } - } else if (byFallBack == AUTO_FB_1) { - for (ii = 0; ii < byTxRetry; ii++) { - if (ii < 5) + awHWRetry0[wRate-RATE_18M][4]; + } else if (byFallBack == AUTO_FB_1) { + if (byTxRetry < 5) wFallBackRate = - awHWRetry1[wRate-RATE_18M][ii]; + awHWRetry1[wRate-RATE_18M][byTxRetry]; else - wFallBackRate = - awHWRetry1[wRate-RATE_18M][4]; - pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++; + wFallBackRate = awHWRetry1[wRate-RATE_18M][4]; } + pMgmt->sNodeDBTable[0].uTxOk[wFallBackRate]++; + } else { + pMgmt->sNodeDBTable[0].uTxFailures++; } - } - } - - if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA || - pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && - BSSbIsSTAInNodeDB((void *) pDevice, - pbyDestAddr, - &uNodeIndex)) { - pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1; - if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) { - /* transmit success, TxAttempts at least plus one */ - pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; - if ((byFallBack == AUTO_FB_NONE) || - (wRate < RATE_18M)) { - wFallBackRate = wRate; - } else if (byFallBack == AUTO_FB_0) { - if (byTxRetry < 5) - wFallBackRate = - awHWRetry0[wRate-RATE_18M][byTxRetry]; - else - wFallBackRate = - awHWRetry0[wRate-RATE_18M][4]; - } else if (byFallBack == AUTO_FB_1) { - if (byTxRetry < 5) - wFallBackRate = - awHWRetry1[wRate-RATE_18M][byTxRetry]; - else - wFallBackRate = - awHWRetry1[wRate-RATE_18M][4]; + pMgmt->sNodeDBTable[0].uTxRetry += byTxRetry; + if (byTxRetry != 0) { + pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE] += byTxRetry; + if (byFallBack == AUTO_FB_NONE || + wRate < RATE_18M) { + pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry; + } else if (byFallBack == AUTO_FB_0) { + for (ii = 0; ii < byTxRetry; ii++) { + if (ii < 5) + wFallBackRate = + awHWRetry0[wRate-RATE_18M][ii]; + else + wFallBackRate = + awHWRetry0[wRate-RATE_18M][4]; + pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++; + } + } else if (byFallBack == AUTO_FB_1) { + for (ii = 0; ii < byTxRetry; ii++) { + if (ii < 5) + wFallBackRate = + awHWRetry1[wRate-RATE_18M][ii]; + else + wFallBackRate = + awHWRetry1[wRate-RATE_18M][4]; + pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++; + } + } } - pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++; - } else { - pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++; } - pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry; - if (byTxRetry != 0) { - pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry; - if ((byFallBack == AUTO_FB_NONE) || - (wRate < RATE_18M)) { - pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry; - } else if (byFallBack == AUTO_FB_0) { - for (ii = 0; ii < byTxRetry; ii++) { - if (ii < 5) + + if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA || + pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && + BSSbIsSTAInNodeDB((void *) pDevice, + pbyDestAddr, + &uNodeIndex)) { + pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1; + if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) { + /* transmit success, TxAttempts at least plus one */ + pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; + if ((byFallBack == AUTO_FB_NONE) || + (wRate < RATE_18M)) { + wFallBackRate = wRate; + } else if (byFallBack == AUTO_FB_0) { + if (byTxRetry < 5) wFallBackRate = - awHWRetry0[wRate-RATE_18M][ii]; + awHWRetry0[wRate-RATE_18M][byTxRetry]; else wFallBackRate = - awHWRetry0[wRate-RATE_18M][4]; - pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++; - } - } else if (byFallBack == AUTO_FB_1) { - for (ii = 0; ii < byTxRetry; ii++) { - if (ii < 5) - wFallBackRate = awHWRetry1[wRate-RATE_18M][ii]; + awHWRetry0[wRate-RATE_18M][4]; + } else if (byFallBack == AUTO_FB_1) { + if (byTxRetry < 5) + wFallBackRate = + awHWRetry1[wRate-RATE_18M][byTxRetry]; else - wFallBackRate = awHWRetry1[wRate-RATE_18M][4]; - pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++; + wFallBackRate = + awHWRetry1[wRate-RATE_18M][4]; + } + pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++; + } else { + pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++; + } + pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry; + if (byTxRetry != 0) { + pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry; + if ((byFallBack == AUTO_FB_NONE) || + (wRate < RATE_18M)) { + pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry; + } else if (byFallBack == AUTO_FB_0) { + for (ii = 0; ii < byTxRetry; ii++) { + if (ii < 5) + wFallBackRate = + awHWRetry0[wRate-RATE_18M][ii]; + else + wFallBackRate = + awHWRetry0[wRate-RATE_18M][4]; + pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++; + } + } else if (byFallBack == AUTO_FB_1) { + for (ii = 0; ii < byTxRetry; ii++) { + if (ii < 5) + wFallBackRate = awHWRetry1[wRate-RATE_18M][ii]; + else + wFallBackRate = awHWRetry1[wRate-RATE_18M][4]; + pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++; + } } } } } } -} -/* - * Routine Description: - * Clear Nodes & skb in DB Table - * - * - * Parameters: - * In: - * hDeviceContext - The adapter context. - * uStartIndex - starting index - * Out: - * none - * - * Return Value: - * None. - */ -void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - struct sk_buff *skb; - int ii; - - for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) { - if (pMgmt->sNodeDBTable[ii].bActive) { - /* check if sTxPSQueue has been initial */ - if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next) { - while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue))) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "PS skb != NULL %d\n", - ii); - dev_kfree_skb(skb); + /* + * Routine Description: + * Clear Nodes & skb in DB Table + * + * + * Parameters: + * In: + * hDeviceContext - The adapter context. + * uStartIndex - starting index + * Out: + * none + * + * Return Value: + * None. + */ + void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct sk_buff *skb; + int ii; + + for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) { + if (pMgmt->sNodeDBTable[ii].bActive) { + /* check if sTxPSQueue has been initial */ + if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next) { + while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue))) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "PS skb != NULL %d\n", + ii); + dev_kfree_skb(skb); + } } + memset(&pMgmt->sNodeDBTable[ii], 0, sizeof(KnownNodeDB)); } - memset(&pMgmt->sNodeDBTable[ii], 0, sizeof(KnownNodeDB)); } } -} -static void s_vCheckSensitivity(struct vnt_private *pDevice) -{ - PKnownBSS pBSSList = NULL; - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - int ii; - - if (pMgmt->eCurrState == WMAC_STATE_ASSOC || - (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && - pMgmt->eCurrState == WMAC_STATE_JOINTED)) { - pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, - (PWLAN_IE_SSID) pMgmt->abyCurrSSID); - if (pBSSList) { - /* Update BB register if RSSI is too strong */ - signed long LocalldBmAverage = 0; - signed long uNumofdBm = 0; - for (ii = 0; ii < RSSI_STAT_COUNT; ii++) { - if (pBSSList->ldBmAverage[ii] != 0) { - uNumofdBm++; - LocalldBmAverage += pBSSList->ldBmAverage[ii]; - } - } - if (uNumofdBm > 0) { - LocalldBmAverage = LocalldBmAverage/uNumofdBm; - for (ii = 0; ii < BB_VGA_LEVEL; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n", - LocalldBmAverage, - pDevice->ldBmThreshold[ii], - pDevice->abyBBVGA[ii]); - if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) { - pDevice->byBBVGANew = - pDevice->abyBBVGA[ii]; - break; + static void s_vCheckSensitivity(struct vnt_private *pDevice) + { + PKnownBSS pBSSList = NULL; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; + + if (pMgmt->eCurrState == WMAC_STATE_ASSOC || + (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && + pMgmt->eCurrState == WMAC_STATE_JOINTED)) { + pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, + (PWLAN_IE_SSID) pMgmt->abyCurrSSID); + if (pBSSList) { + /* Update BB register if RSSI is too strong */ + signed long LocalldBmAverage = 0; + signed long uNumofdBm = 0; + for (ii = 0; ii < RSSI_STAT_COUNT; ii++) { + if (pBSSList->ldBmAverage[ii] != 0) { + uNumofdBm++; + LocalldBmAverage += pBSSList->ldBmAverage[ii]; } } - if (pDevice->byBBVGANew != - pDevice->byBBVGACurrent) { - pDevice->uBBVGADiffCount++; - if (pDevice->uBBVGADiffCount >= - BB_VGA_CHANGE_THRESHOLD) - bScheduleCommand(pDevice, - WLAN_CMD_CHANGE_BBSENSITIVITY, - NULL); - } else { - pDevice->uBBVGADiffCount = 0; + if (uNumofdBm > 0) { + LocalldBmAverage = LocalldBmAverage/uNumofdBm; + for (ii = 0; ii < BB_VGA_LEVEL; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n", + LocalldBmAverage, + pDevice->ldBmThreshold[ii], + pDevice->abyBBVGA[ii]); + if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) { + pDevice->byBBVGANew = + pDevice->abyBBVGA[ii]; + break; + } + } + if (pDevice->byBBVGANew != + pDevice->byBBVGACurrent) { + pDevice->uBBVGADiffCount++; + if (pDevice->uBBVGADiffCount >= + BB_VGA_CHANGE_THRESHOLD) + bScheduleCommand(pDevice, + WLAN_CMD_CHANGE_BBSENSITIVITY, + NULL); + } else { + pDevice->uBBVGADiffCount = 0; + } } } } } -} -static void s_uCalculateLinkQual(struct vnt_private *pDevice) -{ - struct net_device_stats *stats = &pDevice->stats; - unsigned long TxOkRatio, TxCnt; - unsigned long RxOkRatio, RxCnt; - unsigned long RssiRatio; - unsigned long qual; - long ldBm; + static void s_uCalculateLinkQual(struct vnt_private *pDevice) + { + struct net_device_stats *stats = &pDevice->stats; + unsigned long TxOkRatio, TxCnt; + unsigned long RxOkRatio, RxCnt; + unsigned long RssiRatio; + unsigned long qual; + long ldBm; - TxCnt = stats->tx_packets + pDevice->wstats.discard.retries; + TxCnt = stats->tx_packets + pDevice->wstats.discard.retries; - RxCnt = stats->rx_packets + stats->rx_frame_errors; + RxCnt = stats->rx_packets + stats->rx_frame_errors; - TxOkRatio = (TxCnt < 6) ? 4000:((stats->tx_packets * 4000) / TxCnt); + TxOkRatio = (TxCnt < 6) ? 4000:((stats->tx_packets * 4000) / TxCnt); - RxOkRatio = (RxCnt < 6) ? 2000 : + RxOkRatio = (RxCnt < 6) ? 2000 : ((stats->rx_packets * 2000) / RxCnt); - /* decide link quality */ - if (pDevice->bLinkPass != true) { - pDevice->wstats.qual.qual = 0; - } else { - RFvRSSITodBm(pDevice, (u8) (pDevice->uCurrRSSI), &ldBm); - if (-ldBm < 50) - RssiRatio = 4000; - else if (-ldBm > 90) - RssiRatio = 0; - else - RssiRatio = (40-(-ldBm-50)) * 4000 / 40; - - qual = (RssiRatio + TxOkRatio + RxOkRatio) / 100; - if (qual < 100) - pDevice->wstats.qual.qual = (u8) qual; - else - pDevice->wstats.qual.qual = 100; + /* decide link quality */ + if (pDevice->bLinkPass != true) { + pDevice->wstats.qual.qual = 0; + } else { + RFvRSSITodBm(pDevice, (u8) (pDevice->uCurrRSSI), &ldBm); + if (-ldBm < 50) + RssiRatio = 4000; + else if (-ldBm > 90) + RssiRatio = 0; + else + RssiRatio = (40-(-ldBm-50)) * 4000 / 40; + + qual = (RssiRatio + TxOkRatio + RxOkRatio) / 100; + if (qual < 100) + pDevice->wstats.qual.qual = (u8) qual; + else + pDevice->wstats.qual.qual = 100; + } } -} -void BSSvClearAnyBSSJoinRecord(struct vnt_private *pDevice) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - int ii; + void BSSvClearAnyBSSJoinRecord(struct vnt_private *pDevice) + { + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; - for (ii = 0; ii < MAX_BSS_NUM; ii++) - pMgmt->sBSSList[ii].bSelected = false; + for (ii = 0; ii < MAX_BSS_NUM; ii++) + pMgmt->sBSSList[ii].bSelected = false; - return; -} - -static void s_vCheckPreEDThreshold(struct vnt_private *pDevice) -{ - PKnownBSS pBSSList = NULL; - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + return; + } - if (pMgmt->eCurrState == WMAC_STATE_ASSOC || - (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && - pMgmt->eCurrState == WMAC_STATE_JOINTED)) { - pBSSList = BSSpAddrIsInBSSList(pDevice, - pMgmt->abyCurrBSSID, - (PWLAN_IE_SSID) pMgmt->abyCurrSSID); - if (pBSSList) { - pDevice->byBBPreEDRSSI = - (u8) (~(pBSSList->ldBmAverRange) + 1); - BBvUpdatePreEDThreshold(pDevice, false); + static void s_vCheckPreEDThreshold(struct vnt_private *pDevice) + { + PKnownBSS pBSSList = NULL; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + + if (pMgmt->eCurrState == WMAC_STATE_ASSOC || + (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && + pMgmt->eCurrState == WMAC_STATE_JOINTED)) { + pBSSList = BSSpAddrIsInBSSList(pDevice, + pMgmt->abyCurrBSSID, + (PWLAN_IE_SSID) pMgmt->abyCurrSSID); + if (pBSSList) { + pDevice->byBBPreEDRSSI = + (u8) (~(pBSSList->ldBmAverRange) + 1); + BBvUpdatePreEDThreshold(pDevice, false); + } } } -} - diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h index 8df3fb2..8405637 100644 --- a/drivers/staging/vt6656/bssdb.h +++ b/drivers/staging/vt6656/bssdb.h @@ -68,198 +68,198 @@ // typedef struct tagSERPObject { - bool bERPExist; - u8 byERP; + bool bERPExist; + u8 byERP; } ERPObject, *PERPObject; typedef struct tagSRSNCapObject { - bool bRSNCapExist; - u16 wRSNCap; + bool bRSNCapExist; + u16 wRSNCap; } SRSNCapObject, *PSRSNCapObject; // BSS info(AP) typedef struct tagKnownBSS { - // BSS info - bool bActive; - u8 abyBSSID[WLAN_BSSID_LEN]; - unsigned int uChannel; - u8 abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - u8 abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - unsigned int uRSSI; - 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; - //For any BSSID selection improvment - bool bSelected; - - //++ WPA informations - bool bWPAValid; - u8 byGKType; - u8 abyPKType[4]; - u16 wPKCount; - u8 abyAuthType[4]; - u16 wAuthCount; - u8 byDefaultK_as_PK; - u8 byReplayIdx; - //-- - - //++ WPA2 informations - bool bWPA2Valid; - u8 byCSSGK; - u16 wCSSPKCount; - u8 abyCSSPK[4]; - u16 wAKMSSAuthCount; - u8 abyAKMSSAuthType[4]; - - //++ wpactl - u8 byWPAIE[MAX_WPA_IE_LEN]; - u8 byRSNIE[MAX_WPA_IE_LEN]; - u16 wWPALen; - u16 wRSNLen; - - // Clear count - unsigned int uClearCount; -// u8 abyIEs[WLAN_BEACON_FR_MAXLEN]; - unsigned int uIELength; + // BSS info + bool bActive; + u8 abyBSSID[WLAN_BSSID_LEN]; + unsigned int uChannel; + u8 abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + unsigned int uRSSI; + 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; + //For any BSSID selection improvment + bool bSelected; + + //++ WPA informations + bool bWPAValid; + u8 byGKType; + u8 abyPKType[4]; + u16 wPKCount; + u8 abyAuthType[4]; + u16 wAuthCount; + u8 byDefaultK_as_PK; + u8 byReplayIdx; + //-- + + //++ WPA2 informations + bool bWPA2Valid; + u8 byCSSGK; + u16 wCSSPKCount; + u8 abyCSSPK[4]; + u16 wAKMSSAuthCount; + u8 abyAKMSSAuthType[4]; + + //++ wpactl + u8 byWPAIE[MAX_WPA_IE_LEN]; + u8 byRSNIE[MAX_WPA_IE_LEN]; + u16 wWPALen; + u16 wRSNLen; + + // Clear count + unsigned int uClearCount; + // u8 abyIEs[WLAN_BEACON_FR_MAXLEN]; + unsigned int uIELength; u64 qwBSSTimestamp; u64 qwLocalTSF;/* local TSF timer */ - CARD_PHY_TYPE eNetworkTypeInUse; + CARD_PHY_TYPE eNetworkTypeInUse; - ERPObject sERP; - SRSNCapObject sRSNCapObj; - u8 abyIEs[1024]; // don't move this field !! + ERPObject sERP; + SRSNCapObject sRSNCapObj; + u8 abyIEs[1024]; // don't move this field !! } __attribute__ ((__packed__)) KnownBSS , *PKnownBSS; typedef enum tagNODE_STATE { - NODE_FREE, - NODE_AGED, - NODE_KNOWN, - NODE_AUTH, - NODE_ASSOC + NODE_FREE, + NODE_AGED, + NODE_KNOWN, + NODE_AUTH, + NODE_ASSOC } NODE_STATE, *PNODE_STATE; // STA node info typedef struct tagKnownNodeDB { - // STA info - bool bActive; - 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; - 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; - u16 wCapInfo; - u16 wListenInterval; - u16 wAID; - NODE_STATE eNodeState; - bool bPSEnable; - bool bRxPSPoll; - u8 byAuthSequence; - unsigned long ulLastRxJiffer; - u8 bySuppRate; - u32 dwFlags; - u16 wEnQueueCnt; - - bool bOnFly; - unsigned long long KeyRSC; - u8 byKeyIndex; - u32 dwKeyIndex; - u8 byCipherSuite; - u32 dwTSC47_16; - u16 wTSC15_0; - unsigned int uWepKeyLength; - u8 abyWepKey[WLAN_WEPMAX_KEYLEN]; - // - // Auto rate fallback vars - bool bIsInFallback; - unsigned int uAverageRSSI; - unsigned int uRateRecoveryTimeout; - unsigned int uRatePollTimeout; - unsigned int uTxFailures; - unsigned int uTxAttempts; - - unsigned int uTxRetry; - unsigned int uFailureRatio; - unsigned int uRetryRatio; - unsigned int uTxOk[MAX_RATE+1]; - unsigned int uTxFail[MAX_RATE+1]; - unsigned int uTimeCount; + // STA info + bool bActive; + 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; + 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; + u16 wCapInfo; + u16 wListenInterval; + u16 wAID; + NODE_STATE eNodeState; + bool bPSEnable; + bool bRxPSPoll; + u8 byAuthSequence; + unsigned long ulLastRxJiffer; + u8 bySuppRate; + u32 dwFlags; + u16 wEnQueueCnt; + + bool bOnFly; + unsigned long long KeyRSC; + u8 byKeyIndex; + u32 dwKeyIndex; + u8 byCipherSuite; + u32 dwTSC47_16; + u16 wTSC15_0; + unsigned int uWepKeyLength; + u8 abyWepKey[WLAN_WEPMAX_KEYLEN]; + // + // Auto rate fallback vars + bool bIsInFallback; + unsigned int uAverageRSSI; + unsigned int uRateRecoveryTimeout; + unsigned int uRatePollTimeout; + unsigned int uTxFailures; + unsigned int uTxAttempts; + + unsigned int uTxRetry; + unsigned int uFailureRatio; + unsigned int uRetryRatio; + unsigned int uTxOk[MAX_RATE+1]; + unsigned int uTxFail[MAX_RATE+1]; + unsigned int uTimeCount; } KnownNodeDB, *PKnownNodeDB; PKnownBSS BSSpSearchBSSList(struct vnt_private *, u8 *pbyDesireBSSID, - u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType); + u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType); PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *, u8 *abyBSSID, - PWLAN_IE_SSID pSSID); + PWLAN_IE_SSID pSSID); void BSSvClearBSSList(struct vnt_private *, int bKeepCurrBSSID); int BSSbInsertToBSSList(struct vnt_private *, - u8 *abyBSSIDAddr, - u64 qwTimestamp, - u16 wBeaconInterval, - u16 wCapInfo, - u8 byCurrChannel, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pSuppRates, - PWLAN_IE_SUPP_RATES pExtSuppRates, - PERPObject psERP, - PWLAN_IE_RSN pRSN, - PWLAN_IE_RSN_EXT pRSNWPA, - PWLAN_IE_COUNTRY pIE_Country, - PWLAN_IE_QUIET pIE_Quiet, - u32 uIELength, - u8 *pbyIEs, - void *pRxPacketContext); + u8 *abyBSSIDAddr, + u64 qwTimestamp, + u16 wBeaconInterval, + u16 wCapInfo, + u8 byCurrChannel, + PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pSuppRates, + PWLAN_IE_SUPP_RATES pExtSuppRates, + PERPObject psERP, + PWLAN_IE_RSN pRSN, + PWLAN_IE_RSN_EXT pRSNWPA, + PWLAN_IE_COUNTRY pIE_Country, + PWLAN_IE_QUIET pIE_Quiet, + u32 uIELength, + u8 *pbyIEs, + void *pRxPacketContext); int BSSbUpdateToBSSList(struct vnt_private *, - u64 qwTimestamp, - u16 wBeaconInterval, - u16 wCapInfo, - u8 byCurrChannel, - int bChannelHit, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pSuppRates, - PWLAN_IE_SUPP_RATES pExtSuppRates, - PERPObject psERP, - PWLAN_IE_RSN pRSN, - PWLAN_IE_RSN_EXT pRSNWPA, - PWLAN_IE_COUNTRY pIE_Country, - PWLAN_IE_QUIET pIE_Quiet, - PKnownBSS pBSSList, - u32 uIELength, - u8 *pbyIEs, - void *pRxPacketContext); + u64 qwTimestamp, + u16 wBeaconInterval, + u16 wCapInfo, + u8 byCurrChannel, + int bChannelHit, + PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pSuppRates, + PWLAN_IE_SUPP_RATES pExtSuppRates, + PERPObject psERP, + PWLAN_IE_RSN pRSN, + PWLAN_IE_RSN_EXT pRSNWPA, + PWLAN_IE_COUNTRY pIE_Country, + PWLAN_IE_QUIET pIE_Quiet, + PKnownBSS pBSSList, + u32 uIELength, + u8 *pbyIEs, + void *pRxPacketContext); int BSSbIsSTAInNodeDB(struct vnt_private *, u8 * abyDstAddr, - u32 *puNodeIndex); + u32 *puNodeIndex); void BSSvCreateOneNode(struct vnt_private *, u32 *puNodeIndex); void BSSvUpdateAPNode(struct vnt_private *, u16 *pwCapInfo, - PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pExtSuppRates); + PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pExtSuppRates); void BSSvSecondCallBack(struct work_struct *work); diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 0d87728..a1d40a6 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -84,11 +84,11 @@ void CARDbSetMediaChannel(struct vnt_private *priv, u32 connection_channel) if (priv->byBBType == BB_TYPE_11A) { if ((connection_channel < (CB_MAX_CHANNEL_24G + 1)) || - (connection_channel > CB_MAX_CHANNEL)) + (connection_channel > CB_MAX_CHANNEL)) connection_channel = (CB_MAX_CHANNEL_24G + 1); } else { if ((connection_channel > CB_MAX_CHANNEL_24G) || - (connection_channel == 0)) + (connection_channel == 0)) connection_channel = 1; } @@ -99,24 +99,24 @@ void CARDbSetMediaChannel(struct vnt_private *priv, u32 connection_channel) MACvRegBitsOff(priv, MAC_REG_CHANNEL, 0xb0); CONTROLnsRequestOut(priv, MESSAGE_TYPE_SELECT_CHANNLE, - connection_channel, 0, 0, NULL); + connection_channel, 0, 0, NULL); if (priv->byBBType == BB_TYPE_11A) { priv->byCurPwr = 0xff; RFbRawSetPower(priv, - priv->abyOFDMAPwrTbl[connection_channel-15], RATE_54M); + priv->abyOFDMAPwrTbl[connection_channel-15], RATE_54M); } else if (priv->byBBType == BB_TYPE_11G) { priv->byCurPwr = 0xff; RFbRawSetPower(priv, - priv->abyOFDMPwrTbl[connection_channel-1], RATE_54M); + priv->abyOFDMPwrTbl[connection_channel-1], RATE_54M); } else { priv->byCurPwr = 0xff; RFbRawSetPower(priv, - priv->abyCCKPwrTbl[connection_channel-1], RATE_1M); + priv->abyCCKPwrTbl[connection_channel-1], RATE_1M); } ControlvWriteByte(priv, MESSAGE_REQUEST_MACREG, MAC_REG_CHANNEL, - (u8)(connection_channel|0x80)); + (u8)(connection_channel|0x80)); } /* @@ -163,11 +163,11 @@ static u16 swGetOFDMControlRate(struct vnt_private *pDevice, u16 wRateIdx) u16 ui = wRateIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n", - pDevice->wBasicRate); + pDevice->wBasicRate); if (!CARDbIsOFDMinBasicRate(pDevice)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "swGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); + "swGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); if (wRateIdx > RATE_24M) wRateIdx = RATE_24M; return wRateIdx; @@ -176,7 +176,7 @@ static u16 swGetOFDMControlRate(struct vnt_private *pDevice, u16 wRateIdx) while (ui > RATE_11M) { if (pDevice->wBasicRate & (1 << ui)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "swGetOFDMControlRate: %d\n", ui); + "swGetOFDMControlRate: %d\n", ui); return ui; } ui--; @@ -201,104 +201,104 @@ static u16 swGetOFDMControlRate(struct vnt_private *pDevice, u16 wRateIdx) * Return Value: none * */ -static void + static void CARDvCalculateOFDMRParameter ( - u16 wRate, - u8 byBBType, - u8 * pbyTxRate, - u8 * pbyRsvTime - ) + u16 wRate, + u8 byBBType, + u8 * pbyTxRate, + u8 * pbyRsvTime + ) { - switch (wRate) { - case RATE_6M : - if (byBBType == BB_TYPE_11A) {//5GHZ - *pbyTxRate = 0x9B; - *pbyRsvTime = 24; - } - else { - *pbyTxRate = 0x8B; - *pbyRsvTime = 30; - } - break; - - case RATE_9M : - if (byBBType == BB_TYPE_11A) {//5GHZ - *pbyTxRate = 0x9F; - *pbyRsvTime = 16; - } - else { - *pbyTxRate = 0x8F; - *pbyRsvTime = 22; - } - break; - - case RATE_12M : - if (byBBType == BB_TYPE_11A) {//5GHZ - *pbyTxRate = 0x9A; - *pbyRsvTime = 12; - } - else { - *pbyTxRate = 0x8A; - *pbyRsvTime = 18; - } - break; - - case RATE_18M : - if (byBBType == BB_TYPE_11A) {//5GHZ - *pbyTxRate = 0x9E; - *pbyRsvTime = 8; - } - else { - *pbyTxRate = 0x8E; - *pbyRsvTime = 14; - } - break; - - case RATE_36M : - if (byBBType == BB_TYPE_11A) {//5GHZ - *pbyTxRate = 0x9D; - *pbyRsvTime = 4; - } - else { - *pbyTxRate = 0x8D; - *pbyRsvTime = 10; - } - break; - - case RATE_48M : - if (byBBType == BB_TYPE_11A) {//5GHZ - *pbyTxRate = 0x98; - *pbyRsvTime = 4; - } - else { - *pbyTxRate = 0x88; - *pbyRsvTime = 10; - } - break; - - case RATE_54M : - if (byBBType == BB_TYPE_11A) {//5GHZ - *pbyTxRate = 0x9C; - *pbyRsvTime = 4; - } - else { - *pbyTxRate = 0x8C; - *pbyRsvTime = 10; - } - break; - - case RATE_24M : - default : - if (byBBType == BB_TYPE_11A) {//5GHZ - *pbyTxRate = 0x99; - *pbyRsvTime = 8; - } - else { - *pbyTxRate = 0x89; - *pbyRsvTime = 14; - } - break; - } + switch (wRate) { + case RATE_6M : + if (byBBType == BB_TYPE_11A) {//5GHZ + *pbyTxRate = 0x9B; + *pbyRsvTime = 24; + } + else { + *pbyTxRate = 0x8B; + *pbyRsvTime = 30; + } + break; + + case RATE_9M : + if (byBBType == BB_TYPE_11A) {//5GHZ + *pbyTxRate = 0x9F; + *pbyRsvTime = 16; + } + else { + *pbyTxRate = 0x8F; + *pbyRsvTime = 22; + } + break; + + case RATE_12M : + if (byBBType == BB_TYPE_11A) {//5GHZ + *pbyTxRate = 0x9A; + *pbyRsvTime = 12; + } + else { + *pbyTxRate = 0x8A; + *pbyRsvTime = 18; + } + break; + + case RATE_18M : + if (byBBType == BB_TYPE_11A) {//5GHZ + *pbyTxRate = 0x9E; + *pbyRsvTime = 8; + } + else { + *pbyTxRate = 0x8E; + *pbyRsvTime = 14; + } + break; + + case RATE_36M : + if (byBBType == BB_TYPE_11A) {//5GHZ + *pbyTxRate = 0x9D; + *pbyRsvTime = 4; + } + else { + *pbyTxRate = 0x8D; + *pbyRsvTime = 10; + } + break; + + case RATE_48M : + if (byBBType == BB_TYPE_11A) {//5GHZ + *pbyTxRate = 0x98; + *pbyRsvTime = 4; + } + else { + *pbyTxRate = 0x88; + *pbyRsvTime = 10; + } + break; + + case RATE_54M : + if (byBBType == BB_TYPE_11A) {//5GHZ + *pbyTxRate = 0x9C; + *pbyRsvTime = 4; + } + else { + *pbyTxRate = 0x8C; + *pbyRsvTime = 10; + } + break; + + case RATE_24M : + default : + if (byBBType == BB_TYPE_11A) {//5GHZ + *pbyTxRate = 0x99; + *pbyRsvTime = 8; + } + else { + *pbyTxRate = 0x89; + *pbyRsvTime = 14; + } + break; + } } /* @@ -321,75 +321,75 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType) u8 abyData[34]; int i; - //RSPINF_b_1 + //RSPINF_b_1 BBvCalculateParameter(pDevice, 14, - swGetCCKControlRate(pDevice, RATE_1M), PK_TYPE_11B, &phy[0]); + swGetCCKControlRate(pDevice, RATE_1M), PK_TYPE_11B, &phy[0]); - ///RSPINF_b_2 + ///RSPINF_b_2 BBvCalculateParameter(pDevice, 14, - swGetCCKControlRate(pDevice, RATE_2M), PK_TYPE_11B, &phy[1]); + swGetCCKControlRate(pDevice, RATE_2M), PK_TYPE_11B, &phy[1]); - //RSPINF_b_5 + //RSPINF_b_5 BBvCalculateParameter(pDevice, 14, - swGetCCKControlRate(pDevice, RATE_5M), PK_TYPE_11B, &phy[2]); + swGetCCKControlRate(pDevice, RATE_5M), PK_TYPE_11B, &phy[2]); - //RSPINF_b_11 + //RSPINF_b_11 BBvCalculateParameter(pDevice, 14, - swGetCCKControlRate(pDevice, RATE_11M), PK_TYPE_11B, &phy[3]); - - //RSPINF_a_6 - CARDvCalculateOFDMRParameter (RATE_6M, - byBBType, - &abyTxRate[0], - &abyRsvTime[0]); - - //RSPINF_a_9 - CARDvCalculateOFDMRParameter (RATE_9M, - byBBType, - &abyTxRate[1], - &abyRsvTime[1]); - - //RSPINF_a_12 - CARDvCalculateOFDMRParameter (RATE_12M, - byBBType, - &abyTxRate[2], - &abyRsvTime[2]); - - //RSPINF_a_18 - CARDvCalculateOFDMRParameter (RATE_18M, - byBBType, - &abyTxRate[3], - &abyRsvTime[3]); - - //RSPINF_a_24 - CARDvCalculateOFDMRParameter (RATE_24M, - byBBType, - &abyTxRate[4], - &abyRsvTime[4]); - - //RSPINF_a_36 - CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_36M), - byBBType, - &abyTxRate[5], - &abyRsvTime[5]); - - //RSPINF_a_48 - CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_48M), - byBBType, - &abyTxRate[6], - &abyRsvTime[6]); - - //RSPINF_a_54 - CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_54M), - byBBType, - &abyTxRate[7], - &abyRsvTime[7]); - - //RSPINF_a_72 - CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_54M), - byBBType, - &abyTxRate[8], - &abyRsvTime[8]); + swGetCCKControlRate(pDevice, RATE_11M), PK_TYPE_11B, &phy[3]); + + //RSPINF_a_6 + CARDvCalculateOFDMRParameter (RATE_6M, + byBBType, + &abyTxRate[0], + &abyRsvTime[0]); + + //RSPINF_a_9 + CARDvCalculateOFDMRParameter (RATE_9M, + byBBType, + &abyTxRate[1], + &abyRsvTime[1]); + + //RSPINF_a_12 + CARDvCalculateOFDMRParameter (RATE_12M, + byBBType, + &abyTxRate[2], + &abyRsvTime[2]); + + //RSPINF_a_18 + CARDvCalculateOFDMRParameter (RATE_18M, + byBBType, + &abyTxRate[3], + &abyRsvTime[3]); + + //RSPINF_a_24 + CARDvCalculateOFDMRParameter (RATE_24M, + byBBType, + &abyTxRate[4], + &abyRsvTime[4]); + + //RSPINF_a_36 + CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_36M), + byBBType, + &abyTxRate[5], + &abyRsvTime[5]); + + //RSPINF_a_48 + CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_48M), + byBBType, + &abyTxRate[6], + &abyRsvTime[6]); + + //RSPINF_a_54 + CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_54M), + byBBType, + &abyTxRate[7], + &abyRsvTime[7]); + + //RSPINF_a_72 + CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_54M), + byBBType, + &abyTxRate[8], + &abyRsvTime[8]); put_unaligned(phy[0].len, (u16 *)&abyData[0]); abyData[2] = phy[0].signal; @@ -407,17 +407,17 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType) abyData[14] = phy[3].signal; abyData[15] = phy[3].service; - for (i = 0; i < 9; i++) { - abyData[16+i*2] = abyTxRate[i]; - abyData[16+i*2+1] = abyRsvTime[i]; - } + for (i = 0; i < 9; i++) { + abyData[16+i*2] = abyTxRate[i]; + abyData[16+i*2+1] = abyRsvTime[i]; + } - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - MAC_REG_RSPINF_B_1, - MESSAGE_REQUEST_MACREG, - 34, - &abyData[0]); + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE, + MAC_REG_RSPINF_B_1, + MESSAGE_REQUEST_MACREG, + 34, + &abyData[0]); } @@ -438,83 +438,83 @@ void vUpdateIFS(struct vnt_private *pDevice) u8 byMaxMin = 0; u8 byData[4]; - if (pDevice->byPacketType==PK_TYPE_11A) {//0000 0000 0000 0000,11a - pDevice->uSlot = C_SLOT_SHORT; - pDevice->uSIFS = C_SIFS_A; - pDevice->uDIFS = C_SIFS_A + 2*C_SLOT_SHORT; - pDevice->uCwMin = C_CWMIN_A; - byMaxMin = 4; - } - else if (pDevice->byPacketType==PK_TYPE_11B) {//0000 0001 0000 0000,11b - pDevice->uSlot = C_SLOT_LONG; - pDevice->uSIFS = C_SIFS_BG; - pDevice->uDIFS = C_SIFS_BG + 2*C_SLOT_LONG; - pDevice->uCwMin = C_CWMIN_B; - byMaxMin = 5; - } - else {// PK_TYPE_11GA & PK_TYPE_11GB - u8 byRate = 0; - bool bOFDMRate = false; - unsigned int ii = 0; - PWLAN_IE_SUPP_RATES pItemRates = NULL; - - pDevice->uSIFS = C_SIFS_BG; - if (pDevice->bShortSlotTime) { - pDevice->uSlot = C_SLOT_SHORT; - } else { - pDevice->uSlot = C_SLOT_LONG; - } - pDevice->uDIFS = C_SIFS_BG + 2*pDevice->uSlot; - - pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt.abyCurrSuppRates; - for (ii = 0; ii < pItemRates->len; ii++) { - byRate = (u8)(pItemRates->abyRates[ii]&0x7F); - if (RATEwGetRateIdx(byRate) > RATE_11M) { - bOFDMRate = true; - break; - } - } - if (bOFDMRate == false) { - pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt - .abyCurrExtSuppRates; - for (ii = 0; ii < pItemRates->len; ii++) { - byRate = (u8)(pItemRates->abyRates[ii]&0x7F); - if (RATEwGetRateIdx(byRate) > RATE_11M) { - bOFDMRate = true; - break; - } - } - } - if (bOFDMRate == true) { - pDevice->uCwMin = C_CWMIN_A; - byMaxMin = 4; - } else { - pDevice->uCwMin = C_CWMIN_B; - byMaxMin = 5; - } - } - - pDevice->uCwMax = C_CWMAX; - pDevice->uEIFS = C_EIFS; - - 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, - MESSAGE_REQUEST_MACREG, - 4, - &byData[0]); - - byMaxMin |= 0xA0;//1010 1111,C_CWMAX = 1023 - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - MAC_REG_CWMAXMIN0, - MESSAGE_REQUEST_MACREG, - 1, - &byMaxMin); + if (pDevice->byPacketType==PK_TYPE_11A) {//0000 0000 0000 0000,11a + pDevice->uSlot = C_SLOT_SHORT; + pDevice->uSIFS = C_SIFS_A; + pDevice->uDIFS = C_SIFS_A + 2*C_SLOT_SHORT; + pDevice->uCwMin = C_CWMIN_A; + byMaxMin = 4; + } + else if (pDevice->byPacketType==PK_TYPE_11B) {//0000 0001 0000 0000,11b + pDevice->uSlot = C_SLOT_LONG; + pDevice->uSIFS = C_SIFS_BG; + pDevice->uDIFS = C_SIFS_BG + 2*C_SLOT_LONG; + pDevice->uCwMin = C_CWMIN_B; + byMaxMin = 5; + } + else {// PK_TYPE_11GA & PK_TYPE_11GB + u8 byRate = 0; + bool bOFDMRate = false; + unsigned int ii = 0; + PWLAN_IE_SUPP_RATES pItemRates = NULL; + + pDevice->uSIFS = C_SIFS_BG; + if (pDevice->bShortSlotTime) { + pDevice->uSlot = C_SLOT_SHORT; + } else { + pDevice->uSlot = C_SLOT_LONG; + } + pDevice->uDIFS = C_SIFS_BG + 2*pDevice->uSlot; + + pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt.abyCurrSuppRates; + for (ii = 0; ii < pItemRates->len; ii++) { + byRate = (u8)(pItemRates->abyRates[ii]&0x7F); + if (RATEwGetRateIdx(byRate) > RATE_11M) { + bOFDMRate = true; + break; + } + } + if (bOFDMRate == false) { + pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt + .abyCurrExtSuppRates; + for (ii = 0; ii < pItemRates->len; ii++) { + byRate = (u8)(pItemRates->abyRates[ii]&0x7F); + if (RATEwGetRateIdx(byRate) > RATE_11M) { + bOFDMRate = true; + break; + } + } + } + if (bOFDMRate == true) { + pDevice->uCwMin = C_CWMIN_A; + byMaxMin = 4; + } else { + pDevice->uCwMin = C_CWMIN_B; + byMaxMin = 5; + } + } + + pDevice->uCwMax = C_CWMAX; + pDevice->uEIFS = C_EIFS; + + 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, + MESSAGE_REQUEST_MACREG, + 4, + &byData[0]); + + byMaxMin |= 0xA0;//1010 1111,C_CWMAX = 1023 + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE, + MAC_REG_CWMAXMIN0, + MESSAGE_REQUEST_MACREG, + 1, + &byMaxMin); } void CARDvUpdateBasicTopRate(struct vnt_private *pDevice) @@ -522,25 +522,25 @@ void CARDvUpdateBasicTopRate(struct vnt_private *pDevice) u8 byTopOFDM = RATE_24M, byTopCCK = RATE_1M; u8 ii; - //Determines the highest basic rate. - for (ii = RATE_54M; ii >= RATE_6M; ii --) { - if ( (pDevice->wBasicRate) & ((u16)(1<<ii)) ) { - byTopOFDM = ii; - break; - } - } - pDevice->byTopOFDMBasicRate = byTopOFDM; - - for (ii = RATE_11M;; ii --) { - if ( (pDevice->wBasicRate) & ((u16)(1<<ii)) ) { - byTopCCK = ii; - break; - } - if (ii == RATE_1M) - break; - } - pDevice->byTopCCKBasicRate = byTopCCK; - } + //Determines the highest basic rate. + for (ii = RATE_54M; ii >= RATE_6M; ii --) { + if ( (pDevice->wBasicRate) & ((u16)(1<<ii)) ) { + byTopOFDM = ii; + break; + } + } + pDevice->byTopOFDMBasicRate = byTopOFDM; + + for (ii = RATE_11M;; ii --) { + if ( (pDevice->wBasicRate) & ((u16)(1<<ii)) ) { + byTopCCK = ii; + break; + } + if (ii == RATE_1M) + break; + } + pDevice->byTopCCKBasicRate = byTopCCK; +} /* * Description: Set NIC Tx Basic Rate @@ -559,35 +559,35 @@ void CARDbAddBasicRate(struct vnt_private *pDevice, u16 wRateIdx) { u16 wRate = (1 << wRateIdx); - pDevice->wBasicRate |= wRate; + pDevice->wBasicRate |= wRate; - //Determines the highest basic rate. - CARDvUpdateBasicTopRate(pDevice); + //Determines the highest basic rate. + CARDvUpdateBasicTopRate(pDevice); } int CARDbIsOFDMinBasicRate(struct vnt_private *pDevice) { int ii; - for (ii = RATE_54M; ii >= RATE_6M; ii --) { - if ((pDevice->wBasicRate) & ((u16)(1<<ii))) - return true; - } - return false; + for (ii = RATE_54M; ii >= RATE_6M; ii --) { + if ((pDevice->wBasicRate) & ((u16)(1<<ii))) + return true; + } + return false; } u8 CARDbyGetPktType(struct vnt_private *pDevice) { - if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) { - return (u8)pDevice->byBBType; - } - else if (CARDbIsOFDMinBasicRate(pDevice)) { - return PK_TYPE_11GA; - } - else { - return PK_TYPE_11GB; - } + if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) { + return (u8)pDevice->byBBType; + } + else if (CARDbIsOFDMinBasicRate(pDevice)) { + return PK_TYPE_11GA; + } + else { + return PK_TYPE_11GB; + } } /* @@ -640,9 +640,9 @@ 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 + qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF); + // adjust TSF + // HW's TSF add TSF Offset reg pbyData[0] = (u8)qwTSFOffset; pbyData[1] = (u8)(qwTSFOffset >> 8); @@ -653,13 +653,13 @@ void CARDvAdjustTSF(struct vnt_private *pDevice, u8 byRxRate, pbyData[6] = (u8)(qwTSFOffset >> 48); pbyData[7] = (u8)(qwTSFOffset >> 56); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_SET_TSFTBTT, - MESSAGE_REQUEST_TSF, - 0, - 8, - pbyData - ); + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_SET_TSFTBTT, + MESSAGE_REQUEST_TSF, + 0, + 8, + pbyData + ); } /* @@ -725,8 +725,8 @@ u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBeaconInterval) uBeaconInterval = wBeaconInterval * 1024; /* Next TBTT = - * ((local_current_TSF / beacon_interval) + 1) * beacon_interval - */ + * ((local_current_TSF / beacon_interval) + 1) * beacon_interval + */ if (uBeaconInterval) { do_div(qwTSF, uBeaconInterval); qwTSF += 1; @@ -756,9 +756,9 @@ void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, u16 wBeaconInterval) u8 pbyData[8]; CARDbClearCurrentTSF(pDevice); - //CARDbGetCurrentTSF(pDevice, &qwNextTBTT); //Get Local TSF counter + //CARDbGetCurrentTSF(pDevice, &qwNextTBTT); //Get Local TSF counter qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); - // Set NextTBTT + // Set NextTBTT pbyData[0] = (u8)qwNextTBTT; pbyData[1] = (u8)(qwNextTBTT >> 8); @@ -769,15 +769,15 @@ void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, u16 wBeaconInterval) pbyData[6] = (u8)(qwNextTBTT >> 48); pbyData[7] = (u8)(qwNextTBTT >> 56); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_SET_TSFTBTT, - MESSAGE_REQUEST_TBTT, - 0, - 8, - pbyData - ); + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_SET_TSFTBTT, + MESSAGE_REQUEST_TBTT, + 0, + 8, + pbyData + ); - return; + return; } /* @@ -796,13 +796,13 @@ void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, u16 wBeaconInterval) * */ void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, - u16 wBeaconInterval) + u16 wBeaconInterval) { u8 pbyData[8]; - qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval); + qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval); - // Set NextTBTT + // Set NextTBTT pbyData[0] = (u8)qwTSF; pbyData[1] = (u8)(qwTSF >> 8); @@ -813,18 +813,18 @@ void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, pbyData[6] = (u8)(qwTSF >> 48); pbyData[7] = (u8)(qwTSF >> 56); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_SET_TSFTBTT, - MESSAGE_REQUEST_TBTT, - 0, - 8, - pbyData - ); + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_SET_TSFTBTT, + MESSAGE_REQUEST_TBTT, + 0, + 8, + pbyData + ); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Card:Update Next TBTT[%8lx]\n", (unsigned long)qwTSF); + "Card:Update Next TBTT[%8lx]\n", (unsigned long)qwTSF); - return; + return; } /* @@ -843,27 +843,27 @@ int CARDbRadioPowerOff(struct vnt_private *pDevice) { int bResult = true; - //if (pDevice->bRadioOff == true) - // return true; + //if (pDevice->bRadioOff == true) + // return true; - pDevice->bRadioOff = true; + pDevice->bRadioOff = true; - switch (pDevice->byRFType) { - case RF_AL2230: - case RF_AL2230S: - case RF_AIROHA7230: - case RF_VT3226: //RobertYu:20051111 - case RF_VT3226D0: - case RF_VT3342A0: //RobertYu:20060609 - MACvRegBitsOff(pDevice, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3)); - break; - } + switch (pDevice->byRFType) { + case RF_AL2230: + case RF_AL2230S: + case RF_AIROHA7230: + case RF_VT3226: //RobertYu:20051111 + case RF_VT3226D0: + case RF_VT3342A0: //RobertYu:20060609 + MACvRegBitsOff(pDevice, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3)); + break; + } - MACvRegBitsOff(pDevice, MAC_REG_HOSTCR, HOSTCR_RXON); + MACvRegBitsOff(pDevice, MAC_REG_HOSTCR, HOSTCR_RXON); - BBvSetDeepSleep(pDevice); + BBvSetDeepSleep(pDevice); - return bResult; + return bResult; } /* @@ -882,73 +882,73 @@ int CARDbRadioPowerOn(struct vnt_private *pDevice) { int bResult = true; - if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) { - return false; - } + if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) { + return false; + } - //if (pDevice->bRadioOff == false) - // return true; + //if (pDevice->bRadioOff == false) + // return true; - pDevice->bRadioOff = false; + pDevice->bRadioOff = false; - BBvExitDeepSleep(pDevice); + BBvExitDeepSleep(pDevice); - MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_RXON); + MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_RXON); - switch (pDevice->byRFType) { - case RF_AL2230: - case RF_AL2230S: - case RF_AIROHA7230: - case RF_VT3226: //RobertYu:20051111 - case RF_VT3226D0: - case RF_VT3342A0: //RobertYu:20060609 - MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3)); - break; - } + switch (pDevice->byRFType) { + case RF_AL2230: + case RF_AL2230S: + case RF_AIROHA7230: + case RF_VT3226: //RobertYu:20051111 + case RF_VT3226D0: + case RF_VT3342A0: //RobertYu:20060609 + MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3)); + break; + } - return bResult; + return bResult; } void CARDvSetBSSMode(struct vnt_private *pDevice) { - // Set BB and packet type at the same time.//{{RobertYu:20050222, AL7230 have two TX PA output, only connet to b/g now - // so in 11a mode need to set the MAC Reg0x4C to 11b/g mode to turn on PA - if( (pDevice->byRFType == RF_AIROHA7230 ) && (pDevice->byBBType == BB_TYPE_11A) ) - { - MACvSetBBType(pDevice, BB_TYPE_11G); - } - else - { - MACvSetBBType(pDevice, pDevice->byBBType); - } - pDevice->byPacketType = CARDbyGetPktType(pDevice); - - if (pDevice->byBBType == BB_TYPE_11A) { - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x03); - } else if (pDevice->byBBType == BB_TYPE_11B) { - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x02); - } else if (pDevice->byBBType == BB_TYPE_11G) { - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x08); - } - - vUpdateIFS(pDevice); - CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); - - if ( pDevice->byBBType == BB_TYPE_11A ) { - //request by Jack 2005-04-26 - if (pDevice->byRFType == RF_AIROHA7230) { - pDevice->abyBBVGA[0] = 0x20; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, pDevice->abyBBVGA[0]); - } - pDevice->abyBBVGA[2] = 0x10; - pDevice->abyBBVGA[3] = 0x10; - } else { - //request by Jack 2005-04-26 - if (pDevice->byRFType == RF_AIROHA7230) { - pDevice->abyBBVGA[0] = 0x1C; - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, pDevice->abyBBVGA[0]); - } - pDevice->abyBBVGA[2] = 0x0; - pDevice->abyBBVGA[3] = 0x0; - } + // Set BB and packet type at the same time.//{{RobertYu:20050222, AL7230 have two TX PA output, only connet to b/g now + // so in 11a mode need to set the MAC Reg0x4C to 11b/g mode to turn on PA + if( (pDevice->byRFType == RF_AIROHA7230 ) && (pDevice->byBBType == BB_TYPE_11A) ) + { + MACvSetBBType(pDevice, BB_TYPE_11G); + } + else + { + MACvSetBBType(pDevice, pDevice->byBBType); + } + pDevice->byPacketType = CARDbyGetPktType(pDevice); + + if (pDevice->byBBType == BB_TYPE_11A) { + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x03); + } else if (pDevice->byBBType == BB_TYPE_11B) { + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x02); + } else if (pDevice->byBBType == BB_TYPE_11G) { + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x08); + } + + vUpdateIFS(pDevice); + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); + + if ( pDevice->byBBType == BB_TYPE_11A ) { + //request by Jack 2005-04-26 + if (pDevice->byRFType == RF_AIROHA7230) { + pDevice->abyBBVGA[0] = 0x20; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, pDevice->abyBBVGA[0]); + } + pDevice->abyBBVGA[2] = 0x10; + pDevice->abyBBVGA[3] = 0x10; + } else { + //request by Jack 2005-04-26 + if (pDevice->byRFType == RF_AIROHA7230) { + pDevice->abyBBVGA[0] = 0x1C; + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, pDevice->abyBBVGA[0]); + } + pDevice->abyBBVGA[2] = 0x0; + pDevice->abyBBVGA[3] = 0x0; + } } diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index f843e50..80c2185 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -33,10 +33,10 @@ /* init card type */ typedef enum _CARD_PHY_TYPE { - PHY_TYPE_AUTO = 0, - PHY_TYPE_11B, - PHY_TYPE_11G, - PHY_TYPE_11A + PHY_TYPE_AUTO = 0, + PHY_TYPE_11B, + PHY_TYPE_11G, + PHY_TYPE_11A } CARD_PHY_TYPE, *PCARD_PHY_TYPE; #define CB_MAX_CHANNEL_24G 14 @@ -57,7 +57,7 @@ bool CARDbGetCurrentTSF(struct vnt_private *pDevice, u64 *pqwCurrTSF); bool CARDbClearCurrentTSF(struct vnt_private *pDevice); void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, u16 wBeaconInterval); void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, - u16 wBeaconInterval); + u16 wBeaconInterval); u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBeaconInterval); u64 CARDqGetTSFOffset(u8 byRxRate, u64 qwTSF1, u64 qwTSF2); int CARDbRadioPowerOff(struct vnt_private *pDevice); diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index 5a4fa0e..0f32ea6 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -44,63 +44,63 @@ static int msglevel = MSG_LEVEL_INFO; static SChannelTblElement sChannelTbl[CB_MAX_CHANNEL+1] = { - {0, 0, false}, - {1, 2412, true}, - {2, 2417, true}, - {3, 2422, true}, - {4, 2427, true}, - {5, 2432, true}, - {6, 2437, true}, - {7, 2442, true}, - {8, 2447, true}, - {9, 2452, true}, - {10, 2457, true}, - {11, 2462, true}, - {12, 2467, true}, - {13, 2472, true}, - {14, 2484, true}, - {183, 4915, true}, //15 - {184, 4920, true}, //16 - {185, 4925, true}, //17 - {187, 4935, true}, //18 - {188, 4940, true}, //19 - {189, 4945, true}, //20 - {192, 4960, true}, //21 - {196, 4980, true}, //22 - {7, 5035, true}, //23 - {8, 5040, true}, //24 - {9, 5045, true}, //25 - {11, 5055, true}, //26 - {12, 5060, true}, //27 - {16, 5080, true}, //28 - {34, 5170, true}, //29 - {36, 5180, true}, //30 - {38, 5190, true}, //31 - {40, 5200, true}, //32 - {42, 5210, true}, //33 - {44, 5220, true}, //34 - {46, 5230, true}, //35 - {48, 5240, true}, //36 - {52, 5260, true}, //37 - {56, 5280, true}, //38 - {60, 5300, true}, //39 - {64, 5320, true}, //40 - {100, 5500, true}, //41 - {104, 5520, true}, //42 - {108, 5540, true}, //43 - {112, 5560, true}, //44 - {116, 5580, true}, //45 - {120, 5600, true}, //46 - {124, 5620, true}, //47 - {128, 5640, true}, //48 - {132, 5660, true}, //49 - {136, 5680, true}, //50 - {140, 5700, true}, //51 - {149, 5745, true}, //52 - {153, 5765, true}, //53 - {157, 5785, true}, //54 - {161, 5805, true}, //55 - {165, 5825, true} //56 + {0, 0, false}, + {1, 2412, true}, + {2, 2417, true}, + {3, 2422, true}, + {4, 2427, true}, + {5, 2432, true}, + {6, 2437, true}, + {7, 2442, true}, + {8, 2447, true}, + {9, 2452, true}, + {10, 2457, true}, + {11, 2462, true}, + {12, 2467, true}, + {13, 2472, true}, + {14, 2484, true}, + {183, 4915, true}, //15 + {184, 4920, true}, //16 + {185, 4925, true}, //17 + {187, 4935, true}, //18 + {188, 4940, true}, //19 + {189, 4945, true}, //20 + {192, 4960, true}, //21 + {196, 4980, true}, //22 + {7, 5035, true}, //23 + {8, 5040, true}, //24 + {9, 5045, true}, //25 + {11, 5055, true}, //26 + {12, 5060, true}, //27 + {16, 5080, true}, //28 + {34, 5170, true}, //29 + {36, 5180, true}, //30 + {38, 5190, true}, //31 + {40, 5200, true}, //32 + {42, 5210, true}, //33 + {44, 5220, true}, //34 + {46, 5230, true}, //35 + {48, 5240, true}, //36 + {52, 5260, true}, //37 + {56, 5280, true}, //38 + {60, 5300, true}, //39 + {64, 5320, true}, //40 + {100, 5500, true}, //41 + {104, 5520, true}, //42 + {108, 5540, true}, //43 + {112, 5560, true}, //44 + {116, 5580, true}, //45 + {120, 5600, true}, //46 + {124, 5620, true}, //47 + {128, 5640, true}, //48 + {132, 5660, true}, //49 + {136, 5680, true}, //50 + {140, 5700, true}, //51 + {149, 5745, true}, //52 + {153, 5765, true}, //53 + {157, 5785, true}, //54 + {161, 5805, true}, //55 + {165, 5825, true} //56 }; /************************************************************************ @@ -108,256 +108,256 @@ static SChannelTblElement sChannelTbl[CB_MAX_CHANNEL+1] = ************************************************************************/ static struct { - u8 byChannelCountryCode; /* The country code */ - char chCountryCode[2]; - u8 bChannelIdxList[CB_MAX_CHANNEL]; /* Available channels Index */ - u8 byPower[CB_MAX_CHANNEL]; + u8 byChannelCountryCode; /* The country code */ + char chCountryCode[2]; + u8 bChannelIdxList[CB_MAX_CHANNEL]; /* Available channels Index */ + u8 byPower[CB_MAX_CHANNEL]; } ChannelRuleTab[] = { -/************************************************************************ - * This table is based on Athero driver rules - ************************************************************************/ -/* Country Available channels, ended with 0 */ -/* 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 */ -{CCODE_FCC, {'U','S'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1} - , { 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} }, -{CCODE_TELEC, {'J','P'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 23, 0, 0, 23, 0, 23, 23, 0, 23, 0, 0, 23, 23, 23, 0, 23, 0, 23, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, -{CCODE_ETSI, {'E','U'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, -{CCODE_CYPRUS, {'C','Y'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, -{CCODE_CZECH, {'C','Z'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, -{CCODE_DENMARK, {'D','K'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 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, 27, 27, 27, 0, 0, 0, 0, 0} }, -{CCODE_FINLAND, {'F','I'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, -{CCODE_FRANCE, {'F','R'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, -{CCODE_GERMANY, {'D','E'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 18, 0, 18, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, -{CCODE_LITHUANIA, {'L','T'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, -{CCODE_LUXEMBURG, {'L','U'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, -{CCODE_MACAU, {'M','O'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, -{CCODE_SOUTH_AFRICA, {'Z','A'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, -{CCODE_SOUTH_KOREA, {'K','R'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 23, 23, 23, 0} }, -{CCODE_SPAIN, {'E','S'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0} - , { 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 16, 0, 16, 0, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 0} }, -{CCODE_SWEDEN, {'S','E'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, -{CCODE_SWITZERLAND, {'C','H'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 18, 0, 18, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, -{CCODE_SYRIA, {'S','Y'}, { 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0} }, -{CCODE_MAX, {'U','N'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - , { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} } -/* 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 */ + /************************************************************************ + * This table is based on Athero driver rules + ************************************************************************/ + /* Country Available channels, ended with 0 */ + /* 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 */ + {CCODE_FCC, {'U','S'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1} + , { 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30,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, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_CZECH, {'C','Z'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, + {CCODE_DENMARK, {'D','K'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_DOMINICAN_REPUBLIC, {'D','O'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} }, + {CCODE_IRELAND, {'I','E'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_ITALY, {'I','T'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_ISRAEL, {'I','L'}, { 0, 0, 0, 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0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_LUXEMBURG, {'L','U'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_MACAU, {'M','O'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 23, 0, 23, 0, 23, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} }, + {CCODE_MACEDONIA, {'M','K'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0} }, + {CCODE_NETHERLANDS, {'N','L'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_NEW_ZEALAND, {'N','Z'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1} + , { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 23, 0, 23, 0, 23, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} }, + {CCODE_NORTH_KOREA, {'K','P'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} }, + {CCODE_POLAND, {'P','L'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_PORTUGAL, {'P','T'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_PUERTO_RICO, {'P','R'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,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0, 20, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 20, 20, 20} }, + {CCODE_SLOVAKIA, {'S','K'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0} + , { 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 16, 0, 16, 0, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 0} }, + {CCODE_SLOVENIA, {'S','I'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} }, + {CCODE_SOUTH_AFRICA, {'Z','A'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0} + , { 20, 20, 20, 20, 20, 20, 20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 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 */ }; /************************************************************************ @@ -372,32 +372,32 @@ static struct * 16 = 4.9G channel 184 * ..... * Output: true if the specified 5GHz band is allowed to be used. - False otherwise. + False otherwise. // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) ************************************************************************/ -bool + bool ChannelValid(unsigned int CountryCode, unsigned int ChannelIndex) { - bool bValid; + bool bValid; - bValid = false; - /* - * If Channel Index is invalid, return invalid - */ - if ((ChannelIndex > CB_MAX_CHANNEL) || - (ChannelIndex == 0)) - { - bValid = false; - goto exit; - } + bValid = false; + /* + * If Channel Index is invalid, return invalid + */ + if ((ChannelIndex > CB_MAX_CHANNEL) || + (ChannelIndex == 0)) + { + bValid = false; + goto exit; + } - bValid = sChannelTbl[ChannelIndex].bValid; + bValid = sChannelTbl[ChannelIndex].bValid; exit: - return (bValid); + return (bValid); } /* end ChannelValid */ @@ -406,68 +406,68 @@ void CHvInitChannelTable(struct vnt_private *pDevice) bool bMultiBand = false; int ii; - for (ii = 1; ii <= CB_MAX_CHANNEL; ii++) - sChannelTbl[ii].bValid = false; + for (ii = 1; ii <= CB_MAX_CHANNEL; ii++) + sChannelTbl[ii].bValid = false; - switch (pDevice->byRFType) { - case RF_AL2230: - case RF_AL2230S: - case RF_VT3226: - case RF_VT3226D0: - bMultiBand = false; - break; - case RF_AIROHA7230: - case RF_VT3342A0: - default : - bMultiBand = true; - break; - } + switch (pDevice->byRFType) { + case RF_AL2230: + case RF_AL2230S: + case RF_VT3226: + case RF_VT3226D0: + bMultiBand = false; + break; + case RF_AIROHA7230: + case RF_VT3342A0: + default : + bMultiBand = true; + break; + } - if (pDevice->b11hEable == true) { - if (bMultiBand == true) { - for (ii = 0; ii < CB_MAX_CHANNEL; ii++) { - sChannelTbl[ii+1].bValid = true; - //pDevice->abyRegPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; - //pDevice->abyLocalPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; - } - for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { - //pDevice->abyRegPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; - //pDevice->abyLocalPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; - } - } else { - for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { - sChannelTbl[ii+1].bValid = true; - //pDevice->abyRegPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; - //pDevice->abyLocalPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; - } - } - } else if (pDevice->byZoneType <= CCODE_MAX) { - if (bMultiBand == true) { - for (ii = 0; ii < CB_MAX_CHANNEL; ii++) { - if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) { + if (pDevice->b11hEable == true) { + if (bMultiBand == true) { + for (ii = 0; ii < CB_MAX_CHANNEL; ii++) { sChannelTbl[ii+1].bValid = true; - //pDevice->abyRegPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; - //pDevice->abyLocalPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; + //pDevice->abyRegPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; + //pDevice->abyLocalPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; } - } - } else { - for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { - if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) { + for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { + //pDevice->abyRegPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; + //pDevice->abyLocalPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; + } + } else { + for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { sChannelTbl[ii+1].bValid = true; - //pDevice->abyRegPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; - //pDevice->abyLocalPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; + //pDevice->abyRegPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; + //pDevice->abyLocalPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1]; + } + } + } else if (pDevice->byZoneType <= CCODE_MAX) { + if (bMultiBand == true) { + for (ii = 0; ii < CB_MAX_CHANNEL; ii++) { + if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) { + sChannelTbl[ii+1].bValid = true; + //pDevice->abyRegPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; + //pDevice->abyLocalPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; + } + } + } else { + for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) { + if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) { + sChannelTbl[ii+1].bValid = true; + //pDevice->abyRegPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; + //pDevice->abyLocalPwr[ii+1] = ChannelRuleTab[pDevice->byZoneType].byPower[ii]; + } } } - } - } - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO"Zone=[%d][%c][%c]!!\n",pDevice->byZoneType,ChannelRuleTab[pDevice->byZoneType].chCountryCode[0],ChannelRuleTab[pDevice->byZoneType].chCountryCode[1]); - for (ii = 0; ii < CB_MAX_CHANNEL; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Channel[%d] is [%d]\n",sChannelTbl[ii].byChannelNumber,sChannelTbl[ii+1].bValid); - /*if (pDevice->abyRegPwr[ii+1] == 0) { - pDevice->abyRegPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; - } - if (pDevice->abyLocalPwr[ii+1] == 0) { - pDevice->abyLocalPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; - }*/ - } + } + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO"Zone=[%d][%c][%c]!!\n",pDevice->byZoneType,ChannelRuleTab[pDevice->byZoneType].chCountryCode[0],ChannelRuleTab[pDevice->byZoneType].chCountryCode[1]); + for (ii = 0; ii < CB_MAX_CHANNEL; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Channel[%d] is [%d]\n",sChannelTbl[ii].byChannelNumber,sChannelTbl[ii+1].bValid); + /*if (pDevice->abyRegPwr[ii+1] == 0) { + pDevice->abyRegPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; + } + if (pDevice->abyLocalPwr[ii+1] == 0) { + pDevice->abyLocalPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; + }*/ + } } diff --git a/drivers/staging/vt6656/channel.h b/drivers/staging/vt6656/channel.h index 95701e0..b1af377 100644 --- a/drivers/staging/vt6656/channel.h +++ b/drivers/staging/vt6656/channel.h @@ -33,9 +33,9 @@ #include "device.h" typedef struct tagSChannelTblElement { - u8 byChannelNumber; - unsigned int uFrequency; - bool bValid; + u8 byChannelNumber; + unsigned int uFrequency; + bool bValid; } SChannelTblElement, *PSChannelTblElement; bool ChannelValid(unsigned int CountryCode, unsigned int ChannelNum); diff --git a/drivers/staging/vt6656/control.c b/drivers/staging/vt6656/control.c index 026784f..a3817c4 100644 --- a/drivers/staging/vt6656/control.c +++ b/drivers/staging/vt6656/control.c @@ -47,17 +47,17 @@ /* static int msglevel =MSG_LEVEL_DEBUG; */ void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, - u8 data) + u8 data) { CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, reg_off, reg, - sizeof(u8), &data); + sizeof(u8), &data); return; } void ControlvReadByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, - u8 *data) + u8 *data) { CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, reg_off, reg, sizeof(u8), data); @@ -65,7 +65,7 @@ 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) + u8 reg_mask, u8 data) { u8 reg_data[2]; diff --git a/drivers/staging/vt6656/control.h b/drivers/staging/vt6656/control.h index 9da9b96..ccd348f 100644 --- a/drivers/staging/vt6656/control.h +++ b/drivers/staging/vt6656/control.h @@ -34,21 +34,21 @@ #include "usbpipe.h" #define CONTROLnsRequestOut(Device, Request, Value, Index, Length, Buffer) \ - PIPEnsControlOut(Device, Request, Value, Index, Length, Buffer) + PIPEnsControlOut(Device, Request, Value, Index, Length, Buffer) #define CONTROLnsRequestOutAsyn(Device, Request, Value, Index, Length, Buffer) \ - PIPEnsControlOutAsyn(Device, Request, Value, Index, Length, Buffer) + PIPEnsControlOutAsyn(Device, Request, Value, Index, Length, Buffer) #define CONTROLnsRequestIn(Device, Request, Value, Index, Length, Buffer) \ - PIPEnsControlIn(Device, Request, Value, Index, Length, Buffer) + PIPEnsControlIn(Device, Request, Value, Index, Length, Buffer) void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, - u8 data); + u8 data); void ControlvReadByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, - u8 *data); + u8 *data); void ControlvMaskByte(struct vnt_private *pDevice, u8 reg_type, u8 reg_off, - u8 reg_mask, u8 data); + u8 reg_mask, u8 data); #endif /* __CONTROL_H__ */ diff --git a/drivers/staging/vt6656/country.h b/drivers/staging/vt6656/country.h index a0320d8..b6f9bc4 100644 --- a/drivers/staging/vt6656/country.h +++ b/drivers/staging/vt6656/country.h @@ -35,125 +35,125 @@ * Please check with VNWL.inf/VNWL64.inf/VNWL*.inf ************************************************************************/ typedef enum _COUNTRY_CODE { - CCODE_FCC = 0, - CCODE_TELEC, - CCODE_ETSI, - CCODE_RESV3, - CCODE_RESV4, - CCODE_RESV5, - CCODE_RESV6, - CCODE_RESV7, - CCODE_RESV8, - CCODE_RESV9, - CCODE_RESVa, - CCODE_RESVb, - CCODE_RESVc, - CCODE_RESVd, - CCODE_RESVe, - CCODE_ALLBAND, - CCODE_ALBANIA, - CCODE_ALGERIA, - CCODE_ARGENTINA, - CCODE_ARMENIA, - CCODE_AUSTRALIA, - CCODE_AUSTRIA, - CCODE_AZERBAIJAN, - CCODE_BAHRAIN, - CCODE_BELARUS, - CCODE_BELGIUM, - CCODE_BELIZE, - CCODE_BOLIVIA, - CCODE_BRAZIL, - CCODE_BRUNEI_DARUSSALAM, - CCODE_BULGARIA, - CCODE_CANADA, - CCODE_CHILE, - CCODE_CHINA, - CCODE_COLOMBIA, - CCODE_COSTA_RICA, - CCODE_CROATIA, - CCODE_CYPRUS, - CCODE_CZECH, - CCODE_DENMARK, - CCODE_DOMINICAN_REPUBLIC, - CCODE_ECUADOR, - CCODE_EGYPT, - CCODE_EL_SALVADOR, - CCODE_ESTONIA, - CCODE_FINLAND, - CCODE_FRANCE, - CCODE_GERMANY, - CCODE_GREECE, - CCODE_GEORGIA, - CCODE_GUATEMALA, - CCODE_HONDURAS, - CCODE_HONG_KONG, - CCODE_HUNGARY, - CCODE_ICELAND, - CCODE_INDIA, - CCODE_INDONESIA, - CCODE_IRAN, - CCODE_IRELAND, - CCODE_ITALY, - CCODE_ISRAEL, - CCODE_JAPAN, - CCODE_JORDAN, - CCODE_KAZAKHSTAN, - CCODE_KUWAIT, - CCODE_LATVIA, - CCODE_LEBANON, - CCODE_LEICHTENSTEIN, - CCODE_LITHUANIA, - CCODE_LUXEMBURG, - CCODE_MACAU, - CCODE_MACEDONIA, - CCODE_MALTA, - CCODE_MALAYSIA, - CCODE_MEXICO, - CCODE_MONACO, - CCODE_MOROCCO, - CCODE_NETHERLANDS, - CCODE_NEW_ZEALAND, - CCODE_NORTH_KOREA, - CCODE_NORWAY, - CCODE_OMAN, - CCODE_PAKISTAN, - CCODE_PANAMA, - CCODE_PERU, - CCODE_PHILIPPINES, - CCODE_POLAND, - CCODE_PORTUGAL, - CCODE_PUERTO_RICO, - CCODE_QATAR, - CCODE_ROMANIA, - CCODE_RUSSIA, - CCODE_SAUDI_ARABIA, - CCODE_SINGAPORE, - CCODE_SLOVAKIA, - CCODE_SLOVENIA, - CCODE_SOUTH_AFRICA, - CCODE_SOUTH_KOREA, - CCODE_SPAIN, - CCODE_SWEDEN, - CCODE_SWITZERLAND, - CCODE_SYRIA, - CCODE_TAIWAN, - CCODE_THAILAND, - CCODE_TRINIDAD_TOBAGO, - CCODE_TUNISIA, - CCODE_TURKEY, - CCODE_UK, - CCODE_UKRAINE, - CCODE_UNITED_ARAB_EMIRATES, - CCODE_UNITED_STATES, - CCODE_URUGUAY, - CCODE_UZBEKISTAN, - CCODE_VENEZUELA, - CCODE_VIETNAM, - CCODE_YEMEN, - CCODE_ZIMBABWE, - CCODE_JAPAN_W52_W53, - CCODE_MAX + CCODE_FCC = 0, + CCODE_TELEC, + CCODE_ETSI, + CCODE_RESV3, + CCODE_RESV4, + CCODE_RESV5, + CCODE_RESV6, + CCODE_RESV7, + CCODE_RESV8, + CCODE_RESV9, + CCODE_RESVa, + CCODE_RESVb, + CCODE_RESVc, + CCODE_RESVd, + CCODE_RESVe, + CCODE_ALLBAND, + CCODE_ALBANIA, + CCODE_ALGERIA, + CCODE_ARGENTINA, + CCODE_ARMENIA, + CCODE_AUSTRALIA, + CCODE_AUSTRIA, + CCODE_AZERBAIJAN, + CCODE_BAHRAIN, + CCODE_BELARUS, + CCODE_BELGIUM, + CCODE_BELIZE, + CCODE_BOLIVIA, + CCODE_BRAZIL, + CCODE_BRUNEI_DARUSSALAM, + CCODE_BULGARIA, + CCODE_CANADA, + CCODE_CHILE, + CCODE_CHINA, + CCODE_COLOMBIA, + CCODE_COSTA_RICA, + CCODE_CROATIA, + CCODE_CYPRUS, + CCODE_CZECH, + CCODE_DENMARK, + CCODE_DOMINICAN_REPUBLIC, + CCODE_ECUADOR, + CCODE_EGYPT, + CCODE_EL_SALVADOR, + CCODE_ESTONIA, + CCODE_FINLAND, + CCODE_FRANCE, + CCODE_GERMANY, + CCODE_GREECE, + CCODE_GEORGIA, + CCODE_GUATEMALA, + CCODE_HONDURAS, + CCODE_HONG_KONG, + CCODE_HUNGARY, + CCODE_ICELAND, + CCODE_INDIA, + CCODE_INDONESIA, + CCODE_IRAN, + CCODE_IRELAND, + CCODE_ITALY, + CCODE_ISRAEL, + CCODE_JAPAN, + CCODE_JORDAN, + CCODE_KAZAKHSTAN, + CCODE_KUWAIT, + CCODE_LATVIA, + CCODE_LEBANON, + CCODE_LEICHTENSTEIN, + CCODE_LITHUANIA, + CCODE_LUXEMBURG, + CCODE_MACAU, + CCODE_MACEDONIA, + CCODE_MALTA, + CCODE_MALAYSIA, + CCODE_MEXICO, + CCODE_MONACO, + CCODE_MOROCCO, + CCODE_NETHERLANDS, + CCODE_NEW_ZEALAND, + CCODE_NORTH_KOREA, + CCODE_NORWAY, + CCODE_OMAN, + CCODE_PAKISTAN, + CCODE_PANAMA, + CCODE_PERU, + CCODE_PHILIPPINES, + CCODE_POLAND, + CCODE_PORTUGAL, + CCODE_PUERTO_RICO, + CCODE_QATAR, + CCODE_ROMANIA, + CCODE_RUSSIA, + CCODE_SAUDI_ARABIA, + CCODE_SINGAPORE, + CCODE_SLOVAKIA, + CCODE_SLOVENIA, + CCODE_SOUTH_AFRICA, + CCODE_SOUTH_KOREA, + CCODE_SPAIN, + CCODE_SWEDEN, + CCODE_SWITZERLAND, + CCODE_SYRIA, + CCODE_TAIWAN, + CCODE_THAILAND, + CCODE_TRINIDAD_TOBAGO, + CCODE_TUNISIA, + CCODE_TURKEY, + CCODE_UK, + CCODE_UKRAINE, + CCODE_UNITED_ARAB_EMIRATES, + CCODE_UNITED_STATES, + CCODE_URUGUAY, + CCODE_UZBEKISTAN, + CCODE_VENEZUELA, + CCODE_VIETNAM, + CCODE_YEMEN, + CCODE_ZIMBABWE, + CCODE_JAPAN_W52_W53, + CCODE_MAX } COUNTRY_CODE; /************************************************************************ diff --git a/drivers/staging/vt6656/datarate.c b/drivers/staging/vt6656/datarate.c index 547db6f..90b81c5 100644 --- a/drivers/staging/vt6656/datarate.c +++ b/drivers/staging/vt6656/datarate.c @@ -79,7 +79,7 @@ void s_vResetCounter(PKnownNodeDB psNodeDBTable) * * Return Value: none * --*/ + -*/ #define AUTORATE_TXCNT_THRESHOLD 20 #define AUTORATE_INC_THRESHOLD 30 @@ -96,7 +96,7 @@ void s_vResetCounter(PKnownNodeDB psNodeDBTable) * * Return Value: RateIdx * --*/ + -*/ u16 RATEwGetRateIdx(u8 byRate) { u16 ii; @@ -129,12 +129,12 @@ u16 RATEwGetRateIdx(u8 byRate) * * Return Value: none * --*/ + -*/ void RATEvParseMaxRate(struct vnt_private *pDevice, - PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pItemExtRates, - int bUpdateBasicRate, u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, - u16 *pwSuppRate, u8 *pbyTopCCKRate, u8 *pbyTopOFDMRate) + PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pItemExtRates, + int bUpdateBasicRate, u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, + u16 *pwSuppRate, u8 *pbyTopCCKRate, u8 *pbyTopOFDMRate) { int ii; u8 byHighSuppRate = 0, byRate = 0; @@ -166,8 +166,8 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, */ CARDbAddBasicRate((void *)pDevice, RATEwGetRateIdx(byRate)); DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO"ParseMaxRate AddBasicRate: %d\n", - RATEwGetRateIdx(byRate)); + KERN_INFO"ParseMaxRate AddBasicRate: %d\n", + RATEwGetRateIdx(byRate)); } byRate = (u8)(pItemRates->abyRates[ii]&0x7F); if (byHighSuppRate == 0) @@ -242,18 +242,18 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, * * Return Value: none * --*/ + -*/ #define AUTORATE_TXCNT_THRESHOLD 20 #define AUTORATE_INC_THRESHOLD 30 void RATEvTxRateFallBack(struct vnt_private *pDevice, - PKnownNodeDB psNodeDBTable) + PKnownNodeDB psNodeDBTable) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; u16 wIdxDownRate = 0; int ii; int bAutoRate[MAX_RATE] = {true, true, true, true, false, false, true, - true, true, true, true, true}; + true, true, true, true, true}; u32 dwThroughputTbl[MAX_RATE] = {10, 20, 55, 110, 60, 90, 120, 180, 240, 360, 480, 540}; u32 dwThroughput = 0; @@ -341,7 +341,7 @@ void RATEvTxRateFallBack(struct vnt_private *pDevice, * * Return Value: None * --*/ + -*/ u8 RATEuSetIE(PWLAN_IE_SUPP_RATES pSrcRates, PWLAN_IE_SUPP_RATES pDstRates, unsigned int uRateLen) { diff --git a/drivers/staging/vt6656/datarate.h b/drivers/staging/vt6656/datarate.h index 96252ad..f8dc235 100644 --- a/drivers/staging/vt6656/datarate.h +++ b/drivers/staging/vt6656/datarate.h @@ -54,23 +54,23 @@ #define RATE_AUTO 12 void RATEvParseMaxRate(struct vnt_private *, PWLAN_IE_SUPP_RATES pItemRates, - PWLAN_IE_SUPP_RATES pItemExtRates, int bUpdateBasicRate, - u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, u16 *pwSuppRate, - u8 *pbyTopCCKRate, u8 *pbyTopOFDMRate); + PWLAN_IE_SUPP_RATES pItemExtRates, int bUpdateBasicRate, + u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, u16 *pwSuppRate, + u8 *pbyTopCCKRate, u8 *pbyTopOFDMRate); void RATEvTxRateFallBack(struct vnt_private *pDevice, - PKnownNodeDB psNodeDBTable); + PKnownNodeDB psNodeDBTable); u8 RATEuSetIE( - PWLAN_IE_SUPP_RATES pSrcRates, - PWLAN_IE_SUPP_RATES pDstRates, - unsigned int uRateLen - ); + PWLAN_IE_SUPP_RATES pSrcRates, + PWLAN_IE_SUPP_RATES pDstRates, + unsigned int uRateLen + ); u16 RATEwGetRateIdx( - u8 byRate - ); + u8 byRate + ); #endif /* __DATARATE_H__ */ diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h index 7c6dd5f..1f063a4 100644 --- a/drivers/staging/vt6656/desc.h +++ b/drivers/staging/vt6656/desc.h @@ -156,14 +156,14 @@ SBEACONCtl; typedef struct tagSSecretKey { u32 dwLowDword; - u8 byHighByte; + u8 byHighByte; } __attribute__ ((__packed__)) SSecretKey; typedef struct tagSKeyEntry { - u8 abyAddrHi[2]; - u16 wKCTL; - u8 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 e2abe3d..0369a1f 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -212,10 +212,10 @@ struct vnt_interrupt_buffer { /*++ NDIS related */ typedef enum __DEVICE_NDIS_STATUS { - STATUS_SUCCESS = 0, - STATUS_FAILURE, - STATUS_RESOURCES, - STATUS_PENDING, + STATUS_SUCCESS = 0, + STATUS_FAILURE, + STATUS_RESOURCES, + STATUS_PENDING, } DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS; #define MAX_BSSIDINFO_4_PMKID 16 @@ -228,20 +228,20 @@ typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; typedef enum _NDIS_802_11_WEP_STATUS { - Ndis802_11WEPEnabled, - Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, - Ndis802_11WEPDisabled, - Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, - Ndis802_11WEPKeyAbsent, - Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, - Ndis802_11WEPNotSupported, - Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, - Ndis802_11Encryption2Enabled, - Ndis802_11Encryption2KeyAbsent, - Ndis802_11Encryption3Enabled, - Ndis802_11Encryption3KeyAbsent + Ndis802_11WEPEnabled, + Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, + Ndis802_11WEPDisabled, + Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, + Ndis802_11WEPKeyAbsent, + Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, + Ndis802_11WEPNotSupported, + Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, + Ndis802_11Encryption2Enabled, + Ndis802_11Encryption2KeyAbsent, + Ndis802_11Encryption3Enabled, + Ndis802_11Encryption3KeyAbsent } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, - NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; + NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; typedef enum _NDIS_802_11_STATUS_TYPE { @@ -253,42 +253,42 @@ typedef enum _NDIS_802_11_STATUS_TYPE /* added new types for PMKID Candidate lists */ typedef struct _PMKID_CANDIDATE { - NDIS_802_11_MAC_ADDRESS BSSID; - unsigned long Flags; + NDIS_802_11_MAC_ADDRESS BSSID; + unsigned long Flags; } PMKID_CANDIDATE, *PPMKID_CANDIDATE; typedef struct _BSSID_INFO { - NDIS_802_11_MAC_ADDRESS BSSID; - NDIS_802_11_PMKID_VALUE PMKID; + NDIS_802_11_MAC_ADDRESS BSSID; + NDIS_802_11_PMKID_VALUE PMKID; } BSSID_INFO, *PBSSID_INFO; typedef struct tagSPMKID { - unsigned long Length; - unsigned long BSSIDInfoCount; - BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID]; + unsigned long Length; + unsigned long BSSIDInfoCount; + BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID]; } SPMKID, *PSPMKID; typedef struct tagSPMKIDCandidateEvent { - NDIS_802_11_STATUS_TYPE StatusType; + NDIS_802_11_STATUS_TYPE StatusType; unsigned long Version; /* Version of the structure */ unsigned long NumCandidates; /* No. of pmkid candidates */ - PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; + PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; /* The receive duplicate detection cache entry */ typedef struct tagSCacheEntry{ - u16 wFmSequence; - u8 abyAddr2[ETH_ALEN]; - u16 wFrameCtl; + u16 wFmSequence; + u8 abyAddr2[ETH_ALEN]; + u16 wFrameCtl; } SCacheEntry, *PSCacheEntry; typedef struct tagSCache{ -/* The receive cache is updated circularly. The next entry to be written is - * indexed by the "InPtr". - */ + /* The receive cache is updated circularly. The next entry to be written is + * indexed by the "InPtr". + */ unsigned int uInPtr; /* Place to use next */ - SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH]; + SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH]; } SCache, *PSCache; #define CB_MAX_RX_FRAG 64 @@ -297,14 +297,14 @@ typedef struct tagSCache{ */ typedef struct tagSDeFragControlBlock { - u16 wSequence; - u16 wFragNum; - u8 abyAddr2[ETH_ALEN]; + u16 wSequence; + u16 wFragNum; + u8 abyAddr2[ETH_ALEN]; unsigned int uLifetime; - struct sk_buff* skb; - u8 * pbyRxBuffer; - unsigned int cbFrameLength; - bool bInUse; + struct sk_buff* skb; + u8 * pbyRxBuffer; + unsigned int cbFrameLength; + bool bInUse; } SDeFragControlBlock, *PSDeFragControlBlock; /* flags for options */ @@ -337,14 +337,14 @@ typedef struct __device_opt { int nRxDescs0; /* number of RX descriptors 0 */ int nTxDescs0; /* number of TX descriptors 0, 1, 2, 3 */ int rts_thresh; /* RTS threshold */ - int frag_thresh; - int OpMode; - int data_rate; - int channel_num; - int short_retry; - int long_retry; - int bbp_type; - u32 flags; + int frag_thresh; + int OpMode; + int data_rate; + int channel_num; + int short_retry; + int long_retry; + int bbp_type; + u32 flags; } OPTIONS, *POPTIONS; struct vnt_private { @@ -706,30 +706,30 @@ struct vnt_private { #define EnqueueRCB(_Head, _Tail, _RCB) \ { \ - if (!_Head) { \ - _Head = _RCB; \ - } \ - else { \ - _Tail->Next = _RCB; \ - } \ - _RCB->Next = NULL; \ - _Tail = _RCB; \ + if (!_Head) { \ + _Head = _RCB; \ + } \ + else { \ + _Tail->Next = _RCB; \ + } \ + _RCB->Next = NULL; \ + _Tail = _RCB; \ } #define DequeueRCB(Head, Tail) \ { \ - struct vnt_rcb *RCB = Head; \ - if (!RCB->Next) { \ - Tail = NULL; \ - } \ - Head = RCB->Next; \ + struct vnt_rcb *RCB = Head; \ + if (!RCB->Next) { \ + Tail = NULL; \ + } \ + Head = RCB->Next; \ } #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ - if ((uVar) >= ((uModulo) - 1)) \ - (uVar) = 0; \ - else \ - (uVar)++; \ + if ((uVar) >= ((uModulo) - 1)) \ + (uVar) = 0; \ + else \ + (uVar)++; \ } #define fMP_RESET_IN_PROGRESS 0x00000001 @@ -750,7 +750,7 @@ struct vnt_private { #define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) #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) + (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0) int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF); void vnt_configure_filter(struct vnt_private *); diff --git a/drivers/staging/vt6656/device_cfg.h b/drivers/staging/vt6656/device_cfg.h index 0b9d834..fcd90eb 100644 --- a/drivers/staging/vt6656/device_cfg.h +++ b/drivers/staging/vt6656/device_cfg.h @@ -31,9 +31,9 @@ typedef struct _version { - unsigned char major; - unsigned char minor; - unsigned char build; + unsigned char major; + unsigned char minor; + unsigned char build; } version_t, *pversion_t; #ifndef false @@ -81,7 +81,7 @@ struct _version { #define OPTION_DEFAULT { [0 ... MAX_UINTS-1] = -1} typedef enum _chip_type { - VT3184 = 1 + VT3184 = 1 } CHIP_TYPE, *PCHIP_TYPE; #endif diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index 4ccaa7e..15dc4b4 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -68,28 +68,28 @@ static u8 s_byGetRateIdx(u8 byRate); static void s_vGetDASA( - u8 * pbyRxBufferAddr, - unsigned int *pcbHeaderSize, - struct ethhdr *psEthHeader - ); + u8 * pbyRxBufferAddr, + unsigned int *pcbHeaderSize, + struct ethhdr *psEthHeader + ); static void s_vProcessRxMACHeader(struct vnt_private *pDevice, - u8 *pbyRxBufferAddr, u32 cbPacketSize, int bIsWEP, int bExtIV, - u32 *pcbHeadSize); + u8 *pbyRxBufferAddr, u32 cbPacketSize, int bIsWEP, int bExtIV, + u32 *pcbHeadSize); static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, - s32 iSANodeIndex); + s32 iSANodeIndex); static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, - u32 FrameSize, u32 cbHeaderOffset, s32 iSANodeIndex, s32 iDANodeIndex); + u32 FrameSize, u32 cbHeaderOffset, s32 iSANodeIndex, s32 iDANodeIndex); static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, - u32 FrameSize, u8 *pbyRsr, u8 *pbyNewRsr, PSKeyItem *pKeyOut, - s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16); + u32 FrameSize, u8 *pbyRsr, u8 *pbyNewRsr, PSKeyItem *pKeyOut, + s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16); static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, - u32 FrameSize, u8 *pbyRsr, int bOnFly, PSKeyItem pKey, u8 *pbyNewRsr, - s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16); + u32 FrameSize, u8 *pbyRsr, int bOnFly, PSKeyItem pKey, u8 *pbyNewRsr, + s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16); /*+ * @@ -107,11 +107,11 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, * * Return Value: None * --*/ + -*/ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, - u8 *pbyRxBufferAddr, u32 cbPacketSize, int bIsWEP, int bExtIV, - u32 *pcbHeadSize) + u8 *pbyRxBufferAddr, u32 cbPacketSize, int bIsWEP, int bExtIV, + u32 *pcbHeadSize) { u8 *pbyRxBuffer; u32 cbHeaderSize = 0; @@ -119,88 +119,88 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, struct ieee80211_hdr *pMACHeader; int ii; - pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize); - - s_vGetDASA((u8 *)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader); - - if (bIsWEP) { - if (bExtIV) { - // strip IV&ExtIV , add 8 byte - cbHeaderSize += (WLAN_HDR_ADDR3_LEN + 8); - } else { - // strip IV , add 4 byte - cbHeaderSize += (WLAN_HDR_ADDR3_LEN + 4); - } - } - else { - cbHeaderSize += WLAN_HDR_ADDR3_LEN; - }; - - pbyRxBuffer = (u8 *) (pbyRxBufferAddr + cbHeaderSize); - if (ether_addr_equal(pbyRxBuffer, pDevice->abySNAP_Bridgetunnel)) { - cbHeaderSize += 6; - } else if (ether_addr_equal(pbyRxBuffer, pDevice->abySNAP_RFC1042)) { - cbHeaderSize += 6; - pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); - if ((*pwType == cpu_to_be16(ETH_P_IPX)) || - (*pwType == cpu_to_le16(0xF380))) { - cbHeaderSize -= 8; - pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); - if (bIsWEP) { - if (bExtIV) { - *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 8); // 8 is IV&ExtIV - } else { - *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 4); // 4 is IV - } - } - else { - *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN); - } - } - } - else { - cbHeaderSize -= 2; - pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); - if (bIsWEP) { - if (bExtIV) { - *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 8); // 8 is IV&ExtIV - } else { - *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 4); // 4 is IV - } - } - else { - *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN); - } - } - - cbHeaderSize -= (ETH_ALEN * 2); - pbyRxBuffer = (u8 *) (pbyRxBufferAddr + cbHeaderSize); - for (ii = 0; ii < ETH_ALEN; ii++) - *pbyRxBuffer++ = pDevice->sRxEthHeader.h_dest[ii]; - for (ii = 0; ii < ETH_ALEN; ii++) - *pbyRxBuffer++ = pDevice->sRxEthHeader.h_source[ii]; - - *pcbHeadSize = cbHeaderSize; + pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize); + + s_vGetDASA((u8 *)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader); + + if (bIsWEP) { + if (bExtIV) { + // strip IV&ExtIV , add 8 byte + cbHeaderSize += (WLAN_HDR_ADDR3_LEN + 8); + } else { + // strip IV , add 4 byte + cbHeaderSize += (WLAN_HDR_ADDR3_LEN + 4); + } + } + else { + cbHeaderSize += WLAN_HDR_ADDR3_LEN; + }; + + pbyRxBuffer = (u8 *) (pbyRxBufferAddr + cbHeaderSize); + if (ether_addr_equal(pbyRxBuffer, pDevice->abySNAP_Bridgetunnel)) { + cbHeaderSize += 6; + } else if (ether_addr_equal(pbyRxBuffer, pDevice->abySNAP_RFC1042)) { + cbHeaderSize += 6; + pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); + if ((*pwType == cpu_to_be16(ETH_P_IPX)) || + (*pwType == cpu_to_le16(0xF380))) { + cbHeaderSize -= 8; + pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); + if (bIsWEP) { + if (bExtIV) { + *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 8); // 8 is IV&ExtIV + } else { + *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 4); // 4 is IV + } + } + else { + *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN); + } + } + } + else { + cbHeaderSize -= 2; + pwType = (u16 *) (pbyRxBufferAddr + cbHeaderSize); + if (bIsWEP) { + if (bExtIV) { + *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 8); // 8 is IV&ExtIV + } else { + *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 4); // 4 is IV + } + } + else { + *pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN); + } + } + + cbHeaderSize -= (ETH_ALEN * 2); + pbyRxBuffer = (u8 *) (pbyRxBufferAddr + cbHeaderSize); + for (ii = 0; ii < ETH_ALEN; ii++) + *pbyRxBuffer++ = pDevice->sRxEthHeader.h_dest[ii]; + for (ii = 0; ii < ETH_ALEN; ii++) + *pbyRxBuffer++ = pDevice->sRxEthHeader.h_source[ii]; + + *pcbHeadSize = cbHeaderSize; } static u8 s_byGetRateIdx(u8 byRate) { - u8 byRateIdx; + u8 byRateIdx; - for (byRateIdx = 0; byRateIdx <MAX_RATE ; byRateIdx++) { - if (acbyRxRate[byRateIdx%MAX_RATE] == byRate) - return byRateIdx; - } - return 0; + for (byRateIdx = 0; byRateIdx <MAX_RATE ; byRateIdx++) { + if (acbyRxRate[byRateIdx%MAX_RATE] == byRate) + return byRateIdx; + } + return 0; } static -void + void s_vGetDASA ( - u8 * pbyRxBufferAddr, - unsigned int *pcbHeaderSize, - struct ethhdr *psEthHeader - ) + u8 * pbyRxBufferAddr, + unsigned int *pcbHeaderSize, + struct ethhdr *psEthHeader + ) { unsigned int cbHeaderSize = 0; struct ieee80211_hdr *pMACHeader; @@ -212,17 +212,17 @@ s_vGetDASA ( if (pMACHeader->frame_control & FC_FROMDS) { for (ii = 0; ii < ETH_ALEN; ii++) { psEthHeader->h_dest[ii] = - pMACHeader->addr1[ii]; + pMACHeader->addr1[ii]; psEthHeader->h_source[ii] = - pMACHeader->addr3[ii]; + pMACHeader->addr3[ii]; } } else { /* IBSS mode */ for (ii = 0; ii < ETH_ALEN; ii++) { psEthHeader->h_dest[ii] = - pMACHeader->addr1[ii]; + pMACHeader->addr1[ii]; psEthHeader->h_source[ii] = - pMACHeader->addr2[ii]; + pMACHeader->addr2[ii]; } } } else { @@ -230,25 +230,25 @@ s_vGetDASA ( if (pMACHeader->frame_control & FC_FROMDS) { for (ii = 0; ii < ETH_ALEN; ii++) { psEthHeader->h_dest[ii] = - pMACHeader->addr3[ii]; + pMACHeader->addr3[ii]; psEthHeader->h_source[ii] = - pMACHeader->addr4[ii]; + pMACHeader->addr4[ii]; cbHeaderSize += 6; } } else { for (ii = 0; ii < ETH_ALEN; ii++) { psEthHeader->h_dest[ii] = - pMACHeader->addr3[ii]; + pMACHeader->addr3[ii]; psEthHeader->h_source[ii] = - pMACHeader->addr2[ii]; + pMACHeader->addr2[ii]; } } }; - *pcbHeaderSize = cbHeaderSize; + *pcbHeaderSize = cbHeaderSize; } int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB, - unsigned long BytesToIndicate) + unsigned long BytesToIndicate) { struct net_device_stats *pStats = &pDevice->stats; struct sk_buff *skb; @@ -276,14 +276,14 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB, u8 *pbyDAddress; u16 *pwPLCP_Length; u8 abyVaildRate[MAX_RATE] - = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; + = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; u16 wPLCPwithPadding; struct ieee80211_hdr *pMACHeader; int bRxeapol_key = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- RXbBulkInProcessData---\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- RXbBulkInProcessData---\n"); - skb = pRCB->skb; + skb = pRCB->skb; /* [31:16]RcvByteCount ( not include 4-byte Status ) */ dwWbkStatus = *((u32 *)(skb->data)); @@ -296,460 +296,460 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB, return false; } - if ((BytesToIndicate > 2372) || (BytesToIndicate <= 40)) { - // Frame Size error drop this packet. - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 2\n"); - pStats->rx_frame_errors++; - return false; - } - - 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 = (u16 *) (pbyDAddress + 6); - //Fix hardware bug => PLCP_Length error - if ( ((BytesToIndicate - (*pwPLCP_Length)) > 27) || - ((BytesToIndicate - (*pwPLCP_Length)) < 24) || - (BytesToIndicate < (*pwPLCP_Length)) ) { - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Wrong PLCP Length %x\n", (int) *pwPLCP_Length); - pStats->rx_frame_errors++; - return false; - } - for ( ii=RATE_1M;ii<MAX_RATE;ii++) { - if ( *pbyRxRate == abyVaildRate[ii] ) { - break; - } - } - if ( ii==MAX_RATE ) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Wrong RxRate %x\n",(int) *pbyRxRate); - return false; - } - - wPLCPwithPadding = ( (*pwPLCP_Length / 4) + ( (*pwPLCP_Length % 4) ? 1:0 ) ) *4; + if ((BytesToIndicate > 2372) || (BytesToIndicate <= 40)) { + // Frame Size error drop this packet. + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 2\n"); + pStats->rx_frame_errors++; + return false; + } + + 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 = (u16 *) (pbyDAddress + 6); + //Fix hardware bug => PLCP_Length error + if ( ((BytesToIndicate - (*pwPLCP_Length)) > 27) || + ((BytesToIndicate - (*pwPLCP_Length)) < 24) || + (BytesToIndicate < (*pwPLCP_Length)) ) { + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Wrong PLCP Length %x\n", (int) *pwPLCP_Length); + pStats->rx_frame_errors++; + return false; + } + for ( ii=RATE_1M;ii<MAX_RATE;ii++) { + if ( *pbyRxRate == abyVaildRate[ii] ) { + break; + } + } + if ( ii==MAX_RATE ) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Wrong RxRate %x\n",(int) *pbyRxRate); + return false; + } + + wPLCPwithPadding = ( (*pwPLCP_Length / 4) + ( (*pwPLCP_Length % 4) ? 1:0 ) ) *4; pqwTSFTime = (u64 *)(pbyDAddress + 8 + wPLCPwithPadding); - if(pDevice->byBBType == BB_TYPE_11G) { - pby3SQ = pbyDAddress + 8 + wPLCPwithPadding + 12; - pbySQ = pby3SQ; - } - else { - pbySQ = pbyDAddress + 8 + wPLCPwithPadding + 8; - pby3SQ = pbySQ; - } - pbyNewRsr = pbyDAddress + 8 + wPLCPwithPadding + 9; - pbyRSSI = pbyDAddress + 8 + wPLCPwithPadding + 10; - pbyRsr = pbyDAddress + 8 + wPLCPwithPadding + 11; - - FrameSize = *pwPLCP_Length; - - pbyFrame = pbyDAddress + 8; - - 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 (ether_addr_equal(pMgmt->abyCurrBSSID, pMACHeader->addr2)) { - if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) - pMgmt->sNodeDBTable[0].uInActiveCount = 0; - } - } - } - - if (!is_multicast_ether_addr(pMACHeader->addr1)) { - if (WCTLbIsDuplicate(&(pDevice->sDupRxCache), (struct ieee80211_hdr *) pbyFrame)) { - return false; - } - - if (!ether_addr_equal(pDevice->abyCurrentNetAddr, pMACHeader->addr1)) { + if(pDevice->byBBType == BB_TYPE_11G) { + pby3SQ = pbyDAddress + 8 + wPLCPwithPadding + 12; + pbySQ = pby3SQ; + } + else { + pbySQ = pbyDAddress + 8 + wPLCPwithPadding + 8; + pby3SQ = pbySQ; + } + pbyNewRsr = pbyDAddress + 8 + wPLCPwithPadding + 9; + pbyRSSI = pbyDAddress + 8 + wPLCPwithPadding + 10; + pbyRsr = pbyDAddress + 8 + wPLCPwithPadding + 11; + + FrameSize = *pwPLCP_Length; + + pbyFrame = pbyDAddress + 8; + + 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 (ether_addr_equal(pMgmt->abyCurrBSSID, pMACHeader->addr2)) { + if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) + pMgmt->sNodeDBTable[0].uInActiveCount = 0; + } + } + } + + if (!is_multicast_ether_addr(pMACHeader->addr1)) { + if (WCTLbIsDuplicate(&(pDevice->sDupRxCache), (struct ieee80211_hdr *) pbyFrame)) { + return false; + } + + if (!ether_addr_equal(pDevice->abyCurrentNetAddr, pMACHeader->addr1)) { + return false; + } + } + + // Use for TKIP MIC + s_vGetDASA(pbyFrame, &cbHeaderSize, &pDevice->sRxEthHeader); + + if (ether_addr_equal((u8 *)pDevice->sRxEthHeader.h_source, + pDevice->abyCurrentNetAddr)) return false; - } - } - - // Use for TKIP MIC - s_vGetDASA(pbyFrame, &cbHeaderSize, &pDevice->sRxEthHeader); - - if (ether_addr_equal((u8 *)pDevice->sRxEthHeader.h_source, - 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 = (struct ieee80211_hdr *) (pbyFrame); - // get SA NodeIndex - if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(p802_11Header->addr2), &iSANodeIndex)) { - pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = jiffies; - pMgmt->sNodeDBTable[iSANodeIndex].uInActiveCount = 0; - } - } - } - - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - if (s_bAPModeRxCtl(pDevice, pbyFrame, iSANodeIndex) == true) { - return false; - } - } - - if (IS_FC_WEP(pbyFrame)) { - bool bRxDecryOK = false; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"rx WEP pkt\n"); - bIsWEP = true; - if ((pDevice->bEnableHostWEP) && (iSANodeIndex >= 0)) { - pKey = &STempKey; - pKey->byCipherSuite = pMgmt->sNodeDBTable[iSANodeIndex].byCipherSuite; - pKey->dwKeyIndex = pMgmt->sNodeDBTable[iSANodeIndex].dwKeyIndex; - pKey->uKeyLength = pMgmt->sNodeDBTable[iSANodeIndex].uWepKeyLength; - pKey->dwTSC47_16 = pMgmt->sNodeDBTable[iSANodeIndex].dwTSC47_16; - pKey->wTSC15_0 = pMgmt->sNodeDBTable[iSANodeIndex].wTSC15_0; - memcpy(pKey->abyKey, - &pMgmt->sNodeDBTable[iSANodeIndex].abyWepKey[0], - pKey->uKeyLength - ); - - bRxDecryOK = s_bHostWepRxEncryption(pDevice, - pbyFrame, - FrameSize, - pbyRsr, - pMgmt->sNodeDBTable[iSANodeIndex].bOnFly, - pKey, - pbyNewRsr, - &bExtIV, - &wRxTSC15_0, - &dwRxTSC47_16); - } else { - bRxDecryOK = s_bHandleRxEncryption(pDevice, - pbyFrame, - FrameSize, - pbyRsr, - pbyNewRsr, - &pKey, - &bExtIV, - &wRxTSC15_0, - &dwRxTSC47_16); - } - - if (bRxDecryOK) { - if ((*pbyNewRsr & NEWRSR_DECRYPTOK) == 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV Fail\n"); - if ( (pMgmt->eAuthenMode == WMAC_AUTH_WPA) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { - } - return false; - } - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WEP Func Fail\n"); - return false; - } - if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP)) - FrameSize -= 8; // Message Integrity Code - else - FrameSize -= 4; // 4 is ICV - } - - // - // RX OK - // - /* remove the FCS/CRC length */ - FrameSize -= ETH_FCS_LEN; - - if ( !(*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) && // unicast address - (IS_FRAGMENT_PKT((pbyFrame))) - ) { - // defragment - bDeFragRx = WCTLbHandleFragment(pDevice, (struct ieee80211_hdr *) (pbyFrame), FrameSize, bIsWEP, bExtIV); - if (bDeFragRx) { - // defrag complete - // TODO skb, pbyFrame - skb = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb; - FrameSize = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength; - pbyFrame = skb->data + 8; - } - else { - return false; - } - } - - // - // Management & Control frame Handle - // - if ((IS_TYPE_DATA((pbyFrame))) == false) { - // Handle Control & Manage Frame - - if (IS_TYPE_MGMT((pbyFrame))) { - u8 * pbyData1; - u8 * pbyData2; - - pRxPacket = &(pRCB->sMngPacket); - pRxPacket->p80211Header = (PUWLAN_80211HDR)(pbyFrame); - pRxPacket->cbMPDULen = FrameSize; - pRxPacket->uRSSI = *pbyRSSI; - pRxPacket->bySQ = *pbySQ; - pRxPacket->qwLocalTSF = cpu_to_le64(*pqwTSFTime); - if (bIsWEP) { - // strip IV - pbyData1 = WLAN_HDR_A3_DATA_PTR(pbyFrame); - pbyData2 = WLAN_HDR_A3_DATA_PTR(pbyFrame) + 4; - for (ii = 0; ii < (FrameSize - 4); ii++) { - *pbyData1 = *pbyData2; - pbyData1++; - pbyData2++; - } - } - - pRxPacket->byRxRate = s_byGetRateIdx(*pbyRxRate); - - if ( *pbyRxSts == 0 ) { - //Discard beacon packet which channel is 0 - if ( (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) == WLAN_FSTYPE_BEACON) || - (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) == WLAN_FSTYPE_PROBERESP) ) { + + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) { + if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { + p802_11Header = (struct ieee80211_hdr *) (pbyFrame); + // get SA NodeIndex + if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(p802_11Header->addr2), &iSANodeIndex)) { + pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = jiffies; + pMgmt->sNodeDBTable[iSANodeIndex].uInActiveCount = 0; + } + } + } + + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + if (s_bAPModeRxCtl(pDevice, pbyFrame, iSANodeIndex) == true) { return false; - } - } - pRxPacket->byRxChannel = (*pbyRxSts) >> 2; - - // hostap Deamon handle 802.11 management - if (pDevice->bEnableHostapd) { - skb->dev = pDevice->apdev; - //skb->data += 4; - //skb->tail += 4; - skb->data += 8; - skb->tail += 8; - skb_put(skb, FrameSize); - skb_reset_mac_header(skb); - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb); - return true; - } - - // - // Insert the RCB in the Recv Mng list - // - EnqueueRCB(pDevice->FirstRecvMngList, pDevice->LastRecvMngList, pRCBIndicate); - pDevice->NumRecvMngList++; - if ( bDeFragRx == false) { - pRCB->Ref++; - } - if (pDevice->bIsRxMngWorkItemQueued == false) { - pDevice->bIsRxMngWorkItemQueued = true; - schedule_work(&pDevice->rx_mng_work_item); - } - - } - else { - // Control Frame - }; - return false; - } - else { - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - //In AP mode, hw only check addr1(BSSID or RA) if equal to local MAC. - if ( !(*pbyRsr & RSR_BSSIDOK)) { - if (bDeFragRx) { - if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); - } - } - return false; - } - } - else { - // discard DATA packet while not associate || BSSID error - if ((pDevice->bLinkPass == false) || - !(*pbyRsr & RSR_BSSIDOK)) { - if (bDeFragRx) { - if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); - } - } - return false; - } - //mike add:station mode check eapol-key challenge---> - { - u8 Protocol_Version; //802.1x Authentication - u8 Packet_Type; //802.1x Authentication - u8 Descriptor_type; - u16 Key_info; - if (bIsWEP) - cbIVOffset = 8; - else - cbIVOffset = 0; - wEtherType = (skb->data[cbIVOffset + 8 + 24 + 6] << 8) | - skb->data[cbIVOffset + 8 + 24 + 6 + 1]; - Protocol_Version = skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1]; - Packet_Type = skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1]; - if (wEtherType == ETH_P_PAE) { //Protocol Type in LLC-Header - if(((Protocol_Version==1) ||(Protocol_Version==2)) && - (Packet_Type==3)) { //802.1x OR eapol-key challenge frame receive - bRxeapol_key = true; - Descriptor_type = skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2]; - Key_info = (skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2+1]<<8) |skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2+2] ; - if(Descriptor_type==2) { //RSN - // printk("WPA2_Rx_eapol-key_info<-----:%x\n",Key_info); - } - else if(Descriptor_type==254) { - // printk("WPA_Rx_eapol-key_info<-----:%x\n",Key_info); - } - } - } - } - //mike add:station mode check eapol-key challenge<--- - } - } - -// Data frame Handle - - if (pDevice->bEnablePSMode) { - if (IS_FC_MOREDATA((pbyFrame))) { - if (*pbyRsr & RSR_ADDROK) { - //PSbSendPSPOLL((PSDevice)pDevice); - } - } - else { - if (pMgmt->bInTIMWake == true) { - pMgmt->bInTIMWake = false; - } - } - } - - // Now it only supports 802.11g Infrastructure Mode, and support rate must up to 54 Mbps - if (pDevice->bDiversityEnable && (FrameSize>50) && - pDevice->op_mode == NL80211_IFTYPE_STATION && - (pDevice->bLinkPass == true)) { - BBvAntennaDiversity(pDevice, s_byGetRateIdx(*pbyRxRate), 0); - } - - // ++++++++ For BaseBand Algorithm +++++++++++++++ - pDevice->uCurrRSSI = *pbyRSSI; - pDevice->byCurrSQ = *pbySQ; - - // todo -/* - if ((*pbyRSSI != 0) && - (pMgmt->pCurrBSS!=NULL)) { - RFvRSSITodBm(pDevice, *pbyRSSI, &ldBm); - // Monitor if RSSI is too strong. - pMgmt->pCurrBSS->byRSSIStatCnt++; - pMgmt->pCurrBSS->byRSSIStatCnt %= RSSI_STAT_COUNT; - pMgmt->pCurrBSS->ldBmAverage[pMgmt->pCurrBSS->byRSSIStatCnt] = ldBm; + } + } + + if (IS_FC_WEP(pbyFrame)) { + bool bRxDecryOK = false; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"rx WEP pkt\n"); + bIsWEP = true; + if ((pDevice->bEnableHostWEP) && (iSANodeIndex >= 0)) { + pKey = &STempKey; + pKey->byCipherSuite = pMgmt->sNodeDBTable[iSANodeIndex].byCipherSuite; + pKey->dwKeyIndex = pMgmt->sNodeDBTable[iSANodeIndex].dwKeyIndex; + pKey->uKeyLength = pMgmt->sNodeDBTable[iSANodeIndex].uWepKeyLength; + pKey->dwTSC47_16 = pMgmt->sNodeDBTable[iSANodeIndex].dwTSC47_16; + pKey->wTSC15_0 = pMgmt->sNodeDBTable[iSANodeIndex].wTSC15_0; + memcpy(pKey->abyKey, + &pMgmt->sNodeDBTable[iSANodeIndex].abyWepKey[0], + pKey->uKeyLength + ); + + bRxDecryOK = s_bHostWepRxEncryption(pDevice, + pbyFrame, + FrameSize, + pbyRsr, + pMgmt->sNodeDBTable[iSANodeIndex].bOnFly, + pKey, + pbyNewRsr, + &bExtIV, + &wRxTSC15_0, + &dwRxTSC47_16); + } else { + bRxDecryOK = s_bHandleRxEncryption(pDevice, + pbyFrame, + FrameSize, + pbyRsr, + pbyNewRsr, + &pKey, + &bExtIV, + &wRxTSC15_0, + &dwRxTSC47_16); + } + + if (bRxDecryOK) { + if ((*pbyNewRsr & NEWRSR_DECRYPTOK) == 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV Fail\n"); + if ( (pMgmt->eAuthenMode == WMAC_AUTH_WPA) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { + } + return false; + } + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WEP Func Fail\n"); + return false; + } + if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP)) + FrameSize -= 8; // Message Integrity Code + else + FrameSize -= 4; // 4 is ICV + } + + // + // RX OK + // + /* remove the FCS/CRC length */ + FrameSize -= ETH_FCS_LEN; + + if ( !(*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) && // unicast address + (IS_FRAGMENT_PKT((pbyFrame))) + ) { + // defragment + bDeFragRx = WCTLbHandleFragment(pDevice, (struct ieee80211_hdr *) (pbyFrame), FrameSize, bIsWEP, bExtIV); + if (bDeFragRx) { + // defrag complete + // TODO skb, pbyFrame + skb = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb; + FrameSize = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength; + pbyFrame = skb->data + 8; + } + else { + return false; + } + } + + // + // Management & Control frame Handle + // + if ((IS_TYPE_DATA((pbyFrame))) == false) { + // Handle Control & Manage Frame + + if (IS_TYPE_MGMT((pbyFrame))) { + u8 * pbyData1; + u8 * pbyData2; + + pRxPacket = &(pRCB->sMngPacket); + pRxPacket->p80211Header = (PUWLAN_80211HDR)(pbyFrame); + pRxPacket->cbMPDULen = FrameSize; + pRxPacket->uRSSI = *pbyRSSI; + pRxPacket->bySQ = *pbySQ; + pRxPacket->qwLocalTSF = cpu_to_le64(*pqwTSFTime); + if (bIsWEP) { + // strip IV + pbyData1 = WLAN_HDR_A3_DATA_PTR(pbyFrame); + pbyData2 = WLAN_HDR_A3_DATA_PTR(pbyFrame) + 4; + for (ii = 0; ii < (FrameSize - 4); ii++) { + *pbyData1 = *pbyData2; + pbyData1++; + pbyData2++; + } + } + + pRxPacket->byRxRate = s_byGetRateIdx(*pbyRxRate); + + if ( *pbyRxSts == 0 ) { + //Discard beacon packet which channel is 0 + if ( (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) == WLAN_FSTYPE_BEACON) || + (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) == WLAN_FSTYPE_PROBERESP) ) { + return false; + } + } + pRxPacket->byRxChannel = (*pbyRxSts) >> 2; + + // hostap Deamon handle 802.11 management + if (pDevice->bEnableHostapd) { + skb->dev = pDevice->apdev; + //skb->data += 4; + //skb->tail += 4; + skb->data += 8; + skb->tail += 8; + skb_put(skb, FrameSize); + skb_reset_mac_header(skb); + skb->pkt_type = PACKET_OTHERHOST; + skb->protocol = htons(ETH_P_802_2); + memset(skb->cb, 0, sizeof(skb->cb)); + netif_rx(skb); + return true; + } + + // + // Insert the RCB in the Recv Mng list + // + EnqueueRCB(pDevice->FirstRecvMngList, pDevice->LastRecvMngList, pRCBIndicate); + pDevice->NumRecvMngList++; + if ( bDeFragRx == false) { + pRCB->Ref++; + } + if (pDevice->bIsRxMngWorkItemQueued == false) { + pDevice->bIsRxMngWorkItemQueued = true; + schedule_work(&pDevice->rx_mng_work_item); + } + + } + else { + // Control Frame + }; + return false; + } + else { + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + //In AP mode, hw only check addr1(BSSID or RA) if equal to local MAC. + if ( !(*pbyRsr & RSR_BSSIDOK)) { + if (bDeFragRx) { + if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + pDevice->dev->name); + } + } + return false; + } + } + else { + // discard DATA packet while not associate || BSSID error + if ((pDevice->bLinkPass == false) || + !(*pbyRsr & RSR_BSSIDOK)) { + if (bDeFragRx) { + if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + pDevice->dev->name); + } + } + return false; + } + //mike add:station mode check eapol-key challenge---> + { + u8 Protocol_Version; //802.1x Authentication + u8 Packet_Type; //802.1x Authentication + u8 Descriptor_type; + u16 Key_info; + if (bIsWEP) + cbIVOffset = 8; + else + cbIVOffset = 0; + wEtherType = (skb->data[cbIVOffset + 8 + 24 + 6] << 8) | + skb->data[cbIVOffset + 8 + 24 + 6 + 1]; + Protocol_Version = skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1]; + Packet_Type = skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1]; + if (wEtherType == ETH_P_PAE) { //Protocol Type in LLC-Header + if(((Protocol_Version==1) ||(Protocol_Version==2)) && + (Packet_Type==3)) { //802.1x OR eapol-key challenge frame receive + bRxeapol_key = true; + Descriptor_type = skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2]; + Key_info = (skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2+1]<<8) |skb->data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2+2] ; + if(Descriptor_type==2) { //RSN + // printk("WPA2_Rx_eapol-key_info<-----:%x\n",Key_info); + } + else if(Descriptor_type==254) { + // printk("WPA_Rx_eapol-key_info<-----:%x\n",Key_info); + } + } + } + } + //mike add:station mode check eapol-key challenge<--- + } + } + + // Data frame Handle + + if (pDevice->bEnablePSMode) { + if (IS_FC_MOREDATA((pbyFrame))) { + if (*pbyRsr & RSR_ADDROK) { + //PSbSendPSPOLL((PSDevice)pDevice); + } + } + else { + if (pMgmt->bInTIMWake == true) { + pMgmt->bInTIMWake = false; + } + } + } + + // Now it only supports 802.11g Infrastructure Mode, and support rate must up to 54 Mbps + if (pDevice->bDiversityEnable && (FrameSize>50) && + pDevice->op_mode == NL80211_IFTYPE_STATION && + (pDevice->bLinkPass == true)) { + BBvAntennaDiversity(pDevice, s_byGetRateIdx(*pbyRxRate), 0); + } + + // ++++++++ For BaseBand Algorithm +++++++++++++++ + pDevice->uCurrRSSI = *pbyRSSI; + pDevice->byCurrSQ = *pbySQ; + + // todo + /* + if ((*pbyRSSI != 0) && + (pMgmt->pCurrBSS!=NULL)) { + RFvRSSITodBm(pDevice, *pbyRSSI, &ldBm); + // Monitor if RSSI is too strong. + pMgmt->pCurrBSS->byRSSIStatCnt++; + pMgmt->pCurrBSS->byRSSIStatCnt %= RSSI_STAT_COUNT; + pMgmt->pCurrBSS->ldBmAverage[pMgmt->pCurrBSS->byRSSIStatCnt] = ldBm; for (ii = 0; ii < RSSI_STAT_COUNT; ii++) { - if (pMgmt->pCurrBSS->ldBmAverage[ii] != 0) { - pMgmt->pCurrBSS->ldBmMAX = - max(pMgmt->pCurrBSS->ldBmAverage[ii], ldBm); + if (pMgmt->pCurrBSS->ldBmAverage[ii] != 0) { + pMgmt->pCurrBSS->ldBmMAX = + max(pMgmt->pCurrBSS->ldBmAverage[ii], ldBm); + } + } + } + */ + + // ----------------------------------------------- + + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)){ + u8 abyMacHdr[24]; + + // Only 802.1x packet incoming allowed + if (bIsWEP) + cbIVOffset = 8; + else + cbIVOffset = 0; + wEtherType = (skb->data[cbIVOffset + 8 + 24 + 6] << 8) | + skb->data[cbIVOffset + 8 + 24 + 6 + 1]; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wEtherType = %04x\n", wEtherType); + if (wEtherType == ETH_P_PAE) { + skb->dev = pDevice->apdev; + + if (bIsWEP == true) { + // strip IV header(8) + memcpy(&abyMacHdr[0], (skb->data + 8), 24); + memcpy((skb->data + 8 + cbIVOffset), &abyMacHdr[0], 24); + } + + skb->data += (cbIVOffset + 8); + skb->tail += (cbIVOffset + 8); + skb_put(skb, FrameSize); + skb_reset_mac_header(skb); + skb->pkt_type = PACKET_OTHERHOST; + skb->protocol = htons(ETH_P_802_2); + memset(skb->cb, 0, sizeof(skb->cb)); + netif_rx(skb); + return true; + + } + // check if 802.1x authorized + if (!(pMgmt->sNodeDBTable[iSANodeIndex].dwFlags & WLAN_STA_AUTHORIZED)) + return false; + } + + if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) { + if (bIsWEP) { + FrameSize -= 8; //MIC } - } - } -*/ - - // ----------------------------------------------- - - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)){ - u8 abyMacHdr[24]; - - // Only 802.1x packet incoming allowed - if (bIsWEP) - cbIVOffset = 8; - else - cbIVOffset = 0; - wEtherType = (skb->data[cbIVOffset + 8 + 24 + 6] << 8) | - skb->data[cbIVOffset + 8 + 24 + 6 + 1]; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wEtherType = %04x \n", wEtherType); - if (wEtherType == ETH_P_PAE) { - skb->dev = pDevice->apdev; - - if (bIsWEP == true) { - // strip IV header(8) - memcpy(&abyMacHdr[0], (skb->data + 8), 24); - memcpy((skb->data + 8 + cbIVOffset), &abyMacHdr[0], 24); - } - - skb->data += (cbIVOffset + 8); - skb->tail += (cbIVOffset + 8); - skb_put(skb, FrameSize); - skb_reset_mac_header(skb); - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb); - return true; - - } - // check if 802.1x authorized - if (!(pMgmt->sNodeDBTable[iSANodeIndex].dwFlags & WLAN_STA_AUTHORIZED)) - return false; - } - - if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) { - if (bIsWEP) { - FrameSize -= 8; //MIC - } - } - - //-------------------------------------------------------------------------------- - // Soft MIC - if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) { - if (bIsWEP) { - 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(*(u32 *)(&pKey->abyKey[24])); - dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[28])); - } - else { - if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { - 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(*(u32 *)(&pKey->abyKey[16])); - dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[20])); - } else { - dwMICKey0 = cpu_to_le32(*(u32 *)(&pKey->abyKey[24])); - dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[28])); - } - } - - MIC_vInit(dwMICKey0, dwMICKey1); - MIC_vAppend((u8 *)&(pDevice->sRxEthHeader.h_dest[0]), 12); - dwMIC_Priority = 0; - MIC_vAppend((u8 *)&dwMIC_Priority, 4); - // 4 is Rcv buffer header, 24 is MAC Header, and 8 is IV and Ext IV. - 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 = (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)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC comparison is fail!\n"); - pDevice->bRxMICFail = false; - if (bDeFragRx) { - if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); - } - } + } + + //-------------------------------------------------------------------------------- + // Soft MIC + if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) { + if (bIsWEP) { + 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(*(u32 *)(&pKey->abyKey[24])); + dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[28])); + } + else { + if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { + 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(*(u32 *)(&pKey->abyKey[16])); + dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[20])); + } else { + dwMICKey0 = cpu_to_le32(*(u32 *)(&pKey->abyKey[24])); + dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[28])); + } + } + + MIC_vInit(dwMICKey0, dwMICKey1); + MIC_vAppend((u8 *)&(pDevice->sRxEthHeader.h_dest[0]), 12); + dwMIC_Priority = 0; + MIC_vAppend((u8 *)&dwMIC_Priority, 4); + // 4 is Rcv buffer header, 24 is MAC Header, and 8 is IV and Ext IV. + 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 = (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)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC comparison is fail!\n"); + pDevice->bRxMICFail = false; + if (bDeFragRx) { + if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + pDevice->dev->name); + } + } //send event to wpa_supplicant //if(pDevice->bWPASuppWextEnabled == true) { @@ -760,7 +760,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB, ev.flags = keyidx & IW_MICFAILURE_KEY_ID; if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC) && - (*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) { + (*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) { ev.flags |= IW_MICFAILURE_PAIRWISE; } else { ev.flags |= IW_MICFAILURE_GROUP; @@ -770,211 +770,211 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB, 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"); + PRINT_K("wireless_send_event--->IWEVMICHAELMICFAILURE\n"); wireless_send_event(pDevice->dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&ev); } - return false; - - } - } - } //---end of SOFT MIC----------------------------------------------------------------------- - - // ++++++++++ Reply Counter Check +++++++++++++ - - if ((pKey != NULL) && ((pKey->byCipherSuite == KEY_CTL_TKIP) || - (pKey->byCipherSuite == KEY_CTL_CCMP))) { - if (bIsWEP) { - u16 wLocalTSC15_0 = 0; - u32 dwLocalTSC47_16 = 0; - unsigned long long RSC = 0; - // endian issues - RSC = *((unsigned long long *) &(pKey->KeyRSC)); - wLocalTSC15_0 = (u16) RSC; - dwLocalTSC47_16 = (u32) (RSC>>16); - - RSC = dwRxTSC47_16; - RSC <<= 16; - RSC += wRxTSC15_0; - memcpy(&(pKey->KeyRSC), &RSC, sizeof(u64)); - - if (pDevice->vnt_mgmt.eCurrMode == WMAC_MODE_ESS_STA && - pDevice->vnt_mgmt.eCurrState == WMAC_STATE_ASSOC) { - /* check RSC */ - if ( (wRxTSC15_0 < wLocalTSC15_0) && - (dwRxTSC47_16 <= dwLocalTSC47_16) && - !((dwRxTSC47_16 == 0) && (dwLocalTSC47_16 == 0xFFFFFFFF))) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC is illegal~~!\n "); - - if (bDeFragRx) { - if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); - } - } - return false; - } - } - } - } // ----- End of Reply Counter Check -------------------------- - - s_vProcessRxMACHeader(pDevice, (u8 *)(skb->data+8), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset); - FrameSize -= cbHeaderOffset; - cbHeaderOffset += 8; // 8 is Rcv buffer header - - // Null data, framesize = 12 - if (FrameSize < 12) - return false; - - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - if (s_bAPModeRxData(pDevice, - skb, - FrameSize, - cbHeaderOffset, - iSANodeIndex, - iDANodeIndex - ) == false) { - - if (bDeFragRx) { - if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); - } - } - return false; - } - - } + return false; + + } + } + } //---end of SOFT MIC----------------------------------------------------------------------- + + // ++++++++++ Reply Counter Check +++++++++++++ + + if ((pKey != NULL) && ((pKey->byCipherSuite == KEY_CTL_TKIP) || + (pKey->byCipherSuite == KEY_CTL_CCMP))) { + if (bIsWEP) { + u16 wLocalTSC15_0 = 0; + u32 dwLocalTSC47_16 = 0; + unsigned long long RSC = 0; + // endian issues + RSC = *((unsigned long long *) &(pKey->KeyRSC)); + wLocalTSC15_0 = (u16) RSC; + dwLocalTSC47_16 = (u32) (RSC>>16); + + RSC = dwRxTSC47_16; + RSC <<= 16; + RSC += wRxTSC15_0; + memcpy(&(pKey->KeyRSC), &RSC, sizeof(u64)); + + if (pDevice->vnt_mgmt.eCurrMode == WMAC_MODE_ESS_STA && + pDevice->vnt_mgmt.eCurrState == WMAC_STATE_ASSOC) { + /* check RSC */ + if ( (wRxTSC15_0 < wLocalTSC15_0) && + (dwRxTSC47_16 <= dwLocalTSC47_16) && + !((dwRxTSC47_16 == 0) && (dwLocalTSC47_16 == 0xFFFFFFFF))) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC is illegal~~!\n "); + + if (bDeFragRx) { + if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + pDevice->dev->name); + } + } + return false; + } + } + } + } // ----- End of Reply Counter Check -------------------------- + + s_vProcessRxMACHeader(pDevice, (u8 *)(skb->data+8), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset); + FrameSize -= cbHeaderOffset; + cbHeaderOffset += 8; // 8 is Rcv buffer header + + // Null data, framesize = 12 + if (FrameSize < 12) + return false; + + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + if (s_bAPModeRxData(pDevice, + skb, + FrameSize, + cbHeaderOffset, + iSANodeIndex, + iDANodeIndex + ) == false) { + + if (bDeFragRx) { + if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + pDevice->dev->name); + } + } + return false; + } + + } skb->data += cbHeaderOffset; skb->tail += cbHeaderOffset; - skb_put(skb, FrameSize); - skb->protocol=eth_type_trans(skb, skb->dev); - skb->ip_summed=CHECKSUM_NONE; - pStats->rx_bytes +=skb->len; - pStats->rx_packets++; - netif_rx(skb); - if (bDeFragRx) { - if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", - pDevice->dev->name); - } - return false; - } - - return true; + skb_put(skb, FrameSize); + skb->protocol=eth_type_trans(skb, skb->dev); + skb->ip_summed=CHECKSUM_NONE; + pStats->rx_bytes +=skb->len; + pStats->rx_packets++; + netif_rx(skb); + if (bDeFragRx) { + if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + pDevice->dev->name); + } + return false; + } + + return true; } static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, - s32 iSANodeIndex) + s32 iSANodeIndex) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct ieee80211_hdr *p802_11Header; CMD_STATUS Status; - if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { - - p802_11Header = (struct ieee80211_hdr *) (pbyFrame); - if (!IS_TYPE_MGMT(pbyFrame)) { - - // Data & PS-Poll packet - // check frame class - if (iSANodeIndex > 0) { - // frame class 3 fliter & checking - if (pMgmt->sNodeDBTable[iSANodeIndex].eNodeState < NODE_AUTH) { - // send deauth notification - // reason = (6) class 2 received from nonauth sta - vMgrDeAuthenBeginSta(pDevice, - pMgmt, - (u8 *)(p802_11Header->addr2), - (WLAN_MGMT_REASON_CLASS2_NONAUTH), - &Status - ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 1\n"); - return true; - } - if (pMgmt->sNodeDBTable[iSANodeIndex].eNodeState < NODE_ASSOC) { - // send deassoc notification - // reason = (7) class 3 received from nonassoc sta - vMgrDisassocBeginSta(pDevice, - pMgmt, - (u8 *)(p802_11Header->addr2), - (WLAN_MGMT_REASON_CLASS3_NONASSOC), - &Status - ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDisassocBeginSta 2\n"); - return true; - } - - if (pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable) { - // delcare received ps-poll event - if (IS_CTL_PSPOLL(pbyFrame)) { - pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; - bScheduleCommand((void *) pDevice, - WLAN_CMD_RX_PSPOLL, - NULL); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n"); - } - else { - // check Data PS state - // if PW bit off, send out all PS bufferring packets. - if (!IS_FC_POWERMGT(pbyFrame)) { - pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false; - pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; - bScheduleCommand((void *) pDevice, - WLAN_CMD_RX_PSPOLL, - NULL); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n"); - } - } - } - else { - if (IS_FC_POWERMGT(pbyFrame)) { - pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = true; - // Once if STA in PS state, enable multicast bufferring - pMgmt->sNodeDBTable[0].bPSEnable = true; - } - else { - // clear all pending PS frame. - if (pMgmt->sNodeDBTable[iSANodeIndex].wEnQueueCnt > 0) { - pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false; - pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; - bScheduleCommand((void *) pDevice, - WLAN_CMD_RX_PSPOLL, - NULL); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 3\n"); - - } - } - } - } - else { - vMgrDeAuthenBeginSta(pDevice, - pMgmt, - (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->addr3); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%pM\n", - p802_11Header->addr2); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n", - p802_11Header->addr1); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: frame_control= %x\n", p802_11Header->frame_control); - return true; - } - } - } - return false; + if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { + + p802_11Header = (struct ieee80211_hdr *) (pbyFrame); + if (!IS_TYPE_MGMT(pbyFrame)) { + + // Data & PS-Poll packet + // check frame class + if (iSANodeIndex > 0) { + // frame class 3 fliter & checking + if (pMgmt->sNodeDBTable[iSANodeIndex].eNodeState < NODE_AUTH) { + // send deauth notification + // reason = (6) class 2 received from nonauth sta + vMgrDeAuthenBeginSta(pDevice, + pMgmt, + (u8 *)(p802_11Header->addr2), + (WLAN_MGMT_REASON_CLASS2_NONAUTH), + &Status + ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 1\n"); + return true; + } + if (pMgmt->sNodeDBTable[iSANodeIndex].eNodeState < NODE_ASSOC) { + // send deassoc notification + // reason = (7) class 3 received from nonassoc sta + vMgrDisassocBeginSta(pDevice, + pMgmt, + (u8 *)(p802_11Header->addr2), + (WLAN_MGMT_REASON_CLASS3_NONASSOC), + &Status + ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDisassocBeginSta 2\n"); + return true; + } + + if (pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable) { + // delcare received ps-poll event + if (IS_CTL_PSPOLL(pbyFrame)) { + pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; + bScheduleCommand((void *) pDevice, + WLAN_CMD_RX_PSPOLL, + NULL); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n"); + } + else { + // check Data PS state + // if PW bit off, send out all PS bufferring packets. + if (!IS_FC_POWERMGT(pbyFrame)) { + pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false; + pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; + bScheduleCommand((void *) pDevice, + WLAN_CMD_RX_PSPOLL, + NULL); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n"); + } + } + } + else { + if (IS_FC_POWERMGT(pbyFrame)) { + pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = true; + // Once if STA in PS state, enable multicast bufferring + pMgmt->sNodeDBTable[0].bPSEnable = true; + } + else { + // clear all pending PS frame. + if (pMgmt->sNodeDBTable[iSANodeIndex].wEnQueueCnt > 0) { + pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false; + pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true; + bScheduleCommand((void *) pDevice, + WLAN_CMD_RX_PSPOLL, + NULL); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 3\n"); + + } + } + } + } + else { + vMgrDeAuthenBeginSta(pDevice, + pMgmt, + (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->addr3); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%pM\n", + p802_11Header->addr2); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n", + p802_11Header->addr1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: frame_control= %x\n", p802_11Header->frame_control); + return true; + } + } + } + return false; } static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, - u32 FrameSize, u8 *pbyRsr, u8 *pbyNewRsr, PSKeyItem *pKeyOut, - s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16) + u32 FrameSize, u8 *pbyRsr, u8 *pbyNewRsr, PSKeyItem *pKeyOut, + s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; u32 PayloadLen = FrameSize; @@ -983,124 +983,124 @@ 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(*(u16 *)pbyFrame) && - WLAN_GET_FC_FROMDS(*(u16 *)pbyFrame) ) { - pbyIV += 6; // 6 is 802.11 address4 - PayloadLen -= 6; - } - byKeyIdx = (*(pbyIV+3) & 0xc0); - byKeyIdx >>= 6; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); - - if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { - if (((*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) && - (pMgmt->byCSSPK != KEY_CTL_NONE)) { - // unicast pkt use pairwise key - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt\n"); - if (KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, 0xFFFFFFFF, &pKey) == true) { - if (pMgmt->byCSSPK == KEY_CTL_TKIP) - byDecMode = KEY_CTL_TKIP; - else if (pMgmt->byCSSPK == KEY_CTL_CCMP) - byDecMode = KEY_CTL_CCMP; - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt: %d, %p\n", byDecMode, pKey); - } else { - // use group key - KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, byKeyIdx, &pKey); - if (pMgmt->byCSSGK == KEY_CTL_TKIP) - byDecMode = KEY_CTL_TKIP; - else if (pMgmt->byCSSGK == KEY_CTL_CCMP) - byDecMode = KEY_CTL_CCMP; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"group pkt: %d, %d, %p\n", byKeyIdx, byDecMode, pKey); - } - } - // our WEP only support Default Key - if (pKey == NULL) { - // use default group key - KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, byKeyIdx, &pKey); - if (pMgmt->byCSSGK == KEY_CTL_TKIP) - byDecMode = KEY_CTL_TKIP; - else if (pMgmt->byCSSGK == KEY_CTL_CCMP) - byDecMode = KEY_CTL_CCMP; - } - *pKeyOut = pKey; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pMgmt->byCSSPK, pMgmt->byCSSGK, byDecMode); - - if (pKey == NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey == NULL\n"); - return false; - } - if (byDecMode != pKey->byCipherSuite) { - *pKeyOut = NULL; - return false; - } - if (byDecMode == KEY_CTL_WEP) { - // handle WEP - if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || - (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true)) { - // Software WEP - // 1. 3253A - // 2. WEP 256 - - PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4); // 24 is 802.11 header,4 is IV, 4 is crc - memcpy(pDevice->abyPRNG, pbyIV, 3); - memcpy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); - rc4_init(&pDevice->SBox, pDevice->abyPRNG, pKey->uKeyLength + 3); - rc4_encrypt(&pDevice->SBox, pbyIV+4, pbyIV+4, PayloadLen); - - if (ETHbIsBufferCrc32Ok(pbyIV+4, PayloadLen)) { - *pbyNewRsr |= NEWRSR_DECRYPTOK; - } - } - } else if ((byDecMode == KEY_CTL_TKIP) || - (byDecMode == KEY_CTL_CCMP)) { - // 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(*(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(*(u16 *)pbyIV); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); - - if ((byDecMode == KEY_CTL_TKIP) && - (pDevice->byLocalID <= REV_ID_VT3253_A1)) { - // Software TKIP - // 1. 3253 A - 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)) { - *pbyNewRsr |= NEWRSR_DECRYPTOK; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); - } - } - }// end of TKIP/AES - - if ((*(pbyIV+3) & 0x20) != 0) - *pbExtIV = true; - return true; + *pwRxTSC15_0 = 0; + *pdwRxTSC47_16 = 0; + + pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; + if ( WLAN_GET_FC_TODS(*(u16 *)pbyFrame) && + WLAN_GET_FC_FROMDS(*(u16 *)pbyFrame) ) { + pbyIV += 6; // 6 is 802.11 address4 + PayloadLen -= 6; + } + byKeyIdx = (*(pbyIV+3) & 0xc0); + byKeyIdx >>= 6; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); + + if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { + if (((*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) && + (pMgmt->byCSSPK != KEY_CTL_NONE)) { + // unicast pkt use pairwise key + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt\n"); + if (KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, 0xFFFFFFFF, &pKey) == true) { + if (pMgmt->byCSSPK == KEY_CTL_TKIP) + byDecMode = KEY_CTL_TKIP; + else if (pMgmt->byCSSPK == KEY_CTL_CCMP) + byDecMode = KEY_CTL_CCMP; + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt: %d, %p\n", byDecMode, pKey); + } else { + // use group key + KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, byKeyIdx, &pKey); + if (pMgmt->byCSSGK == KEY_CTL_TKIP) + byDecMode = KEY_CTL_TKIP; + else if (pMgmt->byCSSGK == KEY_CTL_CCMP) + byDecMode = KEY_CTL_CCMP; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"group pkt: %d, %d, %p\n", byKeyIdx, byDecMode, pKey); + } + } + // our WEP only support Default Key + if (pKey == NULL) { + // use default group key + KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, byKeyIdx, &pKey); + if (pMgmt->byCSSGK == KEY_CTL_TKIP) + byDecMode = KEY_CTL_TKIP; + else if (pMgmt->byCSSGK == KEY_CTL_CCMP) + byDecMode = KEY_CTL_CCMP; + } + *pKeyOut = pKey; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pMgmt->byCSSPK, pMgmt->byCSSGK, byDecMode); + + if (pKey == NULL) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey == NULL\n"); + return false; + } + if (byDecMode != pKey->byCipherSuite) { + *pKeyOut = NULL; + return false; + } + if (byDecMode == KEY_CTL_WEP) { + // handle WEP + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || + (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true)) { + // Software WEP + // 1. 3253A + // 2. WEP 256 + + PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4); // 24 is 802.11 header,4 is IV, 4 is crc + memcpy(pDevice->abyPRNG, pbyIV, 3); + memcpy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); + rc4_init(&pDevice->SBox, pDevice->abyPRNG, pKey->uKeyLength + 3); + rc4_encrypt(&pDevice->SBox, pbyIV+4, pbyIV+4, PayloadLen); + + if (ETHbIsBufferCrc32Ok(pbyIV+4, PayloadLen)) { + *pbyNewRsr |= NEWRSR_DECRYPTOK; + } + } + } else if ((byDecMode == KEY_CTL_TKIP) || + (byDecMode == KEY_CTL_CCMP)) { + // 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(*(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(*(u16 *)pbyIV); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); + + if ((byDecMode == KEY_CTL_TKIP) && + (pDevice->byLocalID <= REV_ID_VT3253_A1)) { + // Software TKIP + // 1. 3253 A + 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)) { + *pbyNewRsr |= NEWRSR_DECRYPTOK; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); + } + } + }// end of TKIP/AES + + if ((*(pbyIV+3) & 0x20) != 0) + *pbExtIV = true; + return true; } 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) + u32 FrameSize, u8 *pbyRsr, int bOnFly, PSKeyItem pKey, u8 *pbyNewRsr, + s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct ieee80211_hdr *pMACHeader; @@ -1112,107 +1112,107 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, *pwRxTSC15_0 = 0; *pdwRxTSC47_16 = 0; - pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; - if ( WLAN_GET_FC_TODS(*(u16 *)pbyFrame) && - WLAN_GET_FC_FROMDS(*(u16 *)pbyFrame) ) { - pbyIV += 6; // 6 is 802.11 address4 - PayloadLen -= 6; - } - byKeyIdx = (*(pbyIV+3) & 0xc0); - 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) - byDecMode = KEY_CTL_CCMP; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pMgmt->byCSSPK, pMgmt->byCSSGK, byDecMode); - - if (byDecMode != pKey->byCipherSuite) { - return false; - } - - if (byDecMode == KEY_CTL_WEP) { - // handle WEP - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP\n"); - if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || - (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true) || - (bOnFly == false)) { - // Software WEP - // 1. 3253A - // 2. WEP 256 - // 3. NotOnFly - - PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4); // 24 is 802.11 header,4 is IV, 4 is crc - memcpy(pDevice->abyPRNG, pbyIV, 3); - memcpy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); - rc4_init(&pDevice->SBox, pDevice->abyPRNG, pKey->uKeyLength + 3); - rc4_encrypt(&pDevice->SBox, pbyIV+4, pbyIV+4, PayloadLen); - - if (ETHbIsBufferCrc32Ok(pbyIV+4, PayloadLen)) { - *pbyNewRsr |= NEWRSR_DECRYPTOK; - } - } - } else if ((byDecMode == KEY_CTL_TKIP) || - (byDecMode == KEY_CTL_CCMP)) { - // 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(*(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(*(u16 *)pbyIV); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); - - if (byDecMode == KEY_CTL_TKIP) { - - if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (bOnFly == false)) { - // Software TKIP - // 1. 3253 A - // 2. NotOnFly - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP \n"); - 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)) { - *pbyNewRsr |= NEWRSR_DECRYPTOK; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); - } - } - } - - if (byDecMode == KEY_CTL_CCMP) { - if (bOnFly == false) { - // Software CCMP - // NotOnFly - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_CCMP\n"); - if (AESbGenCCMP(pKey->abyKey, pbyFrame, FrameSize)) { - *pbyNewRsr |= NEWRSR_DECRYPTOK; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC compare OK!\n"); - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC fail!\n"); - } - } - } - - }// end of TKIP/AES - - if ((*(pbyIV+3) & 0x20) != 0) - *pbExtIV = true; - return true; + pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN; + if ( WLAN_GET_FC_TODS(*(u16 *)pbyFrame) && + WLAN_GET_FC_FROMDS(*(u16 *)pbyFrame) ) { + pbyIV += 6; // 6 is 802.11 address4 + PayloadLen -= 6; + } + byKeyIdx = (*(pbyIV+3) & 0xc0); + 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) + byDecMode = KEY_CTL_CCMP; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pMgmt->byCSSPK, pMgmt->byCSSGK, byDecMode); + + if (byDecMode != pKey->byCipherSuite) { + return false; + } + + if (byDecMode == KEY_CTL_WEP) { + // handle WEP + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP\n"); + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || + (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true) || + (bOnFly == false)) { + // Software WEP + // 1. 3253A + // 2. WEP 256 + // 3. NotOnFly + + PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4); // 24 is 802.11 header,4 is IV, 4 is crc + memcpy(pDevice->abyPRNG, pbyIV, 3); + memcpy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); + rc4_init(&pDevice->SBox, pDevice->abyPRNG, pKey->uKeyLength + 3); + rc4_encrypt(&pDevice->SBox, pbyIV+4, pbyIV+4, PayloadLen); + + if (ETHbIsBufferCrc32Ok(pbyIV+4, PayloadLen)) { + *pbyNewRsr |= NEWRSR_DECRYPTOK; + } + } + } else if ((byDecMode == KEY_CTL_TKIP) || + (byDecMode == KEY_CTL_CCMP)) { + // 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(*(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(*(u16 *)pbyIV); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); + + if (byDecMode == KEY_CTL_TKIP) { + + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (bOnFly == false)) { + // Software TKIP + // 1. 3253 A + // 2. NotOnFly + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP\n"); + 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)) { + *pbyNewRsr |= NEWRSR_DECRYPTOK; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); + } + } + } + + if (byDecMode == KEY_CTL_CCMP) { + if (bOnFly == false) { + // Software CCMP + // NotOnFly + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_CCMP\n"); + if (AESbGenCCMP(pKey->abyKey, pbyFrame, FrameSize)) { + *pbyNewRsr |= NEWRSR_DECRYPTOK; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC compare OK!\n"); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC fail!\n"); + } + } + } + + }// end of TKIP/AES + + if ((*(pbyIV+3) & 0x20) != 0) + *pbExtIV = true; + return true; } static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, - u32 FrameSize, u32 cbHeaderOffset, s32 iSANodeIndex, s32 iDANodeIndex) + u32 FrameSize, u32 cbHeaderOffset, s32 iSANodeIndex, s32 iDANodeIndex) { struct sk_buff *skbcpy; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -1221,81 +1221,81 @@ 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((u8 *)(skb->data+cbHeaderOffset))) { - if (pMgmt->sNodeDBTable[0].bPSEnable) { - - skbcpy = netdev_alloc_skb(pDevice->dev, pDevice->rx_buf_sz); - - // if any node in PS mode, buffer packet until DTIM. - if (skbcpy == NULL) { - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available \n"); - } - else { - skbcpy->len = FrameSize; - memcpy(skbcpy->data, skb->data+cbHeaderOffset, FrameSize); - skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skbcpy); - pMgmt->sNodeDBTable[0].wEnQueueCnt++; - // set tx map - pMgmt->abyPSTxMap[0] |= byMask[0]; - } - } - else { - bRelayAndForward = true; - } - } - else { - // check if relay - 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. - - skb->data += cbHeaderOffset; - skb->tail += cbHeaderOffset; - skb_put(skb, FrameSize); - skb_queue_tail(&pMgmt->sNodeDBTable[iDANodeIndex].sTxPSQueue, skb); - - pMgmt->sNodeDBTable[iDANodeIndex].wEnQueueCnt++; - wAID = pMgmt->sNodeDBTable[iDANodeIndex].wAID; - pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n", - iDANodeIndex, (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); - return true; - } - else { - bRelayOnly = true; - } - } - } - } - - if (bRelayOnly || bRelayAndForward) { - // relay this packet right now - if (bRelayAndForward) - iDANodeIndex = 0; - - if ((pDevice->uAssocCount > 1) && (iDANodeIndex >= 0)) { - bRelayPacketSend(pDevice, (u8 *) (skb->data + cbHeaderOffset), - FrameSize, (unsigned int) iDANodeIndex); - } - - if (bRelayOnly) - return false; - } - // none associate, don't forward - if (pDevice->uAssocCount == 0) - return false; - - return true; + if (FrameSize > CB_MAX_BUF_SIZE) + return false; + // check DA + if (is_multicast_ether_addr((u8 *)(skb->data+cbHeaderOffset))) { + if (pMgmt->sNodeDBTable[0].bPSEnable) { + + skbcpy = netdev_alloc_skb(pDevice->dev, pDevice->rx_buf_sz); + + // if any node in PS mode, buffer packet until DTIM. + if (skbcpy == NULL) { + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available\n"); + } + else { + skbcpy->len = FrameSize; + memcpy(skbcpy->data, skb->data+cbHeaderOffset, FrameSize); + skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skbcpy); + pMgmt->sNodeDBTable[0].wEnQueueCnt++; + // set tx map + pMgmt->abyPSTxMap[0] |= byMask[0]; + } + } + else { + bRelayAndForward = true; + } + } + else { + // check if relay + 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. + + skb->data += cbHeaderOffset; + skb->tail += cbHeaderOffset; + skb_put(skb, FrameSize); + skb_queue_tail(&pMgmt->sNodeDBTable[iDANodeIndex].sTxPSQueue, skb); + + pMgmt->sNodeDBTable[iDANodeIndex].wEnQueueCnt++; + wAID = pMgmt->sNodeDBTable[iDANodeIndex].wAID; + pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n", + iDANodeIndex, (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); + return true; + } + else { + bRelayOnly = true; + } + } + } + } + + if (bRelayOnly || bRelayAndForward) { + // relay this packet right now + if (bRelayAndForward) + iDANodeIndex = 0; + + if ((pDevice->uAssocCount > 1) && (iDANodeIndex >= 0)) { + bRelayPacketSend(pDevice, (u8 *) (skb->data + cbHeaderOffset), + FrameSize, (unsigned int) iDANodeIndex); + } + + if (bRelayOnly) + return false; + } + // none associate, don't forward + if (pDevice->uAssocCount == 0) + return false; + + return true; } void RXvWorkItem(struct work_struct *work) { struct vnt_private *priv = - container_of(work, struct vnt_private, read_work_item); + container_of(work, struct vnt_private, read_work_item); int status; struct vnt_rcb *rcb = NULL; @@ -1338,7 +1338,7 @@ void RXvFreeRCB(struct vnt_rcb *rcb, int re_alloc_skb) /* TODO error handling */ if (!rcb->skb) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR - " Failed to re-alloc rx skb\n"); + " Failed to re-alloc rx skb\n"); } } @@ -1359,7 +1359,7 @@ void RXvFreeRCB(struct vnt_rcb *rcb, int re_alloc_skb) void RXvMngWorkItem(struct work_struct *work) { struct vnt_private *pDevice = - container_of(work, struct vnt_private, rx_mng_work_item); + container_of(work, struct vnt_private, rx_mng_work_item); struct vnt_rcb *pRCB = NULL; struct vnt_rx_mgmt *pRxPacket; int bReAllocSkb = false; @@ -1367,30 +1367,29 @@ void RXvMngWorkItem(struct work_struct *work) if (pDevice->Flags & fMP_DISCONNECTED) return; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Rx Mng Thread\n"); - - spin_lock_irq(&pDevice->lock); - while (pDevice->NumRecvMngList!=0) - { - pRCB = pDevice->FirstRecvMngList; - pDevice->NumRecvMngList--; - DequeueRCB(pDevice->FirstRecvMngList, pDevice->LastRecvMngList); - if(!pRCB){ - break; - } - pRxPacket = &(pRCB->sMngPacket); - vMgrRxManagePacket(pDevice, &pDevice->vnt_mgmt, pRxPacket); - pRCB->Ref--; - if(pRCB->Ref == 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RxvFreeMng %d %d\n",pDevice->NumRecvFreeList, pDevice->NumRecvMngList); - RXvFreeRCB(pRCB, bReAllocSkb); - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Rx Mng Only we have the right to free RCB\n"); - } - } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Rx Mng Thread\n"); + + spin_lock_irq(&pDevice->lock); + while (pDevice->NumRecvMngList!=0) + { + pRCB = pDevice->FirstRecvMngList; + pDevice->NumRecvMngList--; + DequeueRCB(pDevice->FirstRecvMngList, pDevice->LastRecvMngList); + if(!pRCB){ + break; + } + pRxPacket = &(pRCB->sMngPacket); + vMgrRxManagePacket(pDevice, &pDevice->vnt_mgmt, pRxPacket); + pRCB->Ref--; + if(pRCB->Ref == 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RxvFreeMng %d %d\n",pDevice->NumRecvFreeList, pDevice->NumRecvMngList); + RXvFreeRCB(pRCB, bReAllocSkb); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Rx Mng Only we have the right to free RCB\n"); + } + } pDevice->bIsRxMngWorkItemQueued = false; spin_unlock_irq(&pDevice->lock); } - diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h index 8d52434..2782b65 100644 --- a/drivers/staging/vt6656/dpc.h +++ b/drivers/staging/vt6656/dpc.h @@ -39,6 +39,6 @@ void RXvMngWorkItem(struct work_struct *work); void RXvFreeRCB(struct vnt_rcb *pRCB, int bReAllocSkb); int RXbBulkInProcessData(struct vnt_private *, struct vnt_rcb *pRCB, - unsigned long BytesToIndicate); + unsigned long BytesToIndicate); #endif /* __RXTX_H__ */ diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index cd2ea76..9676fae 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -59,8 +59,8 @@ int FIRMWAREbDownload(struct vnt_private *pDevice) rc = request_firmware(&fw, FIRMWARE_NAME, dev); if (rc) { dev_err(dev, "firmware file %s request failed (%d)\n", - FIRMWARE_NAME, rc); - goto out; + FIRMWARE_NAME, rc); + goto out; } pBuffer = kmalloc(FIRMWARE_CHUNK_SIZE, GFP_KERNEL); @@ -72,14 +72,14 @@ int FIRMWAREbDownload(struct vnt_private *pDevice) memcpy(pBuffer, fw->data + ii, wLength); NdisStatus = CONTROLnsRequestOutAsyn(pDevice, - 0, - 0x1200+ii, - 0x0000, - wLength, - pBuffer); + 0, + 0x1200+ii, + 0x0000, + wLength, + pBuffer); DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO"Download firmware...%d %zu\n", ii, fw->size); + KERN_INFO"Download firmware...%d %zu\n", ii, fw->size); if (NdisStatus != STATUS_SUCCESS) goto free_fw; } @@ -103,11 +103,11 @@ int FIRMWAREbBrach2Sram(struct vnt_private *pDevice) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Branch to Sram\n"); NdisStatus = CONTROLnsRequestOut(pDevice, - 1, - 0x1200, - 0x0000, - 0, - NULL); + 1, + 0x1200, + 0x0000, + 0, + NULL); if (NdisStatus != STATUS_SUCCESS) return false; else @@ -119,14 +119,14 @@ int FIRMWAREbCheckVersion(struct vnt_private *pDevice) int ntStatus; ntStatus = CONTROLnsRequestIn(pDevice, - MESSAGE_TYPE_READ, - 0, - MESSAGE_REQUEST_VERSION, - 2, - (u8 *) &(pDevice->wFirmwareVersion)); + MESSAGE_TYPE_READ, + 0, + MESSAGE_REQUEST_VERSION, + 2, + (u8 *) &(pDevice->wFirmwareVersion)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", - pDevice->wFirmwareVersion); + pDevice->wFirmwareVersion); if (ntStatus != STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Invalid.\n"); return false; @@ -136,7 +136,7 @@ int FIRMWAREbCheckVersion(struct vnt_private *pDevice) return false; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", - pDevice->wFirmwareVersion); + pDevice->wFirmwareVersion); if (pDevice->wFirmwareVersion < FIRMWARE_VERSION) { /* branch to loader for download new firmware */ FIRMWAREbBrach2Sram(pDevice); diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index 67ba48b..506e5d3 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -69,14 +69,14 @@ static int hostap_enable_hostapd(struct vnt_private *pDevice, int rtnl_locked) .ndo_start_xmit = pDevice->tx_80211, }; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name); pDevice->apdev = kzalloc(sizeof(struct net_device), GFP_KERNEL); if (pDevice->apdev == NULL) return -ENOMEM; - apdev_priv = netdev_priv(pDevice->apdev); - *apdev_priv = *pDevice; + apdev_priv = netdev_priv(pDevice->apdev); + *apdev_priv = *pDevice; memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN); pDevice->apdev->netdev_ops = &apdev_netdev_ops; @@ -94,14 +94,14 @@ static int hostap_enable_hostapd(struct vnt_private *pDevice, int rtnl_locked) ret = register_netdev(pDevice->apdev); if (ret) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdevice(AP) failed!\n", - dev->name); + dev->name); return -1; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n", - dev->name, pDevice->apdev->name); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n", + dev->name, pDevice->apdev->name); - KeyvInitTable(pDevice,&pDevice->sKey); + KeyvInitTable(pDevice,&pDevice->sKey); return 0; } @@ -123,22 +123,22 @@ static int hostap_enable_hostapd(struct vnt_private *pDevice, int rtnl_locked) static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name); - if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) { + if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) { if (rtnl_locked) unregister_netdevice(pDevice->apdev); else unregister_netdev(pDevice->apdev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", - pDevice->dev->name, pDevice->apdev->name); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", + pDevice->dev->name, pDevice->apdev->name); } if (pDevice->apdev) free_netdev(pDevice->apdev); pDevice->apdev = NULL; - pDevice->bEnable8021x = false; - pDevice->bEnableHostWEP = false; - pDevice->bEncryptionEnable = false; + pDevice->bEnable8021x = false; + pDevice->bEnableHostWEP = false; + pDevice->bEncryptionEnable = false; return 0; } @@ -158,7 +158,7 @@ static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked) */ int vt6656_hostap_set_hostapd(struct vnt_private *pDevice, - int val, int rtnl_locked) + int val, int rtnl_locked) { if (val < 0 || val > 1) return -EINVAL; @@ -188,16 +188,16 @@ int vt6656_hostap_set_hostapd(struct vnt_private *pDevice, * */ static int hostap_remove_sta(struct vnt_private *pDevice, - struct viawget_hostapd_param *param) + struct viawget_hostapd_param *param) { unsigned int uNodeIndex; - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { - BSSvRemoveOneNode(pDevice, uNodeIndex); - } - else { - return -ENOENT; - } + if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { + BSSvRemoveOneNode(pDevice, uNodeIndex); + } + else { + return -ENOENT; + } return 0; } @@ -215,7 +215,7 @@ static int hostap_remove_sta(struct vnt_private *pDevice, * */ static int hostap_add_sta(struct vnt_private *pDevice, - struct viawget_hostapd_param *param) + struct viawget_hostapd_param *param) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; unsigned int uNodeIndex; @@ -223,38 +223,38 @@ static int hostap_add_sta(struct vnt_private *pDevice, if (!BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) BSSvCreateOneNode(pDevice, &uNodeIndex); - memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN); - pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; - pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability; -// TODO listenInterval -// pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = 1; - pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = false; - pMgmt->sNodeDBTable[uNodeIndex].bySuppRate = param->u.add_sta.tx_supp_rates; - - // set max tx rate - pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = - pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; - // set max basic rate - pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate = RATE_2M; - // Todo: check sta preamble, if ap can't support, set status code - pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = - WLAN_GET_CAP_INFO_SHORTPREAMBLE(pMgmt->sNodeDBTable[uNodeIndex].wCapInfo); - - pMgmt->sNodeDBTable[uNodeIndex].wAID = (u16)param->u.add_sta.aid; - - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d \n", pMgmt->sNodeDBTable[uNodeIndex].wAID); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", - param->sta_addr[0], - param->sta_addr[1], - param->sta_addr[2], - param->sta_addr[3], - param->sta_addr[4], - param->sta_addr[5] - ) ; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d \n", - pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); + memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN); + pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; + pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability; + // TODO listenInterval + // pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = 1; + pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = false; + pMgmt->sNodeDBTable[uNodeIndex].bySuppRate = param->u.add_sta.tx_supp_rates; + + // set max tx rate + pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = + pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; + // set max basic rate + pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate = RATE_2M; + // Todo: check sta preamble, if ap can't support, set status code + pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = + WLAN_GET_CAP_INFO_SHORTPREAMBLE(pMgmt->sNodeDBTable[uNodeIndex].wCapInfo); + + pMgmt->sNodeDBTable[uNodeIndex].wAID = (u16)param->u.add_sta.aid; + + pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d\n", pMgmt->sNodeDBTable[uNodeIndex].wAID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", + param->sta_addr[0], + param->sta_addr[1], + param->sta_addr[2], + param->sta_addr[3], + param->sta_addr[4], + param->sta_addr[5] + ) ; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d\n", + pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); return 0; } @@ -274,19 +274,19 @@ static int hostap_add_sta(struct vnt_private *pDevice, */ static int hostap_get_info_sta(struct vnt_private *pDevice, - struct viawget_hostapd_param *param) + struct viawget_hostapd_param *param) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; unsigned int uNodeIndex; - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { - param->u.get_info_sta.inactive_sec = - (jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ; + if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { + param->u.get_info_sta.inactive_sec = + (jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ; - //param->u.get_info_sta.txexc = pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts; + //param->u.get_info_sta.txexc = pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts; } else { - return -ENOENT; + return -ENOENT; } return 0; @@ -311,14 +311,14 @@ static int hostap_set_flags_sta(struct vnt_private *pDevice, struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; unsigned int uNodeIndex; - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { + if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { pMgmt->sNodeDBTable[uNodeIndex].dwFlags |= param->u.set_flags_sta.flags_or; pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x\n", - (unsigned int) pMgmt->sNodeDBTable[uNodeIndex].dwFlags); + (unsigned int) pMgmt->sNodeDBTable[uNodeIndex].dwFlags); } else { - return -ENOENT; + return -ENOENT; } return 0; @@ -338,32 +338,32 @@ static int hostap_set_flags_sta(struct vnt_private *pDevice, * */ static int hostap_set_generic_element(struct vnt_private *pDevice, - struct viawget_hostapd_param *param) + struct viawget_hostapd_param *param) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - memcpy( pMgmt->abyWPAIE, - param->u.generic_elem.data, - param->u.generic_elem.len - ); - - pMgmt->wWPAIELen = param->u.generic_elem.len; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen); - - // disable wpa - if (pMgmt->wWPAIELen == 0) { - pMgmt->eAuthenMode = WMAC_AUTH_OPEN; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA \n"); - } else { - // enable wpa - if ((pMgmt->abyWPAIE[0] == WLAN_EID_RSN_WPA) || - (pMgmt->abyWPAIE[0] == WLAN_EID_RSN)) { - pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set WPAIE enable WPA\n"); - } else - return -EINVAL; - } + memcpy( pMgmt->abyWPAIE, + param->u.generic_elem.data, + param->u.generic_elem.len + ); + + pMgmt->wWPAIELen = param->u.generic_elem.len; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen); + + // disable wpa + if (pMgmt->wWPAIELen == 0) { + pMgmt->eAuthenMode = WMAC_AUTH_OPEN; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA\n"); + } else { + // enable wpa + if ((pMgmt->abyWPAIE[0] == WLAN_EID_RSN_WPA) || + (pMgmt->abyWPAIE[0] == WLAN_EID_RSN)) { + pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set WPAIE enable WPA\n"); + } else + return -EINVAL; + } return 0; } @@ -383,11 +383,11 @@ static int hostap_set_generic_element(struct vnt_private *pDevice, static void hostap_flush_sta(struct vnt_private *pDevice) { - // reserved node index =0 for multicast node. - BSSvClearNodeDBTable(pDevice, 1); - pDevice->uAssocCount = 0; + // reserved node index =0 for multicast node. + BSSvClearNodeDBTable(pDevice, 1); + pDevice->uAssocCount = 0; - return; + return; } /* @@ -404,7 +404,7 @@ static void hostap_flush_sta(struct vnt_private *pDevice) * */ static int hostap_set_encryption(struct vnt_private *pDevice, - struct viawget_hostapd_param *param, int param_len) + struct viawget_hostapd_param *param, int param_len) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; u32 dwKeyIndex = 0; @@ -432,103 +432,103 @@ static int hostap_set_encryption(struct vnt_private *pDevice, if (is_broadcast_ether_addr(param->sta_addr)) { if (param->u.crypt.idx >= MAX_GROUP_KEY) return -EINVAL; - iNodeIndex = 0; + iNodeIndex = 0; } else { - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &iNodeIndex) == false) { - param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); - return -EINVAL; - } + if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &iNodeIndex) == false) { + param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); + return -EINVAL; + } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: sta_index %d \n", iNodeIndex); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d \n", param->u.crypt.alg); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: sta_index %d\n", iNodeIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d\n", param->u.crypt.alg); if (param->u.crypt.alg == WPA_ALG_NONE) { - if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly == true) { - if (KeybRemoveKey( pDevice, - &(pDevice->sKey), - param->sta_addr, - pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex - ) == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail \n"); - } - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; - } - pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = 0; - pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = 0; - pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = 0; - pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = 0; - pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; - pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0; - pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = 0; - memset(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], - 0, - MAX_KEY_LEN - ); - - return ret; + if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly == true) { + if (KeybRemoveKey( pDevice, + &(pDevice->sKey), + param->sta_addr, + pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex + ) == false) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail\n"); + } + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; + } + pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = 0; + pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = 0; + pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = 0; + pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = 0; + pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; + pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0; + pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = 0; + memset(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], + 0, + MAX_KEY_LEN + ); + + return ret; } - memcpy(abyKey, param->u.crypt.key, param->u.crypt.key_len); - // copy to node key tbl - pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = param->u.crypt.idx; - pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = param->u.crypt.key_len; - memcpy(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], - param->u.crypt.key, - param->u.crypt.key_len - ); - - dwKeyIndex = (u32)(param->u.crypt.idx); - if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) { - pDevice->byKeyIndex = (u8)dwKeyIndex; - pDevice->bTransmitKey = true; - dwKeyIndex |= (1 << 31); - } + memcpy(abyKey, param->u.crypt.key, param->u.crypt.key_len); + // copy to node key tbl + pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = param->u.crypt.idx; + pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = param->u.crypt.key_len; + memcpy(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], + param->u.crypt.key, + param->u.crypt.key_len + ); + + dwKeyIndex = (u32)(param->u.crypt.idx); + if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) { + pDevice->byKeyIndex = (u8)dwKeyIndex; + pDevice->bTransmitKey = true; + dwKeyIndex |= (1 << 31); + } if (param->u.crypt.alg == WPA_ALG_WEP) { - if ((pDevice->bEnable8021x == false) || (iNodeIndex == 0)) { - KeybSetDefaultKey( pDevice, - &(pDevice->sKey), - dwKeyIndex & ~(BIT30 | USE_KEYRSC), - param->u.crypt.key_len, - NULL, - abyKey, - KEY_CTL_WEP - ); - - } else { - // 8021x enable, individual key - dwKeyIndex |= (1 << 30); // set pairwise key - if (KeybSetKey(pDevice, &(pDevice->sKey), - ¶m->sta_addr[0], - dwKeyIndex & ~(USE_KEYRSC), - param->u.crypt.key_len, - &KeyRSC, (u8 *)abyKey, - KEY_CTL_WEP - ) == true) { - - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; - - } else { - // Key Table Full - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; - bKeyTableFull = true; - } - } - pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; - pDevice->bEncryptionEnable = true; - pMgmt->byCSSPK = KEY_CTL_WEP; - pMgmt->byCSSGK = KEY_CTL_WEP; - pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = KEY_CTL_WEP; - pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; - return ret; + if ((pDevice->bEnable8021x == false) || (iNodeIndex == 0)) { + KeybSetDefaultKey( pDevice, + &(pDevice->sKey), + dwKeyIndex & ~(BIT30 | USE_KEYRSC), + param->u.crypt.key_len, + NULL, + abyKey, + KEY_CTL_WEP + ); + + } else { + // 8021x enable, individual key + dwKeyIndex |= (1 << 30); // set pairwise key + if (KeybSetKey(pDevice, &(pDevice->sKey), + ¶m->sta_addr[0], + dwKeyIndex & ~(USE_KEYRSC), + param->u.crypt.key_len, + &KeyRSC, (u8 *)abyKey, + KEY_CTL_WEP + ) == true) { + + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; + + } else { + // Key Table Full + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; + bKeyTableFull = true; + } + } + pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; + pDevice->bEncryptionEnable = true; + pMgmt->byCSSPK = KEY_CTL_WEP; + pMgmt->byCSSGK = KEY_CTL_WEP; + pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = KEY_CTL_WEP; + pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; + return ret; } if (param->u.crypt.seq) { - memcpy(&abySeq, param->u.crypt.seq, 8); + memcpy(&abySeq, param->u.crypt.seq, 8); for (ii = 0 ; ii < 8 ; ii++) KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8); @@ -537,85 +537,85 @@ static int hostap_set_encryption(struct vnt_private *pDevice, } if (param->u.crypt.alg == WPA_ALG_TKIP) { - if (param->u.crypt.key_len != MAX_KEY_LEN) - return -EINVAL; - pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; - byKeyDecMode = KEY_CTL_TKIP; - pMgmt->byCSSPK = KEY_CTL_TKIP; - pMgmt->byCSSGK = KEY_CTL_TKIP; + if (param->u.crypt.key_len != MAX_KEY_LEN) + return -EINVAL; + pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; + byKeyDecMode = KEY_CTL_TKIP; + pMgmt->byCSSPK = KEY_CTL_TKIP; + pMgmt->byCSSGK = KEY_CTL_TKIP; } if (param->u.crypt.alg == WPA_ALG_CCMP) { - if ((param->u.crypt.key_len != AES_KEY_LEN) || - (pDevice->byLocalID <= REV_ID_VT3253_A1)) - return -EINVAL; - pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; - byKeyDecMode = KEY_CTL_CCMP; - pMgmt->byCSSPK = KEY_CTL_CCMP; - pMgmt->byCSSGK = KEY_CTL_CCMP; - } - - if (iNodeIndex == 0) { - KeybSetDefaultKey( pDevice, - &(pDevice->sKey), - dwKeyIndex, - param->u.crypt.key_len, - &KeyRSC, - abyKey, - byKeyDecMode - ); - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; - - } else { - dwKeyIndex |= (1 << 30); // set pairwise key - if (KeybSetKey(pDevice, - &(pDevice->sKey), - ¶m->sta_addr[0], - dwKeyIndex, - param->u.crypt.key_len, - &KeyRSC, - (u8 *)abyKey, - byKeyDecMode - ) == true) { - - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; - - } else { - // Key Table Full - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; - bKeyTableFull = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n"); - } - - } - - if (bKeyTableFull == true) { - wKeyCtl &= 0x7F00; // clear all key control filed - wKeyCtl |= (byKeyDecMode << 4); - wKeyCtl |= (byKeyDecMode); - wKeyCtl |= 0x0044; // use group key for all address - wKeyCtl |= 0x4000; // disable KeyTable[MAX_KEY_TABLE-1] on-fly to genernate rx int -// Todo.. xxxxxx - //MACvSetDefaultKeyCtl(pDevice->PortOffset, wKeyCtl, MAX_KEY_TABLE-1, pDevice->byLocalID); - } - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set key sta_index= %d \n", iNodeIndex); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " tx_index=%d len=%d \n", param->u.crypt.idx, - param->u.crypt.key_len ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n", - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1], - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2], - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3], - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4] - ); + if ((param->u.crypt.key_len != AES_KEY_LEN) || + (pDevice->byLocalID <= REV_ID_VT3253_A1)) + return -EINVAL; + pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; + byKeyDecMode = KEY_CTL_CCMP; + pMgmt->byCSSPK = KEY_CTL_CCMP; + pMgmt->byCSSGK = KEY_CTL_CCMP; + } + + if (iNodeIndex == 0) { + KeybSetDefaultKey( pDevice, + &(pDevice->sKey), + dwKeyIndex, + param->u.crypt.key_len, + &KeyRSC, + abyKey, + byKeyDecMode + ); + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; + + } else { + dwKeyIndex |= (1 << 30); // set pairwise key + if (KeybSetKey(pDevice, + &(pDevice->sKey), + ¶m->sta_addr[0], + dwKeyIndex, + param->u.crypt.key_len, + &KeyRSC, + (u8 *)abyKey, + byKeyDecMode + ) == true) { + + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; + + } else { + // Key Table Full + pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; + bKeyTableFull = true; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n"); + } + + } + + if (bKeyTableFull == true) { + wKeyCtl &= 0x7F00; // clear all key control filed + wKeyCtl |= (byKeyDecMode << 4); + wKeyCtl |= (byKeyDecMode); + wKeyCtl |= 0x0044; // use group key for all address + wKeyCtl |= 0x4000; // disable KeyTable[MAX_KEY_TABLE-1] on-fly to genernate rx int + // Todo.. xxxxxx + //MACvSetDefaultKeyCtl(pDevice->PortOffset, wKeyCtl, MAX_KEY_TABLE-1, pDevice->byLocalID); + } + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set key sta_index= %d\n", iNodeIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " tx_index=%d len=%d\n", param->u.crypt.idx, + param->u.crypt.key_len ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx\n", + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1], + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2], + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3], + pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4] + ); // set wep key - pDevice->bEncryptionEnable = true; - pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = byKeyDecMode; - pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; - pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; - pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0; + pDevice->bEncryptionEnable = true; + pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = byKeyDecMode; + pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; + pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; + pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0; return ret; } @@ -634,8 +634,8 @@ static int hostap_set_encryption(struct vnt_private *pDevice, * */ static int hostap_get_encryption(struct vnt_private *pDevice, - struct viawget_hostapd_param *param, - int param_len) + struct viawget_hostapd_param *param, + int param_len) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int ret = 0; @@ -645,19 +645,19 @@ static int hostap_get_encryption(struct vnt_private *pDevice, param->u.crypt.err = 0; if (is_broadcast_ether_addr(param->sta_addr)) { - iNodeIndex = 0; + iNodeIndex = 0; } else { - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &iNodeIndex) == false) { - param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); - return -EINVAL; - } + if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &iNodeIndex) == false) { + param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); + return -EINVAL; + } } 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] = (u8)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8); - } + memset(param->u.crypt.seq, 0, 8); + for (ii = 0 ; ii < 8 ; ii++) { + param->u.crypt.seq[ii] = (u8)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8); + } return ret; } @@ -683,7 +683,7 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) int ap_ioctl = 0; if (p->length < sizeof(struct viawget_hostapd_param) || - p->length > VIAWGET_HOSTAPD_MAX_BUF_SIZE || !p->pointer) + p->length > VIAWGET_HOSTAPD_MAX_BUF_SIZE || !p->pointer) return -EINVAL; param = kmalloc((int)p->length, GFP_KERNEL); @@ -697,69 +697,69 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) switch (param->cmd) { case VIAWGET_HOSTAPD_SET_ENCRYPTION: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ENCRYPTION \n"); - spin_lock_irq(&pDevice->lock); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ENCRYPTION\n"); + spin_lock_irq(&pDevice->lock); ret = hostap_set_encryption(pDevice, param, p->length); - spin_unlock_irq(&pDevice->lock); + spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_GET_ENCRYPTION: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_ENCRYPTION \n"); - spin_lock_irq(&pDevice->lock); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_ENCRYPTION\n"); + spin_lock_irq(&pDevice->lock); ret = hostap_get_encryption(pDevice, param, p->length); - spin_unlock_irq(&pDevice->lock); + spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR\n"); ret = -EOPNOTSUPP; goto out; case VIAWGET_HOSTAPD_FLUSH: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH \n"); - spin_lock_irq(&pDevice->lock); - hostap_flush_sta(pDevice); - spin_unlock_irq(&pDevice->lock); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH\n"); + spin_lock_irq(&pDevice->lock); + hostap_flush_sta(pDevice); + spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_ADD_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_ADD_STA \n"); - spin_lock_irq(&pDevice->lock); - ret = hostap_add_sta(pDevice, param); - spin_unlock_irq(&pDevice->lock); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_ADD_STA\n"); + spin_lock_irq(&pDevice->lock); + ret = hostap_add_sta(pDevice, param); + spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_REMOVE_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_REMOVE_STA \n"); - spin_lock_irq(&pDevice->lock); - ret = hostap_remove_sta(pDevice, param); - spin_unlock_irq(&pDevice->lock); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_REMOVE_STA\n"); + spin_lock_irq(&pDevice->lock); + ret = hostap_remove_sta(pDevice, param); + spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_GET_INFO_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_INFO_STA \n"); - ret = hostap_get_info_sta(pDevice, param); - ap_ioctl = 1; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_INFO_STA\n"); + ret = hostap_get_info_sta(pDevice, param); + ap_ioctl = 1; break; case VIAWGET_HOSTAPD_SET_FLAGS_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n"); - ret = hostap_set_flags_sta(pDevice, param); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA\n"); + ret = hostap_set_flags_sta(pDevice, param); break; case VIAWGET_HOSTAPD_MLME: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n"); - return -EOPNOTSUPP; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME\n"); + return -EOPNOTSUPP; case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT\n"); ret = hostap_set_generic_element(pDevice, param); break; case VIAWGET_HOSTAPD_SCAN_REQ: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ \n"); - return -EOPNOTSUPP; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ\n"); + return -EOPNOTSUPP; case VIAWGET_HOSTAPD_STA_CLEAR_STATS: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n"); - ret = -EOPNOTSUPP; - goto out; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS\n"); + ret = -EOPNOTSUPP; + goto out; default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6656_hostap_ioctl: unknown cmd=%d\n", - (int)param->cmd); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6656_hostap_ioctl: unknown cmd=%d\n", + (int)param->cmd); ret = -EOPNOTSUPP; goto out; } @@ -771,9 +771,8 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) } } - out: +out: kfree(param); return ret; } - diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index cca56b2..62e2a4e 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -62,7 +62,7 @@ static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */ * like it's in a 'stall' condition, so we deliberately time out every second * if we've gotten no data * --*/ + -*/ void INTvWorkItem(struct vnt_private *pDevice) { int ntStatus; @@ -93,8 +93,8 @@ void INTnsProcessData(struct vnt_private *priv) stats->tx_packets++; BSSvUpdateNodeTxCounter(priv, - int_data->tsr0, - int_data->pkt0); + int_data->tsr0, + int_data->pkt0); } if (int_data->tsr1 & TSR_VALID) { @@ -105,8 +105,8 @@ void INTnsProcessData(struct vnt_private *priv) BSSvUpdateNodeTxCounter(priv, - int_data->tsr1, - int_data->pkt1); + int_data->tsr1, + int_data->pkt1); } if (int_data->tsr2 & TSR_VALID) { @@ -116,8 +116,8 @@ void INTnsProcessData(struct vnt_private *priv) stats->tx_packets++; BSSvUpdateNodeTxCounter(priv, - int_data->tsr2, - int_data->pkt2); + int_data->tsr2, + int_data->pkt2); } if (int_data->tsr3 & TSR_VALID) { @@ -127,8 +127,8 @@ void INTnsProcessData(struct vnt_private *priv) stats->tx_packets++; BSSvUpdateNodeTxCounter(priv, - int_data->tsr3, - int_data->pkt3); + int_data->tsr3, + int_data->pkt3); } if (int_data->isr0 != 0) { @@ -137,16 +137,16 @@ void INTnsProcessData(struct vnt_private *priv) if (mgmt->byDTIMCount > 0) { mgmt->byDTIMCount--; mgmt->sNodeDBTable[0].bRxPSPoll = - false; + false; } else if (mgmt->byDTIMCount == 0) { /* check if multicast tx buffering */ mgmt->byDTIMCount = - mgmt->byDTIMPeriod-1; + mgmt->byDTIMPeriod-1; mgmt->sNodeDBTable[0].bRxPSPoll = true; if (mgmt->sNodeDBTable[0].bPSEnable) bScheduleCommand((void *) priv, - WLAN_CMD_RX_PSPOLL, - NULL); + WLAN_CMD_RX_PSPOLL, + NULL); } bScheduleCommand((void *) priv, WLAN_CMD_BECON_SEND, diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h index f3406da..d2d80cc 100644 --- a/drivers/staging/vt6656/iocmd.h +++ b/drivers/staging/vt6656/iocmd.h @@ -38,33 +38,33 @@ typedef enum tagWMAC_CMD { - WLAN_CMD_BSS_SCAN, - WLAN_CMD_BSS_JOIN, - WLAN_CMD_DISASSOC, - WLAN_CMD_SET_WEP, - WLAN_CMD_GET_LINK, - WLAN_CMD_GET_LISTLEN, - WLAN_CMD_GET_LIST, - WLAN_CMD_GET_MIB, - WLAN_CMD_GET_STAT, - WLAN_CMD_STOP_MAC, - WLAN_CMD_START_MAC, - WLAN_CMD_AP_START, - WLAN_CMD_SET_HOSTAPD, - WLAN_CMD_SET_HOSTAPD_STA, - WLAN_CMD_SET_802_1X, - WLAN_CMD_SET_HOST_WEP, - WLAN_CMD_SET_WPA, - WLAN_CMD_GET_NODE_CNT, - WLAN_CMD_ZONETYPE_SET, - WLAN_CMD_GET_NODE_LIST + WLAN_CMD_BSS_SCAN, + WLAN_CMD_BSS_JOIN, + WLAN_CMD_DISASSOC, + WLAN_CMD_SET_WEP, + WLAN_CMD_GET_LINK, + WLAN_CMD_GET_LISTLEN, + WLAN_CMD_GET_LIST, + WLAN_CMD_GET_MIB, + WLAN_CMD_GET_STAT, + WLAN_CMD_STOP_MAC, + WLAN_CMD_START_MAC, + WLAN_CMD_AP_START, + WLAN_CMD_SET_HOSTAPD, + WLAN_CMD_SET_HOSTAPD_STA, + WLAN_CMD_SET_802_1X, + WLAN_CMD_SET_HOST_WEP, + WLAN_CMD_SET_WPA, + WLAN_CMD_GET_NODE_CNT, + WLAN_CMD_ZONETYPE_SET, + WLAN_CMD_GET_NODE_LIST } WMAC_CMD, *PWMAC_CMD; typedef enum tagWZONETYPE { - ZoneType_USA = 0, - ZoneType_Japan = 1, - ZoneType_Europe = 2 + ZoneType_USA = 0, + ZoneType_Japan = 1, + ZoneType_Europe = 2 } WZONETYPE; #define ADHOC 0 @@ -104,7 +104,7 @@ typedef struct tagSCmdRequest { typedef struct tagSCmdScan { - u8 ssid[SSID_MAXLEN + 2]; + u8 ssid[SSID_MAXLEN + 2]; } __packed SCmdScan, *PSCmdScan; @@ -114,12 +114,12 @@ typedef struct tagSCmdScan { typedef struct tagSCmdBSSJoin { - u16 wBSSType; - u16 wBBPType; - u8 ssid[SSID_MAXLEN + 2]; - u32 uChannel; - bool bPSEnable; - bool bShareKeyAuth; + u16 wBSSType; + u16 wBBPType; + u8 ssid[SSID_MAXLEN + 2]; + u32 uChannel; + bool bPSEnable; + bool bShareKeyAuth; } __packed SCmdBSSJoin, *PSCmdBSSJoin; @@ -129,51 +129,51 @@ typedef struct tagSCmdBSSJoin { typedef struct tagSCmdZoneTypeSet { - bool bWrite; - WZONETYPE ZoneType; + bool bWrite; + WZONETYPE ZoneType; } __packed SCmdZoneTypeSet, *PSCmdZoneTypeSet; typedef struct tagSWPAResult { - char ifname[100]; + char ifname[100]; u8 proto; u8 key_mgmt; u8 eap_type; - bool authenticated; + bool authenticated; } __packed SWPAResult, *PSWPAResult; typedef struct tagSCmdStartAP { - u16 wBSSType; - u16 wBBPType; - u8 ssid[SSID_MAXLEN + 2]; + u16 wBSSType; + u16 wBBPType; + u8 ssid[SSID_MAXLEN + 2]; u32 uChannel; u32 uBeaconInt; - bool bShareKeyAuth; - u8 byBasicRate; + bool bShareKeyAuth; + u8 byBasicRate; } __packed SCmdStartAP, *PSCmdStartAP; typedef struct tagSCmdSetWEP { - bool bEnableWep; - u8 byKeyIndex; - u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN]; - bool bWepKeyAvailable[WEP_NKEYS]; - u32 auWepKeyLength[WEP_NKEYS]; + bool bEnableWep; + u8 byKeyIndex; + u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN]; + bool bWepKeyAvailable[WEP_NKEYS]; + u32 auWepKeyLength[WEP_NKEYS]; } __packed SCmdSetWEP, *PSCmdSetWEP; typedef struct tagSBSSIDItem { u32 uChannel; - u8 abyBSSID[BSSID_LEN]; - u8 abySSID[SSID_MAXLEN + 1]; - u16 wBeaconInterval; - u16 wCapInfo; - u8 byNetType; - bool bWEPOn; - u32 uRSSI; + u8 abyBSSID[BSSID_LEN]; + u8 abySSID[SSID_MAXLEN + 1]; + u16 wBeaconInterval; + u16 wCapInfo; + u8 byNetType; + bool bWEPOn; + u32 uRSSI; } __packed SBSSIDItem; @@ -184,22 +184,22 @@ typedef struct tagSBSSIDList { } __packed SBSSIDList, *PSBSSIDList; typedef struct tagSNodeItem { - // STA info - u16 wAID; - u8 abyMACAddr[6]; - u16 wTxDataRate; - u16 wInActiveCount; - u16 wEnQueueCnt; - u16 wFlags; - bool bPWBitOn; - u8 byKeyIndex; - u16 wWepKeyLength; - u8 abyWepKey[WEP_KEYMAXLEN]; - // Auto rate fallback vars - bool bIsInFallback; - u32 uTxFailures; - u32 uTxAttempts; - u16 wFailureRatio; + // STA info + u16 wAID; + u8 abyMACAddr[6]; + u16 wTxDataRate; + u16 wInActiveCount; + u16 wEnQueueCnt; + u16 wFlags; + bool bPWBitOn; + u8 byKeyIndex; + u16 wWepKeyLength; + u8 abyWepKey[WEP_KEYMAXLEN]; + // Auto rate fallback vars + bool bIsInFallback; + u32 uTxFailures; + u32 uTxAttempts; + u16 wFailureRatio; } __packed SNodeItem; @@ -212,13 +212,13 @@ typedef struct tagSNodeList { typedef struct tagSCmdLinkStatus { - bool bLink; + bool bLink; u16 wBSSType; u8 byState; - u8 abyBSSID[BSSID_LEN]; - u8 abySSID[SSID_MAXLEN + 2]; - u32 uChannel; - u32 uLinkRate; + u8 abyBSSID[BSSID_LEN]; + u8 abySSID[SSID_MAXLEN + 2]; + u32 uChannel; + u32 uLinkRate; } __packed SCmdLinkStatus, *PSCmdLinkStatus; @@ -226,107 +226,107 @@ typedef struct tagSCmdLinkStatus { // 802.11 counter // typedef struct tagSDot11MIBCount { - u32 TransmittedFragmentCount; - u32 MulticastTransmittedFrameCount; - u32 FailedCount; - u32 RetryCount; - u32 MultipleRetryCount; - u32 RTSSuccessCount; - u32 RTSFailureCount; - u32 ACKFailureCount; - u32 FrameDuplicateCount; - u32 ReceivedFragmentCount; - u32 MulticastReceivedFrameCount; - u32 FCSErrorCount; + u32 TransmittedFragmentCount; + u32 MulticastTransmittedFrameCount; + u32 FailedCount; + u32 RetryCount; + u32 MultipleRetryCount; + u32 RTSSuccessCount; + u32 RTSFailureCount; + u32 ACKFailureCount; + u32 FrameDuplicateCount; + u32 ReceivedFragmentCount; + u32 MulticastReceivedFrameCount; + u32 FCSErrorCount; } __packed SDot11MIBCount, *PSDot11MIBCount; // // statistic counter // typedef struct tagSStatMIBCount { - // - // ISR status count - // - u32 dwIsrTx0OK; - u32 dwIsrTx1OK; - u32 dwIsrBeaconTxOK; - u32 dwIsrRxOK; - u32 dwIsrTBTTInt; - u32 dwIsrSTIMERInt; - u32 dwIsrUnrecoverableError; - u32 dwIsrSoftInterrupt; - u32 dwIsrRxNoBuf; - ///////////////////////////////////// + // + // ISR status count + // + u32 dwIsrTx0OK; + u32 dwIsrTx1OK; + u32 dwIsrBeaconTxOK; + u32 dwIsrRxOK; + u32 dwIsrTBTTInt; + u32 dwIsrSTIMERInt; + u32 dwIsrUnrecoverableError; + u32 dwIsrSoftInterrupt; + u32 dwIsrRxNoBuf; + ///////////////////////////////////// u32 dwIsrUnknown; /* unknown interrupt count */ - // RSR status count - // - u32 dwRsrFrmAlgnErr; - u32 dwRsrErr; - u32 dwRsrCRCErr; - u32 dwRsrCRCOk; - u32 dwRsrBSSIDOk; - u32 dwRsrADDROk; - u32 dwRsrICVOk; - u32 dwNewRsrShortPreamble; - u32 dwRsrLong; - u32 dwRsrRunt; - - u32 dwRsrRxControl; - u32 dwRsrRxData; - u32 dwRsrRxManage; - - u32 dwRsrRxPacket; - u32 dwRsrRxOctet; - u32 dwRsrBroadcast; - u32 dwRsrMulticast; - u32 dwRsrDirected; - // 64-bit OID - u32 ullRsrOK; - - // for some optional OIDs (64 bits) and DMI support - u32 ullRxBroadcastBytes; - u32 ullRxMulticastBytes; - u32 ullRxDirectedBytes; - u32 ullRxBroadcastFrames; - u32 ullRxMulticastFrames; - u32 ullRxDirectedFrames; - - u32 dwRsrRxFragment; - u32 dwRsrRxFrmLen64; - u32 dwRsrRxFrmLen65_127; - u32 dwRsrRxFrmLen128_255; - u32 dwRsrRxFrmLen256_511; - u32 dwRsrRxFrmLen512_1023; - u32 dwRsrRxFrmLen1024_1518; - - // TSR0,1 status count - // + // RSR status count + // + u32 dwRsrFrmAlgnErr; + u32 dwRsrErr; + u32 dwRsrCRCErr; + u32 dwRsrCRCOk; + u32 dwRsrBSSIDOk; + u32 dwRsrADDROk; + u32 dwRsrICVOk; + u32 dwNewRsrShortPreamble; + u32 dwRsrLong; + u32 dwRsrRunt; + + u32 dwRsrRxControl; + u32 dwRsrRxData; + u32 dwRsrRxManage; + + u32 dwRsrRxPacket; + u32 dwRsrRxOctet; + u32 dwRsrBroadcast; + u32 dwRsrMulticast; + u32 dwRsrDirected; + // 64-bit OID + u32 ullRsrOK; + + // for some optional OIDs (64 bits) and DMI support + u32 ullRxBroadcastBytes; + u32 ullRxMulticastBytes; + u32 ullRxDirectedBytes; + u32 ullRxBroadcastFrames; + u32 ullRxMulticastFrames; + u32 ullRxDirectedFrames; + + u32 dwRsrRxFragment; + u32 dwRsrRxFrmLen64; + u32 dwRsrRxFrmLen65_127; + u32 dwRsrRxFrmLen128_255; + u32 dwRsrRxFrmLen256_511; + u32 dwRsrRxFrmLen512_1023; + u32 dwRsrRxFrmLen1024_1518; + + // TSR0,1 status count + // u32 dwTsrTotalRetry[2]; /* total collision retry count */ u32 dwTsrOnceRetry[2]; /* this packet had one collision */ u32 dwTsrMoreThanOnceRetry[2]; /* this packet had many collisions */ u32 dwTsrRetry[2]; /* this packet has ever occur collision, * that is (dwTsrOnceCollision0 plus * dwTsrMoreThanOnceCollision0) */ - u32 dwTsrACKData[2]; - u32 dwTsrErr[2]; - u32 dwAllTsrOK[2]; - u32 dwTsrRetryTimeout[2]; - u32 dwTsrTransmitTimeout[2]; + u32 dwTsrACKData[2]; + u32 dwTsrErr[2]; + u32 dwAllTsrOK[2]; + u32 dwTsrRetryTimeout[2]; + u32 dwTsrTransmitTimeout[2]; - u32 dwTsrTxPacket[2]; - u32 dwTsrTxOctet[2]; - u32 dwTsrBroadcast[2]; - u32 dwTsrMulticast[2]; - u32 dwTsrDirected[2]; + u32 dwTsrTxPacket[2]; + u32 dwTsrTxOctet[2]; + u32 dwTsrBroadcast[2]; + u32 dwTsrMulticast[2]; + u32 dwTsrDirected[2]; - // RD/TD count - u32 dwCntRxFrmLength; - u32 dwCntTxBufLength; + // RD/TD count + u32 dwCntRxFrmLength; + u32 dwCntTxBufLength; - u8 abyCntRxPattern[16]; - u8 abyCntTxPattern[16]; + u8 abyCntRxPattern[16]; + u8 abyCntTxPattern[16]; /* Software check.... */ u32 dwCntRxDataErr; /* rx buffer data CRC err count */ @@ -337,18 +337,18 @@ typedef struct tagSStatMIBCount { /* 64-bit OID */ u32 ullTsrOK[2]; - // for some optional OIDs (64 bits) and DMI support - u32 ullTxBroadcastFrames[2]; - u32 ullTxMulticastFrames[2]; - u32 ullTxDirectedFrames[2]; - u32 ullTxBroadcastBytes[2]; - u32 ullTxMulticastBytes[2]; - u32 ullTxDirectedBytes[2]; + // for some optional OIDs (64 bits) and DMI support + u32 ullTxBroadcastFrames[2]; + u32 ullTxMulticastFrames[2]; + u32 ullTxDirectedFrames[2]; + u32 ullTxBroadcastBytes[2]; + u32 ullTxMulticastBytes[2]; + u32 ullTxDirectedBytes[2]; } __packed SStatMIBCount, *PSStatMIBCount; typedef struct tagSCmdValue { - u32 dwValue; + u32 dwValue; } __packed SCmdValue, *PSCmdValue; @@ -373,7 +373,7 @@ enum { }; #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \ -((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data)) + ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data)) // Maximum length for algorithm names (-1 for nul termination) used in ioctl() diff --git a/drivers/staging/vt6656/iowpa.h b/drivers/staging/vt6656/iowpa.h index 97af32e..c6fec82 100644 --- a/drivers/staging/vt6656/iowpa.h +++ b/drivers/staging/vt6656/iowpa.h @@ -33,12 +33,12 @@ //WPA related /* -typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg; -typedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, - CIPHER_WEP104 } wpa_cipher; -typedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE, - KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE } wpa_key_mgmt; -*/ + typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg; + typedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, + CIPHER_WEP104 } wpa_cipher; + typedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE, + KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE } wpa_key_mgmt; + */ enum { VIAWGET_SET_WPA = 1, diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index cf4c06a..3a74de7 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -136,7 +136,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, } pMgmt->eScanType = WMAC_SCAN_PASSIVE; PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n", ((PWLAN_IE_SSID)abyScanSSID)->abySSID, - ((PWLAN_IE_SSID)abyScanSSID)->len); + ((PWLAN_IE_SSID)abyScanSSID)->len); bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); spin_unlock_irq(&pDevice->lock); @@ -313,7 +313,7 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, // If setting by frequency, convert to a channel if ((wrq->e == 1) && (wrq->m >= (int)2.412e8) && - (wrq->m <= (int)2.487e8)) { + (wrq->m <= (int)2.487e8)) { int f = wrq->m / 100000; int c = 0; while ((c < 14) && (f != frequency_list[c])) @@ -386,7 +386,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Can't set operation mode, hostapd is running\n"); + "Can't set operation mode, hostapd is running\n"); return rc; } @@ -435,20 +435,20 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, netif_stop_queue(pDevice->dev); spin_lock_irq(&pDevice->lock); bScheduleCommand((void *) pDevice, - WLAN_CMD_RUN_AP, NULL); + WLAN_CMD_RUN_AP, NULL); spin_unlock_irq(&pDevice->lock); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Commit the settings\n"); + "Commit the settings\n"); spin_lock_irq(&pDevice->lock); if (pDevice->bLinkPass && - memcmp(pMgmt->abyCurrSSID, - pMgmt->abyDesireSSID, - WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN)) { + memcmp(pMgmt->abyCurrSSID, + pMgmt->abyDesireSSID, + WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN)) { bScheduleCommand((void *) pDevice, - WLAN_CMD_DISASSOCIATE, NULL); + WLAN_CMD_DISASSOCIATE, NULL); } else { pDevice->bLinkPass = false; pMgmt->eCurrState = WMAC_STATE_IDLE; @@ -456,7 +456,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, } ControlvMaskByte(pDevice, - MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, + MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); netif_stop_queue(pDevice->dev); @@ -465,12 +465,12 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, if (!pDevice->bWPASuppWextEnabled) bScheduleCommand((void *) pDevice, - WLAN_CMD_BSSID_SCAN, - pMgmt->abyDesireSSID); + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); bScheduleCommand((void *) pDevice, - WLAN_CMD_SSID, - NULL); + WLAN_CMD_SSID, + NULL); spin_unlock_irq(&pDevice->lock); } @@ -585,7 +585,7 @@ int iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, range->max_encoding_tokens = 4; range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; + IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; range->min_pmp = 0; range->max_pmp = 1000000; // 1 secs @@ -642,7 +642,7 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6); // mike: add if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) || - (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)) { + (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)) { PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n"); return rc; } @@ -654,8 +654,8 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, unsigned uSameBssidNum = 0; for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && - ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, - pMgmt->abyDesireBSSID)) { + ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, + pMgmt->abyDesireBSSID)) { uSameBssidNum++; } } @@ -751,7 +751,7 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, wrq->length = jj; memcpy(extra, sock, sizeof(struct sockaddr) * jj); memcpy(extra + sizeof(struct sockaddr) * jj, qual, - sizeof(struct iw_quality) * jj); + sizeof(struct iw_quality) * jj); kfree(sock); kfree(qual); @@ -819,8 +819,8 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, memcpy(abyTmpDesireSSID, pMgmt->abyDesireSSID, sizeof(abyTmpDesireSSID)); pCurr = BSSpSearchBSSList(pDevice, NULL, - abyTmpDesireSSID, - pDevice->eConfigPHYMode); + abyTmpDesireSSID, + pDevice->eConfigPHYMode); if (pCurr == NULL) { PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); @@ -837,8 +837,8 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, // are two same BSSID exist in list ? for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && - ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, - pCurr->abyBSSID)) { + ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, + pCurr->abyBSSID)) { uSameBssidNum++; } } @@ -1401,11 +1401,11 @@ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { wrq->value = (int)((pMgmt->wListenInterval * - pMgmt->wCurrBeaconPeriod) / 100); + pMgmt->wCurrBeaconPeriod) / 100); wrq->flags = IW_POWER_TIMEOUT; } else { wrq->value = (int)((pMgmt->wListenInterval * - pMgmt->wCurrBeaconPeriod) / 100); + pMgmt->wCurrBeaconPeriod) / 100); wrq->flags = IW_POWER_PERIOD; } @@ -1468,7 +1468,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, } else if (pairwise == IW_AUTH_CIPHER_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; } else if (pairwise == IW_AUTH_CIPHER_WEP40 || - pairwise == IW_AUTH_CIPHER_WEP104) { + pairwise == IW_AUTH_CIPHER_WEP104) { pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; } else if (pairwise == IW_AUTH_CIPHER_NONE) { // do nothing, einsn liu @@ -1610,7 +1610,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; struct viawget_wpa_param *param = NULL; -// original member + // original member wpa_alg alg_name; u8 addr[6]; int key_idx; @@ -1637,7 +1637,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, param = (struct viawget_wpa_param *)buf; -// recover alg_name + // recover alg_name switch (ext->alg) { case IW_ENCODE_ALG_NONE: alg_name = WPA_ALG_NONE; @@ -1656,19 +1656,19 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, ret = -ENOMEM; goto error; } -// recover addr + // recover addr memcpy(addr, ext->addr.sa_data, ETH_ALEN); -// recover key_idx + // recover key_idx key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1; -// recover set_tx + // recover set_tx if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) set_tx = 1; -// recover seq,seq_len + // recover seq,seq_len if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { seq_len = IW_ENCODE_SEQ_MAX_SIZE; memcpy(seq, ext->rx_seq, seq_len); } -// recover key,key_len + // recover key,key_len if (ext->key_len) { key_len = ext->key_len; memcpy(key, &ext->key[0], key_len); @@ -1683,7 +1683,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, } } -/**************Translate iw_encode_ext to viawget_wpa_param****************/ + /**************Translate iw_encode_ext to viawget_wpa_param****************/ memcpy(param->addr, addr, ETH_ALEN); param->u.wpa_key.alg_name = (int)alg_name; param->u.wpa_key.set_tx = set_tx; @@ -1693,8 +1693,8 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, param->u.wpa_key.seq = (u8 *)seq; param->u.wpa_key.seq_len = seq_len; -/****set if current action is Network Manager count?? */ -/****this method is so foolish,but there is no other way??? */ + /****set if current action is Network Manager count?? */ + /****this method is so foolish,but there is no other way??? */ if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { if (param->u.wpa_key.key_index == 0) { pDevice->bwextstep0 = true; @@ -1722,7 +1722,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, memset(pMgmt->abyDesireBSSID, 0xFF, 6); KeyvInitTable(pDevice, &pDevice->sKey); } -/*******/ + /*******/ spin_lock_irq(&pDevice->lock); ret = wpa_set_keys(pDevice, param); spin_unlock_irq(&pDevice->lock); @@ -1771,7 +1771,7 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, } static int iwctl_config_commit(struct net_device *dev, - struct iw_request_info *info, union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SIOCSIWCOMMIT\n"); diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index be92c04..1dfaea1 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -46,37 +46,37 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; static void s_vCheckKeyTableValid(struct vnt_private *pDevice, - PSKeyManagement pTable) + PSKeyManagement pTable) { int i; u16 wLength = 0; u8 pbyData[MAX_KEY_TABLE]; - for (i=0;i<MAX_KEY_TABLE;i++) { - if ((pTable->KeyTable[i].bInUse == true) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[0].bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[1].bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[2].bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[3].bKeyValid == false) - ) { - - pTable->KeyTable[i].bInUse = false; - pTable->KeyTable[i].wKeyCtl = 0; - pTable->KeyTable[i].bSoftWEP = false; - pbyData[wLength++] = (u8) i; - //MACvDisableKeyEntry(pDevice, i); - } - } - if ( wLength != 0 ) { - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_CLRKEYENTRY, - 0, - 0, - wLength, - pbyData - ); - } + for (i=0;i<MAX_KEY_TABLE;i++) { + if ((pTable->KeyTable[i].bInUse == true) && + (pTable->KeyTable[i].PairwiseKey.bKeyValid == false) && + (pTable->KeyTable[i].GroupKey[0].bKeyValid == false) && + (pTable->KeyTable[i].GroupKey[1].bKeyValid == false) && + (pTable->KeyTable[i].GroupKey[2].bKeyValid == false) && + (pTable->KeyTable[i].GroupKey[3].bKeyValid == false) + ) { + + pTable->KeyTable[i].bInUse = false; + pTable->KeyTable[i].wKeyCtl = 0; + pTable->KeyTable[i].bSoftWEP = false; + pbyData[wLength++] = (u8) i; + //MACvDisableKeyEntry(pDevice, i); + } + } + if ( wLength != 0 ) { + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_CLRKEYENTRY, + 0, + 0, + wLength, + pbyData + ); + } } @@ -97,34 +97,34 @@ void KeyvInitTable(struct vnt_private *pDevice, PSKeyManagement pTable) int i, jj; u8 pbyData[MAX_KEY_TABLE+1]; - spin_lock_irq(&pDevice->lock); - for (i=0;i<MAX_KEY_TABLE;i++) { - pTable->KeyTable[i].bInUse = false; - pTable->KeyTable[i].PairwiseKey.bKeyValid = false; - pTable->KeyTable[i].PairwiseKey.pvKeyTable = - (void *)&pTable->KeyTable[i]; - for (jj=0; jj < MAX_GROUP_KEY; jj++) { - pTable->KeyTable[i].GroupKey[jj].bKeyValid = false; - pTable->KeyTable[i].GroupKey[jj].pvKeyTable = - (void *) &(pTable->KeyTable[i]); - } - pTable->KeyTable[i].wKeyCtl = 0; - pTable->KeyTable[i].dwGTKeyIndex = 0; - pTable->KeyTable[i].bSoftWEP = false; - pbyData[i] = (u8) i; - } - pbyData[i] = (u8) i; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_CLRKEYENTRY, - 0, - 0, - 11, - pbyData - ); - - spin_unlock_irq(&pDevice->lock); - - return; + spin_lock_irq(&pDevice->lock); + for (i=0;i<MAX_KEY_TABLE;i++) { + pTable->KeyTable[i].bInUse = false; + pTable->KeyTable[i].PairwiseKey.bKeyValid = false; + pTable->KeyTable[i].PairwiseKey.pvKeyTable = + (void *)&pTable->KeyTable[i]; + for (jj=0; jj < MAX_GROUP_KEY; jj++) { + pTable->KeyTable[i].GroupKey[jj].bKeyValid = false; + pTable->KeyTable[i].GroupKey[jj].pvKeyTable = + (void *) &(pTable->KeyTable[i]); + } + pTable->KeyTable[i].wKeyCtl = 0; + pTable->KeyTable[i].dwGTKeyIndex = 0; + pTable->KeyTable[i].bSoftWEP = false; + pbyData[i] = (u8) i; + } + pbyData[i] = (u8) i; + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_CLRKEYENTRY, + 0, + 0, + 11, + pbyData + ); + + spin_unlock_irq(&pDevice->lock); + + return; } /* @@ -142,39 +142,39 @@ void KeyvInitTable(struct vnt_private *pDevice, PSKeyManagement pTable) * */ int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, - PSKeyItem *pKey) + PSKeyItem *pKey) { int i; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetKey()\n"); - *pKey = NULL; - for (i=0;i<MAX_KEY_TABLE;i++) { - if ((pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { - if (dwKeyIndex == 0xFFFFFFFF) { - if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { - *pKey = &(pTable->KeyTable[i].PairwiseKey); - return (true); - } - else { - return (false); - } - } else if (dwKeyIndex < MAX_GROUP_KEY) { - if (pTable->KeyTable[i].GroupKey[dwKeyIndex].bKeyValid == true) { - *pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex]); - return (true); - } - else { - return (false); - } - } - else { - return (false); - } - } - } - return (false); + *pKey = NULL; + for (i=0;i<MAX_KEY_TABLE;i++) { + if ((pTable->KeyTable[i].bInUse == true) && + ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + if (dwKeyIndex == 0xFFFFFFFF) { + if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { + *pKey = &(pTable->KeyTable[i].PairwiseKey); + return (true); + } + else { + return (false); + } + } else if (dwKeyIndex < MAX_GROUP_KEY) { + if (pTable->KeyTable[i].GroupKey[dwKeyIndex].bKeyValid == true) { + *pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex]); + return (true); + } + else { + return (false); + } + } + else { + return (false); + } + } + } + return (false); } /* @@ -195,158 +195,158 @@ int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, * */ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, - u8 *pbyBSSID, u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, - u8 byKeyDecMode) + u8 *pbyBSSID, u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode) { PSKeyItem pKey; int i, j, ii; u32 uKeyIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Enter KeybSetKey: %X\n", dwKeyIndex); - - j = (MAX_KEY_TABLE-1); - for (i=0;i<(MAX_KEY_TABLE-1);i++) { - if ((pTable->KeyTable[i].bInUse == false) && - (j == (MAX_KEY_TABLE-1))) { - // found empty table - j = i; - } - if ((pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { - // found table already exist - if ((dwKeyIndex & PAIRWISE_KEY) != 0) { - // Pairwise key - pKey = &(pTable->KeyTable[i].PairwiseKey); - pTable->KeyTable[i].wKeyCtl &= 0xFFF0; // clear pairwise key control filed - pTable->KeyTable[i].wKeyCtl |= byKeyDecMode; - uKeyIdx = 4; // use HW key entry 4 for pairwise key - } else { - // Group key - if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) - return (false); - pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF]); - if ((dwKeyIndex & TRANSMIT_KEY) != 0) { - // Group transmit key - pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Group transmit key(R)[%X]: %d\n", - pTable->KeyTable[i].dwGTKeyIndex, i); - } - pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed - pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4); - pTable->KeyTable[i].wKeyCtl |= 0x0040; // use group key for group address - uKeyIdx = (dwKeyIndex & 0x000000FF); - } - pTable->KeyTable[i].wKeyCtl |= 0x8000; // enable on-fly - - pKey->bKeyValid = true; - pKey->uKeyLength = uKeyLength; - pKey->dwKeyIndex = dwKeyIndex; - pKey->byCipherSuite = byKeyDecMode; - memcpy(pKey->abyKey, pbyKey, uKeyLength); - if (byKeyDecMode == KEY_CTL_WEP) { - if (uKeyLength == WLAN_WEP40_KEYLEN) - pKey->abyKey[15] &= 0x7F; - if (uKeyLength == WLAN_WEP104_KEYLEN) - pKey->abyKey[15] |= 0x80; - } - MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (u32 *)pKey->abyKey); + "Enter KeybSetKey: %X\n", dwKeyIndex); + + j = (MAX_KEY_TABLE-1); + for (i=0;i<(MAX_KEY_TABLE-1);i++) { + if ((pTable->KeyTable[i].bInUse == false) && + (j == (MAX_KEY_TABLE-1))) { + // found empty table + j = i; + } + if ((pTable->KeyTable[i].bInUse == true) && + ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + // found table already exist + if ((dwKeyIndex & PAIRWISE_KEY) != 0) { + // Pairwise key + pKey = &(pTable->KeyTable[i].PairwiseKey); + pTable->KeyTable[i].wKeyCtl &= 0xFFF0; // clear pairwise key control filed + pTable->KeyTable[i].wKeyCtl |= byKeyDecMode; + uKeyIdx = 4; // use HW key entry 4 for pairwise key + } else { + // Group key + if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) + return (false); + pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF]); + if ((dwKeyIndex & TRANSMIT_KEY) != 0) { + // Group transmit key + pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "Group transmit key(R)[%X]: %d\n", + pTable->KeyTable[i].dwGTKeyIndex, i); + } + pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed + pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4); + pTable->KeyTable[i].wKeyCtl |= 0x0040; // use group key for group address + uKeyIdx = (dwKeyIndex & 0x000000FF); + } + pTable->KeyTable[i].wKeyCtl |= 0x8000; // enable on-fly + + pKey->bKeyValid = true; + pKey->uKeyLength = uKeyLength; + pKey->dwKeyIndex = dwKeyIndex; + pKey->byCipherSuite = byKeyDecMode; + memcpy(pKey->abyKey, pbyKey, uKeyLength); + if (byKeyDecMode == KEY_CTL_WEP) { + if (uKeyLength == WLAN_WEP40_KEYLEN) + pKey->abyKey[15] &= 0x7F; + if (uKeyLength == WLAN_WEP104_KEYLEN) + pKey->abyKey[15] |= 0x80; + } + MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (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 ", pKey->uKeyLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); + for (ii = 0; ii < pKey->uKeyLength; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n ", + pKey->dwTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", + pKey->wTSC15_0); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ", + pKey->dwKeyIndex); + + return (true); + } + } + if (j < (MAX_KEY_TABLE-1)) { + memcpy(pTable->KeyTable[j].abyBSSID, pbyBSSID, ETH_ALEN); + pTable->KeyTable[j].bInUse = true; + if ((dwKeyIndex & PAIRWISE_KEY) != 0) { + // Pairwise key + pKey = &(pTable->KeyTable[j].PairwiseKey); + pTable->KeyTable[j].wKeyCtl &= 0xFFF0; // clear pairwise key control filed + pTable->KeyTable[j].wKeyCtl |= byKeyDecMode; + uKeyIdx = 4; // use HW key entry 4 for pairwise key + } else { + // Group key + if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) + return (false); + pKey = &(pTable->KeyTable[j].GroupKey[dwKeyIndex & 0x000000FF]); + if ((dwKeyIndex & TRANSMIT_KEY) != 0) { + // Group transmit key + pTable->KeyTable[j].dwGTKeyIndex = dwKeyIndex; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "Group transmit key(N)[%X]: %d\n", + pTable->KeyTable[j].dwGTKeyIndex, j); + } + pTable->KeyTable[j].wKeyCtl &= 0xFF0F; // clear group key control filed + pTable->KeyTable[j].wKeyCtl |= (byKeyDecMode << 4); + pTable->KeyTable[j].wKeyCtl |= 0x0040; // use group key for group address + uKeyIdx = (dwKeyIndex & 0x000000FF); + } + pTable->KeyTable[j].wKeyCtl |= 0x8000; // enable on-fly + + pKey->bKeyValid = true; + pKey->uKeyLength = uKeyLength; + pKey->dwKeyIndex = dwKeyIndex; + pKey->byCipherSuite = byKeyDecMode; + memcpy(pKey->abyKey, pbyKey, uKeyLength); + if (byKeyDecMode == KEY_CTL_WEP) { + if (uKeyLength == WLAN_WEP40_KEYLEN) + pKey->abyKey[15] &= 0x7F; + if (uKeyLength == WLAN_WEP104_KEYLEN) + pKey->abyKey[15] |= 0x80; + } + MACvSetKeyEntry(pDevice, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (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; + 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 ", pKey->uKeyLength); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); - for (ii = 0; ii < pKey->uKeyLength; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(N):\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n ", pKey->bKeyValid); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); + for (ii = 0; ii < pKey->uKeyLength; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n ", - pKey->dwTSC47_16); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", - pKey->wTSC15_0); + pKey->dwTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ", - pKey->dwKeyIndex); - - return (true); - } - } - if (j < (MAX_KEY_TABLE-1)) { - memcpy(pTable->KeyTable[j].abyBSSID, pbyBSSID, ETH_ALEN); - pTable->KeyTable[j].bInUse = true; - if ((dwKeyIndex & PAIRWISE_KEY) != 0) { - // Pairwise key - pKey = &(pTable->KeyTable[j].PairwiseKey); - pTable->KeyTable[j].wKeyCtl &= 0xFFF0; // clear pairwise key control filed - pTable->KeyTable[j].wKeyCtl |= byKeyDecMode; - uKeyIdx = 4; // use HW key entry 4 for pairwise key - } else { - // Group key - if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) - return (false); - pKey = &(pTable->KeyTable[j].GroupKey[dwKeyIndex & 0x000000FF]); - if ((dwKeyIndex & TRANSMIT_KEY) != 0) { - // Group transmit key - pTable->KeyTable[j].dwGTKeyIndex = dwKeyIndex; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Group transmit key(N)[%X]: %d\n", - pTable->KeyTable[j].dwGTKeyIndex, j); - } - pTable->KeyTable[j].wKeyCtl &= 0xFF0F; // clear group key control filed - pTable->KeyTable[j].wKeyCtl |= (byKeyDecMode << 4); - pTable->KeyTable[j].wKeyCtl |= 0x0040; // use group key for group address - uKeyIdx = (dwKeyIndex & 0x000000FF); - } - pTable->KeyTable[j].wKeyCtl |= 0x8000; // enable on-fly - - pKey->bKeyValid = true; - pKey->uKeyLength = uKeyLength; - pKey->dwKeyIndex = dwKeyIndex; - pKey->byCipherSuite = byKeyDecMode; - memcpy(pKey->abyKey, pbyKey, uKeyLength); - if (byKeyDecMode == KEY_CTL_WEP) { - if (uKeyLength == WLAN_WEP40_KEYLEN) - pKey->abyKey[15] &= 0x7F; - if (uKeyLength == WLAN_WEP104_KEYLEN) - pKey->abyKey[15] |= 0x80; - } - MACvSetKeyEntry(pDevice, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (u32 *)pKey->abyKey); - - if ((dwKeyIndex & USE_KEYRSC) == 0) - pKey->KeyRSC = 0; /* RSC set by NIC */ - else - pKey->KeyRSC = *KeyRSC; + pKey->dwKeyIndex); - pKey->dwTSC47_16 = 0; - pKey->wTSC15_0 = 0; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(N): \n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n ", pKey->bKeyValid); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); - for (ii = 0; ii < pKey->uKeyLength; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n ", - pKey->dwTSC47_16); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ", - pKey->dwKeyIndex); - - return (true); - } - return (false); + return (true); + } + return (false); } /* @@ -365,63 +365,63 @@ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, */ int KeybRemoveKey(struct vnt_private *pDevice, PSKeyManagement pTable, - u8 *pbyBSSID, u32 dwKeyIndex) + u8 *pbyBSSID, u32 dwKeyIndex) { int i; int bReturnValue = false; - if (is_broadcast_ether_addr(pbyBSSID)) { - // delete all keys - if ((dwKeyIndex & PAIRWISE_KEY) != 0) { - for (i=0;i<MAX_KEY_TABLE;i++) { - pTable->KeyTable[i].PairwiseKey.bKeyValid = false; - } - bReturnValue = true; - } - else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { - for (i=0;i<MAX_KEY_TABLE;i++) { - pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; - if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[i].dwGTKeyIndex & 0x7FFFFFFF)) { - // remove Group transmit key - pTable->KeyTable[i].dwGTKeyIndex = 0; - } - } - bReturnValue = true; - } - else { - bReturnValue = false; - } - - } else { - for (i=0;i<MAX_KEY_TABLE;i++) { - if ( (pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { - - if ((dwKeyIndex & PAIRWISE_KEY) != 0) { - pTable->KeyTable[i].PairwiseKey.bKeyValid = false; - bReturnValue = true; - break; - } - else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { - pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; - if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[i].dwGTKeyIndex & 0x7FFFFFFF)) { - // remove Group transmit key - pTable->KeyTable[i].dwGTKeyIndex = 0; - } - bReturnValue = true; - break; - } - else { - bReturnValue = false; - break; - } - } //pTable->KeyTable[i].bInUse == true - } //for - bReturnValue = true; - } - - s_vCheckKeyTableValid(pDevice,pTable); - return bReturnValue; + if (is_broadcast_ether_addr(pbyBSSID)) { + // delete all keys + if ((dwKeyIndex & PAIRWISE_KEY) != 0) { + for (i=0;i<MAX_KEY_TABLE;i++) { + pTable->KeyTable[i].PairwiseKey.bKeyValid = false; + } + bReturnValue = true; + } + else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { + for (i=0;i<MAX_KEY_TABLE;i++) { + pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; + if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[i].dwGTKeyIndex & 0x7FFFFFFF)) { + // remove Group transmit key + pTable->KeyTable[i].dwGTKeyIndex = 0; + } + } + bReturnValue = true; + } + else { + bReturnValue = false; + } + + } else { + for (i=0;i<MAX_KEY_TABLE;i++) { + if ( (pTable->KeyTable[i].bInUse == true) && + ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + + if ((dwKeyIndex & PAIRWISE_KEY) != 0) { + pTable->KeyTable[i].PairwiseKey.bKeyValid = false; + bReturnValue = true; + break; + } + else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { + pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; + if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[i].dwGTKeyIndex & 0x7FFFFFFF)) { + // remove Group transmit key + pTable->KeyTable[i].dwGTKeyIndex = 0; + } + bReturnValue = true; + break; + } + else { + bReturnValue = false; + break; + } + } //pTable->KeyTable[i].bInUse == true + } //for + bReturnValue = true; + } + + s_vCheckKeyTableValid(pDevice,pTable); + return bReturnValue; } @@ -439,23 +439,23 @@ int KeybRemoveKey(struct vnt_private *pDevice, PSKeyManagement pTable, * */ int KeybRemoveAllKey(struct vnt_private *pDevice, PSKeyManagement pTable, - u8 *pbyBSSID) + u8 *pbyBSSID) { int i, u; - for (i=0;i<MAX_KEY_TABLE;i++) { - if ((pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { - pTable->KeyTable[i].PairwiseKey.bKeyValid = false; - for (u = 0; u < MAX_GROUP_KEY; u++) - pTable->KeyTable[i].GroupKey[u].bKeyValid = false; - - pTable->KeyTable[i].dwGTKeyIndex = 0; - s_vCheckKeyTableValid(pDevice, pTable); - return (true); - } - } - return (false); + for (i=0;i<MAX_KEY_TABLE;i++) { + if ((pTable->KeyTable[i].bInUse == true) && + ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + pTable->KeyTable[i].PairwiseKey.bKeyValid = false; + for (u = 0; u < MAX_GROUP_KEY; u++) + pTable->KeyTable[i].GroupKey[u].bKeyValid = false; + + pTable->KeyTable[i].dwGTKeyIndex = 0; + s_vCheckKeyTableValid(pDevice, pTable); + return (true); + } + } + return (false); } /* @@ -472,67 +472,67 @@ int KeybRemoveAllKey(struct vnt_private *pDevice, PSKeyManagement pTable, * */ int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, - PSKeyItem *pKey) + PSKeyItem *pKey) { int i, ii; *pKey = NULL; - for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && - ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { - - if (dwKeyType == PAIRWISE_KEY) { - - if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { - *pKey = &(pTable->KeyTable[i].PairwiseKey); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PAIRWISE_KEY: KeyTable.abyBSSID: "); - for (ii = 0; ii < 6; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - - return (true); - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PairwiseKey.bKeyValid == false\n"); - return (false); - } - } // End of Type == PAIRWISE - else { - if (pTable->KeyTable[i].dwGTKeyIndex == 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ERROR: dwGTKeyIndex == 0 !!!\n"); - return false; - } - if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid == true) { - *pKey = &(pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)]); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GROUP_KEY: KeyTable.abyBSSID\n"); - for (ii = 0; ii < 6; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %X\n", - pTable->KeyTable[i].dwGTKeyIndex); - - return (true); - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GroupKey.bKeyValid == false\n"); - return (false); - } - } // End of Type = GROUP - } // BSSID match - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ERROR: NO Match BSSID !!! "); - for (ii = 0; ii < 6; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *(pbyBSSID+ii)); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - return (false); + for (i = 0; i < MAX_KEY_TABLE; i++) { + if ((pTable->KeyTable[i].bInUse == true) && + ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { + + if (dwKeyType == PAIRWISE_KEY) { + + if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { + *pKey = &(pTable->KeyTable[i].PairwiseKey); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PAIRWISE_KEY: KeyTable.abyBSSID: "); + for (ii = 0; ii < 6; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + + return (true); + } + else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PairwiseKey.bKeyValid == false\n"); + return (false); + } + } // End of Type == PAIRWISE + else { + if (pTable->KeyTable[i].dwGTKeyIndex == 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ERROR: dwGTKeyIndex == 0 !!!\n"); + return false; + } + if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid == true) { + *pKey = &(pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)]); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GROUP_KEY: KeyTable.abyBSSID\n"); + for (ii = 0; ii < 6; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %X\n", + pTable->KeyTable[i].dwGTKeyIndex); + + return (true); + } + else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GroupKey.bKeyValid == false\n"); + return (false); + } + } // End of Type = GROUP + } // BSSID match + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ERROR: NO Match BSSID !!! "); + for (ii = 0; ii < 6; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *(pbyBSSID+ii)); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + return (false); } /* @@ -553,93 +553,93 @@ int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, */ int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, - u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, - u8 byKeyDecMode) + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode) { int ii; PSKeyItem pKey; u32 uKeyIdx; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetDefaultKey: %1x, %d\n", - (int) dwKeyIndex, (int) uKeyLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetDefaultKey: %1x, %d\n", + (int) dwKeyIndex, (int) uKeyLength); - if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key - return (false); - } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) { - return (false); - } + if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key + return (false); + } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) { + return (false); + } - if (uKeyLength > MAX_KEY_LEN) - return false; + if (uKeyLength > MAX_KEY_LEN) + return false; - pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true; - for (ii = 0; ii < ETH_ALEN; ii++) - pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; + pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true; + for (ii = 0; ii < ETH_ALEN; ii++) + pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; - // Group key - pKey = &(pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF]); - if ((dwKeyIndex & TRANSMIT_KEY) != 0) { - // Group transmit key - pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = dwKeyIndex; + // Group key + pKey = &(pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF]); + if ((dwKeyIndex & TRANSMIT_KEY) != 0) { + // Group transmit key + pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = dwKeyIndex; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Group transmit key(R)[%X]: %d\n", - pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, - MAX_KEY_TABLE-1); - - } - pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl &= 0x7F00; // clear all key control filed - pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= (byKeyDecMode << 4); - pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= (byKeyDecMode); - pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0x0044; // use group key for all address - uKeyIdx = (dwKeyIndex & 0x000000FF); - - if ((uKeyLength == WLAN_WEP232_KEYLEN) && - (byKeyDecMode == KEY_CTL_WEP)) { - pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0x4000; // disable on-fly disable address match - pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP = true; - } else { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP == false) - pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0xC000; // enable on-fly disable address match - } - - pKey->bKeyValid = true; - pKey->uKeyLength = uKeyLength; - pKey->dwKeyIndex = dwKeyIndex; - pKey->byCipherSuite = byKeyDecMode; - memcpy(pKey->abyKey, pbyKey, uKeyLength); - if (byKeyDecMode == KEY_CTL_WEP) { - if (uKeyLength == WLAN_WEP40_KEYLEN) - pKey->abyKey[15] &= 0x7F; - if (uKeyLength == WLAN_WEP104_KEYLEN) - 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, (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); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: \n"); - for (ii = 0; ii < pKey->uKeyLength; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x", pKey->abyKey[ii]); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + "Group transmit key(R)[%X]: %d\n", + pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, + MAX_KEY_TABLE-1); + + } + pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl &= 0x7F00; // clear all key control filed + pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= (byKeyDecMode << 4); + pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= (byKeyDecMode); + pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0x0044; // use group key for all address + uKeyIdx = (dwKeyIndex & 0x000000FF); + + if ((uKeyLength == WLAN_WEP232_KEYLEN) && + (byKeyDecMode == KEY_CTL_WEP)) { + pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0x4000; // disable on-fly disable address match + pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP = true; + } else { + if (pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP == false) + pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0xC000; // enable on-fly disable address match + } + + pKey->bKeyValid = true; + pKey->uKeyLength = uKeyLength; + pKey->dwKeyIndex = dwKeyIndex; + pKey->byCipherSuite = byKeyDecMode; + memcpy(pKey->abyKey, pbyKey, uKeyLength); + if (byKeyDecMode == KEY_CTL_WEP) { + if (uKeyLength == WLAN_WEP40_KEYLEN) + pKey->abyKey[15] &= 0x7F; + if (uKeyLength == WLAN_WEP104_KEYLEN) + 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, (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); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey:\n"); + for (ii = 0; ii < pKey->uKeyLength; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x", pKey->abyKey[ii]); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n", - pKey->dwTSC47_16); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n", pKey->wTSC15_0); + pKey->dwTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n", pKey->wTSC15_0); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n", - pKey->dwKeyIndex); + pKey->dwKeyIndex); - return (true); + return (true); } /* @@ -660,78 +660,78 @@ int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, */ int KeybSetAllGroupKey(struct vnt_private *pDevice, PSKeyManagement pTable, - u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, - u8 byKeyDecMode) + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode) { int i, ii; PSKeyItem pKey; u32 uKeyIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %X\n", - dwKeyIndex); - - if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key - return (false); - } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) { - return (false); - } - - for (i=0; i < MAX_KEY_TABLE-1; i++) { - if (pTable->KeyTable[i].bInUse == true) { - // found table already exist - // Group key - pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF]); - if ((dwKeyIndex & TRANSMIT_KEY) != 0) { - // Group transmit key - pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Group transmit key(R)[%X]: %d\n", - pTable->KeyTable[i].dwGTKeyIndex, i); - - } - pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed - pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4); - pTable->KeyTable[i].wKeyCtl |= 0x0040; // use group key for group address - uKeyIdx = (dwKeyIndex & 0x000000FF); - - pTable->KeyTable[i].wKeyCtl |= 0x8000; // enable on-fly - - pKey->bKeyValid = true; - pKey->uKeyLength = uKeyLength; - pKey->dwKeyIndex = dwKeyIndex; - pKey->byCipherSuite = byKeyDecMode; - memcpy(pKey->abyKey, pbyKey, uKeyLength); - if (byKeyDecMode == KEY_CTL_WEP) { - if (uKeyLength == WLAN_WEP40_KEYLEN) - pKey->abyKey[15] &= 0x7F; - if (uKeyLength == WLAN_WEP104_KEYLEN) - pKey->abyKey[15] |= 0x80; - } - - 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 */ - 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); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); - for (ii = 0; ii < pKey->uKeyLength; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", pKey->abyKey[ii]); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - - //DBG_PRN_GRP12(("pKey->dwTSC47_16: %lX\n ", pKey->dwTSC47_16)); - //DBG_PRN_GRP12(("pKey->wTSC15_0: %X\n ", pKey->wTSC15_0)); - //DBG_PRN_GRP12(("pKey->dwKeyIndex: %lX\n ", pKey->dwKeyIndex)); - - } // (pTable->KeyTable[i].bInUse == true) - } - return (true); + dwKeyIndex); + + if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key + return (false); + } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) { + return (false); + } + + for (i=0; i < MAX_KEY_TABLE-1; i++) { + if (pTable->KeyTable[i].bInUse == true) { + // found table already exist + // Group key + pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF]); + if ((dwKeyIndex & TRANSMIT_KEY) != 0) { + // Group transmit key + pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "Group transmit key(R)[%X]: %d\n", + pTable->KeyTable[i].dwGTKeyIndex, i); + + } + pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed + pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4); + pTable->KeyTable[i].wKeyCtl |= 0x0040; // use group key for group address + uKeyIdx = (dwKeyIndex & 0x000000FF); + + pTable->KeyTable[i].wKeyCtl |= 0x8000; // enable on-fly + + pKey->bKeyValid = true; + pKey->uKeyLength = uKeyLength; + pKey->dwKeyIndex = dwKeyIndex; + pKey->byCipherSuite = byKeyDecMode; + memcpy(pKey->abyKey, pbyKey, uKeyLength); + if (byKeyDecMode == KEY_CTL_WEP) { + if (uKeyLength == WLAN_WEP40_KEYLEN) + pKey->abyKey[15] &= 0x7F; + if (uKeyLength == WLAN_WEP104_KEYLEN) + pKey->abyKey[15] |= 0x80; + } + + 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 */ + 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); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); + for (ii = 0; ii < pKey->uKeyLength; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", pKey->abyKey[ii]); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + + //DBG_PRN_GRP12(("pKey->dwTSC47_16: %lX\n ", pKey->dwTSC47_16)); + //DBG_PRN_GRP12(("pKey->wTSC15_0: %X\n ", pKey->wTSC15_0)); + //DBG_PRN_GRP12(("pKey->dwKeyIndex: %lX\n ", pKey->dwKeyIndex)); + + } // (pTable->KeyTable[i].bInUse == true) + } + return (true); } diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h index 23e188d..e019125 100644 --- a/drivers/staging/vt6656/key.h +++ b/drivers/staging/vt6656/key.h @@ -53,60 +53,60 @@ typedef struct tagSKeyItem { - bool bKeyValid; + bool bKeyValid; u32 uKeyLength; - u8 abyKey[MAX_KEY_LEN]; + u8 abyKey[MAX_KEY_LEN]; u64 KeyRSC; - u32 dwTSC47_16; - u16 wTSC15_0; - u8 byCipherSuite; - u8 byReserved0; - u32 dwKeyIndex; - void *pvKeyTable; + u32 dwTSC47_16; + u16 wTSC15_0; + u8 byCipherSuite; + u8 byReserved0; + u32 dwKeyIndex; + void *pvKeyTable; } SKeyItem, *PSKeyItem; //64 typedef struct tagSKeyTable { - u8 abyBSSID[ETH_ALEN]; /* 6 */ - u8 byReserved0[2]; //8 - SKeyItem PairwiseKey; - SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328 - u32 dwGTKeyIndex; // GroupTransmitKey Index - bool bInUse; - u16 wKeyCtl; - bool bSoftWEP; - u8 byReserved1[6]; + u8 abyBSSID[ETH_ALEN]; /* 6 */ + u8 byReserved0[2]; //8 + SKeyItem PairwiseKey; + SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328 + u32 dwGTKeyIndex; // GroupTransmitKey Index + bool bInUse; + u16 wKeyCtl; + bool bSoftWEP; + u8 byReserved1[6]; } SKeyTable, *PSKeyTable; //352 typedef struct tagSKeyManagement { - SKeyTable KeyTable[MAX_KEY_TABLE]; + SKeyTable KeyTable[MAX_KEY_TABLE]; } SKeyManagement, *PSKeyManagement; void KeyvInitTable(struct vnt_private *, PSKeyManagement pTable); int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, - PSKeyItem *pKey); + PSKeyItem *pKey); int KeybSetKey(struct vnt_private *, PSKeyManagement pTable, u8 *pbyBSSID, - u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, - u8 byKeyDecMode); + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode); int KeybRemoveKey(struct vnt_private *, PSKeyManagement pTable, - u8 *pbyBSSID, u32 dwKeyIndex); + u8 *pbyBSSID, u32 dwKeyIndex); int KeybRemoveAllKey(struct vnt_private *, PSKeyManagement pTable, - u8 *pbyBSSID); + u8 *pbyBSSID); int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, - PSKeyItem *pKey); + PSKeyItem *pKey); int KeybSetDefaultKey(struct vnt_private *, PSKeyManagement pTable, - u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, - u8 byKeyDecMode); + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode); int KeybSetAllGroupKey(struct vnt_private *, PSKeyManagement pTable, - u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, - u8 byKeyDecMode); + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode); #endif /* __KEY_H__ */ diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 3ce19dd..9d9acaa 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -59,7 +59,7 @@ void MACvWriteMultiAddr(struct vnt_private *pDevice, u64 mc_filter) __le64 le_mc = cpu_to_le64(mc_filter); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, MAC_REG_MAR0, - MESSAGE_REQUEST_MACREG, sizeof(le_mc), (u8 *)&le_mc); + MESSAGE_REQUEST_MACREG, sizeof(le_mc), (u8 *)&le_mc); } /* @@ -75,29 +75,29 @@ void MACvWriteMultiAddr(struct vnt_private *pDevice, u64 mc_filter) */ void MACbShutdown(struct vnt_private *pDevice) { - CONTROLnsRequestOutAsyn(pDevice, - MESSAGE_TYPE_MACSHUTDOWN, - 0, - 0, - 0, - NULL - ); + CONTROLnsRequestOutAsyn(pDevice, + MESSAGE_TYPE_MACSHUTDOWN, + 0, + 0, + 0, + NULL + ); } void MACvSetBBType(struct vnt_private *pDevice, u8 byType) { u8 pbyData[2]; - pbyData[0] = byType; - pbyData[1] = EnCFG_BBType_MASK; + pbyData[0] = byType; + pbyData[1] = EnCFG_BBType_MASK; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - MAC_REG_ENCFG0, - MESSAGE_REQUEST_MACREG, + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_MASK, + MAC_REG_ENCFG0, + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } /* @@ -118,16 +118,16 @@ void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) { u8 byData; - byData = (u8) uEntryIdx; + byData = (u8) uEntryIdx; - //issue write misc fifo command to device - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_CLRKEYENTRY, - 0, - 0, - 1, - &byData - ); + //issue write misc fifo command to device + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_CLRKEYENTRY, + 0, + 0, + 1, + &byData + ); } /* @@ -145,7 +145,7 @@ void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) * */ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, - u32 uKeyIdx, u8 *pbyAddr, u32 *pdwKey) + u32 uKeyIdx, u8 *pbyAddr, u32 *pdwKey) { u8 *pbyKey; u16 wOffset; @@ -157,49 +157,49 @@ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, if (pDevice->vnt_mgmt.byCSSPK == KEY_CTL_CCMP) return; - wOffset = MISCFIFO_KEYETRY0; - wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); + wOffset = MISCFIFO_KEYETRY0; + wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); - dwData1 = 0; - dwData1 |= wKeyCtl; - dwData1 <<= 16; - dwData1 |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5)); + dwData1 = 0; + dwData1 |= wKeyCtl; + dwData1 <<= 16; + dwData1 |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %X,"\ - " KeyCtl:%X\n", wOffset, dwData1, wKeyCtl); + " KeyCtl:%X\n", wOffset, dwData1, wKeyCtl); - dwData2 = 0; - dwData2 |= *(pbyAddr+3); - dwData2 <<= 8; - dwData2 |= *(pbyAddr+2); - dwData2 <<= 8; - dwData2 |= *(pbyAddr+1); - dwData2 <<= 8; - dwData2 |= *(pbyAddr+0); + dwData2 = 0; + dwData2 |= *(pbyAddr+3); + dwData2 <<= 8; + dwData2 |= *(pbyAddr+2); + dwData2 <<= 8; + dwData2 |= *(pbyAddr+1); + dwData2 <<= 8; + dwData2 |= *(pbyAddr+0); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %X\n", - wOffset, dwData2); - - 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, - (u16)uKeyIdx, + wOffset, dwData2); + + 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, + (u16)uKeyIdx, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } @@ -207,48 +207,48 @@ void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { u8 pbyData[2]; - pbyData[0] = 0; - pbyData[1] = byBits; + pbyData[0] = 0; + pbyData[1] = byBits; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - byRegOfs, - MESSAGE_REQUEST_MACREG, + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_MASK, + byRegOfs, + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } void MACvRegBitsOn(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { u8 pbyData[2]; - pbyData[0] = byBits; - pbyData[1] = byBits; + pbyData[0] = byBits; + pbyData[1] = byBits; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - byRegOfs, - MESSAGE_REQUEST_MACREG, + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_MASK, + byRegOfs, + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } void MACvWriteWord(struct vnt_private *pDevice, u8 byRegOfs, u16 wData) { u8 pbyData[2]; - pbyData[0] = (u8)(wData & 0xff); - pbyData[1] = (u8)(wData >> 8); + pbyData[0] = (u8)(wData & 0xff); + pbyData[1] = (u8)(wData >> 8); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - byRegOfs, - MESSAGE_REQUEST_MACREG, + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE, + byRegOfs, + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } @@ -256,84 +256,84 @@ void MACvWriteBSSIDAddress(struct vnt_private *pDevice, u8 *pbyEtherAddr) { u8 pbyData[6]; - 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, - MAC_REG_BSSID0, - MESSAGE_REQUEST_MACREG, + 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, + MAC_REG_BSSID0, + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } void MACvEnableProtectMD(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = EnCFG_ProtectMd; - pbyData[1] = EnCFG_ProtectMd; + pbyData[0] = EnCFG_ProtectMd; + pbyData[1] = EnCFG_ProtectMd; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - MAC_REG_ENCFG0, - MESSAGE_REQUEST_MACREG, + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_MASK, + MAC_REG_ENCFG0, + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } void MACvDisableProtectMD(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = 0; - pbyData[1] = EnCFG_ProtectMd; + pbyData[0] = 0; + pbyData[1] = EnCFG_ProtectMd; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - MAC_REG_ENCFG0, - MESSAGE_REQUEST_MACREG, + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_MASK, + MAC_REG_ENCFG0, + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } void MACvEnableBarkerPreambleMd(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = EnCFG_BarkerPream; - pbyData[1] = EnCFG_BarkerPream; + pbyData[0] = EnCFG_BarkerPream; + pbyData[1] = EnCFG_BarkerPream; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - MAC_REG_ENCFG2, - MESSAGE_REQUEST_MACREG, + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_MASK, + MAC_REG_ENCFG2, + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = 0; - pbyData[1] = EnCFG_BarkerPream; + pbyData[0] = 0; + pbyData[1] = EnCFG_BarkerPream; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - MAC_REG_ENCFG2, - MESSAGE_REQUEST_MACREG, + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_MASK, + MAC_REG_ENCFG2, + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(pbyData), - pbyData - ); + pbyData + ); } void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval) @@ -343,7 +343,7 @@ void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval) pbyData[0] = (u8)(wInterval & 0xff); pbyData[1] = (u8)(wInterval >> 8); - CONTROLnsRequestOut(pDevice, + CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, MAC_REG_BI, MESSAGE_REQUEST_MACREG, diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 3c93230..8b12dff 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -81,15 +81,15 @@ static int msglevel =MSG_LEVEL_INFO; /* version information */ #define DRIVER_AUTHOR \ - "VIA Networking Technologies, Inc., <lyndonchen@xxxxxxxxxxxx>" + "VIA Networking Technologies, Inc., <lyndonchen@xxxxxxxxxxxx>" MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); #define DEVICE_PARAM(N,D) \ - static int N[MAX_UINTS]=OPTION_DEFAULT;\ - module_param_array(N, int, NULL, 0);\ - MODULE_PARM_DESC(N, D); + static int N[MAX_UINTS]=OPTION_DEFAULT;\ +module_param_array(N, int, NULL, 0);\ +MODULE_PARM_DESC(N, D); #define RX_DESC_DEF0 64 DEVICE_PARAM(RxDescriptors0,"Number of receive usb desc buffer"); @@ -101,8 +101,8 @@ DEVICE_PARAM(TxDescriptors0,"Number of transmit usb desc buffer"); 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 +0: indicate allows long preamble type +1: indicate allows short preamble type */ #define PREAMBLE_TYPE_DEF 1 @@ -117,20 +117,20 @@ DEVICE_PARAM(FragThreshold, "Fragmentation threshold"); #define DATA_RATE_DEF 13 /* datarate[] index - 0: indicate 1 Mbps 0x02 - 1: indicate 2 Mbps 0x04 - 2: indicate 5.5 Mbps 0x0B - 3: indicate 11 Mbps 0x16 - 4: indicate 6 Mbps 0x0c - 5: indicate 9 Mbps 0x12 - 6: indicate 12 Mbps 0x18 - 7: indicate 18 Mbps 0x24 - 8: indicate 24 Mbps 0x30 - 9: indicate 36 Mbps 0x48 - 10: indicate 48 Mbps 0x60 - 11: indicate 54 Mbps 0x6c - 12: indicate 72 Mbps 0x90 - 13: indicate auto rate +0: indicate 1 Mbps 0x02 +1: indicate 2 Mbps 0x04 +2: indicate 5.5 Mbps 0x0B +3: indicate 11 Mbps 0x16 +4: indicate 6 Mbps 0x0c +5: indicate 9 Mbps 0x12 +6: indicate 12 Mbps 0x18 +7: indicate 18 Mbps 0x24 +8: indicate 24 Mbps 0x30 +9: indicate 36 Mbps 0x48 +10: indicate 48 Mbps 0x60 +11: indicate 54 Mbps 0x6c +12: indicate 72 Mbps 0x90 +13: indicate auto rate */ DEVICE_PARAM(ConnectionRate, "Connection data rate"); @@ -139,14 +139,14 @@ DEVICE_PARAM(ConnectionRate, "Connection data rate"); DEVICE_PARAM(OPMode, "Infrastruct, adhoc, AP mode "); /* OpMode[] is used for transmit. - 0: indicate infrastruct mode used - 1: indicate adhoc mode used - 2: indicate AP mode used +0: indicate infrastruct mode used +1: indicate adhoc mode used +2: indicate AP mode used */ /* PSMode[] - 0: indicate disable power saving mode - 1: indicate enable power saving mode +0: indicate disable power saving mode +1: indicate enable power saving mode */ #define PS_MODE_DEF 0 @@ -159,17 +159,17 @@ DEVICE_PARAM(ShortRetryLimit, "Short frame retry limits"); DEVICE_PARAM(LongRetryLimit, "long frame retry limits"); /* BasebandType[] baseband type selected - 0: indicate 802.11a type - 1: indicate 802.11b type - 2: indicate 802.11g type +0: indicate 802.11a type +1: indicate 802.11b type +2: indicate 802.11g type */ #define BBP_TYPE_DEF 2 DEVICE_PARAM(BasebandType, "baseband type"); /* 80211hEnable[] - 0: indicate disable 802.11h - 1: indicate enable 802.11h +0: indicate disable 802.11h +1: indicate enable 802.11h */ #define X80211h_MODE_DEF 0 @@ -187,19 +187,19 @@ static struct usb_device_id vt6656_table[] = { /* frequency list (map channels to frequencies) */ /* -static const long frequency_list[] = { - 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, - 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980, - 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240, - 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, - 5700, 5745, 5765, 5785, 5805, 5825 - }; - -static const struct iw_handler_def iwctl_handler_def; -*/ + 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, + 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240, + 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, + 5700, 5745, 5765, 5785, 5805, 5825 + }; + + static const struct iw_handler_def iwctl_handler_def; + */ static int vt6656_probe(struct usb_interface *intf, - const struct usb_device_id *id); + const struct usb_device_id *id); static void vt6656_disconnect(struct usb_interface *intf); #ifdef CONFIG_PM /* Minimal support for suspend and resume */ @@ -229,66 +229,66 @@ static bool device_alloc_bufs(struct vnt_private *pDevice); static int Read_config_file(struct vnt_private *pDevice); static unsigned char *Config_FileOperation(struct vnt_private *pDevice); static int Config_FileGetParameter(unsigned char *string, - unsigned char *dest, - unsigned char *source); + unsigned char *dest, + unsigned char *source); static void usb_device_reset(struct vnt_private *pDevice); static void device_set_options(struct vnt_private *pDevice) { - 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); - memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); - memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN); - - pDevice->cbTD = TX_DESC_DEF0; - pDevice->cbRD = RX_DESC_DEF0; - pDevice->uChannel = CHANNEL_DEF; - pDevice->wRTSThreshold = RTS_THRESH_DEF; - pDevice->wFragmentationThreshold = FRAG_THRESH_DEF; - pDevice->byShortRetryLimit = SHORT_RETRY_DEF; - pDevice->byLongRetryLimit = LONG_RETRY_DEF; - pDevice->wMaxTransmitMSDULifetime = DEFAULT_MSDU_LIFETIME; - pDevice->byShortPreamble = PREAMBLE_TYPE_DEF; - pDevice->ePSMode = PS_MODE_DEF; - pDevice->b11hEnable = X80211h_MODE_DEF; - pDevice->op_mode = NL80211_IFTYPE_UNSPECIFIED; - pDevice->uConnectionRate = DATA_RATE_DEF; - if (pDevice->uConnectionRate < RATE_AUTO) pDevice->bFixRate = true; - pDevice->byBBType = BBP_TYPE_DEF; - pDevice->byPacketType = pDevice->byBBType; - pDevice->byAutoFBCtrl = AUTO_FB_0; - pDevice->bUpdateBBVGA = true; - pDevice->byFOETuning = 0; - pDevice->byAutoPwrTunning = 0; - pDevice->byPreambleType = 0; - pDevice->bExistSWNetAddr = false; - /* pDevice->bDiversityRegCtlON = true; */ - pDevice->bDiversityRegCtlON = false; + 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); + memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); + memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN); + + pDevice->cbTD = TX_DESC_DEF0; + pDevice->cbRD = RX_DESC_DEF0; + pDevice->uChannel = CHANNEL_DEF; + pDevice->wRTSThreshold = RTS_THRESH_DEF; + pDevice->wFragmentationThreshold = FRAG_THRESH_DEF; + pDevice->byShortRetryLimit = SHORT_RETRY_DEF; + pDevice->byLongRetryLimit = LONG_RETRY_DEF; + pDevice->wMaxTransmitMSDULifetime = DEFAULT_MSDU_LIFETIME; + pDevice->byShortPreamble = PREAMBLE_TYPE_DEF; + pDevice->ePSMode = PS_MODE_DEF; + pDevice->b11hEnable = X80211h_MODE_DEF; + pDevice->op_mode = NL80211_IFTYPE_UNSPECIFIED; + pDevice->uConnectionRate = DATA_RATE_DEF; + if (pDevice->uConnectionRate < RATE_AUTO) pDevice->bFixRate = true; + pDevice->byBBType = BBP_TYPE_DEF; + pDevice->byPacketType = pDevice->byBBType; + pDevice->byAutoFBCtrl = AUTO_FB_0; + pDevice->bUpdateBBVGA = true; + pDevice->byFOETuning = 0; + pDevice->byAutoPwrTunning = 0; + pDevice->byPreambleType = 0; + pDevice->bExistSWNetAddr = false; + /* pDevice->bDiversityRegCtlON = true; */ + pDevice->bDiversityRegCtlON = false; } static void device_init_diversity_timer(struct vnt_private *pDevice) { - init_timer(&pDevice->TimerSQ3Tmax1); - pDevice->TimerSQ3Tmax1.data = (unsigned long)pDevice; - pDevice->TimerSQ3Tmax1.function = (TimerFunction)TimerSQ3CallBack; - pDevice->TimerSQ3Tmax1.expires = RUN_AT(HZ); - - init_timer(&pDevice->TimerSQ3Tmax2); - pDevice->TimerSQ3Tmax2.data = (unsigned long)pDevice; - pDevice->TimerSQ3Tmax2.function = (TimerFunction)TimerSQ3CallBack; - pDevice->TimerSQ3Tmax2.expires = RUN_AT(HZ); - - init_timer(&pDevice->TimerSQ3Tmax3); - pDevice->TimerSQ3Tmax3.data = (unsigned long)pDevice; - pDevice->TimerSQ3Tmax3.function = (TimerFunction)TimerSQ3Tmax3CallBack; - pDevice->TimerSQ3Tmax3.expires = RUN_AT(HZ); - - return; + init_timer(&pDevice->TimerSQ3Tmax1); + pDevice->TimerSQ3Tmax1.data = (unsigned long)pDevice; + pDevice->TimerSQ3Tmax1.function = (TimerFunction)TimerSQ3CallBack; + pDevice->TimerSQ3Tmax1.expires = RUN_AT(HZ); + + init_timer(&pDevice->TimerSQ3Tmax2); + pDevice->TimerSQ3Tmax2.data = (unsigned long)pDevice; + pDevice->TimerSQ3Tmax2.function = (TimerFunction)TimerSQ3CallBack; + pDevice->TimerSQ3Tmax2.expires = RUN_AT(HZ); + + init_timer(&pDevice->TimerSQ3Tmax3); + pDevice->TimerSQ3Tmax3.data = (unsigned long)pDevice; + pDevice->TimerSQ3Tmax3.function = (TimerFunction)TimerSQ3Tmax3CallBack; + pDevice->TimerSQ3Tmax3.expires = RUN_AT(HZ); + + return; } /* @@ -302,7 +302,7 @@ static int device_init_registers(struct vnt_private *pDevice) 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}; + = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8}; u8 byAntenna; int ii; int ntStatus = STATUS_SUCCESS; @@ -310,7 +310,7 @@ static int device_init_registers(struct vnt_private *pDevice) u8 byCalibTXIQ = 0, byCalibTXDC = 0, byCalibRXIQ = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", - DEVICE_INIT_COLD, pDevice->byPacketType); + DEVICE_INIT_COLD, pDevice->byPacketType); spin_lock_irq(&pDevice->lock); @@ -322,13 +322,13 @@ static int device_init_registers(struct vnt_private *pDevice) if (FIRMWAREbDownload(pDevice) == true) { if (FIRMWAREbBrach2Sram(pDevice) == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - " FIRMWAREbBrach2Sram fail\n"); + " FIRMWAREbBrach2Sram fail\n"); spin_unlock_irq(&pDevice->lock); return false; } } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - " FIRMWAREbDownload fail\n"); + " FIRMWAREbDownload fail\n"); spin_unlock_irq(&pDevice->lock); return false; } @@ -349,8 +349,8 @@ static int device_init_registers(struct vnt_private *pDevice) /* issue card_init command to device */ ntStatus = CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_CARDINIT, 0, 0, - sizeof(struct vnt_cmd_card_init), (u8 *)init_cmd); + MESSAGE_TYPE_CARDINIT, 0, 0, + sizeof(struct vnt_cmd_card_init), (u8 *)init_cmd); if (ntStatus != STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Issue Card init fail\n"); spin_unlock_irq(&pDevice->lock); @@ -358,17 +358,17 @@ static int device_init_registers(struct vnt_private *pDevice) } ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_INIT_RSP, 0, 0, - sizeof(struct vnt_rsp_card_init), (u8 *)init_rsp); + sizeof(struct vnt_rsp_card_init), (u8 *)init_rsp); if (ntStatus != STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Cardinit request in status fail!\n"); + "Cardinit request in status fail!\n"); spin_unlock_irq(&pDevice->lock); return false; } /* local ID for AES functions */ ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, - MAC_REG_LOCALID, MESSAGE_REQUEST_MACREG, 1, + MAC_REG_LOCALID, MESSAGE_REQUEST_MACREG, 1, &pDevice->byLocalID); if (ntStatus != STATUS_SUCCESS) { spin_unlock_irq(&pDevice->lock); @@ -405,7 +405,7 @@ static int device_init_registers(struct vnt_private *pDevice) /* load power table */ for (ii = 0; ii < 14; ii++) { pDevice->abyCCKPwrTbl[ii] = - pDevice->abyEEPROM[ii + EEP_OFS_CCK_PWR_TBL]; + pDevice->abyEEPROM[ii + EEP_OFS_CCK_PWR_TBL]; if (pDevice->abyCCKPwrTbl[ii] == 0) pDevice->abyCCKPwrTbl[ii] = pDevice->byCCKPwr; @@ -420,8 +420,8 @@ static int device_init_registers(struct vnt_private *pDevice) * then need to recover 12, 13, 14 channels with 11 channel */ if (((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) || - (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe)) && - (pDevice->byOriginalZonetype == ZoneType_USA)) { + (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe)) && + (pDevice->byOriginalZonetype == ZoneType_USA)) { for (ii = 11; ii < 14; ii++) { pDevice->abyCCKPwrTbl[ii] = pDevice->abyCCKPwrTbl[10]; pDevice->abyOFDMPwrTbl[ii] = pDevice->abyOFDMPwrTbl[10]; @@ -433,7 +433,7 @@ static int device_init_registers(struct vnt_private *pDevice) /* load OFDM A power table */ for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { pDevice->abyOFDMAPwrTbl[ii] = - pDevice->abyEEPROM[ii + EEP_OFS_OFDMA_PWR_TBL]; + pDevice->abyEEPROM[ii + EEP_OFS_OFDMA_PWR_TBL]; if (pDevice->abyOFDMAPwrTbl[ii] == 0) pDevice->abyOFDMAPwrTbl[ii] = pDevice->byOFDMPwrA; @@ -482,10 +482,10 @@ static int device_init_registers(struct vnt_private *pDevice) } else { pDevice->byTxAntennaMode = ANT_B; - if (pDevice->bTxRxAntInv == true) - pDevice->byRxAntennaMode = ANT_A; - else - pDevice->byRxAntennaMode = ANT_B; + if (pDevice->bTxRxAntInv == true) + pDevice->byRxAntennaMode = ANT_A; + else + pDevice->byRxAntennaMode = ANT_B; } } @@ -525,38 +525,38 @@ static int device_init_registers(struct vnt_private *pDevice) /* load vt3266 calibration parameters in EEPROM */ if (pDevice->byRFType == RF_VT3226D0) { if ((pDevice->abyEEPROM[EEP_OFS_MAJOR_VER] == 0x1) && - (pDevice->abyEEPROM[EEP_OFS_MINOR_VER] >= 0x4)) { + (pDevice->abyEEPROM[EEP_OFS_MINOR_VER] >= 0x4)) { byCalibTXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_IQ]; byCalibTXDC = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_DC]; byCalibRXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_RX_IQ]; if (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) { - /* CR255, enable TX/RX IQ and DC compensation mode */ + /* CR255, enable TX/RX IQ and DC compensation mode */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xff, - 0x03); - /* CR251, TX I/Q Imbalance Calibration */ + MESSAGE_REQUEST_BBREG, + 0xff, + 0x03); + /* CR251, TX I/Q Imbalance Calibration */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xfb, - byCalibTXIQ); - /* CR252, TX DC-Offset Calibration */ + MESSAGE_REQUEST_BBREG, + 0xfb, + byCalibTXIQ); + /* CR252, TX DC-Offset Calibration */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xfC, - byCalibTXDC); - /* CR253, RX I/Q Imbalance Calibration */ + MESSAGE_REQUEST_BBREG, + 0xfC, + byCalibTXDC); + /* CR253, RX I/Q Imbalance Calibration */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xfd, - byCalibRXIQ); + MESSAGE_REQUEST_BBREG, + 0xfd, + byCalibRXIQ); } else { - /* CR255, turn off BB Calibration compensation */ + /* CR255, turn off BB Calibration compensation */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xff, - 0x0); + MESSAGE_REQUEST_BBREG, + 0xff, + 0x0); } } } @@ -569,16 +569,16 @@ static int device_init_registers(struct vnt_private *pDevice) /* get permanent network address */ memcpy(pDevice->abyPermanentNetAddr, init_rsp->net_addr, 6); memcpy(pDevice->abyCurrentNetAddr, - pDevice->abyPermanentNetAddr, ETH_ALEN); + pDevice->abyPermanentNetAddr, ETH_ALEN); /* if exist SW network address, use it */ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n", - pDevice->abyCurrentNetAddr); + pDevice->abyCurrentNetAddr); /* - * set BB and packet type at the same time - * set Short Slot Time, xIFS, and RSPINF - */ + * set BB and packet type at the same time + * set Short Slot Time, xIFS, and RSPINF + */ if (pDevice->byBBType == BB_TYPE_11A) { CARDbAddBasicRate(pDevice, RATE_6M); pDevice->bShortSlotTime = true; @@ -602,7 +602,7 @@ static int device_init_registers(struct vnt_private *pDevice) if ((pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) != 0) { ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, - MAC_REG_GPIOCTL1, MESSAGE_REQUEST_MACREG, 1, &byTmp); + MAC_REG_GPIOCTL1, MESSAGE_REQUEST_MACREG, 1, &byTmp); if (ntStatus != STATUS_SUCCESS) { spin_unlock_irq(&pDevice->lock); @@ -620,15 +620,15 @@ static int device_init_registers(struct vnt_private *pDevice) } ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, - MAC_REG_PAPEDELAY, LEDSTS_TMLEN, 0x38); + MAC_REG_PAPEDELAY, LEDSTS_TMLEN, 0x38); ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, - MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); + MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL0, 0x01); if ((pDevice->bHWRadioOff == true) || - (pDevice->bRadioControlOff == true)) { + (pDevice->bRadioControlOff == true)) { CARDbRadioPowerOff(pDevice); } else { CARDbRadioPowerOn(pDevice); @@ -673,15 +673,15 @@ static int vt6656_resume(struct usb_interface *intf) #endif /* CONFIG_PM */ static const struct net_device_ops device_netdev_ops = { - .ndo_open = device_open, - .ndo_stop = device_close, - .ndo_do_ioctl = device_ioctl, - .ndo_get_stats = device_get_stats, - .ndo_start_xmit = device_xmit, - .ndo_set_rx_mode = device_set_multi, + .ndo_open = device_open, + .ndo_stop = device_close, + .ndo_do_ioctl = device_ioctl, + .ndo_get_stats = device_get_stats, + .ndo_start_xmit = device_xmit, + .ndo_set_rx_mode = device_set_multi, }; -static int + static int vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) { u8 fake_mac[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; @@ -725,7 +725,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) netdev->netdev_ops = &device_netdev_ops; netdev->wireless_handlers = - (struct iw_handler_def *) &iwctl_handler_def; + (struct iw_handler_def *) &iwctl_handler_def; usb_set_intfdata(intf, pDevice); SET_NETDEV_DEV(netdev, &intf->dev); @@ -794,10 +794,10 @@ static void device_free_rx_bufs(struct vnt_private *priv) static void usb_device_reset(struct vnt_private *pDevice) { - int status; - status = usb_reset_device(pDevice->usb); + int status; + status = usb_reset_device(pDevice->usb); if (status) - printk("usb_device_reset fail status=%d\n",status); + printk("usb_device_reset fail status=%d\n",status); return ; } @@ -816,10 +816,10 @@ static bool device_alloc_bufs(struct vnt_private *priv) for (ii = 0; ii < priv->cbTD; ii++) { tx_context = kmalloc(sizeof(struct vnt_usb_send_context), - GFP_KERNEL); + GFP_KERNEL); if (tx_context == NULL) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR - "%s : allocate tx usb context failed\n", + "%s : allocate tx usb context failed\n", priv->dev->name); goto free_tx; } @@ -831,7 +831,7 @@ static bool device_alloc_bufs(struct vnt_private *priv) tx_context->pUrb = usb_alloc_urb(0, GFP_ATOMIC); if (tx_context->pUrb == NULL) { DBG_PRT(MSG_LEVEL_ERR, - KERN_ERR "alloc tx urb failed\n"); + KERN_ERR "alloc tx urb failed\n"); goto free_tx; } @@ -840,10 +840,10 @@ static bool device_alloc_bufs(struct vnt_private *priv) /* allocate RCB mem */ priv->pRCBMem = kzalloc((sizeof(struct vnt_rcb) * priv->cbRD), - GFP_KERNEL); + GFP_KERNEL); if (priv->pRCBMem == NULL) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR - "%s : alloc rx usb context failed\n", + "%s : alloc rx usb context failed\n", priv->dev->name); goto free_tx; } @@ -864,21 +864,21 @@ static bool device_alloc_bufs(struct vnt_private *priv) rcb->pUrb = usb_alloc_urb(0, GFP_ATOMIC); if (rcb->pUrb == NULL) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR - " Failed to alloc rx urb\n"); + " Failed to alloc rx urb\n"); goto free_rx_tx; } rcb->skb = netdev_alloc_skb(priv->dev, priv->rx_buf_sz); if (rcb->skb == NULL) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR - " Failed to alloc rx skb\n"); + " Failed to alloc rx skb\n"); goto free_rx_tx; } rcb->bBoolInUse = false; EnqueueRCB(priv->FirstRecvFreeList, - priv->LastRecvFreeList, rcb); + priv->LastRecvFreeList, rcb); priv->NumRecvFreeList++; rcb++; @@ -913,22 +913,22 @@ static bool device_init_defrag_cb(struct vnt_private *pDevice) int i; PSDeFragControlBlock pDeF; - /* Init the fragment ctl entries */ - for (i = 0; i < CB_MAX_RX_FRAG; i++) { - pDeF = &(pDevice->sRxDFCB[i]); - if (!device_alloc_frag_buf(pDevice, pDeF)) { - DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc frag bufs\n", - pDevice->dev->name); - goto free_frag; - } - } - pDevice->cbDFCB = CB_MAX_RX_FRAG; - pDevice->cbFreeDFCB = pDevice->cbDFCB; - return true; + /* Init the fragment ctl entries */ + for (i = 0; i < CB_MAX_RX_FRAG; i++) { + pDeF = &(pDevice->sRxDFCB[i]); + if (!device_alloc_frag_buf(pDevice, pDeF)) { + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc frag bufs\n", + pDevice->dev->name); + goto free_frag; + } + } + pDevice->cbDFCB = CB_MAX_RX_FRAG; + pDevice->cbFreeDFCB = pDevice->cbDFCB; + return true; free_frag: - device_free_frag_bufs(pDevice); - return false; + device_free_frag_bufs(pDevice); + return false; } static void device_free_frag_bufs(struct vnt_private *pDevice) @@ -936,13 +936,13 @@ static void device_free_frag_bufs(struct vnt_private *pDevice) PSDeFragControlBlock pDeF; int i; - for (i = 0; i < CB_MAX_RX_FRAG; i++) { + for (i = 0; i < CB_MAX_RX_FRAG; i++) { - pDeF = &(pDevice->sRxDFCB[i]); + pDeF = &(pDevice->sRxDFCB[i]); - if (pDeF->skb) - dev_kfree_skb(pDeF->skb); - } + if (pDeF->skb) + dev_kfree_skb(pDeF->skb); + } } int device_alloc_frag_buf(struct vnt_private *pDevice, @@ -959,107 +959,107 @@ static int device_open(struct net_device *dev) { struct vnt_private *pDevice = netdev_priv(dev); - pDevice->fWPA_Authened = false; + pDevice->fWPA_Authened = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_open...\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_open...\n"); - pDevice->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS; + pDevice->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS; - if (device_alloc_bufs(pDevice) == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_alloc_bufs fail... \n"); - return -ENOMEM; - } + if (device_alloc_bufs(pDevice) == false) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_alloc_bufs fail...\n"); + return -ENOMEM; + } - if (device_init_defrag_cb(pDevice)== false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Initial defragment cb fail \n"); - goto free_rx_tx; - } + if (device_init_defrag_cb(pDevice)== false) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Initial defragment cb fail\n"); + goto free_rx_tx; + } - MP_CLEAR_FLAG(pDevice, fMP_DISCONNECTED); - MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); - MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); - MP_SET_FLAG(pDevice, fMP_POST_READS); - MP_SET_FLAG(pDevice, fMP_POST_WRITES); + MP_CLEAR_FLAG(pDevice, fMP_DISCONNECTED); + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); + MP_SET_FLAG(pDevice, fMP_POST_READS); + MP_SET_FLAG(pDevice, fMP_POST_WRITES); - /* read config file */ - Read_config_file(pDevice); + /* read config file */ + Read_config_file(pDevice); if (device_init_registers(pDevice) == false) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " init register fail\n"); goto free_all; } - /* init for key management */ - KeyvInitTable(pDevice,&pDevice->sKey); + /* init for key management */ + KeyvInitTable(pDevice,&pDevice->sKey); memcpy(pDevice->vnt_mgmt.abyMACAddr, - pDevice->abyCurrentNetAddr, ETH_ALEN); - memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, ETH_ALEN); - pDevice->bStopTx0Pkt = false; - pDevice->bStopDataPkt = false; - pDevice->bRoaming = false; - pDevice->bIsRoaming = false; - pDevice->bEnableRoaming = false; - if (pDevice->bDiversityRegCtlON) { - device_init_diversity_timer(pDevice); - } - - vMgrObjectInit(pDevice); + pDevice->abyCurrentNetAddr, ETH_ALEN); + memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, ETH_ALEN); + pDevice->bStopTx0Pkt = false; + pDevice->bStopDataPkt = false; + pDevice->bRoaming = false; + pDevice->bIsRoaming = false; + pDevice->bEnableRoaming = false; + if (pDevice->bDiversityRegCtlON) { + device_init_diversity_timer(pDevice); + } + + vMgrObjectInit(pDevice); schedule_delayed_work(&pDevice->second_callback_work, HZ); pDevice->int_interval = 1; /* bInterval is set to 1 */ - pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; + pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; - pDevice->bIsRxWorkItemQueued = true; + pDevice->bIsRxWorkItemQueued = true; - pDevice->bWPADEVUp = false; - pDevice->bwextstep0 = false; - pDevice->bwextstep1 = false; - pDevice->bwextstep2 = false; - pDevice->bwextstep3 = false; - pDevice->bWPASuppWextEnabled = false; - pDevice->byReAssocCount = 0; + pDevice->bWPADEVUp = false; + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = false; + pDevice->bWPASuppWextEnabled = false; + pDevice->byReAssocCount = 0; schedule_work(&pDevice->read_work_item); - INTvWorkItem(pDevice); - - /* if WEP key already set by iwconfig but device not yet open */ - if ((pDevice->bEncryptionEnable == true) && (pDevice->bTransmitKey == true)) { - spin_lock_irq(&pDevice->lock); - KeybSetDefaultKey( pDevice, - &(pDevice->sKey), - pDevice->byKeyIndex | (1 << 31), - pDevice->uKeyLength, - NULL, - pDevice->abyKey, - KEY_CTL_WEP - ); - spin_unlock_irq(&pDevice->lock); - pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; - } + INTvWorkItem(pDevice); + + /* if WEP key already set by iwconfig but device not yet open */ + if ((pDevice->bEncryptionEnable == true) && (pDevice->bTransmitKey == true)) { + spin_lock_irq(&pDevice->lock); + KeybSetDefaultKey( pDevice, + &(pDevice->sKey), + pDevice->byKeyIndex | (1 << 31), + pDevice->uKeyLength, + NULL, + pDevice->abyKey, + KEY_CTL_WEP + ); + spin_unlock_irq(&pDevice->lock); + pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; + } if (pDevice->vnt_mgmt.eConfigMode == WMAC_CONFIG_AP) bScheduleCommand((void *) pDevice, WLAN_CMD_RUN_AP, NULL); else bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); - netif_stop_queue(pDevice->dev); - pDevice->flags |= DEVICE_FLAGS_OPENED; + netif_stop_queue(pDevice->dev); + pDevice->flags |= DEVICE_FLAGS_OPENED; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success..\n"); return 0; free_all: - device_free_frag_bufs(pDevice); + device_free_frag_bufs(pDevice); free_rx_tx: - device_free_rx_bufs(pDevice); - device_free_tx_bufs(pDevice); - device_free_int_bufs(pDevice); + device_free_rx_bufs(pDevice); + device_free_tx_bufs(pDevice); + device_free_int_bufs(pDevice); usb_kill_urb(pDevice->pInterruptURB); - usb_free_urb(pDevice->pInterruptURB); + usb_free_urb(pDevice->pInterruptURB); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open fail.. \n"); - return -ENOMEM; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open fail..\n"); + return -ENOMEM; } static int device_close(struct net_device *dev) @@ -1069,66 +1069,66 @@ static int device_close(struct net_device *dev) int uu; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close1\n"); - if (pDevice == NULL) - return -ENODEV; - - if (pDevice->bLinkPass) { - bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL); - mdelay(30); - } - - memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - pMgmt->bShareKeyAlgorithm = false; - pDevice->bEncryptionEnable = false; - pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; + if (pDevice == NULL) + return -ENODEV; + + if (pDevice->bLinkPass) { + bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL); + mdelay(30); + } + + memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + pMgmt->bShareKeyAlgorithm = false; + pDevice->bEncryptionEnable = false; + pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; spin_lock_irq(&pDevice->lock); for (uu = 0; uu < MAX_KEY_TABLE; uu++) - MACvDisableKeyEntry(pDevice,uu); + MACvDisableKeyEntry(pDevice,uu); spin_unlock_irq(&pDevice->lock); - if ((pDevice->flags & DEVICE_FLAGS_UNPLUG) == false) { - MACbShutdown(pDevice); - } - netif_stop_queue(pDevice->dev); - MP_SET_FLAG(pDevice, fMP_DISCONNECTED); - MP_CLEAR_FLAG(pDevice, fMP_POST_WRITES); - MP_CLEAR_FLAG(pDevice, fMP_POST_READS); + if ((pDevice->flags & DEVICE_FLAGS_UNPLUG) == false) { + MACbShutdown(pDevice); + } + netif_stop_queue(pDevice->dev); + MP_SET_FLAG(pDevice, fMP_DISCONNECTED); + MP_CLEAR_FLAG(pDevice, fMP_POST_WRITES); + MP_CLEAR_FLAG(pDevice, fMP_POST_READS); cancel_delayed_work_sync(&pDevice->run_command_work); cancel_delayed_work_sync(&pDevice->second_callback_work); - if (pDevice->bDiversityRegCtlON) { - del_timer(&pDevice->TimerSQ3Tmax1); - del_timer(&pDevice->TimerSQ3Tmax2); - del_timer(&pDevice->TimerSQ3Tmax3); - } + if (pDevice->bDiversityRegCtlON) { + del_timer(&pDevice->TimerSQ3Tmax1); + del_timer(&pDevice->TimerSQ3Tmax2); + del_timer(&pDevice->TimerSQ3Tmax3); + } cancel_work_sync(&pDevice->rx_mng_work_item); cancel_work_sync(&pDevice->read_work_item); - pDevice->bRoaming = false; - pDevice->bIsRoaming = false; - pDevice->bEnableRoaming = false; - pDevice->bCmdRunning = false; - pDevice->bLinkPass = false; - memset(pMgmt->abyCurrBSSID, 0, 6); - pMgmt->eCurrState = WMAC_STATE_IDLE; + pDevice->bRoaming = false; + pDevice->bIsRoaming = false; + pDevice->bEnableRoaming = false; + pDevice->bCmdRunning = false; + pDevice->bLinkPass = false; + memset(pMgmt->abyCurrBSSID, 0, 6); + pMgmt->eCurrState = WMAC_STATE_IDLE; pDevice->flags &= ~DEVICE_FLAGS_OPENED; - device_free_tx_bufs(pDevice); - device_free_rx_bufs(pDevice); - device_free_int_bufs(pDevice); - device_free_frag_bufs(pDevice); + device_free_tx_bufs(pDevice); + device_free_rx_bufs(pDevice); + device_free_int_bufs(pDevice); + device_free_frag_bufs(pDevice); usb_kill_urb(pDevice->pInterruptURB); - usb_free_urb(pDevice->pInterruptURB); + usb_free_urb(pDevice->pInterruptURB); - BSSvClearNodeDBTable(pDevice, 0); + BSSvClearNodeDBTable(pDevice, 0); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close2 \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close2\n"); - return 0; + return 0; } static void vt6656_disconnect(struct usb_interface *intf) @@ -1202,74 +1202,74 @@ out: /* find out the start position of str2 from str1 */ static unsigned char *kstrstr(const unsigned char *str1, - const unsigned char *str2) { - int str1_len = strlen(str1); - int str2_len = strlen(str2); - - while (str1_len >= str2_len) { - str1_len--; - if(memcmp(str1,str2,str2_len)==0) - return (unsigned char *) str1; - str1++; - } - return NULL; + const unsigned char *str2) { + int str1_len = strlen(str1); + int str2_len = strlen(str2); + + while (str1_len >= str2_len) { + str1_len--; + if(memcmp(str1,str2,str2_len)==0) + return (unsigned char *) str1; + str1++; + } + return NULL; } static int Config_FileGetParameter(unsigned char *string, - unsigned char *dest, - unsigned char *source) + unsigned char *dest, + unsigned char *source) { - unsigned char buf1[100]; - unsigned char buf2[100]; - unsigned char *start_p = NULL, *end_p = NULL, *tmp_p = NULL; - int ii; - - memset(buf1,0,100); - strcat(buf1, string); - strcat(buf1, "="); - source+=strlen(buf1); - - /* find target string start point */ - start_p = kstrstr(source,buf1); - if (start_p == NULL) - return false; + unsigned char buf1[100]; + unsigned char buf2[100]; + unsigned char *start_p = NULL, *end_p = NULL, *tmp_p = NULL; + int ii; - /* check if current config line is marked by "#" */ - for (ii = 1; ; ii++) { - if (memcmp(start_p - ii, "\n", 1) == 0) - break; - if (memcmp(start_p - ii, "#", 1) == 0) + memset(buf1,0,100); + strcat(buf1, string); + strcat(buf1, "="); + source+=strlen(buf1); + + /* find target string start point */ + start_p = kstrstr(source,buf1); + if (start_p == NULL) return false; - } - - /* find target string end point */ - end_p = kstrstr(start_p,"\n"); - if (end_p == NULL) { /* can't find "\n", but don't care */ - end_p = start_p + strlen(start_p); /* no include "\n" */ - } - - memset(buf2,0,100); - memcpy(buf2, start_p, end_p-start_p); /* get the target line */ - buf2[end_p-start_p]='\0'; - - /* find value */ - start_p = kstrstr(buf2,"="); - if (start_p == NULL) - return false; - memset(buf1,0,100); - strcpy(buf1,start_p+1); - - /* except space */ - tmp_p = buf1; - while(*tmp_p != 0x00) { - if(*tmp_p==' ') - tmp_p++; - else - break; - } - - memcpy(dest,tmp_p,strlen(tmp_p)); - return true; + + /* check if current config line is marked by "#" */ + for (ii = 1; ; ii++) { + if (memcmp(start_p - ii, "\n", 1) == 0) + break; + if (memcmp(start_p - ii, "#", 1) == 0) + return false; + } + + /* find target string end point */ + end_p = kstrstr(start_p,"\n"); + if (end_p == NULL) { /* can't find "\n", but don't care */ + end_p = start_p + strlen(start_p); /* no include "\n" */ + } + + memset(buf2,0,100); + memcpy(buf2, start_p, end_p-start_p); /* get the target line */ + buf2[end_p-start_p]='\0'; + + /* find value */ + start_p = kstrstr(buf2,"="); + if (start_p == NULL) + return false; + memset(buf1,0,100); + strcpy(buf1,start_p+1); + + /* except space */ + tmp_p = buf1; + while(*tmp_p != 0x00) { + if(*tmp_p==' ') + tmp_p++; + else + break; + } + + memcpy(dest,tmp_p,strlen(tmp_p)); + return true; } /* if read fails, return NULL, or return data pointer */ @@ -1308,50 +1308,50 @@ static int Read_config_file(struct vnt_private *pDevice) unsigned char *buffer = NULL; /* init config setting */ - pDevice->config_file.ZoneType = -1; - pDevice->config_file.eAuthenMode = -1; - pDevice->config_file.eEncryptionStatus = -1; + pDevice->config_file.ZoneType = -1; + pDevice->config_file.eAuthenMode = -1; + pDevice->config_file.eEncryptionStatus = -1; + + buffer = Config_FileOperation(pDevice); + if (buffer == NULL) { + result =-1; + return result; + } + + /* get zonetype */ + { + memset(tmpbuffer,0,sizeof(tmpbuffer)); + if(Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer) ==true) { + if(memcmp(tmpbuffer,"USA",3)==0) { + pDevice->config_file.ZoneType=ZoneType_USA; + } + else if(memcmp(tmpbuffer,"JAPAN",5)==0) { + pDevice->config_file.ZoneType=ZoneType_Japan; + } + else if(memcmp(tmpbuffer,"EUROPE",6)==0) { + pDevice->config_file.ZoneType=ZoneType_Europe; + } + else { + printk("Unknown Zonetype[%s]?\n",tmpbuffer); + } + } + } - buffer = Config_FileOperation(pDevice); - if (buffer == NULL) { - result =-1; - return result; - } + /* get other parameter */ + { + memset(tmpbuffer,0,sizeof(tmpbuffer)); + if(Config_FileGetParameter("AUTHENMODE",tmpbuffer,buffer)==true) { + pDevice->config_file.eAuthenMode = (int) simple_strtol(tmpbuffer, NULL, 10); + } -/* get zonetype */ -{ - memset(tmpbuffer,0,sizeof(tmpbuffer)); - if(Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer) ==true) { - if(memcmp(tmpbuffer,"USA",3)==0) { - pDevice->config_file.ZoneType=ZoneType_USA; - } - else if(memcmp(tmpbuffer,"JAPAN",5)==0) { - pDevice->config_file.ZoneType=ZoneType_Japan; - } - else if(memcmp(tmpbuffer,"EUROPE",6)==0) { - pDevice->config_file.ZoneType=ZoneType_Europe; - } - else { - printk("Unknown Zonetype[%s]?\n",tmpbuffer); - } - } -} + memset(tmpbuffer,0,sizeof(tmpbuffer)); + if(Config_FileGetParameter("ENCRYPTIONMODE",tmpbuffer,buffer)==true) { + pDevice->config_file.eEncryptionStatus= (int) simple_strtol(tmpbuffer, NULL, 10); + } + } -/* get other parameter */ - { - memset(tmpbuffer,0,sizeof(tmpbuffer)); - if(Config_FileGetParameter("AUTHENMODE",tmpbuffer,buffer)==true) { - pDevice->config_file.eAuthenMode = (int) simple_strtol(tmpbuffer, NULL, 10); - } - - memset(tmpbuffer,0,sizeof(tmpbuffer)); - if(Config_FileGetParameter("ENCRYPTIONMODE",tmpbuffer,buffer)==true) { - pDevice->config_file.eEncryptionStatus= (int) simple_strtol(tmpbuffer, NULL, 10); - } - } - - kfree(buffer); - return result; + kfree(buffer); + return result; } static void device_set_multi(struct net_device *dev) @@ -1378,16 +1378,16 @@ void vnt_configure_filter(struct vnt_private *priv) int rc; rc = CONTROLnsRequestIn(priv, MESSAGE_TYPE_READ, - MAC_REG_RCR, MESSAGE_REQUEST_MACREG, 1, &tmp); + MAC_REG_RCR, MESSAGE_REQUEST_MACREG, 1, &tmp); if (rc == 0) priv->byRxMode = tmp; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "priv->byRxMode in= %x\n", - priv->byRxMode); + priv->byRxMode); if (dev->flags & IFF_PROMISC) { /* set promiscuous mode */ DBG_PRT(MSG_LEVEL_ERR, KERN_NOTICE - "%s: Promiscuous mode enabled.\n", dev->name); + "%s: Promiscuous mode enabled.\n", dev->name); /* unconditionally log net taps */ priv->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST); } else if ((netdev_mc_count(dev) > priv->multicast_limit) || @@ -1419,10 +1419,10 @@ void vnt_configure_filter(struct vnt_private *priv) } ControlvWriteByte(priv, MESSAGE_REQUEST_MACREG, - MAC_REG_RCR, priv->byRxMode); + MAC_REG_RCR, priv->byRxMode); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "priv->byRxMode out= %x\n", priv->byRxMode); + "priv->byRxMode out= %x\n", priv->byRxMode); } static struct net_device_stats *device_get_stats(struct net_device *dev) @@ -1463,17 +1463,17 @@ static int ethtool_ioctl(struct net_device *dev, struct ifreq *rq) if (copy_from_user(ðcmd, rq->ifr_data, sizeof(ethcmd))) return -EFAULT; - switch (ethcmd) { + switch (ethcmd) { case ETHTOOL_GDRVINFO: { - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; - strncpy(info.driver, DEVICE_NAME, sizeof(info.driver)-1); - strncpy(info.version, DEVICE_VERSION, sizeof(info.version)-1); - if (copy_to_user(rq->ifr_data, &info, sizeof(info))) - return -EFAULT; - return 0; - } + struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; + strncpy(info.driver, DEVICE_NAME, sizeof(info.driver)-1); + strncpy(info.version, DEVICE_VERSION, sizeof(info.version)-1); + if (copy_to_user(rq->ifr_data, &info, sizeof(info))) + return -EFAULT; + return 0; + } - } + } return -EOPNOTSUPP; } diff --git a/drivers/staging/vt6656/michael.c b/drivers/staging/vt6656/michael.c index 9a5a0b6..462bba8 100644 --- a/drivers/staging/vt6656/michael.c +++ b/drivers/staging/vt6656/michael.c @@ -61,26 +61,26 @@ static u32 M; /* Message accumulator (single word) */ static unsigned int nBytesInM; /* # bytes in M */ /* -static u32 s_dwGetUINT32 (u8 * p) + static u32 s_dwGetUINT32 (u8 * p) // Convert from u8[] to u32 in a portable way { - u32 res = 0; - unsigned int i; - for (i = 0; i < 4; i++) - res |= (*p++) << (8*i); - return res; +u32 res = 0; +unsigned int i; +for (i = 0; i < 4; i++) +res |= (*p++) << (8*i); +return res; } 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++ = (u8) (val & 0xff); - val >>= 8; - } -} -*/ +unsigned int i; +for (i = 0; i < 4; i++) { + *p++ = (u8) (val & 0xff); + val >>= 8; + } + } + */ static void s_vClear(void) { @@ -141,7 +141,7 @@ void MIC_vUnInit(void) void MIC_vAppend(u8 * src, unsigned int nBytes) { - /* This is simple */ + /* This is simple */ while (nBytes > 0) { s_vAppendByte(*src++); nBytes--; diff --git a/drivers/staging/vt6656/michael.h b/drivers/staging/vt6656/michael.h index 9c69a42..fa4183f 100644 --- a/drivers/staging/vt6656/michael.h +++ b/drivers/staging/vt6656/michael.h @@ -46,7 +46,7 @@ void MIC_vGetMIC(u32 * pdwL, u32 * pdwR); // Rotation functions on 32 bit values #define ROL32(A, n) \ - (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1))) + (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1))) #define ROR32(A, n) ROL32((A), 32-(n)) #endif /* __MICHAEL_H__ */ diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c index 43da589..df41c62 100644 --- a/drivers/staging/vt6656/power.c +++ b/drivers/staging/vt6656/power.c @@ -131,7 +131,7 @@ void PSvDisablePowerSaving(struct vnt_private *pDevice) /* disable power saving hw function */ CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_DISABLE_PS, 0, - 0, 0, NULL); + 0, 0, NULL); /* clear AutoSleep */ MACvRegBitsOff(pDevice, MAC_REG_PSCFG, PSCFG_AUTOSLEEP); @@ -157,14 +157,14 @@ void PSvDisablePowerSaving(struct vnt_private *pDevice) */ int PSbConsiderPowerDown(struct vnt_private *pDevice, int bCheckRxDMA, - int bCheckCountToWakeUp) + int bCheckCountToWakeUp) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; u8 byData; /* check if already in Doze mode */ ControlvReadByte(pDevice, MESSAGE_REQUEST_MACREG, - MAC_REG_PSCTL, &byData); + MAC_REG_PSCTL, &byData); if ((byData & PSCTL_PS) != 0) return true; @@ -188,8 +188,8 @@ int PSbConsiderPowerDown(struct vnt_private *pDevice, int bCheckRxDMA, if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) { if (bCheckCountToWakeUp && (pMgmt->wCountToWakeUp == 0 - || pMgmt->wCountToWakeUp == 1)) { - return false; + || pMgmt->wCountToWakeUp == 1)) { + return false; } } @@ -217,31 +217,31 @@ void PSvSendPSPOLL(struct vnt_private *pDevice) struct vnt_tx_mgmt *pTxPacket = NULL; memset(pMgmt->pbyPSPacketPool, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_HDR_ADDR2_LEN); + + WLAN_HDR_ADDR2_LEN); pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyPSPacketPool; pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); + + sizeof(struct vnt_tx_mgmt)); pTxPacket->p80211Header->sA2.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_CTL) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PSPOLL) | - WLAN_SET_FC_PWRMGT(0) - )); + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_CTL) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PSPOLL) | + WLAN_SET_FC_PWRMGT(0) + )); pTxPacket->p80211Header->sA2.wDurationID = - pMgmt->wCurrAID | BIT14 | BIT15; + pMgmt->wCurrAID | BIT14 | BIT15; memcpy(pTxPacket->p80211Header->sA2.abyAddr1, pMgmt->abyCurrBSSID, - WLAN_ADDR_LEN); + WLAN_ADDR_LEN); memcpy(pTxPacket->p80211Header->sA2.abyAddr2, pMgmt->abyMACAddr, - WLAN_ADDR_LEN); + WLAN_ADDR_LEN); pTxPacket->cbMPDULen = WLAN_HDR_ADDR2_LEN; pTxPacket->cbPayloadLen = 0; /* log failure if sending failed */ if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Send PS-Poll packet failed..\n"); + KERN_INFO "Send PS-Poll packet failed..\n"); } /* @@ -267,10 +267,10 @@ int PSbSendNullPacket(struct vnt_private *pDevice) return false; memset(pMgmt->pbyPSPacketPool, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_NULLDATA_FR_MAXLEN); + + WLAN_NULLDATA_FR_MAXLEN); pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyPSPacketPool; pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); + + sizeof(struct vnt_tx_mgmt)); flags = WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) | WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL); @@ -284,20 +284,20 @@ int PSbSendNullPacket(struct vnt_private *pDevice) if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) pTxPacket->p80211Header->sA3.wFrameCtl |= - cpu_to_le16((u16)WLAN_SET_FC_TODS(1)); + cpu_to_le16((u16)WLAN_SET_FC_TODS(1)); memcpy(pTxPacket->p80211Header->sA3.abyAddr1, pMgmt->abyCurrBSSID, - WLAN_ADDR_LEN); + WLAN_ADDR_LEN); memcpy(pTxPacket->p80211Header->sA3.abyAddr2, pMgmt->abyMACAddr, - WLAN_ADDR_LEN); + WLAN_ADDR_LEN); memcpy(pTxPacket->p80211Header->sA3.abyAddr3, pMgmt->abyCurrBSSID, - WLAN_BSSID_LEN); + WLAN_BSSID_LEN); pTxPacket->cbMPDULen = WLAN_HDR_ADDR3_LEN; pTxPacket->cbPayloadLen = 0; /* log error if sending failed */ if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "Send Null Packet failed !\n"); + KERN_INFO "Send Null Packet failed !\n"); return false; } return true; @@ -336,4 +336,3 @@ int PSbIsNextTBTTWakeUp(struct vnt_private *pDevice) } return bWakeUp; } - diff --git a/drivers/staging/vt6656/power.h b/drivers/staging/vt6656/power.h index 7783582..2f4434a 100644 --- a/drivers/staging/vt6656/power.h +++ b/drivers/staging/vt6656/power.h @@ -37,7 +37,7 @@ /* PSDevice hDeviceContext */ int PSbConsiderPowerDown(struct vnt_private *, int bCheckRxDMA, - int bCheckCountToWakeUp); + int bCheckCountToWakeUp); void PSvDisablePowerSaving(struct vnt_private *); void PSvEnablePowerSaving(struct vnt_private *, u16 wListenInterval); void PSvSendPSPOLL(struct vnt_private *); diff --git a/drivers/staging/vt6656/rc4.c b/drivers/staging/vt6656/rc4.c index 2fd836f..c63c074 100644 --- a/drivers/staging/vt6656/rc4.c +++ b/drivers/staging/vt6656/rc4.c @@ -79,7 +79,7 @@ unsigned int rc4_byte(PRC4Ext pRC4) } void rc4_encrypt(PRC4Ext pRC4, u8 * pbyDest, - u8 * pbySrc, unsigned int cbData_len) + u8 * pbySrc, unsigned int cbData_len) { unsigned int ii; for (ii = 0; ii < cbData_len; ii++) diff --git a/drivers/staging/vt6656/rc4.h b/drivers/staging/vt6656/rc4.h index d376e1a..7651331 100644 --- a/drivers/staging/vt6656/rc4.h +++ b/drivers/staging/vt6656/rc4.h @@ -33,14 +33,14 @@ #include <linux/types.h> typedef struct { - unsigned int ux; - unsigned int uy; - u8 abystate[256]; + unsigned int ux; + unsigned int uy; + u8 abystate[256]; } RC4Ext, *PRC4Ext; void rc4_init(PRC4Ext pRC4, u8 * pbyKey, unsigned int cbKey_len); unsigned int rc4_byte(PRC4Ext pRC4); void rc4_encrypt(PRC4Ext pRC4, u8 * pbyDest, u8 * pbySrc, - unsigned int cbData_len); + unsigned int cbData_len); #endif /* __RC4_H__ */ diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index 1e8f64b..7f4d8a1 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -65,604 +65,604 @@ static int msglevel =MSG_LEVEL_INFO; //}} static u8 al2230_init_table[CB_AL2230_INIT_SEQ][3] = { - {0x03, 0xF7, 0x90}, - {0x03, 0x33, 0x31}, - {0x01, 0xB8, 0x02}, - {0x00, 0xFF, 0xF3}, - {0x00, 0x05, 0xA4}, - {0x0F, 0x4D, 0xC5}, //RobertYu:20060814 - {0x08, 0x05, 0xB6}, - {0x01, 0x47, 0xC7}, - {0x00, 0x06, 0x88}, - {0x04, 0x03, 0xB9}, - {0x00, 0xDB, 0xBA}, - {0x00, 0x09, 0x9B}, - {0x0B, 0xDF, 0xFC}, - {0x00, 0x00, 0x0D}, - {0x00, 0x58, 0x0F} - }; + {0x03, 0xF7, 0x90}, + {0x03, 0x33, 0x31}, + {0x01, 0xB8, 0x02}, + {0x00, 0xFF, 0xF3}, + {0x00, 0x05, 0xA4}, + {0x0F, 0x4D, 0xC5}, //RobertYu:20060814 + {0x08, 0x05, 0xB6}, + {0x01, 0x47, 0xC7}, + {0x00, 0x06, 0x88}, + {0x04, 0x03, 0xB9}, + {0x00, 0xDB, 0xBA}, + {0x00, 0x09, 0x9B}, + {0x0B, 0xDF, 0xFC}, + {0x00, 0x00, 0x0D}, + {0x00, 0x58, 0x0F} +}; static u8 al2230_channel_table0[CB_MAX_CHANNEL_24G][3] = { - {0x03, 0xF7, 0x90}, // channel = 1, Tf = 2412MHz - {0x03, 0xF7, 0x90}, // channel = 2, Tf = 2417MHz - {0x03, 0xE7, 0x90}, // channel = 3, Tf = 2422MHz - {0x03, 0xE7, 0x90}, // channel = 4, Tf = 2427MHz - {0x03, 0xF7, 0xA0}, // channel = 5, Tf = 2432MHz - {0x03, 0xF7, 0xA0}, // channel = 6, Tf = 2437MHz - {0x03, 0xE7, 0xA0}, // channel = 7, Tf = 2442MHz - {0x03, 0xE7, 0xA0}, // channel = 8, Tf = 2447MHz - {0x03, 0xF7, 0xB0}, // channel = 9, Tf = 2452MHz - {0x03, 0xF7, 0xB0}, // channel = 10, Tf = 2457MHz - {0x03, 0xE7, 0xB0}, // channel = 11, Tf = 2462MHz - {0x03, 0xE7, 0xB0}, // channel = 12, Tf = 2467MHz - {0x03, 0xF7, 0xC0}, // channel = 13, Tf = 2472MHz - {0x03, 0xE7, 0xC0} // channel = 14, Tf = 2412M - }; + {0x03, 0xF7, 0x90}, // channel = 1, Tf = 2412MHz + {0x03, 0xF7, 0x90}, // channel = 2, Tf = 2417MHz + {0x03, 0xE7, 0x90}, // channel = 3, Tf = 2422MHz + {0x03, 0xE7, 0x90}, // channel = 4, Tf = 2427MHz + {0x03, 0xF7, 0xA0}, // channel = 5, Tf = 2432MHz + {0x03, 0xF7, 0xA0}, // channel = 6, Tf = 2437MHz + {0x03, 0xE7, 0xA0}, // channel = 7, Tf = 2442MHz + {0x03, 0xE7, 0xA0}, // channel = 8, Tf = 2447MHz + {0x03, 0xF7, 0xB0}, // channel = 9, Tf = 2452MHz + {0x03, 0xF7, 0xB0}, // channel = 10, Tf = 2457MHz + {0x03, 0xE7, 0xB0}, // channel = 11, Tf = 2462MHz + {0x03, 0xE7, 0xB0}, // channel = 12, Tf = 2467MHz + {0x03, 0xF7, 0xC0}, // channel = 13, Tf = 2472MHz + {0x03, 0xE7, 0xC0} // channel = 14, Tf = 2412M +}; static u8 al2230_channel_table1[CB_MAX_CHANNEL_24G][3] = { - {0x03, 0x33, 0x31}, // channel = 1, Tf = 2412MHz - {0x0B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz - {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz - {0x0B, 0x33, 0x31}, // channel = 4, Tf = 2427MHz - {0x03, 0x33, 0x31}, // channel = 5, Tf = 2432MHz - {0x0B, 0x33, 0x31}, // channel = 6, Tf = 2437MHz - {0x03, 0x33, 0x31}, // channel = 7, Tf = 2442MHz - {0x0B, 0x33, 0x31}, // channel = 8, Tf = 2447MHz - {0x03, 0x33, 0x31}, // channel = 9, Tf = 2452MHz - {0x0B, 0x33, 0x31}, // channel = 10, Tf = 2457MHz - {0x03, 0x33, 0x31}, // channel = 11, Tf = 2462MHz - {0x0B, 0x33, 0x31}, // channel = 12, Tf = 2467MHz - {0x03, 0x33, 0x31}, // channel = 13, Tf = 2472MHz - {0x06, 0x66, 0x61} // channel = 14, Tf = 2412M - }; + {0x03, 0x33, 0x31}, // channel = 1, Tf = 2412MHz + {0x0B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz + {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz + {0x0B, 0x33, 0x31}, // channel = 4, Tf = 2427MHz + {0x03, 0x33, 0x31}, // channel = 5, Tf = 2432MHz + {0x0B, 0x33, 0x31}, // channel = 6, Tf = 2437MHz + {0x03, 0x33, 0x31}, // channel = 7, Tf = 2442MHz + {0x0B, 0x33, 0x31}, // channel = 8, Tf = 2447MHz + {0x03, 0x33, 0x31}, // channel = 9, Tf = 2452MHz + {0x0B, 0x33, 0x31}, // channel = 10, Tf = 2457MHz + {0x03, 0x33, 0x31}, // channel = 11, Tf = 2462MHz + {0x0B, 0x33, 0x31}, // channel = 12, Tf = 2467MHz + {0x03, 0x33, 0x31}, // channel = 13, Tf = 2472MHz + {0x06, 0x66, 0x61} // channel = 14, Tf = 2412M +}; // 40MHz reference frequency // Need to Pull PLLON(PE3) low when writing channel registers through 3-wire. static u8 al7230_init_table[CB_AL7230_INIT_SEQ][3] = { - {0x20, 0x37, 0x90}, // Channel1 // Need modify for 11a - {0x13, 0x33, 0x31}, // Channel1 // Need modify for 11a - {0x84, 0x1F, 0xF2}, // Need modify for 11a: 451FE2 - {0x3F, 0xDF, 0xA3}, // Need modify for 11a: 5FDFA3 - {0x7F, 0xD7, 0x84}, // 11b/g // Need modify for 11a - //0x802B4500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 8D1B45 - // RoberYu:20050113, Rev0.47 Regsiter Setting Guide - {0x80, 0x2B, 0x55}, // Need modify for 11a: 8D1B55 - {0x56, 0xAF, 0x36}, - {0xCE, 0x02, 0x07}, // Need modify for 11a: 860207 - {0x6E, 0xBC, 0x98}, - {0x22, 0x1B, 0xB9}, - {0xE0, 0x00, 0x0A}, // Need modify for 11a: E0600A - {0x08, 0x03, 0x1B}, // init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) - //0x00093C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 00143C - // RoberYu:20050113, Rev0.47 Regsiter Setting Guide - {0x00, 0x0A, 0x3C}, // Need modify for 11a: 00143C - {0xFF, 0xFF, 0xFD}, - {0x00, 0x00, 0x0E}, - {0x1A, 0xBA, 0x8F} // Need modify for 11a: 12BACF - }; + {0x20, 0x37, 0x90}, // Channel1 // Need modify for 11a + {0x13, 0x33, 0x31}, // Channel1 // Need modify for 11a + {0x84, 0x1F, 0xF2}, // Need modify for 11a: 451FE2 + {0x3F, 0xDF, 0xA3}, // Need modify for 11a: 5FDFA3 + {0x7F, 0xD7, 0x84}, // 11b/g // Need modify for 11a + //0x802B4500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 8D1B45 + // RoberYu:20050113, Rev0.47 Regsiter Setting Guide + {0x80, 0x2B, 0x55}, // Need modify for 11a: 8D1B55 + {0x56, 0xAF, 0x36}, + {0xCE, 0x02, 0x07}, // Need modify for 11a: 860207 + {0x6E, 0xBC, 0x98}, + {0x22, 0x1B, 0xB9}, + {0xE0, 0x00, 0x0A}, // Need modify for 11a: E0600A + {0x08, 0x03, 0x1B}, // init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) + //0x00093C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 00143C + // RoberYu:20050113, Rev0.47 Regsiter Setting Guide + {0x00, 0x0A, 0x3C}, // Need modify for 11a: 00143C + {0xFF, 0xFF, 0xFD}, + {0x00, 0x00, 0x0E}, + {0x1A, 0xBA, 0x8F} // Need modify for 11a: 12BACF +}; static u8 al7230_init_table_amode[CB_AL7230_INIT_SEQ][3] = { - {0x2F, 0xF5, 0x20}, // Channel184 // Need modify for 11b/g - {0x00, 0x00, 0x01}, // Channel184 // Need modify for 11b/g - {0x45, 0x1F, 0xE2}, // Need modify for 11b/g - {0x5F, 0xDF, 0xA3}, // Need modify for 11b/g - {0x6F, 0xD7, 0x84}, // 11a // Need modify for 11b/g - {0x85, 0x3F, 0x55}, // Need modify for 11b/g, RoberYu:20050113 - {0x56, 0xAF, 0x36}, - {0xCE, 0x02, 0x07}, // Need modify for 11b/g - {0x6E, 0xBC, 0x98}, - {0x22, 0x1B, 0xB9}, - {0xE0, 0x60, 0x0A}, // Need modify for 11b/g - {0x08, 0x03, 0x1B}, // init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) - {0x00, 0x14, 0x7C}, // Need modify for 11b/g - {0xFF, 0xFF, 0xFD}, - {0x00, 0x00, 0x0E}, - {0x12, 0xBA, 0xCF} // Need modify for 11b/g - }; + {0x2F, 0xF5, 0x20}, // Channel184 // Need modify for 11b/g + {0x00, 0x00, 0x01}, // Channel184 // Need modify for 11b/g + {0x45, 0x1F, 0xE2}, // Need modify for 11b/g + {0x5F, 0xDF, 0xA3}, // Need modify for 11b/g + {0x6F, 0xD7, 0x84}, // 11a // Need modify for 11b/g + {0x85, 0x3F, 0x55}, // Need modify for 11b/g, RoberYu:20050113 + {0x56, 0xAF, 0x36}, + {0xCE, 0x02, 0x07}, // Need modify for 11b/g + {0x6E, 0xBC, 0x98}, + {0x22, 0x1B, 0xB9}, + {0xE0, 0x60, 0x0A}, // Need modify for 11b/g + {0x08, 0x03, 0x1B}, // init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) + {0x00, 0x14, 0x7C}, // Need modify for 11b/g + {0xFF, 0xFF, 0xFD}, + {0x00, 0x00, 0x0E}, + {0x12, 0xBA, 0xCF} // Need modify for 11b/g +}; static u8 al7230_channel_table0[CB_MAX_CHANNEL][3] = { - {0x20, 0x37, 0x90}, // channel = 1, Tf = 2412MHz - {0x20, 0x37, 0x90}, // channel = 2, Tf = 2417MHz - {0x20, 0x37, 0x90}, // channel = 3, Tf = 2422MHz - {0x20, 0x37, 0x90}, // channel = 4, Tf = 2427MHz - {0x20, 0x37, 0xA0}, // channel = 5, Tf = 2432MHz - {0x20, 0x37, 0xA0}, // channel = 6, Tf = 2437MHz - {0x20, 0x37, 0xA0}, // channel = 7, Tf = 2442MHz - {0x20, 0x37, 0xA0}, // channel = 8, Tf = 2447MHz //RobertYu: 20050218, update for APNode 0.49 - {0x20, 0x37, 0xB0}, // channel = 9, Tf = 2452MHz //RobertYu: 20050218, update for APNode 0.49 - {0x20, 0x37, 0xB0}, // channel = 10, Tf = 2457MHz //RobertYu: 20050218, update for APNode 0.49 - {0x20, 0x37, 0xB0}, // channel = 11, Tf = 2462MHz //RobertYu: 20050218, update for APNode 0.49 - {0x20, 0x37, 0xB0}, // channel = 12, Tf = 2467MHz //RobertYu: 20050218, update for APNode 0.49 - {0x20, 0x37, 0xC0}, // channel = 13, Tf = 2472MHz //RobertYu: 20050218, update for APNode 0.49 - {0x20, 0x37, 0xC0}, // channel = 14, Tf = 2484MHz - - // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) - {0x0F, 0xF5, 0x20}, // channel = 183, Tf = 4915MHz (15) - {0x2F, 0xF5, 0x20}, // channel = 184, Tf = 4920MHz (16) - {0x0F, 0xF5, 0x20}, // channel = 185, Tf = 4925MHz (17) - {0x0F, 0xF5, 0x20}, // channel = 187, Tf = 4935MHz (18) - {0x2F, 0xF5, 0x20}, // channel = 188, Tf = 4940MHz (19) - {0x0F, 0xF5, 0x20}, // channel = 189, Tf = 4945MHz (20) - {0x2F, 0xF5, 0x30}, // channel = 192, Tf = 4960MHz (21) - {0x2F, 0xF5, 0x30}, // channel = 196, Tf = 4980MHz (22) - - // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, - // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) - - {0x0F, 0xF5, 0x40}, // channel = 7, Tf = 5035MHz (23) - {0x2F, 0xF5, 0x40}, // channel = 8, Tf = 5040MHz (24) - {0x0F, 0xF5, 0x40}, // channel = 9, Tf = 5045MHz (25) - {0x0F, 0xF5, 0x40}, // channel = 11, Tf = 5055MHz (26) - {0x2F, 0xF5, 0x40}, // channel = 12, Tf = 5060MHz (27) - {0x2F, 0xF5, 0x50}, // channel = 16, Tf = 5080MHz (28) - {0x2F, 0xF5, 0x60}, // channel = 34, Tf = 5170MHz (29) - {0x2F, 0xF5, 0x60}, // channel = 36, Tf = 5180MHz (30) - {0x2F, 0xF5, 0x70}, // channel = 38, Tf = 5190MHz (31) //RobertYu: 20050218, update for APNode 0.49 - {0x2F, 0xF5, 0x70}, // channel = 40, Tf = 5200MHz (32) - {0x2F, 0xF5, 0x70}, // channel = 42, Tf = 5210MHz (33) - {0x2F, 0xF5, 0x70}, // channel = 44, Tf = 5220MHz (34) - {0x2F, 0xF5, 0x70}, // channel = 46, Tf = 5230MHz (35) - {0x2F, 0xF5, 0x70}, // channel = 48, Tf = 5240MHz (36) - {0x2F, 0xF5, 0x80}, // channel = 52, Tf = 5260MHz (37) - {0x2F, 0xF5, 0x80}, // channel = 56, Tf = 5280MHz (38) - {0x2F, 0xF5, 0x80}, // channel = 60, Tf = 5300MHz (39) - {0x2F, 0xF5, 0x90}, // channel = 64, Tf = 5320MHz (40) - - {0x2F, 0xF5, 0xC0}, // channel = 100, Tf = 5500MHz (41) - {0x2F, 0xF5, 0xC0}, // channel = 104, Tf = 5520MHz (42) - {0x2F, 0xF5, 0xC0}, // channel = 108, Tf = 5540MHz (43) - {0x2F, 0xF5, 0xD0}, // channel = 112, Tf = 5560MHz (44) - {0x2F, 0xF5, 0xD0}, // channel = 116, Tf = 5580MHz (45) - {0x2F, 0xF5, 0xD0}, // channel = 120, Tf = 5600MHz (46) - {0x2F, 0xF5, 0xE0}, // channel = 124, Tf = 5620MHz (47) - {0x2F, 0xF5, 0xE0}, // channel = 128, Tf = 5640MHz (48) - {0x2F, 0xF5, 0xE0}, // channel = 132, Tf = 5660MHz (49) - {0x2F, 0xF5, 0xF0}, // channel = 136, Tf = 5680MHz (50) - {0x2F, 0xF5, 0xF0}, // channel = 140, Tf = 5700MHz (51) - {0x2F, 0xF6, 0x00}, // channel = 149, Tf = 5745MHz (52) - {0x2F, 0xF6, 0x00}, // channel = 153, Tf = 5765MHz (53) - {0x2F, 0xF6, 0x00}, // channel = 157, Tf = 5785MHz (54) - {0x2F, 0xF6, 0x10}, // channel = 161, Tf = 5805MHz (55) - {0x2F, 0xF6, 0x10} // channel = 165, Tf = 5825MHz (56) - }; + {0x20, 0x37, 0x90}, // channel = 1, Tf = 2412MHz + {0x20, 0x37, 0x90}, // channel = 2, Tf = 2417MHz + {0x20, 0x37, 0x90}, // channel = 3, Tf = 2422MHz + {0x20, 0x37, 0x90}, // channel = 4, Tf = 2427MHz + {0x20, 0x37, 0xA0}, // channel = 5, Tf = 2432MHz + {0x20, 0x37, 0xA0}, // channel = 6, Tf = 2437MHz + {0x20, 0x37, 0xA0}, // channel = 7, Tf = 2442MHz + {0x20, 0x37, 0xA0}, // channel = 8, Tf = 2447MHz //RobertYu: 20050218, update for APNode 0.49 + {0x20, 0x37, 0xB0}, // channel = 9, Tf = 2452MHz //RobertYu: 20050218, update for APNode 0.49 + {0x20, 0x37, 0xB0}, // channel = 10, Tf = 2457MHz //RobertYu: 20050218, update for APNode 0.49 + {0x20, 0x37, 0xB0}, // channel = 11, Tf = 2462MHz //RobertYu: 20050218, update for APNode 0.49 + {0x20, 0x37, 0xB0}, // channel = 12, Tf = 2467MHz //RobertYu: 20050218, update for APNode 0.49 + {0x20, 0x37, 0xC0}, // channel = 13, Tf = 2472MHz //RobertYu: 20050218, update for APNode 0.49 + {0x20, 0x37, 0xC0}, // channel = 14, Tf = 2484MHz + + // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) + {0x0F, 0xF5, 0x20}, // channel = 183, Tf = 4915MHz (15) + {0x2F, 0xF5, 0x20}, // channel = 184, Tf = 4920MHz (16) + {0x0F, 0xF5, 0x20}, // channel = 185, Tf = 4925MHz (17) + {0x0F, 0xF5, 0x20}, // channel = 187, Tf = 4935MHz (18) + {0x2F, 0xF5, 0x20}, // channel = 188, Tf = 4940MHz (19) + {0x0F, 0xF5, 0x20}, // channel = 189, Tf = 4945MHz (20) + {0x2F, 0xF5, 0x30}, // channel = 192, Tf = 4960MHz (21) + {0x2F, 0xF5, 0x30}, // channel = 196, Tf = 4980MHz (22) + + // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, + // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) + + {0x0F, 0xF5, 0x40}, // channel = 7, Tf = 5035MHz (23) + {0x2F, 0xF5, 0x40}, // channel = 8, Tf = 5040MHz (24) + {0x0F, 0xF5, 0x40}, // channel = 9, Tf = 5045MHz (25) + {0x0F, 0xF5, 0x40}, // channel = 11, Tf = 5055MHz (26) + {0x2F, 0xF5, 0x40}, // channel = 12, Tf = 5060MHz (27) + {0x2F, 0xF5, 0x50}, // channel = 16, Tf = 5080MHz (28) + {0x2F, 0xF5, 0x60}, // channel = 34, Tf = 5170MHz (29) + {0x2F, 0xF5, 0x60}, // channel = 36, Tf = 5180MHz (30) + {0x2F, 0xF5, 0x70}, // channel = 38, Tf = 5190MHz (31) //RobertYu: 20050218, update for APNode 0.49 + {0x2F, 0xF5, 0x70}, // channel = 40, Tf = 5200MHz (32) + {0x2F, 0xF5, 0x70}, // channel = 42, Tf = 5210MHz (33) + {0x2F, 0xF5, 0x70}, // channel = 44, Tf = 5220MHz (34) + {0x2F, 0xF5, 0x70}, // channel = 46, Tf = 5230MHz (35) + {0x2F, 0xF5, 0x70}, // channel = 48, Tf = 5240MHz (36) + {0x2F, 0xF5, 0x80}, // channel = 52, Tf = 5260MHz (37) + {0x2F, 0xF5, 0x80}, // channel = 56, Tf = 5280MHz (38) + {0x2F, 0xF5, 0x80}, // channel = 60, Tf = 5300MHz (39) + {0x2F, 0xF5, 0x90}, // channel = 64, Tf = 5320MHz (40) + + {0x2F, 0xF5, 0xC0}, // channel = 100, Tf = 5500MHz (41) + {0x2F, 0xF5, 0xC0}, // channel = 104, Tf = 5520MHz (42) + {0x2F, 0xF5, 0xC0}, // channel = 108, Tf = 5540MHz (43) + {0x2F, 0xF5, 0xD0}, // channel = 112, Tf = 5560MHz (44) + {0x2F, 0xF5, 0xD0}, // channel = 116, Tf = 5580MHz (45) + {0x2F, 0xF5, 0xD0}, // channel = 120, Tf = 5600MHz (46) + {0x2F, 0xF5, 0xE0}, // channel = 124, Tf = 5620MHz (47) + {0x2F, 0xF5, 0xE0}, // channel = 128, Tf = 5640MHz (48) + {0x2F, 0xF5, 0xE0}, // channel = 132, Tf = 5660MHz (49) + {0x2F, 0xF5, 0xF0}, // channel = 136, Tf = 5680MHz (50) + {0x2F, 0xF5, 0xF0}, // channel = 140, Tf = 5700MHz (51) + {0x2F, 0xF6, 0x00}, // channel = 149, Tf = 5745MHz (52) + {0x2F, 0xF6, 0x00}, // channel = 153, Tf = 5765MHz (53) + {0x2F, 0xF6, 0x00}, // channel = 157, Tf = 5785MHz (54) + {0x2F, 0xF6, 0x10}, // channel = 161, Tf = 5805MHz (55) + {0x2F, 0xF6, 0x10} // channel = 165, Tf = 5825MHz (56) +}; static u8 al7230_channel_table1[CB_MAX_CHANNEL][3] = { - {0x13, 0x33, 0x31}, // channel = 1, Tf = 2412MHz - {0x1B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz - {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz - {0x0B, 0x33, 0x31}, // channel = 4, Tf = 2427MHz - {0x13, 0x33, 0x31}, // channel = 5, Tf = 2432MHz - {0x1B, 0x33, 0x31}, // channel = 6, Tf = 2437MHz - {0x03, 0x33, 0x31}, // channel = 7, Tf = 2442MHz - {0x0B, 0x33, 0x31}, // channel = 8, Tf = 2447MHz - {0x13, 0x33, 0x31}, // channel = 9, Tf = 2452MHz - {0x1B, 0x33, 0x31}, // channel = 10, Tf = 2457MHz - {0x03, 0x33, 0x31}, // channel = 11, Tf = 2462MHz - {0x0B, 0x33, 0x31}, // channel = 12, Tf = 2467MHz - {0x13, 0x33, 0x31}, // channel = 13, Tf = 2472MHz - {0x06, 0x66, 0x61}, // channel = 14, Tf = 2484MHz - - // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) - {0x1D, 0x55, 0x51}, // channel = 183, Tf = 4915MHz (15) - {0x00, 0x00, 0x01}, // channel = 184, Tf = 4920MHz (16) - {0x02, 0xAA, 0xA1}, // channel = 185, Tf = 4925MHz (17) - {0x08, 0x00, 0x01}, // channel = 187, Tf = 4935MHz (18) - {0x0A, 0xAA, 0xA1}, // channel = 188, Tf = 4940MHz (19) - {0x0D, 0x55, 0x51}, // channel = 189, Tf = 4945MHz (20) - {0x15, 0x55, 0x51}, // channel = 192, Tf = 4960MHz (21) - {0x00, 0x00, 0x01}, // channel = 196, Tf = 4980MHz (22) - - // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, - // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) - {0x1D, 0x55, 0x51}, // channel = 7, Tf = 5035MHz (23) - {0x00, 0x00, 0x01}, // channel = 8, Tf = 5040MHz (24) - {0x02, 0xAA, 0xA1}, // channel = 9, Tf = 5045MHz (25) - {0x08, 0x00, 0x01}, // channel = 11, Tf = 5055MHz (26) - {0x0A, 0xAA, 0xA1}, // channel = 12, Tf = 5060MHz (27) - {0x15, 0x55, 0x51}, // channel = 16, Tf = 5080MHz (28) - {0x05, 0x55, 0x51}, // channel = 34, Tf = 5170MHz (29) - {0x0A, 0xAA, 0xA1}, // channel = 36, Tf = 5180MHz (30) - {0x10, 0x00, 0x01}, // channel = 38, Tf = 5190MHz (31) - {0x15, 0x55, 0x51}, // channel = 40, Tf = 5200MHz (32) - {0x1A, 0xAA, 0xA1}, // channel = 42, Tf = 5210MHz (33) - {0x00, 0x00, 0x01}, // channel = 44, Tf = 5220MHz (34) - {0x05, 0x55, 0x51}, // channel = 46, Tf = 5230MHz (35) - {0x0A, 0xAA, 0xA1}, // channel = 48, Tf = 5240MHz (36) - {0x15, 0x55, 0x51}, // channel = 52, Tf = 5260MHz (37) - {0x00, 0x00, 0x01}, // channel = 56, Tf = 5280MHz (38) - {0x0A, 0xAA, 0xA1}, // channel = 60, Tf = 5300MHz (39) - {0x15, 0x55, 0x51}, // channel = 64, Tf = 5320MHz (40) - {0x15, 0x55, 0x51}, // channel = 100, Tf = 5500MHz (41) - {0x00, 0x00, 0x01}, // channel = 104, Tf = 5520MHz (42) - {0x0A, 0xAA, 0xA1}, // channel = 108, Tf = 5540MHz (43) - {0x15, 0x55, 0x51}, // channel = 112, Tf = 5560MHz (44) - {0x00, 0x00, 0x01}, // channel = 116, Tf = 5580MHz (45) - {0x0A, 0xAA, 0xA1}, // channel = 120, Tf = 5600MHz (46) - {0x15, 0x55, 0x51}, // channel = 124, Tf = 5620MHz (47) - {0x00, 0x00, 0x01}, // channel = 128, Tf = 5640MHz (48) - {0x0A, 0xAA, 0xA1}, // channel = 132, Tf = 5660MHz (49) - {0x15, 0x55, 0x51}, // channel = 136, Tf = 5680MHz (50) - {0x00, 0x00, 0x01}, // channel = 140, Tf = 5700MHz (51) - {0x18, 0x00, 0x01}, // channel = 149, Tf = 5745MHz (52) - {0x02, 0xAA, 0xA1}, // channel = 153, Tf = 5765MHz (53) - {0x0D, 0x55, 0x51}, // channel = 157, Tf = 5785MHz (54) - {0x18, 0x00, 0x01}, // channel = 161, Tf = 5805MHz (55) - {0x02, 0xAA, 0xB1} // channel = 165, Tf = 5825MHz (56) - }; + {0x13, 0x33, 0x31}, // channel = 1, Tf = 2412MHz + {0x1B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz + {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz + {0x0B, 0x33, 0x31}, // channel = 4, Tf = 2427MHz + {0x13, 0x33, 0x31}, // channel = 5, Tf = 2432MHz + {0x1B, 0x33, 0x31}, // channel = 6, Tf = 2437MHz + {0x03, 0x33, 0x31}, // channel = 7, Tf = 2442MHz + {0x0B, 0x33, 0x31}, // channel = 8, Tf = 2447MHz + {0x13, 0x33, 0x31}, // channel = 9, Tf = 2452MHz + {0x1B, 0x33, 0x31}, // channel = 10, Tf = 2457MHz + {0x03, 0x33, 0x31}, // channel = 11, Tf = 2462MHz + {0x0B, 0x33, 0x31}, // channel = 12, Tf = 2467MHz + {0x13, 0x33, 0x31}, // channel = 13, Tf = 2472MHz + {0x06, 0x66, 0x61}, // channel = 14, Tf = 2484MHz + + // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) + {0x1D, 0x55, 0x51}, // channel = 183, Tf = 4915MHz (15) + {0x00, 0x00, 0x01}, // channel = 184, Tf = 4920MHz (16) + {0x02, 0xAA, 0xA1}, // channel = 185, Tf = 4925MHz (17) + {0x08, 0x00, 0x01}, // channel = 187, Tf = 4935MHz (18) + {0x0A, 0xAA, 0xA1}, // channel = 188, Tf = 4940MHz (19) + {0x0D, 0x55, 0x51}, // channel = 189, Tf = 4945MHz (20) + {0x15, 0x55, 0x51}, // channel = 192, Tf = 4960MHz (21) + {0x00, 0x00, 0x01}, // channel = 196, Tf = 4980MHz (22) + + // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, + // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) + {0x1D, 0x55, 0x51}, // channel = 7, Tf = 5035MHz (23) + {0x00, 0x00, 0x01}, // channel = 8, Tf = 5040MHz (24) + {0x02, 0xAA, 0xA1}, // channel = 9, Tf = 5045MHz (25) + {0x08, 0x00, 0x01}, // channel = 11, Tf = 5055MHz (26) + {0x0A, 0xAA, 0xA1}, // channel = 12, Tf = 5060MHz (27) + {0x15, 0x55, 0x51}, // channel = 16, Tf = 5080MHz (28) + {0x05, 0x55, 0x51}, // channel = 34, Tf = 5170MHz (29) + {0x0A, 0xAA, 0xA1}, // channel = 36, Tf = 5180MHz (30) + {0x10, 0x00, 0x01}, // channel = 38, Tf = 5190MHz (31) + {0x15, 0x55, 0x51}, // channel = 40, Tf = 5200MHz (32) + {0x1A, 0xAA, 0xA1}, // channel = 42, Tf = 5210MHz (33) + {0x00, 0x00, 0x01}, // channel = 44, Tf = 5220MHz (34) + {0x05, 0x55, 0x51}, // channel = 46, Tf = 5230MHz (35) + {0x0A, 0xAA, 0xA1}, // channel = 48, Tf = 5240MHz (36) + {0x15, 0x55, 0x51}, // channel = 52, Tf = 5260MHz (37) + {0x00, 0x00, 0x01}, // channel = 56, Tf = 5280MHz (38) + {0x0A, 0xAA, 0xA1}, // channel = 60, Tf = 5300MHz (39) + {0x15, 0x55, 0x51}, // channel = 64, Tf = 5320MHz (40) + {0x15, 0x55, 0x51}, // channel = 100, Tf = 5500MHz (41) + {0x00, 0x00, 0x01}, // channel = 104, Tf = 5520MHz (42) + {0x0A, 0xAA, 0xA1}, // channel = 108, Tf = 5540MHz (43) + {0x15, 0x55, 0x51}, // channel = 112, Tf = 5560MHz (44) + {0x00, 0x00, 0x01}, // channel = 116, Tf = 5580MHz (45) + {0x0A, 0xAA, 0xA1}, // channel = 120, Tf = 5600MHz (46) + {0x15, 0x55, 0x51}, // channel = 124, Tf = 5620MHz (47) + {0x00, 0x00, 0x01}, // channel = 128, Tf = 5640MHz (48) + {0x0A, 0xAA, 0xA1}, // channel = 132, Tf = 5660MHz (49) + {0x15, 0x55, 0x51}, // channel = 136, Tf = 5680MHz (50) + {0x00, 0x00, 0x01}, // channel = 140, Tf = 5700MHz (51) + {0x18, 0x00, 0x01}, // channel = 149, Tf = 5745MHz (52) + {0x02, 0xAA, 0xA1}, // channel = 153, Tf = 5765MHz (53) + {0x0D, 0x55, 0x51}, // channel = 157, Tf = 5785MHz (54) + {0x18, 0x00, 0x01}, // channel = 161, Tf = 5805MHz (55) + {0x02, 0xAA, 0xB1} // channel = 165, Tf = 5825MHz (56) +}; static u8 al7230_channel_table2[CB_MAX_CHANNEL][3] = { - {0x7F, 0xD7, 0x84}, // channel = 1, Tf = 2412MHz - {0x7F, 0xD7, 0x84}, // channel = 2, Tf = 2417MHz - {0x7F, 0xD7, 0x84}, // channel = 3, Tf = 2422MHz - {0x7F, 0xD7, 0x84}, // channel = 4, Tf = 2427MHz - {0x7F, 0xD7, 0x84}, // channel = 5, Tf = 2432MHz - {0x7F, 0xD7, 0x84}, // channel = 6, Tf = 2437MHz - {0x7F, 0xD7, 0x84}, // channel = 7, Tf = 2442MHz - {0x7F, 0xD7, 0x84}, // channel = 8, Tf = 2447MHz - {0x7F, 0xD7, 0x84}, // channel = 9, Tf = 2452MHz - {0x7F, 0xD7, 0x84}, // channel = 10, Tf = 2457MHz - {0x7F, 0xD7, 0x84}, // channel = 11, Tf = 2462MHz - {0x7F, 0xD7, 0x84}, // channel = 12, Tf = 2467MHz - {0x7F, 0xD7, 0x84}, // channel = 13, Tf = 2472MHz - {0x7F, 0xD7, 0x84}, // channel = 14, Tf = 2484MHz - - // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) - {0x7F, 0xD7, 0x84}, // channel = 183, Tf = 4915MHz (15) - {0x6F, 0xD7, 0x84}, // channel = 184, Tf = 4920MHz (16) - {0x7F, 0xD7, 0x84}, // channel = 185, Tf = 4925MHz (17) - {0x7F, 0xD7, 0x84}, // channel = 187, Tf = 4935MHz (18) - {0x7F, 0xD7, 0x84}, // channel = 188, Tf = 4940MHz (19) - {0x7F, 0xD7, 0x84}, // channel = 189, Tf = 4945MHz (20) - {0x7F, 0xD7, 0x84}, // channel = 192, Tf = 4960MHz (21) - {0x6F, 0xD7, 0x84}, // channel = 196, Tf = 4980MHz (22) - - // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, - // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) - {0x7F, 0xD7, 0x84}, // channel = 7, Tf = 5035MHz (23) - {0x6F, 0xD7, 0x84}, // channel = 8, Tf = 5040MHz (24) - {0x7F, 0xD7, 0x84}, // channel = 9, Tf = 5045MHz (25) - {0x7F, 0xD7, 0x84}, // channel = 11, Tf = 5055MHz (26) - {0x7F, 0xD7, 0x84}, // channel = 12, Tf = 5060MHz (27) - {0x7F, 0xD7, 0x84}, // channel = 16, Tf = 5080MHz (28) - {0x7F, 0xD7, 0x84}, // channel = 34, Tf = 5170MHz (29) - {0x7F, 0xD7, 0x84}, // channel = 36, Tf = 5180MHz (30) - {0x7F, 0xD7, 0x84}, // channel = 38, Tf = 5190MHz (31) - {0x7F, 0xD7, 0x84}, // channel = 40, Tf = 5200MHz (32) - {0x7F, 0xD7, 0x84}, // channel = 42, Tf = 5210MHz (33) - {0x6F, 0xD7, 0x84}, // channel = 44, Tf = 5220MHz (34) - {0x7F, 0xD7, 0x84}, // channel = 46, Tf = 5230MHz (35) - {0x7F, 0xD7, 0x84}, // channel = 48, Tf = 5240MHz (36) - {0x7F, 0xD7, 0x84}, // channel = 52, Tf = 5260MHz (37) - {0x6F, 0xD7, 0x84}, // channel = 56, Tf = 5280MHz (38) - {0x7F, 0xD7, 0x84}, // channel = 60, Tf = 5300MHz (39) - {0x7F, 0xD7, 0x84}, // channel = 64, Tf = 5320MHz (40) - {0x7F, 0xD7, 0x84}, // channel = 100, Tf = 5500MHz (41) - {0x6F, 0xD7, 0x84}, // channel = 104, Tf = 5520MHz (42) - {0x7F, 0xD7, 0x84}, // channel = 108, Tf = 5540MHz (43) - {0x7F, 0xD7, 0x84}, // channel = 112, Tf = 5560MHz (44) - {0x6F, 0xD7, 0x84}, // channel = 116, Tf = 5580MHz (45) - {0x7F, 0xD7, 0x84}, // channel = 120, Tf = 5600MHz (46) - {0x7F, 0xD7, 0x84}, // channel = 124, Tf = 5620MHz (47) - {0x6F, 0xD7, 0x84}, // channel = 128, Tf = 5640MHz (48) - {0x7F, 0xD7, 0x84}, // channel = 132, Tf = 5660MHz (49) - {0x7F, 0xD7, 0x84}, // channel = 136, Tf = 5680MHz (50) - {0x6F, 0xD7, 0x84}, // channel = 140, Tf = 5700MHz (51) - {0x7F, 0xD7, 0x84}, // channel = 149, Tf = 5745MHz (52) - {0x7F, 0xD7, 0x84}, // channel = 153, Tf = 5765MHz (53) - {0x7F, 0xD7, 0x84}, // channel = 157, Tf = 5785MHz (54) - {0x7F, 0xD7, 0x84}, // channel = 161, Tf = 5805MHz (55) - {0x7F, 0xD7, 0x84} // channel = 165, Tf = 5825MHz (56) - }; + {0x7F, 0xD7, 0x84}, // channel = 1, Tf = 2412MHz + {0x7F, 0xD7, 0x84}, // channel = 2, Tf = 2417MHz + {0x7F, 0xD7, 0x84}, // channel = 3, Tf = 2422MHz + {0x7F, 0xD7, 0x84}, // channel = 4, Tf = 2427MHz + {0x7F, 0xD7, 0x84}, // channel = 5, Tf = 2432MHz + {0x7F, 0xD7, 0x84}, // channel = 6, Tf = 2437MHz + {0x7F, 0xD7, 0x84}, // channel = 7, Tf = 2442MHz + {0x7F, 0xD7, 0x84}, // channel = 8, Tf = 2447MHz + {0x7F, 0xD7, 0x84}, // channel = 9, Tf = 2452MHz + {0x7F, 0xD7, 0x84}, // channel = 10, Tf = 2457MHz + {0x7F, 0xD7, 0x84}, // channel = 11, Tf = 2462MHz + {0x7F, 0xD7, 0x84}, // channel = 12, Tf = 2467MHz + {0x7F, 0xD7, 0x84}, // channel = 13, Tf = 2472MHz + {0x7F, 0xD7, 0x84}, // channel = 14, Tf = 2484MHz + + // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) + {0x7F, 0xD7, 0x84}, // channel = 183, Tf = 4915MHz (15) + {0x6F, 0xD7, 0x84}, // channel = 184, Tf = 4920MHz (16) + {0x7F, 0xD7, 0x84}, // channel = 185, Tf = 4925MHz (17) + {0x7F, 0xD7, 0x84}, // channel = 187, Tf = 4935MHz (18) + {0x7F, 0xD7, 0x84}, // channel = 188, Tf = 4940MHz (19) + {0x7F, 0xD7, 0x84}, // channel = 189, Tf = 4945MHz (20) + {0x7F, 0xD7, 0x84}, // channel = 192, Tf = 4960MHz (21) + {0x6F, 0xD7, 0x84}, // channel = 196, Tf = 4980MHz (22) + + // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, + // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) + {0x7F, 0xD7, 0x84}, // channel = 7, Tf = 5035MHz (23) + {0x6F, 0xD7, 0x84}, // channel = 8, Tf = 5040MHz (24) + {0x7F, 0xD7, 0x84}, // channel = 9, Tf = 5045MHz (25) + {0x7F, 0xD7, 0x84}, // channel = 11, Tf = 5055MHz (26) + {0x7F, 0xD7, 0x84}, // channel = 12, Tf = 5060MHz (27) + {0x7F, 0xD7, 0x84}, // channel = 16, Tf = 5080MHz (28) + {0x7F, 0xD7, 0x84}, // channel = 34, Tf = 5170MHz (29) + {0x7F, 0xD7, 0x84}, // channel = 36, Tf = 5180MHz (30) + {0x7F, 0xD7, 0x84}, // channel = 38, Tf = 5190MHz (31) + {0x7F, 0xD7, 0x84}, // channel = 40, Tf = 5200MHz (32) + {0x7F, 0xD7, 0x84}, // channel = 42, Tf = 5210MHz (33) + {0x6F, 0xD7, 0x84}, // channel = 44, Tf = 5220MHz (34) + {0x7F, 0xD7, 0x84}, // channel = 46, Tf = 5230MHz (35) + {0x7F, 0xD7, 0x84}, // channel = 48, Tf = 5240MHz (36) + {0x7F, 0xD7, 0x84}, // channel = 52, Tf = 5260MHz (37) + {0x6F, 0xD7, 0x84}, // channel = 56, Tf = 5280MHz (38) + {0x7F, 0xD7, 0x84}, // channel = 60, Tf = 5300MHz (39) + {0x7F, 0xD7, 0x84}, // channel = 64, Tf = 5320MHz (40) + {0x7F, 0xD7, 0x84}, // channel = 100, Tf = 5500MHz (41) + {0x6F, 0xD7, 0x84}, // channel = 104, Tf = 5520MHz (42) + {0x7F, 0xD7, 0x84}, // channel = 108, Tf = 5540MHz (43) + {0x7F, 0xD7, 0x84}, // channel = 112, Tf = 5560MHz (44) + {0x6F, 0xD7, 0x84}, // channel = 116, Tf = 5580MHz (45) + {0x7F, 0xD7, 0x84}, // channel = 120, Tf = 5600MHz (46) + {0x7F, 0xD7, 0x84}, // channel = 124, Tf = 5620MHz (47) + {0x6F, 0xD7, 0x84}, // channel = 128, Tf = 5640MHz (48) + {0x7F, 0xD7, 0x84}, // channel = 132, Tf = 5660MHz (49) + {0x7F, 0xD7, 0x84}, // channel = 136, Tf = 5680MHz (50) + {0x6F, 0xD7, 0x84}, // channel = 140, Tf = 5700MHz (51) + {0x7F, 0xD7, 0x84}, // channel = 149, Tf = 5745MHz (52) + {0x7F, 0xD7, 0x84}, // channel = 153, Tf = 5765MHz (53) + {0x7F, 0xD7, 0x84}, // channel = 157, Tf = 5785MHz (54) + {0x7F, 0xD7, 0x84}, // channel = 161, Tf = 5805MHz (55) + {0x7F, 0xD7, 0x84} // channel = 165, Tf = 5825MHz (56) +}; ///{{RobertYu:20051111 static u8 at3226_init_table[CB_VT3226_INIT_SEQ][3] = { - {0x03, 0xFF, 0x80}, - {0x02, 0x82, 0xA1}, - {0x03, 0xC6, 0xA2}, - {0x01, 0x97, 0x93}, - {0x03, 0x66, 0x64}, - {0x00, 0x61, 0xA5}, - {0x01, 0x7B, 0xD6}, - {0x00, 0x80, 0x17}, - {0x03, 0xF8, 0x08}, - {0x00, 0x02, 0x39}, //RobertYu:20051116 - {0x02, 0x00, 0x2A} - }; + {0x03, 0xFF, 0x80}, + {0x02, 0x82, 0xA1}, + {0x03, 0xC6, 0xA2}, + {0x01, 0x97, 0x93}, + {0x03, 0x66, 0x64}, + {0x00, 0x61, 0xA5}, + {0x01, 0x7B, 0xD6}, + {0x00, 0x80, 0x17}, + {0x03, 0xF8, 0x08}, + {0x00, 0x02, 0x39}, //RobertYu:20051116 + {0x02, 0x00, 0x2A} +}; static u8 at3226d0_init_table[CB_VT3226_INIT_SEQ][3] = { - {0x03, 0xFF, 0x80}, - {0x03, 0x02, 0x21}, //RobertYu:20060327 - {0x03, 0xC6, 0xA2}, - {0x01, 0x97, 0x93}, - {0x03, 0x66, 0x64}, - {0x00, 0x71, 0xA5}, //RobertYu:20060103 - {0x01, 0x15, 0xC6}, //RobertYu:20060420 - {0x01, 0x2E, 0x07}, //RobertYu:20060420 - {0x00, 0x58, 0x08}, //RobertYu:20060111 - {0x00, 0x02, 0x79}, //RobertYu:20060420 - {0x02, 0x01, 0xAA} //RobertYu:20060523 - }; + {0x03, 0xFF, 0x80}, + {0x03, 0x02, 0x21}, //RobertYu:20060327 + {0x03, 0xC6, 0xA2}, + {0x01, 0x97, 0x93}, + {0x03, 0x66, 0x64}, + {0x00, 0x71, 0xA5}, //RobertYu:20060103 + {0x01, 0x15, 0xC6}, //RobertYu:20060420 + {0x01, 0x2E, 0x07}, //RobertYu:20060420 + {0x00, 0x58, 0x08}, //RobertYu:20060111 + {0x00, 0x02, 0x79}, //RobertYu:20060420 + {0x02, 0x01, 0xAA} //RobertYu:20060523 +}; static u8 vt3226_channel_table0[CB_MAX_CHANNEL_24G][3] = { - {0x01, 0x97, 0x83}, // channel = 1, Tf = 2412MHz - {0x01, 0x97, 0x83}, // channel = 2, Tf = 2417MHz - {0x01, 0x97, 0x93}, // channel = 3, Tf = 2422MHz - {0x01, 0x97, 0x93}, // channel = 4, Tf = 2427MHz - {0x01, 0x97, 0x93}, // channel = 5, Tf = 2432MHz - {0x01, 0x97, 0x93}, // channel = 6, Tf = 2437MHz - {0x01, 0x97, 0xA3}, // channel = 7, Tf = 2442MHz - {0x01, 0x97, 0xA3}, // channel = 8, Tf = 2447MHz - {0x01, 0x97, 0xA3}, // channel = 9, Tf = 2452MHz - {0x01, 0x97, 0xA3}, // channel = 10, Tf = 2457MHz - {0x01, 0x97, 0xB3}, // channel = 11, Tf = 2462MHz - {0x01, 0x97, 0xB3}, // channel = 12, Tf = 2467MHz - {0x01, 0x97, 0xB3}, // channel = 13, Tf = 2472MHz - {0x03, 0x37, 0xC3} // channel = 14, Tf = 2484MHz - }; + {0x01, 0x97, 0x83}, // channel = 1, Tf = 2412MHz + {0x01, 0x97, 0x83}, // channel = 2, Tf = 2417MHz + {0x01, 0x97, 0x93}, // channel = 3, Tf = 2422MHz + {0x01, 0x97, 0x93}, // channel = 4, Tf = 2427MHz + {0x01, 0x97, 0x93}, // channel = 5, Tf = 2432MHz + {0x01, 0x97, 0x93}, // channel = 6, Tf = 2437MHz + {0x01, 0x97, 0xA3}, // channel = 7, Tf = 2442MHz + {0x01, 0x97, 0xA3}, // channel = 8, Tf = 2447MHz + {0x01, 0x97, 0xA3}, // channel = 9, Tf = 2452MHz + {0x01, 0x97, 0xA3}, // channel = 10, Tf = 2457MHz + {0x01, 0x97, 0xB3}, // channel = 11, Tf = 2462MHz + {0x01, 0x97, 0xB3}, // channel = 12, Tf = 2467MHz + {0x01, 0x97, 0xB3}, // channel = 13, Tf = 2472MHz + {0x03, 0x37, 0xC3} // channel = 14, Tf = 2484MHz +}; static u8 vt3226_channel_table1[CB_MAX_CHANNEL_24G][3] = { - {0x02, 0x66, 0x64}, // channel = 1, Tf = 2412MHz - {0x03, 0x66, 0x64}, // channel = 2, Tf = 2417MHz - {0x00, 0x66, 0x64}, // channel = 3, Tf = 2422MHz - {0x01, 0x66, 0x64}, // channel = 4, Tf = 2427MHz - {0x02, 0x66, 0x64}, // channel = 5, Tf = 2432MHz - {0x03, 0x66, 0x64}, // channel = 6, Tf = 2437MHz - {0x00, 0x66, 0x64}, // channel = 7, Tf = 2442MHz - {0x01, 0x66, 0x64}, // channel = 8, Tf = 2447MHz - {0x02, 0x66, 0x64}, // channel = 9, Tf = 2452MHz - {0x03, 0x66, 0x64}, // channel = 10, Tf = 2457MHz - {0x00, 0x66, 0x64}, // channel = 11, Tf = 2462MHz - {0x01, 0x66, 0x64}, // channel = 12, Tf = 2467MHz - {0x02, 0x66, 0x64}, // channel = 13, Tf = 2472MHz - {0x00, 0xCC, 0xC4} // channel = 14, Tf = 2484MHz - }; + {0x02, 0x66, 0x64}, // channel = 1, Tf = 2412MHz + {0x03, 0x66, 0x64}, // channel = 2, Tf = 2417MHz + {0x00, 0x66, 0x64}, // channel = 3, Tf = 2422MHz + {0x01, 0x66, 0x64}, // channel = 4, Tf = 2427MHz + {0x02, 0x66, 0x64}, // channel = 5, Tf = 2432MHz + {0x03, 0x66, 0x64}, // channel = 6, Tf = 2437MHz + {0x00, 0x66, 0x64}, // channel = 7, Tf = 2442MHz + {0x01, 0x66, 0x64}, // channel = 8, Tf = 2447MHz + {0x02, 0x66, 0x64}, // channel = 9, Tf = 2452MHz + {0x03, 0x66, 0x64}, // channel = 10, Tf = 2457MHz + {0x00, 0x66, 0x64}, // channel = 11, Tf = 2462MHz + {0x01, 0x66, 0x64}, // channel = 12, Tf = 2467MHz + {0x02, 0x66, 0x64}, // channel = 13, Tf = 2472MHz + {0x00, 0xCC, 0xC4} // channel = 14, Tf = 2484MHz +}; ///}}RobertYu //{{RobertYu:20060502, TWIF 1.14, LO Current for 11b mode static const u32 vt3226d0_lo_current_table[CB_MAX_CHANNEL_24G] = { - 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz - 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz - 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz - 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz - 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz - 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz - 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz - 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz - 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz - 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz - 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz - 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz - 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz - 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW // channel = 14, Tf = 2484MHz + 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz + 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz + 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz + 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz + 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz + 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz + 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz + 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz + 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz + 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz + 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz + 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz + 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz + 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW // channel = 14, Tf = 2484MHz }; //}} //{{RobertYu:20060609 static u8 vt3342a0_init_table[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */ - {0x03, 0xFF, 0x80}, //update for mode// - {0x02, 0x08, 0x81}, - {0x00, 0xC6, 0x02}, - {0x03, 0xC5, 0x13}, // channel6 - {0x00, 0xEE, 0xE4}, // channel6 - {0x00, 0x71, 0xA5}, - {0x01, 0x75, 0x46}, - {0x01, 0x40, 0x27}, - {0x01, 0x54, 0x08}, - {0x00, 0x01, 0x69}, - {0x02, 0x00, 0xAA}, - {0x00, 0x08, 0xCB}, - {0x01, 0x70, 0x0C} - }; - - //11b/g mode: 0x03, 0xFF, 0x80, - //11a mode: 0x03, 0xFF, 0xC0, - - // channel44, 5220MHz 0x00C402 - // channel56, 5280MHz 0x00C402 for disable Frac - // other channels 0x00C602 + {0x03, 0xFF, 0x80}, //update for mode// + {0x02, 0x08, 0x81}, + {0x00, 0xC6, 0x02}, + {0x03, 0xC5, 0x13}, // channel6 + {0x00, 0xEE, 0xE4}, // channel6 + {0x00, 0x71, 0xA5}, + {0x01, 0x75, 0x46}, + {0x01, 0x40, 0x27}, + {0x01, 0x54, 0x08}, + {0x00, 0x01, 0x69}, + {0x02, 0x00, 0xAA}, + {0x00, 0x08, 0xCB}, + {0x01, 0x70, 0x0C} +}; + +//11b/g mode: 0x03, 0xFF, 0x80, +//11a mode: 0x03, 0xFF, 0xC0, + +// channel44, 5220MHz 0x00C402 +// channel56, 5280MHz 0x00C402 for disable Frac +// other channels 0x00C602 static u8 vt3342_channel_table0[CB_MAX_CHANNEL][3] = { - {0x02, 0x05, 0x03}, // channel = 1, Tf = 2412MHz - {0x01, 0x15, 0x03}, // channel = 2, Tf = 2417MHz - {0x03, 0xC5, 0x03}, // channel = 3, Tf = 2422MHz - {0x02, 0x65, 0x03}, // channel = 4, Tf = 2427MHz - {0x01, 0x15, 0x13}, // channel = 5, Tf = 2432MHz - {0x03, 0xC5, 0x13}, // channel = 6, Tf = 2437MHz - {0x02, 0x05, 0x13}, // channel = 7, Tf = 2442MHz - {0x01, 0x15, 0x13}, // channel = 8, Tf = 2447MHz - {0x03, 0xC5, 0x13}, // channel = 9, Tf = 2452MHz - {0x02, 0x65, 0x13}, // channel = 10, Tf = 2457MHz - {0x01, 0x15, 0x23}, // channel = 11, Tf = 2462MHz - {0x03, 0xC5, 0x23}, // channel = 12, Tf = 2467MHz - {0x02, 0x05, 0x23}, // channel = 13, Tf = 2472MHz - {0x00, 0xD5, 0x23}, // channel = 14, Tf = 2484MHz - - // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) - {0x01, 0x15, 0x13}, // channel = 183, Tf = 4915MHz (15), TBD - {0x01, 0x15, 0x13}, // channel = 184, Tf = 4920MHz (16), TBD - {0x01, 0x15, 0x13}, // channel = 185, Tf = 4925MHz (17), TBD - {0x01, 0x15, 0x13}, // channel = 187, Tf = 4935MHz (18), TBD - {0x01, 0x15, 0x13}, // channel = 188, Tf = 4940MHz (19), TBD - {0x01, 0x15, 0x13}, // channel = 189, Tf = 4945MHz (20), TBD - {0x01, 0x15, 0x13}, // channel = 192, Tf = 4960MHz (21), TBD - {0x01, 0x15, 0x13}, // channel = 196, Tf = 4980MHz (22), TBD - - // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, - // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) - {0x01, 0x15, 0x13}, // channel = 7, Tf = 5035MHz (23), TBD - {0x01, 0x15, 0x13}, // channel = 8, Tf = 5040MHz (24), TBD - {0x01, 0x15, 0x13}, // channel = 9, Tf = 5045MHz (25), TBD - {0x01, 0x15, 0x13}, // channel = 11, Tf = 5055MHz (26), TBD - {0x01, 0x15, 0x13}, // channel = 12, Tf = 5060MHz (27), TBD - {0x01, 0x15, 0x13}, // channel = 16, Tf = 5080MHz (28), TBD - {0x01, 0x15, 0x13}, // channel = 34, Tf = 5170MHz (29), TBD - {0x01, 0x55, 0x63}, // channel = 36, Tf = 5180MHz (30) - {0x01, 0x55, 0x63}, // channel = 38, Tf = 5190MHz (31), TBD - {0x02, 0xA5, 0x63}, // channel = 40, Tf = 5200MHz (32) - {0x02, 0xA5, 0x63}, // channel = 42, Tf = 5210MHz (33), TBD - {0x00, 0x05, 0x73}, // channel = 44, Tf = 5220MHz (34) - {0x00, 0x05, 0x73}, // channel = 46, Tf = 5230MHz (35), TBD - {0x01, 0x55, 0x73}, // channel = 48, Tf = 5240MHz (36) - {0x02, 0xA5, 0x73}, // channel = 52, Tf = 5260MHz (37) - {0x00, 0x05, 0x83}, // channel = 56, Tf = 5280MHz (38) - {0x01, 0x55, 0x83}, // channel = 60, Tf = 5300MHz (39) - {0x02, 0xA5, 0x83}, // channel = 64, Tf = 5320MHz (40) - - {0x02, 0xA5, 0x83}, // channel = 100, Tf = 5500MHz (41), TBD - {0x02, 0xA5, 0x83}, // channel = 104, Tf = 5520MHz (42), TBD - {0x02, 0xA5, 0x83}, // channel = 108, Tf = 5540MHz (43), TBD - {0x02, 0xA5, 0x83}, // channel = 112, Tf = 5560MHz (44), TBD - {0x02, 0xA5, 0x83}, // channel = 116, Tf = 5580MHz (45), TBD - {0x02, 0xA5, 0x83}, // channel = 120, Tf = 5600MHz (46), TBD - {0x02, 0xA5, 0x83}, // channel = 124, Tf = 5620MHz (47), TBD - {0x02, 0xA5, 0x83}, // channel = 128, Tf = 5640MHz (48), TBD - {0x02, 0xA5, 0x83}, // channel = 132, Tf = 5660MHz (49), TBD - {0x02, 0xA5, 0x83}, // channel = 136, Tf = 5680MHz (50), TBD - {0x02, 0xA5, 0x83}, // channel = 140, Tf = 5700MHz (51), TBD - - {0x00, 0x05, 0xF3}, // channel = 149, Tf = 5745MHz (52) - {0x01, 0x56, 0x03}, // channel = 153, Tf = 5765MHz (53) - {0x02, 0xA6, 0x03}, // channel = 157, Tf = 5785MHz (54) - {0x00, 0x06, 0x03}, // channel = 161, Tf = 5805MHz (55) - {0x00, 0x06, 0x03} // channel = 165, Tf = 5825MHz (56), TBD - }; + {0x02, 0x05, 0x03}, // channel = 1, Tf = 2412MHz + {0x01, 0x15, 0x03}, // channel = 2, Tf = 2417MHz + {0x03, 0xC5, 0x03}, // channel = 3, Tf = 2422MHz + {0x02, 0x65, 0x03}, // channel = 4, Tf = 2427MHz + {0x01, 0x15, 0x13}, // channel = 5, Tf = 2432MHz + {0x03, 0xC5, 0x13}, // channel = 6, Tf = 2437MHz + {0x02, 0x05, 0x13}, // channel = 7, Tf = 2442MHz + {0x01, 0x15, 0x13}, // channel = 8, Tf = 2447MHz + {0x03, 0xC5, 0x13}, // channel = 9, Tf = 2452MHz + {0x02, 0x65, 0x13}, // channel = 10, Tf = 2457MHz + {0x01, 0x15, 0x23}, // channel = 11, Tf = 2462MHz + {0x03, 0xC5, 0x23}, // channel = 12, Tf = 2467MHz + {0x02, 0x05, 0x23}, // channel = 13, Tf = 2472MHz + {0x00, 0xD5, 0x23}, // channel = 14, Tf = 2484MHz + + // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) + {0x01, 0x15, 0x13}, // channel = 183, Tf = 4915MHz (15), TBD + {0x01, 0x15, 0x13}, // channel = 184, Tf = 4920MHz (16), TBD + {0x01, 0x15, 0x13}, // channel = 185, Tf = 4925MHz (17), TBD + {0x01, 0x15, 0x13}, // channel = 187, Tf = 4935MHz (18), TBD + {0x01, 0x15, 0x13}, // channel = 188, Tf = 4940MHz (19), TBD + {0x01, 0x15, 0x13}, // channel = 189, Tf = 4945MHz (20), TBD + {0x01, 0x15, 0x13}, // channel = 192, Tf = 4960MHz (21), TBD + {0x01, 0x15, 0x13}, // channel = 196, Tf = 4980MHz (22), TBD + + // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, + // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) + {0x01, 0x15, 0x13}, // channel = 7, Tf = 5035MHz (23), TBD + {0x01, 0x15, 0x13}, // channel = 8, Tf = 5040MHz (24), TBD + {0x01, 0x15, 0x13}, // channel = 9, Tf = 5045MHz (25), TBD + {0x01, 0x15, 0x13}, // channel = 11, Tf = 5055MHz (26), TBD + {0x01, 0x15, 0x13}, // channel = 12, Tf = 5060MHz (27), TBD + {0x01, 0x15, 0x13}, // channel = 16, Tf = 5080MHz (28), TBD + {0x01, 0x15, 0x13}, // channel = 34, Tf = 5170MHz (29), TBD + {0x01, 0x55, 0x63}, // channel = 36, Tf = 5180MHz (30) + {0x01, 0x55, 0x63}, // channel = 38, Tf = 5190MHz (31), TBD + {0x02, 0xA5, 0x63}, // channel = 40, Tf = 5200MHz (32) + {0x02, 0xA5, 0x63}, // channel = 42, Tf = 5210MHz (33), TBD + {0x00, 0x05, 0x73}, // channel = 44, Tf = 5220MHz (34) + {0x00, 0x05, 0x73}, // channel = 46, Tf = 5230MHz (35), TBD + {0x01, 0x55, 0x73}, // channel = 48, Tf = 5240MHz (36) + {0x02, 0xA5, 0x73}, // channel = 52, Tf = 5260MHz (37) + {0x00, 0x05, 0x83}, // channel = 56, Tf = 5280MHz (38) + {0x01, 0x55, 0x83}, // channel = 60, Tf = 5300MHz (39) + {0x02, 0xA5, 0x83}, // channel = 64, Tf = 5320MHz (40) + + {0x02, 0xA5, 0x83}, // channel = 100, Tf = 5500MHz (41), TBD + {0x02, 0xA5, 0x83}, // channel = 104, Tf = 5520MHz (42), TBD + {0x02, 0xA5, 0x83}, // channel = 108, Tf = 5540MHz (43), TBD + {0x02, 0xA5, 0x83}, // channel = 112, Tf = 5560MHz (44), TBD + {0x02, 0xA5, 0x83}, // channel = 116, Tf = 5580MHz (45), TBD + {0x02, 0xA5, 0x83}, // channel = 120, Tf = 5600MHz (46), TBD + {0x02, 0xA5, 0x83}, // channel = 124, Tf = 5620MHz (47), TBD + {0x02, 0xA5, 0x83}, // channel = 128, Tf = 5640MHz (48), TBD + {0x02, 0xA5, 0x83}, // channel = 132, Tf = 5660MHz (49), TBD + {0x02, 0xA5, 0x83}, // channel = 136, Tf = 5680MHz (50), TBD + {0x02, 0xA5, 0x83}, // channel = 140, Tf = 5700MHz (51), TBD + + {0x00, 0x05, 0xF3}, // channel = 149, Tf = 5745MHz (52) + {0x01, 0x56, 0x03}, // channel = 153, Tf = 5765MHz (53) + {0x02, 0xA6, 0x03}, // channel = 157, Tf = 5785MHz (54) + {0x00, 0x06, 0x03}, // channel = 161, Tf = 5805MHz (55) + {0x00, 0x06, 0x03} // channel = 165, Tf = 5825MHz (56), TBD +}; static u8 vt3342_channel_table1[CB_MAX_CHANNEL][3] = { - {0x01, 0x99, 0x94}, // channel = 1, Tf = 2412MHz - {0x02, 0x44, 0x44}, // channel = 2, Tf = 2417MHz - {0x02, 0xEE, 0xE4}, // channel = 3, Tf = 2422MHz - {0x03, 0x99, 0x94}, // channel = 4, Tf = 2427MHz - {0x00, 0x44, 0x44}, // channel = 5, Tf = 2432MHz - {0x00, 0xEE, 0xE4}, // channel = 6, Tf = 2437MHz - {0x01, 0x99, 0x94}, // channel = 7, Tf = 2442MHz - {0x02, 0x44, 0x44}, // channel = 8, Tf = 2447MHz - {0x02, 0xEE, 0xE4}, // channel = 9, Tf = 2452MHz - {0x03, 0x99, 0x94}, // channel = 10, Tf = 2457MHz - {0x00, 0x44, 0x44}, // channel = 11, Tf = 2462MHz - {0x00, 0xEE, 0xE4}, // channel = 12, Tf = 2467MHz - {0x01, 0x99, 0x94}, // channel = 13, Tf = 2472MHz - {0x03, 0x33, 0x34}, // channel = 14, Tf = 2484MHz - - // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) - {0x00, 0x44, 0x44}, // channel = 183, Tf = 4915MHz (15), TBD - {0x00, 0x44, 0x44}, // channel = 184, Tf = 4920MHz (16), TBD - {0x00, 0x44, 0x44}, // channel = 185, Tf = 4925MHz (17), TBD - {0x00, 0x44, 0x44}, // channel = 187, Tf = 4935MHz (18), TBD - {0x00, 0x44, 0x44}, // channel = 188, Tf = 4940MHz (19), TBD - {0x00, 0x44, 0x44}, // channel = 189, Tf = 4945MHz (20), TBD - {0x00, 0x44, 0x44}, // channel = 192, Tf = 4960MHz (21), TBD - {0x00, 0x44, 0x44}, // channel = 196, Tf = 4980MHz (22), TBD - - // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, - // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) - {0x00, 0x44, 0x44}, // channel = 7, Tf = 5035MHz (23), TBD - {0x00, 0x44, 0x44}, // channel = 8, Tf = 5040MHz (24), TBD - {0x00, 0x44, 0x44}, // channel = 9, Tf = 5045MHz (25), TBD - {0x00, 0x44, 0x44}, // channel = 11, Tf = 5055MHz (26), TBD - {0x00, 0x44, 0x44}, // channel = 12, Tf = 5060MHz (27), TBD - {0x00, 0x44, 0x44}, // channel = 16, Tf = 5080MHz (28), TBD - {0x00, 0x44, 0x44}, // channel = 34, Tf = 5170MHz (29), TBD - {0x01, 0x55, 0x54}, // channel = 36, Tf = 5180MHz (30) - {0x01, 0x55, 0x54}, // channel = 38, Tf = 5190MHz (31), TBD - {0x02, 0xAA, 0xA4}, // channel = 40, Tf = 5200MHz (32) - {0x02, 0xAA, 0xA4}, // channel = 42, Tf = 5210MHz (33), TBD - {0x00, 0x00, 0x04}, // channel = 44, Tf = 5220MHz (34) - {0x00, 0x00, 0x04}, // channel = 46, Tf = 5230MHz (35), TBD - {0x01, 0x55, 0x54}, // channel = 48, Tf = 5240MHz (36) - {0x02, 0xAA, 0xA4}, // channel = 52, Tf = 5260MHz (37) - {0x00, 0x00, 0x04}, // channel = 56, Tf = 5280MHz (38) - {0x01, 0x55, 0x54}, // channel = 60, Tf = 5300MHz (39) - {0x02, 0xAA, 0xA4}, // channel = 64, Tf = 5320MHz (40) - {0x02, 0xAA, 0xA4}, // channel = 100, Tf = 5500MHz (41), TBD - {0x02, 0xAA, 0xA4}, // channel = 104, Tf = 5520MHz (42), TBD - {0x02, 0xAA, 0xA4}, // channel = 108, Tf = 5540MHz (43), TBD - {0x02, 0xAA, 0xA4}, // channel = 112, Tf = 5560MHz (44), TBD - {0x02, 0xAA, 0xA4}, // channel = 116, Tf = 5580MHz (45), TBD - {0x02, 0xAA, 0xA4}, // channel = 120, Tf = 5600MHz (46), TBD - {0x02, 0xAA, 0xA4}, // channel = 124, Tf = 5620MHz (47), TBD - {0x02, 0xAA, 0xA4}, // channel = 128, Tf = 5640MHz (48), TBD - {0x02, 0xAA, 0xA4}, // channel = 132, Tf = 5660MHz (49), TBD - {0x02, 0xAA, 0xA4}, // channel = 136, Tf = 5680MHz (50), TBD - {0x02, 0xAA, 0xA4}, // channel = 140, Tf = 5700MHz (51), TBD - {0x03, 0x00, 0x04}, // channel = 149, Tf = 5745MHz (52) - {0x00, 0x55, 0x54}, // channel = 153, Tf = 5765MHz (53) - {0x01, 0xAA, 0xA4}, // channel = 157, Tf = 5785MHz (54) - {0x03, 0x00, 0x04}, // channel = 161, Tf = 5805MHz (55) - {0x03, 0x00, 0x04} // channel = 165, Tf = 5825MHz (56), TBD - }; + {0x01, 0x99, 0x94}, // channel = 1, Tf = 2412MHz + {0x02, 0x44, 0x44}, // channel = 2, Tf = 2417MHz + {0x02, 0xEE, 0xE4}, // channel = 3, Tf = 2422MHz + {0x03, 0x99, 0x94}, // channel = 4, Tf = 2427MHz + {0x00, 0x44, 0x44}, // channel = 5, Tf = 2432MHz + {0x00, 0xEE, 0xE4}, // channel = 6, Tf = 2437MHz + {0x01, 0x99, 0x94}, // channel = 7, Tf = 2442MHz + {0x02, 0x44, 0x44}, // channel = 8, Tf = 2447MHz + {0x02, 0xEE, 0xE4}, // channel = 9, Tf = 2452MHz + {0x03, 0x99, 0x94}, // channel = 10, Tf = 2457MHz + {0x00, 0x44, 0x44}, // channel = 11, Tf = 2462MHz + {0x00, 0xEE, 0xE4}, // channel = 12, Tf = 2467MHz + {0x01, 0x99, 0x94}, // channel = 13, Tf = 2472MHz + {0x03, 0x33, 0x34}, // channel = 14, Tf = 2484MHz + + // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) + {0x00, 0x44, 0x44}, // channel = 183, Tf = 4915MHz (15), TBD + {0x00, 0x44, 0x44}, // channel = 184, Tf = 4920MHz (16), TBD + {0x00, 0x44, 0x44}, // channel = 185, Tf = 4925MHz (17), TBD + {0x00, 0x44, 0x44}, // channel = 187, Tf = 4935MHz (18), TBD + {0x00, 0x44, 0x44}, // channel = 188, Tf = 4940MHz (19), TBD + {0x00, 0x44, 0x44}, // channel = 189, Tf = 4945MHz (20), TBD + {0x00, 0x44, 0x44}, // channel = 192, Tf = 4960MHz (21), TBD + {0x00, 0x44, 0x44}, // channel = 196, Tf = 4980MHz (22), TBD + + // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, + // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) + {0x00, 0x44, 0x44}, // channel = 7, Tf = 5035MHz (23), TBD + {0x00, 0x44, 0x44}, // channel = 8, Tf = 5040MHz (24), TBD + {0x00, 0x44, 0x44}, // channel = 9, Tf = 5045MHz (25), TBD + {0x00, 0x44, 0x44}, // channel = 11, Tf = 5055MHz (26), TBD + {0x00, 0x44, 0x44}, // channel = 12, Tf = 5060MHz (27), TBD + {0x00, 0x44, 0x44}, // channel = 16, Tf = 5080MHz (28), TBD + {0x00, 0x44, 0x44}, // channel = 34, Tf = 5170MHz (29), TBD + {0x01, 0x55, 0x54}, // channel = 36, Tf = 5180MHz (30) + {0x01, 0x55, 0x54}, // channel = 38, Tf = 5190MHz (31), TBD + {0x02, 0xAA, 0xA4}, // channel = 40, Tf = 5200MHz (32) + {0x02, 0xAA, 0xA4}, // channel = 42, Tf = 5210MHz (33), TBD + {0x00, 0x00, 0x04}, // channel = 44, Tf = 5220MHz (34) + {0x00, 0x00, 0x04}, // channel = 46, Tf = 5230MHz (35), TBD + {0x01, 0x55, 0x54}, // channel = 48, Tf = 5240MHz (36) + {0x02, 0xAA, 0xA4}, // channel = 52, Tf = 5260MHz (37) + {0x00, 0x00, 0x04}, // channel = 56, Tf = 5280MHz (38) + {0x01, 0x55, 0x54}, // channel = 60, Tf = 5300MHz (39) + {0x02, 0xAA, 0xA4}, // channel = 64, Tf = 5320MHz (40) + {0x02, 0xAA, 0xA4}, // channel = 100, Tf = 5500MHz (41), TBD + {0x02, 0xAA, 0xA4}, // channel = 104, Tf = 5520MHz (42), TBD + {0x02, 0xAA, 0xA4}, // channel = 108, Tf = 5540MHz (43), TBD + {0x02, 0xAA, 0xA4}, // channel = 112, Tf = 5560MHz (44), TBD + {0x02, 0xAA, 0xA4}, // channel = 116, Tf = 5580MHz (45), TBD + {0x02, 0xAA, 0xA4}, // channel = 120, Tf = 5600MHz (46), TBD + {0x02, 0xAA, 0xA4}, // channel = 124, Tf = 5620MHz (47), TBD + {0x02, 0xAA, 0xA4}, // channel = 128, Tf = 5640MHz (48), TBD + {0x02, 0xAA, 0xA4}, // channel = 132, Tf = 5660MHz (49), TBD + {0x02, 0xAA, 0xA4}, // channel = 136, Tf = 5680MHz (50), TBD + {0x02, 0xAA, 0xA4}, // channel = 140, Tf = 5700MHz (51), TBD + {0x03, 0x00, 0x04}, // channel = 149, Tf = 5745MHz (52) + {0x00, 0x55, 0x54}, // channel = 153, Tf = 5765MHz (53) + {0x01, 0xAA, 0xA4}, // channel = 157, Tf = 5785MHz (54) + {0x03, 0x00, 0x04}, // channel = 161, Tf = 5805MHz (55) + {0x03, 0x00, 0x04} // channel = 165, Tf = 5825MHz (56), TBD +}; /*+ * * Power Table * --*/ + -*/ static const u32 al2230_power_table[AL2230_PWR_IDX_LEN] = { - 0x04040900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04041900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04042900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04043900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04044900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04045900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04046900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04047900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04048900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04049900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0404A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0404B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0404C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0404D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0404E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0404F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04050900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04051900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04052900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04053900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04054900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04055900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04056900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04057900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04058900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04059900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0405A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0405B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0405C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0405D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0405E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0405F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04060900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04061900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04062900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04063900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04064900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04065900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04066900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04067900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04068900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04069900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0406A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0406B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0406C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0406D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0406E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0406F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04070900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04071900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04072900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04073900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04074900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04075900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04076900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04077900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04078900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x04079900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0407A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0407B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0407C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0407D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0407E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, - 0x0407F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW - }; + 0x04040900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04041900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04042900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04043900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04044900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04045900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04046900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04047900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04048900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04049900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0404A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0404B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0404C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0404D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0404E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0404F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04050900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04051900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04052900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04053900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04054900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04055900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04056900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04057900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04058900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04059900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0405A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0405B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0405C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0405D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0405E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0405F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04060900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04061900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04062900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04063900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04064900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04065900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04066900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04067900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04068900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04069900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0406A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0406B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0406C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0406D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0406E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0406F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04070900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04071900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04072900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04073900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04074900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04075900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04076900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04077900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04078900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x04079900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0407A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0407B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0407C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0407D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0407E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0407F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW +}; //{{ RobertYu:20050103, Channel 11a Number To Index // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) @@ -670,28 +670,28 @@ static const u32 al2230_power_table[AL2230_PWR_IDX_LEN] = { // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) const u8 RFaby11aChannelIndex[200] = { - // 1 2 3 4 5 6 7 8 9 10 - 00, 00, 00, 00, 00, 00, 23, 24, 25, 00, // 10 - 26, 27, 00, 00, 00, 28, 00, 00, 00, 00, // 20 - 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, // 30 - 00, 00, 00, 29, 00, 30, 00, 31, 00, 32, // 40 - 00, 33, 00, 34, 00, 35, 00, 36, 00, 00, // 50 - 00, 37, 00, 00, 00, 38, 00, 00, 00, 39, // 60 - 00, 00, 00, 40, 00, 00, 00, 00, 00, 00, // 70 - 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, // 80 - 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, // 90 - 00, 00, 00, 00, 00, 00, 00, 00, 00, 41, //100 - - 00, 00, 00, 42, 00, 00, 00, 43, 00, 00, //110 - 00, 44, 00, 00, 00, 45, 00, 00, 00, 46, //120 - 00, 00, 00, 47, 00, 00, 00, 48, 00, 00, //130 - 00, 49, 00, 00, 00, 50, 00, 00, 00, 51, //140 - 00, 00, 00, 00, 00, 00, 00, 00, 52, 00, //150 - 00, 00, 53, 00, 00, 00, 54, 00, 00, 00, //160 - 55, 00, 00, 00, 56, 00, 00, 00, 00, 00, //170 - 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, //180 - 00, 00, 15, 16, 17, 00, 18, 19, 20, 00, //190 - 00, 21, 00, 00, 00, 22, 00, 00, 00, 00 //200 + // 1 2 3 4 5 6 7 8 9 10 + 00, 00, 00, 00, 00, 00, 23, 24, 25, 00, // 10 + 26, 27, 00, 00, 00, 28, 00, 00, 00, 00, // 20 + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, // 30 + 00, 00, 00, 29, 00, 30, 00, 31, 00, 32, // 40 + 00, 33, 00, 34, 00, 35, 00, 36, 00, 00, // 50 + 00, 37, 00, 00, 00, 38, 00, 00, 00, 39, // 60 + 00, 00, 00, 40, 00, 00, 00, 00, 00, 00, // 70 + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, // 80 + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, // 90 + 00, 00, 00, 00, 00, 00, 00, 00, 00, 41, //100 + + 00, 00, 00, 42, 00, 00, 00, 43, 00, 00, //110 + 00, 44, 00, 00, 00, 45, 00, 00, 00, 46, //120 + 00, 00, 00, 47, 00, 00, 00, 48, 00, 00, //130 + 00, 49, 00, 00, 00, 50, 00, 00, 00, 51, //140 + 00, 00, 00, 00, 00, 00, 00, 00, 52, 00, //150 + 00, 00, 53, 00, 00, 00, 54, 00, 00, 00, //160 + 55, 00, 00, 00, 56, 00, 00, 00, 00, 00, //170 + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, //180 + 00, 00, 15, 16, 17, 00, 18, 19, 20, 00, //190 + 00, 21, 00, 00, 00, 22, 00, 00, 00, 00 //200 }; //}} RobertYu @@ -717,7 +717,7 @@ int IFRFbWriteEmbedded(struct vnt_private *pDevice, u32 dwData) pbyData[3] = (u8)(dwData >> 24); CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_IFRF, 0, 0, 4, pbyData); + MESSAGE_TYPE_WRITE_IFRF, 0, 0, 4, pbyData); return true; } @@ -799,50 +799,50 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate) return false; ret &= IFRFbWriteEmbedded(priv, - al2230_power_table[priv->byCurPwr]); + al2230_power_table[priv->byCurPwr]); if (rate <= RATE_11M) ret &= IFRFbWriteEmbedded(priv, 0x0001b400 + - (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); else ret &= IFRFbWriteEmbedded(priv, 0x0005a400 + - (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); break; case RF_AL2230S: if (priv->byCurPwr >= AL2230_PWR_IDX_LEN) return false; ret &= IFRFbWriteEmbedded(priv, - al2230_power_table[priv->byCurPwr]); + al2230_power_table[priv->byCurPwr]); if (rate <= RATE_11M) { ret &= IFRFbWriteEmbedded(priv, 0x040c1400 + - (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); ret &= IFRFbWriteEmbedded(priv, 0x00299b00 + - (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); } else { ret &= IFRFbWriteEmbedded(priv, 0x0005a400 + - (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); ret &= IFRFbWriteEmbedded(priv, 0x00099b00 + - (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); } break; case RF_AIROHA7230: if (rate <= RATE_11M) ret &= IFRFbWriteEmbedded(priv, 0x111bb900 + - (BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW); + (BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW); else ret &= IFRFbWriteEmbedded(priv, 0x221bb900 + - (BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW); + (BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW); if (priv->byCurPwr > AL7230_PWR_IDX_LEN) return false; /* - * 0x080F1B00 for 3 wire control TxGain(D10) - * and 0x31 as TX Gain value - */ + * 0x080F1B00 for 3 wire control TxGain(D10) + * and 0x31 as TX Gain value + */ power_setting = 0x080c0b00 | ((priv->byCurPwr) << 12) | (BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW; @@ -865,8 +865,8 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate) if (rate <= RATE_11M) { power_setting = ((0x3f-priv->byCurPwr) << 20) | - (0xe07 << 8) | (BY_VT3226_REG_LEN << 3) | - IFREGCTL_REGW; + (0xe07 << 8) | (BY_VT3226_REG_LEN << 3) | + IFREGCTL_REGW; ret &= IFRFbWriteEmbedded(priv, power_setting); ret &= IFRFbWriteEmbedded(priv, 0x03c6a200 + @@ -874,33 +874,33 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate) if (priv->vnt_mgmt.eScanState != WMAC_NO_SCANNING) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "RFbRawSetPower> 11B mode uCurrChannel[%d]\n", + "RFbRawSetPower> 11B mode uCurrChannel[%d]\n", priv->vnt_mgmt.uScanChannel); ret &= IFRFbWriteEmbedded(priv, - vt3226d0_lo_current_table[priv-> + vt3226d0_lo_current_table[priv-> vnt_mgmt.uScanChannel - 1]); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "RFbRawSetPower> 11B mode uCurrChannel[%d]\n", + "RFbRawSetPower> 11B mode uCurrChannel[%d]\n", priv->vnt_mgmt.uCurrChannel); ret &= IFRFbWriteEmbedded(priv, - vt3226d0_lo_current_table[priv-> + vt3226d0_lo_current_table[priv-> vnt_mgmt.uCurrChannel - 1]); } ret &= IFRFbWriteEmbedded(priv, 0x015C0800 + - (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); + (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "@@@@ RFbRawSetPower> 11G mode\n"); power_setting = ((0x3f-priv->byCurPwr) << 20) | - (0x7 << 8) | (BY_VT3226_REG_LEN << 3) | + (0x7 << 8) | (BY_VT3226_REG_LEN << 3) | IFREGCTL_REGW; ret &= IFRFbWriteEmbedded(priv, power_setting); ret &= IFRFbWriteEmbedded(priv, 0x00C6A200 + - (BY_VT3226_REG_LEN << 3) + IFREGCTL_REGW); + (BY_VT3226_REG_LEN << 3) + IFREGCTL_REGW); ret &= IFRFbWriteEmbedded(priv, 0x016BC600 + (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); ret &= IFRFbWriteEmbedded(priv, 0x00900800 + @@ -913,8 +913,8 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate) return false; power_setting = ((0x3F-priv->byCurPwr) << 20) | - (0x27 << 8) | (BY_VT3342_REG_LEN << 3) | - IFREGCTL_REGW; + (0x27 << 8) | (BY_VT3342_REG_LEN << 3) | + IFREGCTL_REGW; ret &= IFRFbWriteEmbedded(priv, power_setting); @@ -939,7 +939,7 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate) * * Return Value: none * --*/ + -*/ void RFvRSSITodBm(struct vnt_private *priv, u8 rssi, long *dbm) { u8 idx = (((rssi & 0xc0) >> 6) & 0x03); @@ -1018,7 +1018,7 @@ void RFbRFTableDownload(struct vnt_private *priv) memcpy(array, addr1, length1); CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_RF_INIT, length1, array); + MESSAGE_REQUEST_RF_INIT, length1, array); /* Channel Table 0 */ value = 0; @@ -1031,7 +1031,7 @@ void RFbRFTableDownload(struct vnt_private *priv) memcpy(array, addr2, length); CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, - value, MESSAGE_REQUEST_RF_CH0, length, array); + value, MESSAGE_REQUEST_RF_CH0, length, array); length2 -= length; value += length; @@ -1049,7 +1049,7 @@ void RFbRFTableDownload(struct vnt_private *priv) memcpy(array, addr3, length); CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, - value, MESSAGE_REQUEST_RF_CH1, length, array); + value, MESSAGE_REQUEST_RF_CH1, length, array); length3 -= length; value += length; @@ -1066,7 +1066,7 @@ void RFbRFTableDownload(struct vnt_private *priv) /* Init Table 2 */ CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, - 0, MESSAGE_REQUEST_RF_INIT2, length1, array); + 0, MESSAGE_REQUEST_RF_INIT2, length1, array); /* Channel Table 0 */ value = 0; @@ -1079,7 +1079,7 @@ void RFbRFTableDownload(struct vnt_private *priv) memcpy(array, addr2, length); CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, - value, MESSAGE_REQUEST_RF_CH2, length, array); + value, MESSAGE_REQUEST_RF_CH2, length, array); length2 -= length; value += length; diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h index 3661f82..1ab0704 100644 --- a/drivers/staging/vt6656/rndis.h +++ b/drivers/staging/vt6656/rndis.h @@ -70,13 +70,13 @@ typedef struct _CMD_MESSAGE { - u8 byData[256]; + u8 byData[256]; } CMD_MESSAGE, *PCMD_MESSAGE; typedef struct _CMD_WRITE_MASK { - u8 byData; - u8 byMask; + u8 byData; + u8 byMask; } CMD_WRITE_MASK, *PCMD_WRITE_MASK; struct vnt_cmd_card_init @@ -99,51 +99,51 @@ struct vnt_rsp_card_init typedef struct _CMD_SET_KEY { - u16 wKCTL; - u8 abyMacAddr[6]; - u8 abyKey[16]; + u16 wKCTL; + u8 abyMacAddr[6]; + u8 abyKey[16]; } CMD_SET_KEY, *PCMD_SET_KEY; typedef struct _CMD_CLRKEY_ENTRY { - u8 abyKeyEntry[11]; + u8 abyKeyEntry[11]; } CMD_CLRKEY_ENTRY, *PCMD_CLRKEY_ENTRY; typedef struct _CMD_WRITE_MISCFF { - u32 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 { - u8 abyTSF_TBTT[8]; + u8 abyTSF_TBTT[8]; } CMD_SET_TSFTBTT, *PCMD_SET_TSFTBTT; typedef struct _CMD_SET_SSTIFS { - u8 bySIFS; - u8 byDIFS; - u8 byEIFS; - u8 bySlotTime; - u8 byCwMax_Min; - u8 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 { - 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]; + 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; #define EXCH_WORD(w) ((u16)((u16)(w)<<8) | (u16)((u16)(w)>>8)) diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 3840323..32c07d5 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -65,18 +65,18 @@ static int msglevel = MSG_LEVEL_INFO; static 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 - }; + {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 +}; static 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 - }; + {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, // fallback_rate0 + {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, // fallback_rate1 +}; static 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 - }; + {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 @@ -94,50 +94,50 @@ static const u16 wFB_Opt1[2][5] = { #define DATADUR_A_F1 13 static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, - u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl); + u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl); static struct vnt_usb_send_context *s_vGetFreeContext(struct vnt_private *); static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, - u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer, - struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize, - int bNeedACK, u32 uDMAIdx, struct ethhdr *psEthHeader, bool need_rts); + u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer, + struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize, + int bNeedACK, u32 uDMAIdx, struct ethhdr *psEthHeader, bool need_rts); static void s_vGenerateMACHeader(struct vnt_private *pDevice, - u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, - int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx); + u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, + int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx); static void s_vFillTxKey(struct vnt_private *pDevice, - struct vnt_tx_fifo_head *fifo_head, u8 *pbyIVHead, - PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen, - struct vnt_mic_hdr *mic_hdr); + struct vnt_tx_fifo_head *fifo_head, u8 *pbyIVHead, + PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen, + struct vnt_mic_hdr *mic_hdr); static void s_vSWencryption(struct vnt_private *pDevice, - PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize); + PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize); static unsigned int s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType, - u32 cbFrameLength, u16 wRate, int bNeedAck); + u32 cbFrameLength, u16 wRate, int bNeedAck); static __le16 s_uGetRTSCTSRsvTime(struct vnt_private *priv, - u8 rsv_type, u8 pkt_type, u32 frame_lenght, u16 current_rate); + u8 rsv_type, u8 pkt_type, u32 frame_lenght, u16 current_rate); static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, - u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength, - int bNeedAck, u16 wCurrentRate, u8 byFBOption); + u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength, + int bNeedAck, u16 wCurrentRate, u8 byFBOption); static u16 s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, - union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck, - struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption); + union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck, + struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption); static __le16 s_uGetDataDuration(struct vnt_private *pDevice, - u8 byPktType, int bNeedAck); + u8 byPktType, int bNeedAck); static __le16 s_uGetRTSCTSDuration(struct vnt_private *pDevice, - u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate, - int bNeedAck, u8 byFBOption); + u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate, + int bNeedAck, u8 byFBOption); -static struct vnt_usb_send_context - *s_vGetFreeContext(struct vnt_private *priv) + static struct vnt_usb_send_context +*s_vGetFreeContext(struct vnt_private *priv) { struct vnt_usb_send_context *context = NULL; int ii; @@ -164,7 +164,7 @@ static struct vnt_usb_send_context } static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, - u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl) + u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl) { struct net_device_stats *stats = &pDevice->stats; struct vnt_tx_pkt_info *pkt_info = pDevice->pkt_info; @@ -176,9 +176,9 @@ static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, } static void s_vFillTxKey(struct vnt_private *pDevice, - struct vnt_tx_fifo_head *fifo_head, u8 *pbyIVHead, - PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen, - struct vnt_mic_hdr *mic_hdr) + struct vnt_tx_fifo_head *fifo_head, u8 *pbyIVHead, + PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen, + struct vnt_mic_hdr *mic_hdr) { u8 *pbyBuf = (u8 *)&fifo_head->adwTxKey[0]; u32 *pdwIV = (u32 *)pbyIVHead; @@ -199,14 +199,14 @@ static void s_vFillTxKey(struct vnt_private *pDevice, if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN) { memcpy(pDevice->abyPRNG, (u8 *)&dwRevIVCounter, 3); memcpy(pDevice->abyPRNG + 3, pTransmitKey->abyKey, - pTransmitKey->uKeyLength); + pTransmitKey->uKeyLength); } else { memcpy(pbyBuf, (u8 *)&dwRevIVCounter, 3); memcpy(pbyBuf + 3, pTransmitKey->abyKey, - pTransmitKey->uKeyLength); + pTransmitKey->uKeyLength); if (pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) { memcpy(pbyBuf+8, (u8 *)&dwRevIVCounter, 3); - memcpy(pbyBuf+11, pTransmitKey->abyKey, + memcpy(pbyBuf+11, pTransmitKey->abyKey, pTransmitKey->uKeyLength); } @@ -228,20 +228,20 @@ static void s_vFillTxKey(struct vnt_private *pDevice, pTransmitKey->dwTSC47_16++; TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr, - pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, - pDevice->abyPRNG); + pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, + pDevice->abyPRNG); memcpy(pbyBuf, pDevice->abyPRNG, 16); /* Make IV */ memcpy(pdwIV, pDevice->abyPRNG, 3); *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) & - 0xc0) | 0x20); + 0xc0) | 0x20); /* Append IV&ExtIV after Mac Header */ *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "vFillTxKey()---- pdwExtIV: %x\n", *pdwExtIV); + "vFillTxKey()---- pdwExtIV: %x\n", *pdwExtIV); break; case KEY_CTL_CCMP: @@ -254,7 +254,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, /* Make IV */ *pdwIV = 0; *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) & - 0xc0) | 0x20); + 0xc0) | 0x20); *pdwIV |= cpu_to_le16((u16)(pTransmitKey->wTSC15_0)); @@ -284,7 +284,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, /* MICHDR2 */ memcpy(mic_hdr->addr3, pMACHeader->addr3, ETH_ALEN); mic_hdr->frame_control = cpu_to_le16(pMACHeader->frame_control - & 0xc78f); + & 0xc78f); mic_hdr->seq_ctrl = cpu_to_le16(pMACHeader->seq_ctrl & 0xf); if (ieee80211_has_a4(pMACHeader->frame_control)) @@ -293,65 +293,65 @@ static void s_vFillTxKey(struct vnt_private *pDevice, } static void s_vSWencryption(struct vnt_private *pDevice, - PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize) + PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize) { u32 cbICVlen = 4; u32 dwICV = 0xffffffff; u32 *pdwICV; - if (pTransmitKey == NULL) - return; - - if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { - //======================================================================= - // Append ICV after payload - dwICV = CRCdwGetCrc32Ex(pbyPayloadHead, wPayloadSize, dwICV);//ICV(Payload) - pdwICV = (u32 *)(pbyPayloadHead + wPayloadSize); - // finally, we must invert dwCRC to get the correct answer - *pdwICV = cpu_to_le32(~dwICV); - // RC4 encryption - rc4_init(&pDevice->SBox, pDevice->abyPRNG, pTransmitKey->uKeyLength + 3); - rc4_encrypt(&pDevice->SBox, pbyPayloadHead, pbyPayloadHead, wPayloadSize+cbICVlen); - //======================================================================= - } else if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) { - //======================================================================= - //Append ICV after payload - dwICV = CRCdwGetCrc32Ex(pbyPayloadHead, wPayloadSize, dwICV);//ICV(Payload) - pdwICV = (u32 *)(pbyPayloadHead + wPayloadSize); - // finally, we must invert dwCRC to get the correct answer - *pdwICV = cpu_to_le32(~dwICV); - // RC4 encryption - rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); - rc4_encrypt(&pDevice->SBox, pbyPayloadHead, pbyPayloadHead, wPayloadSize+cbICVlen); - //======================================================================= - } + if (pTransmitKey == NULL) + return; + + if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { + //======================================================================= + // Append ICV after payload + dwICV = CRCdwGetCrc32Ex(pbyPayloadHead, wPayloadSize, dwICV);//ICV(Payload) + pdwICV = (u32 *)(pbyPayloadHead + wPayloadSize); + // finally, we must invert dwCRC to get the correct answer + *pdwICV = cpu_to_le32(~dwICV); + // RC4 encryption + rc4_init(&pDevice->SBox, pDevice->abyPRNG, pTransmitKey->uKeyLength + 3); + rc4_encrypt(&pDevice->SBox, pbyPayloadHead, pbyPayloadHead, wPayloadSize+cbICVlen); + //======================================================================= + } else if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) { + //======================================================================= + //Append ICV after payload + dwICV = CRCdwGetCrc32Ex(pbyPayloadHead, wPayloadSize, dwICV);//ICV(Payload) + pdwICV = (u32 *)(pbyPayloadHead + wPayloadSize); + // finally, we must invert dwCRC to get the correct answer + *pdwICV = cpu_to_le32(~dwICV); + // RC4 encryption + rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); + rc4_encrypt(&pDevice->SBox, pbyPayloadHead, pbyPayloadHead, wPayloadSize+cbICVlen); + //======================================================================= + } } static __le16 vnt_time_stamp_off(struct vnt_private *priv, u16 rate) { return cpu_to_le16(wTimeStampOff[priv->byPreambleType % 2] - [rate % MAX_RATE]); + [rate % MAX_RATE]); } /*byPktType : PK_TYPE_11A 0 - PK_TYPE_11B 1 - PK_TYPE_11GB 2 - PK_TYPE_11GA 3 -*/ + PK_TYPE_11B 1 + PK_TYPE_11GB 2 + PK_TYPE_11GA 3 + */ static u32 s_uGetTxRsvTime(struct vnt_private *priv, u8 pkt_type, - u32 frame_length, u16 rate, int need_ack) + u32 frame_length, u16 rate, int need_ack) { u32 data_time, ack_time; data_time = BBuGetFrameTime(priv->byPreambleType, pkt_type, - frame_length, rate); + frame_length, rate); if (pkt_type == PK_TYPE_11B) ack_time = BBuGetFrameTime(priv->byPreambleType, pkt_type, 14, - (u16)priv->byTopCCKBasicRate); + (u16)priv->byTopCCKBasicRate); else ack_time = BBuGetFrameTime(priv->byPreambleType, pkt_type, 14, - (u16)priv->byTopOFDMBasicRate); + (u16)priv->byTopOFDMBasicRate); if (need_ack) return data_time + priv->uSIFS + ack_time; @@ -360,45 +360,45 @@ static u32 s_uGetTxRsvTime(struct vnt_private *priv, u8 pkt_type, } static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type, - u32 frame_length, u16 rate, int need_ack) + u32 frame_length, u16 rate, int need_ack) { return cpu_to_le16((u16)s_uGetTxRsvTime(priv, pkt_type, - frame_length, rate, need_ack)); + frame_length, rate, need_ack)); } //byFreqType: 0=>5GHZ 1=>2.4GHZ static __le16 s_uGetRTSCTSRsvTime(struct vnt_private *priv, - u8 rsv_type, u8 pkt_type, u32 frame_lenght, u16 current_rate) + u8 rsv_type, u8 pkt_type, u32 frame_lenght, u16 current_rate) { u32 rrv_time, rts_time, cts_time, ack_time, data_time; rrv_time = rts_time = cts_time = ack_time = data_time = 0; data_time = BBuGetFrameTime(priv->byPreambleType, pkt_type, - frame_lenght, current_rate); + frame_lenght, current_rate); if (rsv_type == 0) { rts_time = BBuGetFrameTime(priv->byPreambleType, - pkt_type, 20, priv->byTopCCKBasicRate); + pkt_type, 20, priv->byTopCCKBasicRate); cts_time = ack_time = BBuGetFrameTime(priv->byPreambleType, - pkt_type, 14, priv->byTopCCKBasicRate); + pkt_type, 14, priv->byTopCCKBasicRate); } else if (rsv_type == 1) { rts_time = BBuGetFrameTime(priv->byPreambleType, - pkt_type, 20, priv->byTopCCKBasicRate); + pkt_type, 20, priv->byTopCCKBasicRate); cts_time = BBuGetFrameTime(priv->byPreambleType, pkt_type, - 14, priv->byTopCCKBasicRate); + 14, priv->byTopCCKBasicRate); ack_time = BBuGetFrameTime(priv->byPreambleType, pkt_type, - 14, priv->byTopOFDMBasicRate); + 14, priv->byTopOFDMBasicRate); } else if (rsv_type == 2) { rts_time = BBuGetFrameTime(priv->byPreambleType, pkt_type, - 20, priv->byTopOFDMBasicRate); + 20, priv->byTopOFDMBasicRate); cts_time = ack_time = BBuGetFrameTime(priv->byPreambleType, - pkt_type, 14, priv->byTopOFDMBasicRate); + pkt_type, 14, priv->byTopOFDMBasicRate); } else if (rsv_type == 3) { cts_time = BBuGetFrameTime(priv->byPreambleType, pkt_type, - 14, priv->byTopCCKBasicRate); + 14, priv->byTopCCKBasicRate); ack_time = BBuGetFrameTime(priv->byPreambleType, pkt_type, - 14, priv->byTopOFDMBasicRate); + 14, priv->byTopOFDMBasicRate); rrv_time = cts_time + ack_time + data_time + 2 * priv->uSIFS; @@ -412,17 +412,17 @@ static __le16 s_uGetRTSCTSRsvTime(struct vnt_private *priv, //byFreqType 0: 5GHz, 1:2.4Ghz static __le16 s_uGetDataDuration(struct vnt_private *pDevice, - u8 byPktType, int bNeedAck) + u8 byPktType, int bNeedAck) { u32 uAckTime = 0; if (bNeedAck) { if (byPktType == PK_TYPE_11B) uAckTime = BBuGetFrameTime(pDevice->byPreambleType, - byPktType, 14, pDevice->byTopCCKBasicRate); + byPktType, 14, pDevice->byTopCCKBasicRate); else uAckTime = BBuGetFrameTime(pDevice->byPreambleType, - byPktType, 14, pDevice->byTopOFDMBasicRate); + byPktType, 14, pDevice->byTopOFDMBasicRate); return cpu_to_le16((u16)(pDevice->uSIFS + uAckTime)); } @@ -431,8 +431,8 @@ static __le16 s_uGetDataDuration(struct vnt_private *pDevice, //byFreqType: 0=>5GHZ 1=>2.4GHZ static __le16 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, - u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, - u8 byFBOption) + u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, + u8 byFBOption) { u32 uCTSTime = 0, uDurTime = 0; @@ -442,9 +442,9 @@ static __le16 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, case RTSDUR_BA_F0: case RTSDUR_BA_F1: uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, - 14, pDevice->byTopCCKBasicRate); + 14, pDevice->byTopCCKBasicRate); uDurTime = uCTSTime + 2 * pDevice->uSIFS + - s_uGetTxRsvTime(pDevice, byPktType, + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); break; @@ -452,9 +452,9 @@ static __le16 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, case RTSDUR_AA_F0: case RTSDUR_AA_F1: uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, - 14, pDevice->byTopOFDMBasicRate); + 14, pDevice->byTopOFDMBasicRate); uDurTime = uCTSTime + 2 * pDevice->uSIFS + - s_uGetTxRsvTime(pDevice, byPktType, + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); break; @@ -478,7 +478,7 @@ static u16 vnt_rxtx_datahead_g(struct vnt_private *priv, u8 pkt_type, u16 rate, /* Get SignalField,ServiceField,Length */ BBvCalculateParameter(priv, frame_len, rate, pkt_type, &buf->a); BBvCalculateParameter(priv, frame_len, priv->byTopCCKBasicRate, - PK_TYPE_11B, &buf->b); + PK_TYPE_11B, &buf->b); /* Get Duration and TimeStamp */ buf->duration_a = s_uGetDataDuration(priv, pkt_type, need_ack); @@ -486,7 +486,7 @@ static u16 vnt_rxtx_datahead_g(struct vnt_private *priv, u8 pkt_type, u16 rate, buf->time_stamp_off_a = vnt_time_stamp_off(priv, rate); buf->time_stamp_off_b = vnt_time_stamp_off(priv, - priv->byTopCCKBasicRate); + priv->byTopCCKBasicRate); return le16_to_cpu(buf->duration_a); } @@ -499,7 +499,7 @@ static u16 vnt_rxtx_datahead_g_fb(struct vnt_private *priv, u8 pkt_type, BBvCalculateParameter(priv, frame_len, rate, pkt_type, &buf->a); BBvCalculateParameter(priv, frame_len, priv->byTopCCKBasicRate, - PK_TYPE_11B, &buf->b); + PK_TYPE_11B, &buf->b); /* Get Duration and TimeStamp */ buf->duration_a = s_uGetDataDuration(priv, pkt_type, need_ack); @@ -510,7 +510,7 @@ static u16 vnt_rxtx_datahead_g_fb(struct vnt_private *priv, u8 pkt_type, buf->time_stamp_off_a = vnt_time_stamp_off(priv, rate); buf->time_stamp_off_b = vnt_time_stamp_off(priv, - priv->byTopCCKBasicRate); + priv->byTopCCKBasicRate); return le16_to_cpu(buf->duration_a); } @@ -547,14 +547,14 @@ static u16 vnt_rxtx_datahead_ab(struct vnt_private *priv, u8 pkt_type, } static int vnt_fill_ieee80211_rts(struct vnt_private *priv, - struct ieee80211_rts *rts, struct ethhdr *eth_hdr, + struct ieee80211_rts *rts, struct ethhdr *eth_hdr, __le16 duration) { rts->duration = duration; rts->frame_control = TYPE_CTL_RTS; if (priv->op_mode == NL80211_IFTYPE_ADHOC || - priv->op_mode == NL80211_IFTYPE_AP) + priv->op_mode == NL80211_IFTYPE_AP) memcpy(rts->ra, eth_hdr->h_dest, ETH_ALEN); else memcpy(rts->ra, priv->abyBSSID, ETH_ALEN); @@ -568,23 +568,23 @@ static int vnt_fill_ieee80211_rts(struct vnt_private *priv, } static u16 vnt_rxtx_rts_g_head(struct vnt_private *priv, - struct vnt_rts_g *buf, struct ethhdr *eth_hdr, - u8 pkt_type, u32 frame_len, int need_ack, - u16 current_rate, u8 fb_option) + struct vnt_rts_g *buf, struct ethhdr *eth_hdr, + u8 pkt_type, u32 frame_len, int need_ack, + u16 current_rate, u8 fb_option) { u16 rts_frame_len = 20; BBvCalculateParameter(priv, rts_frame_len, priv->byTopCCKBasicRate, - PK_TYPE_11B, &buf->b); + PK_TYPE_11B, &buf->b); BBvCalculateParameter(priv, rts_frame_len, - priv->byTopOFDMBasicRate, pkt_type, &buf->a); + priv->byTopOFDMBasicRate, pkt_type, &buf->a); buf->duration_bb = s_uGetRTSCTSDuration(priv, RTSDUR_BB, frame_len, - PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack, fb_option); + PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack, fb_option); buf->duration_aa = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len, - pkt_type, current_rate, need_ack, fb_option); + pkt_type, current_rate, need_ack, fb_option); buf->duration_ba = s_uGetRTSCTSDuration(priv, RTSDUR_BA, frame_len, - pkt_type, current_rate, need_ack, fb_option); + pkt_type, current_rate, need_ack, fb_option); vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->duration_aa); @@ -593,34 +593,34 @@ static u16 vnt_rxtx_rts_g_head(struct vnt_private *priv, } static u16 vnt_rxtx_rts_g_fb_head(struct vnt_private *priv, - struct vnt_rts_g_fb *buf, struct ethhdr *eth_hdr, - u8 pkt_type, u32 frame_len, int need_ack, - u16 current_rate, u8 fb_option) + struct vnt_rts_g_fb *buf, struct ethhdr *eth_hdr, + u8 pkt_type, u32 frame_len, int need_ack, + u16 current_rate, u8 fb_option) { u16 rts_frame_len = 20; BBvCalculateParameter(priv, rts_frame_len, priv->byTopCCKBasicRate, - PK_TYPE_11B, &buf->b); + PK_TYPE_11B, &buf->b); BBvCalculateParameter(priv, rts_frame_len, - priv->byTopOFDMBasicRate, pkt_type, &buf->a); + priv->byTopOFDMBasicRate, pkt_type, &buf->a); buf->duration_bb = s_uGetRTSCTSDuration(priv, RTSDUR_BB, frame_len, - PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack, fb_option); + PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack, fb_option); buf->duration_aa = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len, - pkt_type, current_rate, need_ack, fb_option); + pkt_type, current_rate, need_ack, fb_option); buf->duration_ba = s_uGetRTSCTSDuration(priv, RTSDUR_BA, frame_len, - pkt_type, current_rate, need_ack, fb_option); + pkt_type, current_rate, need_ack, fb_option); buf->rts_duration_ba_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_BA_F0, - frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option); + frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option); buf->rts_duration_aa_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F0, - frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option); + frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option); buf->rts_duration_ba_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_BA_F1, - frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option); + frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option); buf->rts_duration_aa_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F1, - frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option); + frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option); vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->duration_aa); @@ -629,17 +629,17 @@ static u16 vnt_rxtx_rts_g_fb_head(struct vnt_private *priv, } static u16 vnt_rxtx_rts_ab_head(struct vnt_private *priv, - struct vnt_rts_ab *buf, struct ethhdr *eth_hdr, - u8 pkt_type, u32 frame_len, int need_ack, - u16 current_rate, u8 fb_option) + struct vnt_rts_ab *buf, struct ethhdr *eth_hdr, + u8 pkt_type, u32 frame_len, int need_ack, + u16 current_rate, u8 fb_option) { u16 rts_frame_len = 20; BBvCalculateParameter(priv, rts_frame_len, - priv->byTopOFDMBasicRate, pkt_type, &buf->ab); + priv->byTopOFDMBasicRate, pkt_type, &buf->ab); buf->duration = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len, - pkt_type, current_rate, need_ack, fb_option); + pkt_type, current_rate, need_ack, fb_option); vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->duration); @@ -648,23 +648,23 @@ static u16 vnt_rxtx_rts_ab_head(struct vnt_private *priv, } static u16 vnt_rxtx_rts_a_fb_head(struct vnt_private *priv, - struct vnt_rts_a_fb *buf, struct ethhdr *eth_hdr, - u8 pkt_type, u32 frame_len, int need_ack, - u16 current_rate, u8 fb_option) + struct vnt_rts_a_fb *buf, struct ethhdr *eth_hdr, + u8 pkt_type, u32 frame_len, int need_ack, + u16 current_rate, u8 fb_option) { u16 rts_frame_len = 20; BBvCalculateParameter(priv, rts_frame_len, - priv->byTopOFDMBasicRate, pkt_type, &buf->a); + priv->byTopOFDMBasicRate, pkt_type, &buf->a); buf->duration = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len, - pkt_type, current_rate, need_ack, fb_option); + pkt_type, current_rate, need_ack, fb_option); buf->rts_duration_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F0, - frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option); + frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option); buf->rts_duration_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F1, - frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option); + frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option); vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->duration); @@ -673,49 +673,49 @@ static u16 vnt_rxtx_rts_a_fb_head(struct vnt_private *priv, } static u16 s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType, - union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck, - struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption) + union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck, + struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption) { if (!head) return 0; /* Note: So far RTSHead doesn't appear in ATIM - * & Beacom DMA, so we don't need to take them - * into account. - * Otherwise, we need to modified codes for them. - */ + * & Beacom DMA, so we don't need to take them + * into account. + * Otherwise, we need to modified codes for them. + */ switch (byPktType) { case PK_TYPE_11GB: case PK_TYPE_11GA: if (byFBOption == AUTO_FB_NONE) return vnt_rxtx_rts_g_head(pDevice, &head->rts_g, - psEthHeader, byPktType, cbFrameLength, - bNeedAck, wCurrentRate, byFBOption); + psEthHeader, byPktType, cbFrameLength, + bNeedAck, wCurrentRate, byFBOption); else return vnt_rxtx_rts_g_fb_head(pDevice, &head->rts_g_fb, - psEthHeader, byPktType, cbFrameLength, - bNeedAck, wCurrentRate, byFBOption); + psEthHeader, byPktType, cbFrameLength, + bNeedAck, wCurrentRate, byFBOption); break; case PK_TYPE_11A: if (byFBOption) { return vnt_rxtx_rts_a_fb_head(pDevice, &head->rts_a_fb, - psEthHeader, byPktType, cbFrameLength, - bNeedAck, wCurrentRate, byFBOption); + psEthHeader, byPktType, cbFrameLength, + bNeedAck, wCurrentRate, byFBOption); break; } case PK_TYPE_11B: return vnt_rxtx_rts_ab_head(pDevice, &head->rts_ab, - psEthHeader, byPktType, cbFrameLength, - bNeedAck, wCurrentRate, byFBOption); + psEthHeader, byPktType, cbFrameLength, + bNeedAck, wCurrentRate, byFBOption); } return 0; } static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, - u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength, - int bNeedAck, u16 wCurrentRate, u8 byFBOption) + u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength, + int bNeedAck, u16 wCurrentRate, u8 byFBOption) { u32 uCTSFrameLen = 14; @@ -727,18 +727,18 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, struct vnt_cts_fb *pBuf = &head->cts_g_fb; /* Get SignalField,ServiceField,Length */ BBvCalculateParameter(pDevice, uCTSFrameLen, - pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b); + pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b); pBuf->duration_ba = s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, - cbFrameLength, byPktType, - wCurrentRate, bNeedAck, byFBOption); + cbFrameLength, byPktType, + wCurrentRate, bNeedAck, byFBOption); /* Get CTSDuration_ba_f0 */ pBuf->cts_duration_ba_f0 = s_uGetRTSCTSDuration(pDevice, - CTSDUR_BA_F0, cbFrameLength, byPktType, - pDevice->tx_rate_fb0, bNeedAck, byFBOption); + CTSDUR_BA_F0, cbFrameLength, byPktType, + pDevice->tx_rate_fb0, bNeedAck, byFBOption); /* Get CTSDuration_ba_f1 */ pBuf->cts_duration_ba_f1 = s_uGetRTSCTSDuration(pDevice, - CTSDUR_BA_F1, cbFrameLength, byPktType, - pDevice->tx_rate_fb1, bNeedAck, byFBOption); + CTSDUR_BA_F1, cbFrameLength, byPktType, + pDevice->tx_rate_fb1, bNeedAck, byFBOption); /* Get CTS Frame body */ pBuf->data.duration = pBuf->duration_ba; pBuf->data.frame_control = TYPE_CTL_CTS; @@ -750,11 +750,11 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, struct vnt_cts *pBuf = &head->cts_g; /* Get SignalField,ServiceField,Length */ BBvCalculateParameter(pDevice, uCTSFrameLen, - pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b); + pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b); /* Get CTSDuration_ba */ pBuf->duration_ba = s_uGetRTSCTSDuration(pDevice, - CTSDUR_BA, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, byFBOption); + CTSDUR_BA, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, byFBOption); /*Get CTS Frame body*/ pBuf->data.duration = pBuf->duration_ba; pBuf->data.frame_control = TYPE_CTL_CTS; @@ -762,7 +762,7 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, return vnt_rxtx_datahead_g(pDevice, byPktType, wCurrentRate, &pBuf->data_head, cbFrameLength, bNeedAck); - } + } return 0; } @@ -788,12 +788,12 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, * * Return Value: none * --*/ + -*/ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, - u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer, - struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize, - int bNeedACK, u32 uDMAIdx, struct ethhdr *psEthHeader, bool need_rts) + u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer, + struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize, + int bNeedACK, u32 uDMAIdx, struct ethhdr *psEthHeader, bool need_rts) { struct vnt_tx_fifo_head *pFifoHead = &tx_buffer->fifo_head; union vnt_tx_data_head *head = NULL; @@ -821,10 +821,10 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, pBuf->rts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate); pBuf->rts_rrv_time_bb = s_uGetRTSCTSRsvTime(pDevice, 0, - byPktType, cbFrameSize, wCurrentRate); + byPktType, cbFrameSize, wCurrentRate); pBuf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, - byPktType, cbFrameSize, wCurrentRate, bNeedACK); + byPktType, cbFrameSize, wCurrentRate, bNeedACK); pBuf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK); @@ -840,16 +840,16 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, /* Fill RTS */ return s_vFillRTSHead(pDevice, byPktType, head, cbFrameSize, bNeedACK, psEthHeader, - wCurrentRate, byFBOption); + wCurrentRate, byFBOption); } else { struct vnt_rrv_time_cts *pBuf = &tx_buffer-> - tx_head.tx_cts.cts; + tx_head.tx_cts.cts; pBuf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, - byPktType, cbFrameSize, wCurrentRate, bNeedACK); + byPktType, cbFrameSize, wCurrentRate, bNeedACK); pBuf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, - PK_TYPE_11B, cbFrameSize, + PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK); pBuf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 3, @@ -865,7 +865,7 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, /* Fill CTS */ return s_vFillCTSHead(pDevice, uDMAIdx, byPktType, - head, cbFrameSize, bNeedACK, wCurrentRate, + head, cbFrameSize, bNeedACK, wCurrentRate, byFBOption); } } else if (byPktType == PK_TYPE_11A) { @@ -878,29 +878,29 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, if (need_rts) { struct vnt_rrv_time_ab *pBuf = &tx_buffer-> - tx_head.tx_ab.ab; + tx_head.tx_ab.ab; pBuf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 2, - byPktType, cbFrameSize, wCurrentRate); + byPktType, cbFrameSize, wCurrentRate); pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, - byPktType, cbFrameSize, wCurrentRate, bNeedACK); + byPktType, cbFrameSize, wCurrentRate, bNeedACK); /* Fill RTS */ return s_vFillRTSHead(pDevice, byPktType, head, - cbFrameSize, bNeedACK, psEthHeader, + cbFrameSize, bNeedACK, psEthHeader, wCurrentRate, byFBOption); } else { struct vnt_rrv_time_ab *pBuf = &tx_buffer-> - tx_head.tx_ab.ab; + tx_head.tx_ab.ab; pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, - PK_TYPE_11A, cbFrameSize, + PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK); return vnt_rxtx_datahead_a_fb(pDevice, byPktType, - wCurrentRate, &head->data_head_a_fb, - cbFrameSize, bNeedACK); + wCurrentRate, &head->data_head_a_fb, + cbFrameSize, bNeedACK); } } else if (byPktType == PK_TYPE_11B) { if (need_mic) { @@ -912,29 +912,29 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, if (need_rts) { struct vnt_rrv_time_ab *pBuf = &tx_buffer-> - tx_head.tx_ab.ab; + tx_head.tx_ab.ab; pBuf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 0, - byPktType, cbFrameSize, wCurrentRate); + byPktType, cbFrameSize, wCurrentRate); pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, - PK_TYPE_11B, cbFrameSize, wCurrentRate, - bNeedACK); + PK_TYPE_11B, cbFrameSize, wCurrentRate, + bNeedACK); /* Fill RTS */ return s_vFillRTSHead(pDevice, byPktType, head, - cbFrameSize, - bNeedACK, psEthHeader, wCurrentRate, byFBOption); + cbFrameSize, + bNeedACK, psEthHeader, wCurrentRate, byFBOption); } else { struct vnt_rrv_time_ab *pBuf = &tx_buffer-> - tx_head.tx_ab.ab; + tx_head.tx_ab.ab; pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, - PK_TYPE_11B, cbFrameSize, + PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK); return vnt_rxtx_datahead_ab(pDevice, byPktType, - wCurrentRate, &head->data_head_ab, + wCurrentRate, &head->data_head_ab, cbFrameSize, bNeedACK); } } @@ -942,16 +942,16 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice, return 0; } /* - u8 * pbyBuffer,//point to pTxBufHead - u16 wFragType,//00:Non-Frag, 01:Start, 02:Mid, 03:Last - unsigned int cbFragmentSize,//Hdr+payoad+FCS -*/ + 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, - struct vnt_tx_buffer *tx_buffer, int bNeedEncryption, - u32 uSkbPacketLen, u32 uDMAIdx, struct ethhdr *psEthHeader, - u8 *pPacket, PSKeyItem pTransmitKey, u32 uNodeIndex, u16 wCurrentRate, - u32 *pcbHeaderLen, u32 *pcbTotalLen) + struct vnt_tx_buffer *tx_buffer, int bNeedEncryption, + u32 uSkbPacketLen, u32 uDMAIdx, struct ethhdr *psEthHeader, + u8 *pPacket, PSKeyItem pTransmitKey, u32 uNodeIndex, u16 wCurrentRate, + u32 *pcbHeaderLen, u32 *pcbTotalLen) { struct vnt_tx_fifo_head *pTxBufHead = &tx_buffer->fifo_head; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -964,7 +964,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, u8 *pbyType, *pbyMacHdr, *pbyIVHead, *pbyPayloadHead, *pbyTxBufferAddr; u8 abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; u8 abySNAP_Bridgetunnel[ETH_ALEN] - = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; + = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; u32 uDuration; u32 cbHeaderLength = 0, uPadding = 0; struct vnt_mic_hdr *pMICHDR; @@ -987,17 +987,17 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, else cb802_1_H_len = 0; - cbFrameBodySize = uSkbPacketLen - ETH_HLEN + cb802_1_H_len; + cbFrameBodySize = uSkbPacketLen - ETH_HLEN + cb802_1_H_len; - //Set packet type - pTxBufHead->wFIFOCtl |= (u16)(byPktType<<8); + //Set packet type + pTxBufHead->wFIFOCtl |= (u16)(byPktType<<8); if (pDevice->op_mode == NL80211_IFTYPE_ADHOC || pDevice->op_mode == NL80211_IFTYPE_AP) { if (is_multicast_ether_addr(psEthHeader->h_dest)) { bNeedACK = false; pTxBufHead->wFIFOCtl = - pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK); + pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK); } else { bNeedACK = true; pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; @@ -1008,17 +1008,17 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; } - pTxBufHead->wTimeStamp = DEFAULT_MSDU_LIFETIME_RES_64us; + pTxBufHead->wTimeStamp = DEFAULT_MSDU_LIFETIME_RES_64us; - //Set FRAGCTL_MACHDCNT + //Set FRAGCTL_MACHDCNT cbMACHdLen = WLAN_HDR_ADDR3_LEN; - pTxBufHead->wFragCtl |= (u16)(cbMACHdLen << 10); + pTxBufHead->wFragCtl |= (u16)(cbMACHdLen << 10); - //Set FIFOCTL_GrpAckPolicy - if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; - } + //Set FIFOCTL_GrpAckPolicy + if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 + pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; + } /* Set Auto Fallback Ctl */ if (wCurrentRate >= RATE_18M) { @@ -1026,152 +1026,152 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_0; pDevice->tx_rate_fb0 = - wFB_Opt0[FB_RATE0][wCurrentRate - RATE_18M]; + wFB_Opt0[FB_RATE0][wCurrentRate - RATE_18M]; pDevice->tx_rate_fb1 = - wFB_Opt0[FB_RATE1][wCurrentRate - RATE_18M]; + wFB_Opt0[FB_RATE1][wCurrentRate - RATE_18M]; byFBOption = AUTO_FB_0; } else if (pDevice->byAutoFBCtrl == AUTO_FB_1) { pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_1; pDevice->tx_rate_fb0 = - wFB_Opt1[FB_RATE0][wCurrentRate - RATE_18M]; + wFB_Opt1[FB_RATE0][wCurrentRate - RATE_18M]; pDevice->tx_rate_fb1 = - wFB_Opt1[FB_RATE1][wCurrentRate - RATE_18M]; + wFB_Opt1[FB_RATE1][wCurrentRate - RATE_18M]; byFBOption = AUTO_FB_1; } } - if (bSoftWEP != true) { - if ((bNeedEncryption) && (pTransmitKey != NULL)) { //WEP enabled - if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { //WEP40 or WEP104 - pTxBufHead->wFragCtl |= FRAGCTL_LEGACY; - } - if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Tx Set wFragCtl == FRAGCTL_TKIP\n"); - pTxBufHead->wFragCtl |= FRAGCTL_TKIP; - } - else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { //CCMP - pTxBufHead->wFragCtl |= FRAGCTL_AES; - } - } - } - - if ((bNeedEncryption) && (pTransmitKey != NULL)) { - if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { - cbIVlen = 4; - cbICVlen = 4; - } - else if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) { - cbIVlen = 8;//IV+ExtIV - cbMIClen = 8; - cbICVlen = 4; - } - if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { - cbIVlen = 8;//RSN Header - cbICVlen = 8;//MIC - cbMICHDR = sizeof(struct vnt_mic_hdr); - } - if (bSoftWEP == false) { - //MAC Header should be padding 0 to DW alignment. - uPadding = 4 - (cbMACHdLen%4); - uPadding %= 4; - } - } - - cbFrameSize = cbMACHdLen + cbIVlen + (cbFrameBodySize + cbMIClen) + cbICVlen + cbFCSlen; - - if ( (bNeedACK == false) ||(cbFrameSize < pDevice->wRTSThreshold) ) { - bRTS = false; - } else { - bRTS = true; - pTxBufHead->wFIFOCtl |= (FIFOCTL_RTS | FIFOCTL_LRETRY); - } - - pbyTxBufferAddr = (u8 *) &(pTxBufHead->adwTxKey[0]); + if (bSoftWEP != true) { + if ((bNeedEncryption) && (pTransmitKey != NULL)) { //WEP enabled + if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { //WEP40 or WEP104 + pTxBufHead->wFragCtl |= FRAGCTL_LEGACY; + } + if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Tx Set wFragCtl == FRAGCTL_TKIP\n"); + pTxBufHead->wFragCtl |= FRAGCTL_TKIP; + } + else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { //CCMP + pTxBufHead->wFragCtl |= FRAGCTL_AES; + } + } + } + + if ((bNeedEncryption) && (pTransmitKey != NULL)) { + if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { + cbIVlen = 4; + cbICVlen = 4; + } + else if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) { + cbIVlen = 8;//IV+ExtIV + cbMIClen = 8; + cbICVlen = 4; + } + if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { + cbIVlen = 8;//RSN Header + cbICVlen = 8;//MIC + cbMICHDR = sizeof(struct vnt_mic_hdr); + } + if (bSoftWEP == false) { + //MAC Header should be padding 0 to DW alignment. + uPadding = 4 - (cbMACHdLen%4); + uPadding %= 4; + } + } + + cbFrameSize = cbMACHdLen + cbIVlen + (cbFrameBodySize + cbMIClen) + cbICVlen + cbFCSlen; + + if ( (bNeedACK == false) ||(cbFrameSize < pDevice->wRTSThreshold) ) { + bRTS = false; + } else { + bRTS = true; + pTxBufHead->wFIFOCtl |= (FIFOCTL_RTS | FIFOCTL_LRETRY); + } + + pbyTxBufferAddr = (u8 *) &(pTxBufHead->adwTxKey[0]); wTxBufSize = sizeof(struct vnt_tx_fifo_head); - if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet - if (byFBOption == AUTO_FB_NONE) { - if (bRTS == true) {//RTS_need - cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + - cbMICHDR + sizeof(struct vnt_rts_g); - } - else { //RTS_needless - cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + - cbMICHDR + sizeof(struct vnt_cts); - } - } else { - // Auto Fall Back - if (bRTS == true) {//RTS_need - cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + - cbMICHDR + sizeof(struct vnt_rts_g_fb); - } - else if (bRTS == false) { //RTS_needless - cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + - cbMICHDR + sizeof(struct vnt_cts_fb); - } - } // Auto Fall Back - } - else {//802.11a/b packet - if (byFBOption == AUTO_FB_NONE) { - if (bRTS == true) {//RTS_need - cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + - cbMICHDR + sizeof(struct vnt_rts_ab); - } - else if (bRTS == false) { //RTS_needless, no MICHDR - cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + - cbMICHDR + sizeof(struct vnt_tx_datahead_ab); - } - } else { - // Auto Fall Back - if (bRTS == true) {//RTS_need - cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + - cbMICHDR + sizeof(struct vnt_rts_a_fb); - } - else if (bRTS == false) { //RTS_needless - cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + - cbMICHDR + sizeof(struct vnt_tx_datahead_a_fb); - } - } // Auto Fall Back - } - - pbyMacHdr = (u8 *)(pbyTxBufferAddr + cbHeaderLength); - pbyIVHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding); - pbyPayloadHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding + cbIVlen); - - //========================= - // No Fragmentation - //========================= - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No Fragmentation...\n"); - byFragType = FRAGCTL_NONFRAG; - //uDMAIdx = TYPE_AC0DMA; - //pTxBufHead = (PSTxBufHead) &(pTxBufHead->adwTxKey[0]); + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet + if (byFBOption == AUTO_FB_NONE) { + if (bRTS == true) {//RTS_need + cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + + cbMICHDR + sizeof(struct vnt_rts_g); + } + else { //RTS_needless + cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + + cbMICHDR + sizeof(struct vnt_cts); + } + } else { + // Auto Fall Back + if (bRTS == true) {//RTS_need + cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + + cbMICHDR + sizeof(struct vnt_rts_g_fb); + } + else if (bRTS == false) { //RTS_needless + cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + + cbMICHDR + sizeof(struct vnt_cts_fb); + } + } // Auto Fall Back + } + else {//802.11a/b packet + if (byFBOption == AUTO_FB_NONE) { + if (bRTS == true) {//RTS_need + cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + + cbMICHDR + sizeof(struct vnt_rts_ab); + } + else if (bRTS == false) { //RTS_needless, no MICHDR + cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + + cbMICHDR + sizeof(struct vnt_tx_datahead_ab); + } + } else { + // Auto Fall Back + if (bRTS == true) {//RTS_need + cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + + cbMICHDR + sizeof(struct vnt_rts_a_fb); + } + else if (bRTS == false) { //RTS_needless + cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + + cbMICHDR + sizeof(struct vnt_tx_datahead_a_fb); + } + } // Auto Fall Back + } + + pbyMacHdr = (u8 *)(pbyTxBufferAddr + cbHeaderLength); + pbyIVHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding); + pbyPayloadHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding + cbIVlen); + + //========================= + // No Fragmentation + //========================= + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No Fragmentation...\n"); + byFragType = FRAGCTL_NONFRAG; + //uDMAIdx = TYPE_AC0DMA; + //pTxBufHead = (PSTxBufHead) &(pTxBufHead->adwTxKey[0]); /* Fill FIFO, RrvTime, RTS and CTS */ uDuration = s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, tx_buffer, &pMICHDR, cbMICHDR, cbFrameSize, bNeedACK, uDMAIdx, psEthHeader, bRTS); - // Generate TX MAC Header - s_vGenerateMACHeader(pDevice, pbyMacHdr, (u16)uDuration, psEthHeader, bNeedEncryption, - byFragType, uDMAIdx, 0); + // Generate TX MAC Header + s_vGenerateMACHeader(pDevice, pbyMacHdr, (u16)uDuration, psEthHeader, bNeedEncryption, + byFragType, uDMAIdx, 0); - if (bNeedEncryption == true) { - //Fill TXKEY - s_vFillTxKey(pDevice, pTxBufHead, pbyIVHead, pTransmitKey, - pbyMacHdr, (u16)cbFrameBodySize, pMICHDR); + if (bNeedEncryption == true) { + //Fill TXKEY + s_vFillTxKey(pDevice, pTxBufHead, pbyIVHead, pTransmitKey, + pbyMacHdr, (u16)cbFrameBodySize, pMICHDR); - if (pDevice->bEnableHostWEP) { - pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; - pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0; - } - } + if (pDevice->bEnableHostWEP) { + pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; + pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0; + } + } /* 802.1H */ if (ntohs(psEthHeader->h_proto) > ETH_DATA_LEN) { if ((psEthHeader->h_proto == cpu_to_be16(ETH_P_IPX)) || - (psEthHeader->h_proto == cpu_to_le16(0xF380))) + (psEthHeader->h_proto == cpu_to_le16(0xF380))) memcpy((u8 *) (pbyPayloadHead), abySNAP_Bridgetunnel, 6); else @@ -1182,87 +1182,87 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, memcpy(pbyType, &(psEthHeader->h_proto), sizeof(u16)); } - if (pPacket != NULL) { - // Copy the Packet into a tx Buffer - memcpy((pbyPayloadHead + cb802_1_H_len), - (pPacket + ETH_HLEN), - uSkbPacketLen - ETH_HLEN - ); - - } else { - // while bRelayPacketSend psEthHeader is point to header+payload - memcpy((pbyPayloadHead + cb802_1_H_len), ((u8 *)psEthHeader) + ETH_HLEN, uSkbPacketLen - ETH_HLEN); - } - - if ((bNeedEncryption == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { + if (pPacket != NULL) { + // Copy the Packet into a tx Buffer + memcpy((pbyPayloadHead + cb802_1_H_len), + (pPacket + ETH_HLEN), + uSkbPacketLen - ETH_HLEN + ); - /////////////////////////////////////////////////////////////////// - - if (pDevice->vnt_mgmt.eAuthenMode == WMAC_AUTH_WPANONE) { - dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16]); - dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); + } else { + // while bRelayPacketSend psEthHeader is point to header+payload + memcpy((pbyPayloadHead + cb802_1_H_len), ((u8 *)psEthHeader) + ETH_HLEN, uSkbPacketLen - ETH_HLEN); } - else if ((pTransmitKey->dwKeyIndex & AUTHENTICATOR_KEY) != 0) { - dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16]); - dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); - } - else { - dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[24]); - dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[28]); - } - // DO Software Michael - MIC_vInit(dwMICKey0, dwMICKey1); - MIC_vAppend((u8 *)&(psEthHeader->h_dest[0]), 12); - dwMIC_Priority = 0; - MIC_vAppend((u8 *)&dwMIC_Priority, 4); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %X, %X\n", - dwMICKey0, dwMICKey1); - - /////////////////////////////////////////////////////////////////// - - //DBG_PRN_GRP12(("Length:%d, %d\n", cbFrameBodySize, uFromHDtoPLDLength)); - //for (ii = 0; ii < cbFrameBodySize; ii++) { - // DBG_PRN_GRP12(("%02x ", *((u8 *)((pbyPayloadHead + cb802_1_H_len) + ii)))); - //} - //DBG_PRN_GRP12(("\n\n\n")); - - MIC_vAppend(pbyPayloadHead, cbFrameBodySize); - pdwMIC_L = (u32 *)(pbyPayloadHead + cbFrameBodySize); - pdwMIC_R = (u32 *)(pbyPayloadHead + cbFrameBodySize + 4); + if ((bNeedEncryption == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { - MIC_vGetMIC(pdwMIC_L, pdwMIC_R); - MIC_vUnInit(); + /////////////////////////////////////////////////////////////////// - if (pDevice->bTxMICFail == true) { - *pdwMIC_L = 0; - *pdwMIC_R = 0; - pDevice->bTxMICFail = false; - } - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderLength, uPadding, cbIVlen); - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R); - } + if (pDevice->vnt_mgmt.eAuthenMode == WMAC_AUTH_WPANONE) { + dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16]); + dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); + } + else if ((pTransmitKey->dwKeyIndex & AUTHENTICATOR_KEY) != 0) { + dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16]); + dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); + } + else { + dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[24]); + dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[28]); + } + // DO Software Michael + MIC_vInit(dwMICKey0, dwMICKey1); + MIC_vAppend((u8 *)&(psEthHeader->h_dest[0]), 12); + dwMIC_Priority = 0; + MIC_vAppend((u8 *)&dwMIC_Priority, 4); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %X, %X\n", + dwMICKey0, dwMICKey1); + + /////////////////////////////////////////////////////////////////// + + //DBG_PRN_GRP12(("Length:%d, %d\n", cbFrameBodySize, uFromHDtoPLDLength)); + //for (ii = 0; ii < cbFrameBodySize; ii++) { + // DBG_PRN_GRP12(("%02x ", *((u8 *)((pbyPayloadHead + cb802_1_H_len) + ii)))); + //} + //DBG_PRN_GRP12(("\n\n\n")); + + MIC_vAppend(pbyPayloadHead, cbFrameBodySize); + + pdwMIC_L = (u32 *)(pbyPayloadHead + cbFrameBodySize); + pdwMIC_R = (u32 *)(pbyPayloadHead + cbFrameBodySize + 4); + + MIC_vGetMIC(pdwMIC_L, pdwMIC_R); + MIC_vUnInit(); + + if (pDevice->bTxMICFail == true) { + *pdwMIC_L = 0; + *pdwMIC_R = 0; + pDevice->bTxMICFail = false; + } + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderLength, uPadding, cbIVlen); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R); + } - if (bSoftWEP == true) { + if (bSoftWEP == true) { - s_vSWencryption(pDevice, pTransmitKey, (pbyPayloadHead), (u16)(cbFrameBodySize + cbMIClen)); + s_vSWencryption(pDevice, pTransmitKey, (pbyPayloadHead), (u16)(cbFrameBodySize + cbMIClen)); - } else if ( ((pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) && (bNeedEncryption == true)) || - ((pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) && (bNeedEncryption == true)) || - ((pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) && (bNeedEncryption == true)) ) { - cbFrameSize -= cbICVlen; - } + } else if ( ((pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) && (bNeedEncryption == true)) || + ((pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) && (bNeedEncryption == true)) || + ((pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) && (bNeedEncryption == true)) ) { + cbFrameSize -= cbICVlen; + } - cbFrameSize -= cbFCSlen; + cbFrameSize -= cbFCSlen; - *pcbHeaderLen = cbHeaderLength; - *pcbTotalLen = cbHeaderLength + cbFrameSize ; + *pcbHeaderLen = cbHeaderLength; + *pcbTotalLen = cbHeaderLength + cbFrameSize ; - //Set FragCtl in TxBufferHead - pTxBufHead->wFragCtl |= (u16)byFragType; + //Set FragCtl in TxBufferHead + pTxBufHead->wFragCtl |= (u16)byFragType; - return true; + return true; } @@ -1283,69 +1283,69 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, * * Return Value: none * --*/ + -*/ static void s_vGenerateMACHeader(struct vnt_private *pDevice, - u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, - int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx) + u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, + int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx) { struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyBufferAddr; pMACHeader->frame_control = TYPE_802_11_DATA; - if (pDevice->op_mode == NL80211_IFTYPE_AP) { - memcpy(&(pMACHeader->addr1[0]), - &(psEthHeader->h_dest[0]), - ETH_ALEN); - memcpy(&(pMACHeader->addr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); - memcpy(&(pMACHeader->addr3[0]), - &(psEthHeader->h_source[0]), - ETH_ALEN); - pMACHeader->frame_control |= FC_FROMDS; - } else { - if (pDevice->op_mode == NL80211_IFTYPE_ADHOC) { + if (pDevice->op_mode == NL80211_IFTYPE_AP) { memcpy(&(pMACHeader->addr1[0]), - &(psEthHeader->h_dest[0]), - ETH_ALEN); - memcpy(&(pMACHeader->addr2[0]), - &(psEthHeader->h_source[0]), - ETH_ALEN); + &(psEthHeader->h_dest[0]), + ETH_ALEN); + memcpy(&(pMACHeader->addr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); memcpy(&(pMACHeader->addr3[0]), - &(pDevice->abyBSSID[0]), - ETH_ALEN); + &(psEthHeader->h_source[0]), + ETH_ALEN); + pMACHeader->frame_control |= FC_FROMDS; } else { - memcpy(&(pMACHeader->addr3[0]), - &(psEthHeader->h_dest[0]), - ETH_ALEN); - memcpy(&(pMACHeader->addr2[0]), - &(psEthHeader->h_source[0]), - ETH_ALEN); - memcpy(&(pMACHeader->addr1[0]), - &(pDevice->abyBSSID[0]), - ETH_ALEN); - pMACHeader->frame_control |= FC_TODS; - } - } + if (pDevice->op_mode == NL80211_IFTYPE_ADHOC) { + memcpy(&(pMACHeader->addr1[0]), + &(psEthHeader->h_dest[0]), + ETH_ALEN); + memcpy(&(pMACHeader->addr2[0]), + &(psEthHeader->h_source[0]), + ETH_ALEN); + memcpy(&(pMACHeader->addr3[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { + memcpy(&(pMACHeader->addr3[0]), + &(psEthHeader->h_dest[0]), + ETH_ALEN); + memcpy(&(pMACHeader->addr2[0]), + &(psEthHeader->h_source[0]), + ETH_ALEN); + memcpy(&(pMACHeader->addr1[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + pMACHeader->frame_control |= FC_TODS; + } + } - if (bNeedEncrypt) - pMACHeader->frame_control |= cpu_to_le16((u16)WLAN_SET_FC_ISWEP(1)); + if (bNeedEncrypt) + pMACHeader->frame_control |= cpu_to_le16((u16)WLAN_SET_FC_ISWEP(1)); - pMACHeader->duration_id = cpu_to_le16(wDuration); + pMACHeader->duration_id = cpu_to_le16(wDuration); - pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); + pMACHeader->seq_ctrl = cpu_to_le16(pDevice->wSeqCounter << 4); - //Set FragNumber in Sequence Control - pMACHeader->seq_ctrl |= cpu_to_le16((u16)uFragIdx); + //Set FragNumber in Sequence Control + pMACHeader->seq_ctrl |= cpu_to_le16((u16)uFragIdx); - if ((wFragType == FRAGCTL_ENDFRAG) || (wFragType == FRAGCTL_NONFRAG)) { - pDevice->wSeqCounter++; - if (pDevice->wSeqCounter > 0x0fff) - pDevice->wSeqCounter = 0; - } + if ((wFragType == FRAGCTL_ENDFRAG) || (wFragType == FRAGCTL_NONFRAG)) { + pDevice->wSeqCounter++; + if (pDevice->wSeqCounter > 0x0fff) + pDevice->wSeqCounter = 0; + } - if ((wFragType == FRAGCTL_STAFRAG) || (wFragType == FRAGCTL_MIDFRAG)) { //StartFrag or MidFrag - pMACHeader->frame_control |= FC_MOREFRAG; - } + if ((wFragType == FRAGCTL_STAFRAG) || (wFragType == FRAGCTL_MIDFRAG)) { //StartFrag or MidFrag + pMACHeader->frame_control |= FC_MOREFRAG; + } } /*+ @@ -1363,10 +1363,10 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice, * * Return Value: CMD_STATUS_PENDING if MAC Tx resource available; otherwise false * --*/ + -*/ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, - struct vnt_tx_mgmt *pPacket) + struct vnt_tx_mgmt *pPacket) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_tx_buffer *pTX_Buffer; @@ -1386,250 +1386,250 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, pContext = s_vGetFreeContext(pDevice); - if (NULL == pContext) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ManagementSend TX...NO CONTEXT!\n"); - return CMD_STATUS_RESOURCES; - } + if (NULL == pContext) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ManagementSend TX...NO CONTEXT!\n"); + return CMD_STATUS_RESOURCES; + } pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0]; - cbFrameBodySize = pPacket->cbPayloadLen; + cbFrameBodySize = pPacket->cbPayloadLen; pTxBufHead = &pTX_Buffer->fifo_head; pbyTxBufferAddr = (u8 *)&pTxBufHead->adwTxKey[0]; wTxBufSize = sizeof(struct vnt_tx_fifo_head); - if (pDevice->byBBType == BB_TYPE_11A) { - wCurrentRate = RATE_6M; - byPktType = PK_TYPE_11A; - } else { - wCurrentRate = RATE_1M; - byPktType = PK_TYPE_11B; - } - - // SetPower will cause error power TX state for OFDM Date packet in TX buffer. - // 2004.11.11 Kyle -- Using OFDM power to tx MngPkt will decrease the connection capability. - // And cmd timer will wait data pkt TX finish before scanning so it's OK - // to set power here. - if (pMgmt->eScanState != WMAC_NO_SCANNING) { - RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh); - } else { - RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel); - } - pDevice->wCurrentRate = wCurrentRate; - - //Set packet type - if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 - pTxBufHead->wFIFOCtl = 0; - } - else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_11B; - } - else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_11GB; - } - else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_11GA; - } - - pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN; - pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us); - - if (is_multicast_ether_addr(pPacket->p80211Header->sA3.abyAddr1)) { - bNeedACK = false; - } - else { - bNeedACK = true; - pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; - }; - - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || - (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ) { - - pTxBufHead->wFIFOCtl |= FIFOCTL_LRETRY; - //Set Preamble type always long - //pDevice->byPreambleType = PREAMBLE_LONG; - // probe-response don't retry - //if ((pPacket->p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_MGMT_PROBE_RSP) { - // bNeedACK = false; - // pTxBufHead->wFIFOCtl &= (~FIFOCTL_NEEDACK); - //} - } - - pTxBufHead->wFIFOCtl |= (FIFOCTL_GENINT | FIFOCTL_ISDMA0); - - if ((pPacket->p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) { - bIsPSPOLL = true; - cbMacHdLen = WLAN_HDR_ADDR2_LEN; - } else { - cbMacHdLen = WLAN_HDR_ADDR3_LEN; - } - - //Set FRAGCTL_MACHDCNT - 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. - - if (WLAN_GET_FC_ISWEP(pPacket->p80211Header->sA4.wFrameCtl) != 0) { - if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) { - cbIVlen = 4; - cbICVlen = 4; - pTxBufHead->wFragCtl |= FRAGCTL_LEGACY; - } - else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { - cbIVlen = 8;//IV+ExtIV - cbMIClen = 8; - cbICVlen = 4; - pTxBufHead->wFragCtl |= FRAGCTL_TKIP; - //We need to get seed here for filling TxKey entry. - //TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr, - // pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG); - } - else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { - cbIVlen = 8;//RSN Header - cbICVlen = 8;//MIC - pTxBufHead->wFragCtl |= FRAGCTL_AES; - } - //MAC Header should be padding 0 to DW alignment. - uPadding = 4 - (cbMacHdLen%4); - uPadding %= 4; - } - - cbFrameSize = cbMacHdLen + cbFrameBodySize + cbIVlen + cbMIClen + cbICVlen + cbFCSlen; - - //Set FIFOCTL_GrpAckPolicy - if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; - } - //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() - - //Set RrvTime/RTS/CTS Buffer - if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet - cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + - sizeof(struct vnt_cts); - } - else { // 802.11a/b packet - cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + - sizeof(struct vnt_tx_datahead_ab); - } - - memcpy(&(sEthHeader.h_dest[0]), - &(pPacket->p80211Header->sA3.abyAddr1[0]), - ETH_ALEN); - memcpy(&(sEthHeader.h_source[0]), - &(pPacket->p80211Header->sA3.abyAddr2[0]), - ETH_ALEN); - //========================= - // No Fragmentation - //========================= - pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; + if (pDevice->byBBType == BB_TYPE_11A) { + wCurrentRate = RATE_6M; + byPktType = PK_TYPE_11A; + } else { + wCurrentRate = RATE_1M; + byPktType = PK_TYPE_11B; + } + + // SetPower will cause error power TX state for OFDM Date packet in TX buffer. + // 2004.11.11 Kyle -- Using OFDM power to tx MngPkt will decrease the connection capability. + // And cmd timer will wait data pkt TX finish before scanning so it's OK + // to set power here. + if (pMgmt->eScanState != WMAC_NO_SCANNING) { + RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh); + } else { + RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel); + } + pDevice->wCurrentRate = wCurrentRate; + + //Set packet type + if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 + pTxBufHead->wFIFOCtl = 0; + } + else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000 + pTxBufHead->wFIFOCtl |= FIFOCTL_11B; + } + else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000 + pTxBufHead->wFIFOCtl |= FIFOCTL_11GB; + } + else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000 + pTxBufHead->wFIFOCtl |= FIFOCTL_11GA; + } + + pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN; + pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us); + + if (is_multicast_ether_addr(pPacket->p80211Header->sA3.abyAddr1)) { + bNeedACK = false; + } + else { + bNeedACK = true; + pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; + }; + + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || + (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ) { + + pTxBufHead->wFIFOCtl |= FIFOCTL_LRETRY; + //Set Preamble type always long + //pDevice->byPreambleType = PREAMBLE_LONG; + // probe-response don't retry + //if ((pPacket->p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_MGMT_PROBE_RSP) { + // bNeedACK = false; + // pTxBufHead->wFIFOCtl &= (~FIFOCTL_NEEDACK); + //} + } + + pTxBufHead->wFIFOCtl |= (FIFOCTL_GENINT | FIFOCTL_ISDMA0); + + if ((pPacket->p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) { + bIsPSPOLL = true; + cbMacHdLen = WLAN_HDR_ADDR2_LEN; + } else { + cbMacHdLen = WLAN_HDR_ADDR3_LEN; + } + + //Set FRAGCTL_MACHDCNT + 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. + + if (WLAN_GET_FC_ISWEP(pPacket->p80211Header->sA4.wFrameCtl) != 0) { + if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) { + cbIVlen = 4; + cbICVlen = 4; + pTxBufHead->wFragCtl |= FRAGCTL_LEGACY; + } + else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { + cbIVlen = 8;//IV+ExtIV + cbMIClen = 8; + cbICVlen = 4; + pTxBufHead->wFragCtl |= FRAGCTL_TKIP; + //We need to get seed here for filling TxKey entry. + //TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr, + // pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG); + } + else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { + cbIVlen = 8;//RSN Header + cbICVlen = 8;//MIC + pTxBufHead->wFragCtl |= FRAGCTL_AES; + } + //MAC Header should be padding 0 to DW alignment. + uPadding = 4 - (cbMacHdLen%4); + uPadding %= 4; + } + + cbFrameSize = cbMacHdLen + cbFrameBodySize + cbIVlen + cbMIClen + cbICVlen + cbFCSlen; + + //Set FIFOCTL_GrpAckPolicy + if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 + pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; + } + //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() + + //Set RrvTime/RTS/CTS Buffer + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet + cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + + sizeof(struct vnt_cts); + } + else { // 802.11a/b packet + cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + + sizeof(struct vnt_tx_datahead_ab); + } + + memcpy(&(sEthHeader.h_dest[0]), + &(pPacket->p80211Header->sA3.abyAddr1[0]), + ETH_ALEN); + memcpy(&(sEthHeader.h_source[0]), + &(pPacket->p80211Header->sA3.abyAddr2[0]), + ETH_ALEN); + //========================= + // No Fragmentation + //========================= + pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; /* Fill FIFO,RrvTime,RTS,and CTS */ uDuration = s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, - pTX_Buffer, &pMICHDR, 0, - cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false); + pTX_Buffer, &pMICHDR, 0, + cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false); - pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); + pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); - cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + cbFrameBodySize; + cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + cbFrameBodySize; - if (WLAN_GET_FC_ISWEP(pPacket->p80211Header->sA4.wFrameCtl) != 0) { - u8 * pbyIVHead; - u8 * pbyPayloadHead; - u8 * pbyBSSID; - PSKeyItem pTransmitKey = NULL; + if (WLAN_GET_FC_ISWEP(pPacket->p80211Header->sA4.wFrameCtl) != 0) { + u8 * pbyIVHead; + u8 * pbyPayloadHead; + u8 * pbyBSSID; + PSKeyItem pTransmitKey = NULL; - pbyIVHead = (u8 *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding); - pbyPayloadHead = (u8 *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding + cbIVlen); - do { - if (pDevice->op_mode == NL80211_IFTYPE_STATION && + pbyIVHead = (u8 *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding); + pbyPayloadHead = (u8 *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding + cbIVlen); + do { + if (pDevice->op_mode == NL80211_IFTYPE_STATION && pDevice->bLinkPass == true) { - pbyBSSID = pDevice->abyBSSID; - // get pairwise key - if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == false) { - // get group key - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); - break; - } - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get PTK.\n"); - break; - } - } - // get group key - pbyBSSID = pDevice->abyBroadcastAddr; - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { - pTransmitKey = NULL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KEY is NULL. OP Mode[%d]\n", pDevice->op_mode); - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); - } - } while(false); - //Fill TXKEY - s_vFillTxKey(pDevice, pTxBufHead, pbyIVHead, pTransmitKey, - (u8 *)pMACHeader, (u16)cbFrameBodySize, NULL); - - memcpy(pMACHeader, pPacket->p80211Header, cbMacHdLen); - memcpy(pbyPayloadHead, ((u8 *)(pPacket->p80211Header) + cbMacHdLen), - cbFrameBodySize); - } - else { - // Copy the Packet into a tx Buffer - memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); - } - - 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. - // This will cause AID-field of PS-POLL packet be incorrect (Because PS-POLL's AID field is - // in the same place of other packet's Duration-field). - // And it will cause Cisco-AP to issue Disassociation-packet - if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { - struct vnt_tx_datahead_g *data_head = &pTX_Buffer->tx_head. - tx_cts.tx.head.cts_g.data_head; - data_head->duration_a = - cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); - data_head->duration_b = - cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); - } else { - struct vnt_tx_datahead_ab *data_head = &pTX_Buffer->tx_head. + pbyBSSID = pDevice->abyBSSID; + // get pairwise key + if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == false) { + // get group key + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); + break; + } + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get PTK.\n"); + break; + } + } + // get group key + pbyBSSID = pDevice->abyBroadcastAddr; + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { + pTransmitKey = NULL; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KEY is NULL. OP Mode[%d]\n", pDevice->op_mode); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); + } + } while(false); + //Fill TXKEY + s_vFillTxKey(pDevice, pTxBufHead, pbyIVHead, pTransmitKey, + (u8 *)pMACHeader, (u16)cbFrameBodySize, NULL); + + memcpy(pMACHeader, pPacket->p80211Header, cbMacHdLen); + memcpy(pbyPayloadHead, ((u8 *)(pPacket->p80211Header) + cbMacHdLen), + cbFrameBodySize); + } + else { + // Copy the Packet into a tx Buffer + memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); + } + + 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. + // This will cause AID-field of PS-POLL packet be incorrect (Because PS-POLL's AID field is + // in the same place of other packet's Duration-field). + // And it will cause Cisco-AP to issue Disassociation-packet + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { + struct vnt_tx_datahead_g *data_head = &pTX_Buffer->tx_head. + tx_cts.tx.head.cts_g.data_head; + data_head->duration_a = + cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); + data_head->duration_b = + cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); + } else { + struct vnt_tx_datahead_ab *data_head = &pTX_Buffer->tx_head. tx_ab.tx.head.data_head_ab; - data_head->duration = - cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); + data_head->duration = + cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); + } } - } - pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount)); - pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); - pTX_Buffer->byType = 0x00; + 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 = (u16)cbReqCount + 4; //USB header + pContext->pPacket = NULL; + pContext->type = CONTEXT_MGMT_PACKET; + pContext->uBufLen = (u16)cbReqCount + 4; //USB header - if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), - &pMACHeader->addr1[0], (u16)cbFrameSize, - pTxBufHead->wFIFOCtl); - } - else { - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), - &pMACHeader->addr3[0], (u16)cbFrameSize, - pTxBufHead->wFIFOCtl); - } + if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { + s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), + &pMACHeader->addr1[0], (u16)cbFrameSize, + pTxBufHead->wFIFOCtl); + } + else { + s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), + &pMACHeader->addr3[0], (u16)cbFrameSize, + pTxBufHead->wFIFOCtl); + } - PIPEnsSendBulkOut(pDevice,pContext); - return CMD_STATUS_PENDING; + PIPEnsSendBulkOut(pDevice,pContext); + return CMD_STATUS_PENDING; } CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, - struct vnt_tx_mgmt *pPacket) + struct vnt_tx_mgmt *pPacket) { struct vnt_beacon_buffer *pTX_Buffer; struct vnt_tx_short_buf_head *short_head; @@ -1643,16 +1643,16 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, CMD_STATUS status; pContext = s_vGetFreeContext(pDevice); - if (NULL == pContext) { - status = CMD_STATUS_RESOURCES; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ManagementSend TX...NO CONTEXT!\n"); - return status ; - } + if (NULL == pContext) { + status = CMD_STATUS_RESOURCES; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ManagementSend TX...NO CONTEXT!\n"); + return status ; + } pTX_Buffer = (struct vnt_beacon_buffer *)&pContext->Data[0]; short_head = &pTX_Buffer->short_head; - cbFrameBodySize = pPacket->cbPayloadLen; + cbFrameBodySize = pPacket->cbPayloadLen; cbHeaderSize = sizeof(struct vnt_tx_short_buf_head); @@ -1661,11 +1661,11 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, /* Get SignalField,ServiceField,Length */ BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, - PK_TYPE_11A, &short_head->ab); + PK_TYPE_11A, &short_head->ab); /* Get Duration and TimeStampOff */ short_head->duration = s_uGetDataDuration(pDevice, - PK_TYPE_11A, false); + PK_TYPE_11A, false); short_head->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); } else { @@ -1674,13 +1674,13 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, /* Get SignalField,ServiceField,Length */ BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, - PK_TYPE_11B, &short_head->ab); + PK_TYPE_11B, &short_head->ab); /* Get Duration and TimeStampOff */ short_head->duration = s_uGetDataDuration(pDevice, - PK_TYPE_11B, false); + PK_TYPE_11B, false); short_head->time_stamp_off = - vnt_time_stamp_off(pDevice, wCurrentRate); + vnt_time_stamp_off(pDevice, wCurrentRate); } @@ -1695,18 +1695,18 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, if (pDevice->wSeqCounter > 0x0fff) pDevice->wSeqCounter = 0; - cbReqCount = cbHeaderSize + WLAN_HDR_ADDR3_LEN + cbFrameBodySize; + cbReqCount = cbHeaderSize + WLAN_HDR_ADDR3_LEN + cbFrameBodySize; - pTX_Buffer->wTxByteCount = (u16)cbReqCount; - pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); - pTX_Buffer->byType = 0x01; + 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 = (u16)cbReqCount + 4; //USB header + pContext->pPacket = NULL; + pContext->type = CONTEXT_MGMT_PACKET; + pContext->uBufLen = (u16)cbReqCount + 4; //USB header - PIPEnsSendBulkOut(pDevice,pContext); - return CMD_STATUS_PENDING; + PIPEnsSendBulkOut(pDevice,pContext); + return CMD_STATUS_PENDING; } @@ -1744,327 +1744,327 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) pMICHDR = NULL; - if(skb->len <= WLAN_HDR_ADDR3_LEN) { - cbFrameBodySize = 0; - } - else { - cbFrameBodySize = skb->len - WLAN_HDR_ADDR3_LEN; - } - p80211Header = (PUWLAN_80211HDR)skb->data; + if(skb->len <= WLAN_HDR_ADDR3_LEN) { + cbFrameBodySize = 0; + } + else { + cbFrameBodySize = skb->len - WLAN_HDR_ADDR3_LEN; + } + p80211Header = (PUWLAN_80211HDR)skb->data; pContext = s_vGetFreeContext(pDevice); - if (NULL == pContext) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0 TX...NO CONTEXT!\n"); - dev_kfree_skb_irq(skb); - return ; - } + if (NULL == pContext) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0 TX...NO CONTEXT!\n"); + dev_kfree_skb_irq(skb); + return ; + } pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0]; pTxBufHead = &pTX_Buffer->fifo_head; pbyTxBufferAddr = (u8 *)&pTxBufHead->adwTxKey[0]; wTxBufSize = sizeof(struct vnt_tx_fifo_head); - if (pDevice->byBBType == BB_TYPE_11A) { - wCurrentRate = RATE_6M; - byPktType = PK_TYPE_11A; - } else { - wCurrentRate = RATE_1M; - byPktType = PK_TYPE_11B; - } - - // SetPower will cause error power TX state for OFDM Date packet in TX buffer. - // 2004.11.11 Kyle -- Using OFDM power to tx MngPkt will decrease the connection capability. - // And cmd timer will wait data pkt TX finish before scanning so it's OK - // to set power here. - if (pMgmt->eScanState != WMAC_NO_SCANNING) { - RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh); - } else { - RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel); - } - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vDMA0_tx_80211: p80211Header->sA3.wFrameCtl = %x \n", p80211Header->sA3.wFrameCtl); - - //Set packet type - if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 - pTxBufHead->wFIFOCtl = 0; - } - else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_11B; - } - else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_11GB; - } - else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_11GA; - } - - pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN; - pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us); - - if (is_multicast_ether_addr(p80211Header->sA3.abyAddr1)) { - bNeedACK = false; - if (pDevice->bEnableHostWEP) { - uNodeIndex = 0; - bNodeExist = true; - } - } - else { - if (pDevice->bEnableHostWEP) { - if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(p80211Header->sA3.abyAddr1), &uNodeIndex)) - bNodeExist = true; - } - bNeedACK = true; - pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; - }; - - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || - (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ) { - - pTxBufHead->wFIFOCtl |= FIFOCTL_LRETRY; - //Set Preamble type always long - //pDevice->byPreambleType = PREAMBLE_LONG; - - // probe-response don't retry - //if ((p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_MGMT_PROBE_RSP) { - // bNeedACK = false; - // pTxBufHead->wFIFOCtl &= (~FIFOCTL_NEEDACK); - //} - } - - pTxBufHead->wFIFOCtl |= (FIFOCTL_GENINT | FIFOCTL_ISDMA0); - - if ((p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) { - bIsPSPOLL = true; - cbMacHdLen = WLAN_HDR_ADDR2_LEN; - } else { - cbMacHdLen = WLAN_HDR_ADDR3_LEN; - } - - // hostapd daemon ext support rate patch - if (WLAN_GET_FC_FSTYPE(p80211Header->sA4.wFrameCtl) == WLAN_FSTYPE_ASSOCRESP) { - - if (((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len != 0) { - cbExtSuppRate += ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len + WLAN_IEHDR_LEN; - } - - if (((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates)->len != 0) { - cbExtSuppRate += ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates)->len + WLAN_IEHDR_LEN; - } - - if (cbExtSuppRate >0) { - cbFrameBodySize = WLAN_ASSOCRESP_OFF_SUPP_RATES; - } - } - - //Set FRAGCTL_MACHDCNT - 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. - - if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) { - if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) { - cbIVlen = 4; - cbICVlen = 4; - pTxBufHead->wFragCtl |= FRAGCTL_LEGACY; - } - else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { - cbIVlen = 8;//IV+ExtIV - cbMIClen = 8; - cbICVlen = 4; - pTxBufHead->wFragCtl |= FRAGCTL_TKIP; - //We need to get seed here for filling TxKey entry. - //TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr, - // pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG); - } - else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { - cbIVlen = 8;//RSN Header - cbICVlen = 8;//MIC - cbMICHDR = sizeof(struct vnt_mic_hdr); - pTxBufHead->wFragCtl |= FRAGCTL_AES; - } - //MAC Header should be padding 0 to DW alignment. - uPadding = 4 - (cbMacHdLen%4); - uPadding %= 4; - } - - cbFrameSize = cbMacHdLen + cbFrameBodySize + cbIVlen + cbMIClen + cbICVlen + cbFCSlen + cbExtSuppRate; - - //Set FIFOCTL_GrpAckPolicy - if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 - pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; - } - //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() - - if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet - cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + - sizeof(struct vnt_cts); - - } - else {//802.11a/b packet - cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + - sizeof(struct vnt_tx_datahead_ab); - } - memcpy(&(sEthHeader.h_dest[0]), - &(p80211Header->sA3.abyAddr1[0]), - ETH_ALEN); - memcpy(&(sEthHeader.h_source[0]), - &(p80211Header->sA3.abyAddr2[0]), - ETH_ALEN); - //========================= - // No Fragmentation - //========================= - pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; + if (pDevice->byBBType == BB_TYPE_11A) { + wCurrentRate = RATE_6M; + byPktType = PK_TYPE_11A; + } else { + wCurrentRate = RATE_1M; + byPktType = PK_TYPE_11B; + } + + // SetPower will cause error power TX state for OFDM Date packet in TX buffer. + // 2004.11.11 Kyle -- Using OFDM power to tx MngPkt will decrease the connection capability. + // And cmd timer will wait data pkt TX finish before scanning so it's OK + // to set power here. + if (pMgmt->eScanState != WMAC_NO_SCANNING) { + RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh); + } else { + RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel); + } + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vDMA0_tx_80211: p80211Header->sA3.wFrameCtl = %x\n", p80211Header->sA3.wFrameCtl); + + //Set packet type + if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 + pTxBufHead->wFIFOCtl = 0; + } + else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000 + pTxBufHead->wFIFOCtl |= FIFOCTL_11B; + } + else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000 + pTxBufHead->wFIFOCtl |= FIFOCTL_11GB; + } + else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000 + pTxBufHead->wFIFOCtl |= FIFOCTL_11GA; + } + + pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN; + pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us); + + if (is_multicast_ether_addr(p80211Header->sA3.abyAddr1)) { + bNeedACK = false; + if (pDevice->bEnableHostWEP) { + uNodeIndex = 0; + bNodeExist = true; + } + } + else { + if (pDevice->bEnableHostWEP) { + if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(p80211Header->sA3.abyAddr1), &uNodeIndex)) + bNodeExist = true; + } + bNeedACK = true; + pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; + }; + + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || + (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ) { + + pTxBufHead->wFIFOCtl |= FIFOCTL_LRETRY; + //Set Preamble type always long + //pDevice->byPreambleType = PREAMBLE_LONG; + + // probe-response don't retry + //if ((p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_MGMT_PROBE_RSP) { + // bNeedACK = false; + // pTxBufHead->wFIFOCtl &= (~FIFOCTL_NEEDACK); + //} + } + + pTxBufHead->wFIFOCtl |= (FIFOCTL_GENINT | FIFOCTL_ISDMA0); + + if ((p80211Header->sA4.wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) { + bIsPSPOLL = true; + cbMacHdLen = WLAN_HDR_ADDR2_LEN; + } else { + cbMacHdLen = WLAN_HDR_ADDR3_LEN; + } + + // hostapd daemon ext support rate patch + if (WLAN_GET_FC_FSTYPE(p80211Header->sA4.wFrameCtl) == WLAN_FSTYPE_ASSOCRESP) { + + if (((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len != 0) { + cbExtSuppRate += ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len + WLAN_IEHDR_LEN; + } + + if (((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates)->len != 0) { + cbExtSuppRate += ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates)->len + WLAN_IEHDR_LEN; + } + + if (cbExtSuppRate >0) { + cbFrameBodySize = WLAN_ASSOCRESP_OFF_SUPP_RATES; + } + } + + //Set FRAGCTL_MACHDCNT + 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. + + if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) { + if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) { + cbIVlen = 4; + cbICVlen = 4; + pTxBufHead->wFragCtl |= FRAGCTL_LEGACY; + } + else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { + cbIVlen = 8;//IV+ExtIV + cbMIClen = 8; + cbICVlen = 4; + pTxBufHead->wFragCtl |= FRAGCTL_TKIP; + //We need to get seed here for filling TxKey entry. + //TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr, + // pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG); + } + else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { + cbIVlen = 8;//RSN Header + cbICVlen = 8;//MIC + cbMICHDR = sizeof(struct vnt_mic_hdr); + pTxBufHead->wFragCtl |= FRAGCTL_AES; + } + //MAC Header should be padding 0 to DW alignment. + uPadding = 4 - (cbMacHdLen%4); + uPadding %= 4; + } + + cbFrameSize = cbMacHdLen + cbFrameBodySize + cbIVlen + cbMIClen + cbICVlen + cbFCSlen + cbExtSuppRate; + + //Set FIFOCTL_GrpAckPolicy + if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000 + pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK; + } + //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() + + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet + cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + + sizeof(struct vnt_cts); + + } + else {//802.11a/b packet + cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + + sizeof(struct vnt_tx_datahead_ab); + } + memcpy(&(sEthHeader.h_dest[0]), + &(p80211Header->sA3.abyAddr1[0]), + ETH_ALEN); + memcpy(&(sEthHeader.h_source[0]), + &(p80211Header->sA3.abyAddr2[0]), + ETH_ALEN); + //========================= + // No Fragmentation + //========================= + pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; /* Fill FIFO,RrvTime,RTS,and CTS */ uDuration = s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, - pTX_Buffer, &pMICHDR, cbMICHDR, - cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false); + pTX_Buffer, &pMICHDR, cbMICHDR, + cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false); pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize); - cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen) + cbExtSuppRate; - - 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->frame_control &= cpu_to_le16(0xfffc); - memcpy(pbyPayloadHead, (skb->data + cbMacHdLen), cbFrameBodySize); - - // replace support rate, patch for hostapd daemon( only support 11M) - if (WLAN_GET_FC_FSTYPE(p80211Header->sA4.wFrameCtl) == WLAN_FSTYPE_ASSOCRESP) { - if (cbExtSuppRate != 0) { - if (((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len != 0) - memcpy((pbyPayloadHead + cbFrameBodySize), - pMgmt->abyCurrSuppRates, - ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len + WLAN_IEHDR_LEN - ); - if (((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates)->len != 0) - memcpy((pbyPayloadHead + cbFrameBodySize) + ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len + WLAN_IEHDR_LEN, - pMgmt->abyCurrExtSuppRates, - ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates)->len + WLAN_IEHDR_LEN - ); - } - } - - // Set wep - if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) { - - if (pDevice->bEnableHostWEP) { - pTransmitKey = &STempKey; - pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; - pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; - pTransmitKey->uKeyLength = pMgmt->sNodeDBTable[uNodeIndex].uWepKeyLength; - pTransmitKey->dwTSC47_16 = pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16; - pTransmitKey->wTSC15_0 = pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0; - memcpy(pTransmitKey->abyKey, - &pMgmt->sNodeDBTable[uNodeIndex].abyWepKey[0], - pTransmitKey->uKeyLength - ); - } - - if ((pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { - - dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16]); - dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); - - // DO Software Michael - MIC_vInit(dwMICKey0, dwMICKey1); - MIC_vAppend((u8 *)&(sEthHeader.h_dest[0]), 12); - dwMIC_Priority = 0; - MIC_vAppend((u8 *)&dwMIC_Priority, 4); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY:"\ - " %X, %X\n", dwMICKey0, dwMICKey1); - - uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen; - - MIC_vAppend((pbyTxBufferAddr + uLength), cbFrameBodySize); - - pdwMIC_L = (u32 *)(pbyTxBufferAddr + uLength + cbFrameBodySize); - pdwMIC_R = (u32 *)(pbyTxBufferAddr + uLength + cbFrameBodySize + 4); - - MIC_vGetMIC(pdwMIC_L, pdwMIC_R); - MIC_vUnInit(); - - if (pDevice->bTxMICFail == true) { - *pdwMIC_L = 0; - *pdwMIC_R = 0; - pDevice->bTxMICFail = false; - } - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderSize, uPadding, cbIVlen); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%x, %x\n", - *pdwMIC_L, *pdwMIC_R); - - } - - s_vFillTxKey(pDevice, pTxBufHead, pbyIVHead, pTransmitKey, - pbyMacHdr, (u16)cbFrameBodySize, pMICHDR); - - if (pDevice->bEnableHostWEP) { - pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; - pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0; - } - - if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) { - s_vSWencryption(pDevice, pTransmitKey, pbyPayloadHead, (u16)(cbFrameBodySize + cbMIClen)); - } - } - - 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. - // This will cause AID-field of PS-POLL packet be incorrect (Because PS-POLL's AID field is - // in the same place of other packet's Duration-field). - // And it will cause Cisco-AP to issue Disassociation-packet - if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { - struct vnt_tx_datahead_g *data_head = &pTX_Buffer->tx_head. - tx_cts.tx.head.cts_g.data_head; - data_head->duration_a = - cpu_to_le16(p80211Header->sA2.wDurationID); - data_head->duration_b = - cpu_to_le16(p80211Header->sA2.wDurationID); - } else { - struct vnt_tx_datahead_ab *data_head = &pTX_Buffer->tx_head. + cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen) + cbExtSuppRate; + + 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->frame_control &= cpu_to_le16(0xfffc); + memcpy(pbyPayloadHead, (skb->data + cbMacHdLen), cbFrameBodySize); + + // replace support rate, patch for hostapd daemon( only support 11M) + if (WLAN_GET_FC_FSTYPE(p80211Header->sA4.wFrameCtl) == WLAN_FSTYPE_ASSOCRESP) { + if (cbExtSuppRate != 0) { + if (((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len != 0) + memcpy((pbyPayloadHead + cbFrameBodySize), + pMgmt->abyCurrSuppRates, + ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len + WLAN_IEHDR_LEN + ); + if (((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates)->len != 0) + memcpy((pbyPayloadHead + cbFrameBodySize) + ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len + WLAN_IEHDR_LEN, + pMgmt->abyCurrExtSuppRates, + ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates)->len + WLAN_IEHDR_LEN + ); + } + } + + // Set wep + if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) { + + if (pDevice->bEnableHostWEP) { + pTransmitKey = &STempKey; + pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; + pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; + pTransmitKey->uKeyLength = pMgmt->sNodeDBTable[uNodeIndex].uWepKeyLength; + pTransmitKey->dwTSC47_16 = pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16; + pTransmitKey->wTSC15_0 = pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0; + memcpy(pTransmitKey->abyKey, + &pMgmt->sNodeDBTable[uNodeIndex].abyWepKey[0], + pTransmitKey->uKeyLength + ); + } + + if ((pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { + + dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16]); + dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20]); + + // DO Software Michael + MIC_vInit(dwMICKey0, dwMICKey1); + MIC_vAppend((u8 *)&(sEthHeader.h_dest[0]), 12); + dwMIC_Priority = 0; + MIC_vAppend((u8 *)&dwMIC_Priority, 4); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY:"\ + " %X, %X\n", dwMICKey0, dwMICKey1); + + uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen; + + MIC_vAppend((pbyTxBufferAddr + uLength), cbFrameBodySize); + + pdwMIC_L = (u32 *)(pbyTxBufferAddr + uLength + cbFrameBodySize); + pdwMIC_R = (u32 *)(pbyTxBufferAddr + uLength + cbFrameBodySize + 4); + + MIC_vGetMIC(pdwMIC_L, pdwMIC_R); + MIC_vUnInit(); + + if (pDevice->bTxMICFail == true) { + *pdwMIC_L = 0; + *pdwMIC_R = 0; + pDevice->bTxMICFail = false; + } + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderSize, uPadding, cbIVlen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%x, %x\n", + *pdwMIC_L, *pdwMIC_R); + + } + + s_vFillTxKey(pDevice, pTxBufHead, pbyIVHead, pTransmitKey, + pbyMacHdr, (u16)cbFrameBodySize, pMICHDR); + + if (pDevice->bEnableHostWEP) { + pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; + pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0; + } + + if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) { + s_vSWencryption(pDevice, pTransmitKey, pbyPayloadHead, (u16)(cbFrameBodySize + cbMIClen)); + } + } + + 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. + // This will cause AID-field of PS-POLL packet be incorrect (Because PS-POLL's AID field is + // in the same place of other packet's Duration-field). + // And it will cause Cisco-AP to issue Disassociation-packet + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { + struct vnt_tx_datahead_g *data_head = &pTX_Buffer->tx_head. + tx_cts.tx.head.cts_g.data_head; + data_head->duration_a = + cpu_to_le16(p80211Header->sA2.wDurationID); + data_head->duration_b = + cpu_to_le16(p80211Header->sA2.wDurationID); + } else { + struct vnt_tx_datahead_ab *data_head = &pTX_Buffer->tx_head. tx_ab.tx.head.data_head_ab; - data_head->duration = - cpu_to_le16(p80211Header->sA2.wDurationID); + data_head->duration = + cpu_to_le16(p80211Header->sA2.wDurationID); + } } - } - pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount)); - pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); - pTX_Buffer->byType = 0x00; + 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 = (u16)cbReqCount + 4; //USB header + pContext->pPacket = skb; + pContext->type = CONTEXT_MGMT_PACKET; + pContext->uBufLen = (u16)cbReqCount + 4; //USB header - if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), - &pMACHeader->addr1[0], (u16)cbFrameSize, - pTxBufHead->wFIFOCtl); - } - else { - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), - &pMACHeader->addr3[0], (u16)cbFrameSize, - pTxBufHead->wFIFOCtl); - } - PIPEnsSendBulkOut(pDevice,pContext); - return ; + if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) { + s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), + &pMACHeader->addr1[0], (u16)cbFrameSize, + pTxBufHead->wFIFOCtl); + } + else { + s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), + &pMACHeader->addr3[0], (u16)cbFrameSize, + pTxBufHead->wFIFOCtl); + } + PIPEnsSendBulkOut(pDevice,pContext); + return ; } @@ -2084,7 +2084,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) */ int nsDMA_tx_packet(struct vnt_private *pDevice, - u32 uDMAIdx, struct sk_buff *skb) + u32 uDMAIdx, struct sk_buff *skb) { struct net_device_stats *pStats = &pDevice->stats; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -2108,240 +2108,240 @@ 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) { - dev_kfree_skb_irq(skb); - return 0; - } - - if (is_multicast_ether_addr((u8 *)(skb->data))) { - uNodeIndex = 0; - bNodeExist = true; - if (pMgmt->sNodeDBTable[0].bPSEnable) { - - skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skb); - pMgmt->sNodeDBTable[0].wEnQueueCnt++; - // set tx map - pMgmt->abyPSTxMap[0] |= byMask[0]; - return 0; - } - // multicast/broadcast data rate - - if (pDevice->byBBType != BB_TYPE_11A) - pDevice->wCurrentRate = RATE_2M; - else - pDevice->wCurrentRate = RATE_24M; - // long preamble type - pDevice->byPreambleType = PREAMBLE_SHORT; - - }else { - - if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(skb->data), &uNodeIndex)) { - - if (pMgmt->sNodeDBTable[uNodeIndex].bPSEnable) { - - skb_queue_tail(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue, skb); - - pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt++; - // set tx map - wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID; - pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set:pMgmt->abyPSTxMap[%d]= %d\n", - (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); - - return 0; - } - // AP rate decided from node - pDevice->wCurrentRate = pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate; - // tx preamble decided from node - - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) { - pDevice->byPreambleType = pDevice->byShortPreamble; - - }else { - pDevice->byPreambleType = PREAMBLE_LONG; - } - bNodeExist = true; - } - } - - if (bNodeExist == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Unknown STA not found in node DB \n"); - dev_kfree_skb_irq(skb); - return 0; - } - } + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + + if (pDevice->uAssocCount == 0) { + dev_kfree_skb_irq(skb); + return 0; + } + + if (is_multicast_ether_addr((u8 *)(skb->data))) { + uNodeIndex = 0; + bNodeExist = true; + if (pMgmt->sNodeDBTable[0].bPSEnable) { + + skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skb); + pMgmt->sNodeDBTable[0].wEnQueueCnt++; + // set tx map + pMgmt->abyPSTxMap[0] |= byMask[0]; + return 0; + } + // multicast/broadcast data rate + + if (pDevice->byBBType != BB_TYPE_11A) + pDevice->wCurrentRate = RATE_2M; + else + pDevice->wCurrentRate = RATE_24M; + // long preamble type + pDevice->byPreambleType = PREAMBLE_SHORT; + + }else { + + if (BSSbIsSTAInNodeDB(pDevice, (u8 *)(skb->data), &uNodeIndex)) { + + if (pMgmt->sNodeDBTable[uNodeIndex].bPSEnable) { + + skb_queue_tail(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue, skb); + + pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt++; + // set tx map + wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID; + pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set:pMgmt->abyPSTxMap[%d]= %d\n", + (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); + + return 0; + } + // AP rate decided from node + pDevice->wCurrentRate = pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate; + // tx preamble decided from node + + if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) { + pDevice->byPreambleType = pDevice->byShortPreamble; + + }else { + pDevice->byPreambleType = PREAMBLE_LONG; + } + bNodeExist = true; + } + } + + if (bNodeExist == false) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Unknown STA not found in node DB\n"); + dev_kfree_skb_irq(skb); + return 0; + } + } pContext = s_vGetFreeContext(pDevice); - if (pContext == NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG" pContext == NULL\n"); - dev_kfree_skb_irq(skb); - return STATUS_RESOURCES; - } + if (pContext == NULL) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG" pContext == NULL\n"); + dev_kfree_skb_irq(skb); + return STATUS_RESOURCES; + } + + memcpy(pDevice->sTxEthHeader.h_dest, (u8 *)(skb->data), ETH_HLEN); + + //mike add:station mode check eapol-key challenge---> + { + 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.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)) { + bTxeapol_key = true; + if(!(Key_info & BIT3) && //WPA or RSN group-key challenge + (Key_info & BIT8) && (Key_info & BIT9)) { //send 2/2 key + if(Descriptor_type==254) { + pDevice->fWPA_Authened = true; + PRINT_K("WPA "); + } + else { + pDevice->fWPA_Authened = true; + PRINT_K("WPA2(re-keying) "); + } + PRINT_K("Authentication completed!!\n"); + } + else if((Key_info & BIT3) && (Descriptor_type==2) && //RSN pairwise-key challenge + (Key_info & BIT8) && (Key_info & BIT9)) { + pDevice->fWPA_Authened = true; + PRINT_K("WPA2 Authentication completed!!\n"); + } + } + } + } + //mike add:station mode check eapol-key challenge<--- + + if (pDevice->bEncryptionEnable == true) { + bNeedEncryption = true; + // get Transmit key + do { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && + (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { + pbyBSSID = pDevice->abyBSSID; + // get pairwise key + if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == false) { + // get group key + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) { + bTKIP_UseGTK = true; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); + break; + } + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get PTK.\n"); + break; + } + }else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + /* 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)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"\n"); + + // get pairwise key + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) + break; + } + // get group key + pbyBSSID = pDevice->abyBroadcastAddr; + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { + pTransmitKey = NULL; + if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS and KEY is NULL. [%d]\n", pMgmt->eCurrMode); + } + else + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"NOT IBSS and KEY is NULL. [%d]\n", pMgmt->eCurrMode); + } else { + bTKIP_UseGTK = true; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); + } + } while(false); + } + + if (pDevice->bEnableHostWEP) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"acdma0: STA index %d\n", uNodeIndex); + if (pDevice->bEncryptionEnable == true) { + pTransmitKey = &STempKey; + pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; + pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; + pTransmitKey->uKeyLength = pMgmt->sNodeDBTable[uNodeIndex].uWepKeyLength; + pTransmitKey->dwTSC47_16 = pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16; + pTransmitKey->wTSC15_0 = pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0; + memcpy(pTransmitKey->abyKey, + &pMgmt->sNodeDBTable[uNodeIndex].abyWepKey[0], + pTransmitKey->uKeyLength + ); + } + } - memcpy(pDevice->sTxEthHeader.h_dest, (u8 *)(skb->data), ETH_HLEN); + byPktType = (u8)pDevice->byPacketType; -//mike add:station mode check eapol-key challenge---> -{ - 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.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)) { - bTxeapol_key = true; - if(!(Key_info & BIT3) && //WPA or RSN group-key challenge - (Key_info & BIT8) && (Key_info & BIT9)) { //send 2/2 key - if(Descriptor_type==254) { - pDevice->fWPA_Authened = true; - PRINT_K("WPA "); - } - else { - pDevice->fWPA_Authened = true; - PRINT_K("WPA2(re-keying) "); - } - PRINT_K("Authentication completed!!\n"); - } - else if((Key_info & BIT3) && (Descriptor_type==2) && //RSN pairwise-key challenge - (Key_info & BIT8) && (Key_info & BIT9)) { - pDevice->fWPA_Authened = true; - PRINT_K("WPA2 Authentication completed!!\n"); - } - } - } -} -//mike add:station mode check eapol-key challenge<--- - - if (pDevice->bEncryptionEnable == true) { - bNeedEncryption = true; - // get Transmit key - do { - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && - (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { - pbyBSSID = pDevice->abyBSSID; - // get pairwise key - if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == false) { - // get group key - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) { - bTKIP_UseGTK = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); - break; - } - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get PTK.\n"); - break; - } - }else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - /* 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)); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"\n"); - - // get pairwise key - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) - break; - } - // get group key - pbyBSSID = pDevice->abyBroadcastAddr; - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { - pTransmitKey = NULL; - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS and KEY is NULL. [%d]\n", pMgmt->eCurrMode); - } - else - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"NOT IBSS and KEY is NULL. [%d]\n", pMgmt->eCurrMode); - } else { - bTKIP_UseGTK = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); - } - } while(false); - } - - if (pDevice->bEnableHostWEP) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"acdma0: STA index %d\n", uNodeIndex); - if (pDevice->bEncryptionEnable == true) { - pTransmitKey = &STempKey; - pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; - pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; - pTransmitKey->uKeyLength = pMgmt->sNodeDBTable[uNodeIndex].uWepKeyLength; - pTransmitKey->dwTSC47_16 = pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16; - pTransmitKey->wTSC15_0 = pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0; - memcpy(pTransmitKey->abyKey, - &pMgmt->sNodeDBTable[uNodeIndex].abyWepKey[0], - pTransmitKey->uKeyLength - ); - } - } - - 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 = (u16)pDevice->uConnectionRate; - } - } else { - if ((pDevice->byBBType == BB_TYPE_11A) && - (pDevice->uConnectionRate <= RATE_6M)) { - pDevice->wCurrentRate = RATE_6M; - } else { - if (pDevice->uConnectionRate >= RATE_54M) - pDevice->wCurrentRate = RATE_54M; - else - pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; - } - } - } - else { - if (pDevice->op_mode == NL80211_IFTYPE_ADHOC) { - // Adhoc Tx rate decided from node DB - 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.h_dest[0]), &uNodeIndex)) { - pDevice->wCurrentRate = pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate; - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) { - pDevice->byPreambleType = pDevice->byShortPreamble; - - } - else { - pDevice->byPreambleType = PREAMBLE_LONG; - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Found Node Index is [%d] Tx Data Rate:[%d]\n",uNodeIndex, pDevice->wCurrentRate); - } - else { - if (pDevice->byBBType != BB_TYPE_11A) - pDevice->wCurrentRate = RATE_2M; - else - pDevice->wCurrentRate = RATE_24M; // refer to vMgrCreateOwnIBSS()'s - // abyCurrExtSuppRates[] - pDevice->byPreambleType = PREAMBLE_SHORT; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Not Found Node use highest basic Rate.....\n"); - } - } - } - if (pDevice->op_mode == NL80211_IFTYPE_STATION) { - // Infra STA rate decided from AP Node, index = 0 - pDevice->wCurrentRate = pMgmt->sNodeDBTable[0].wTxDataRate; - } - } + if (pDevice->bFixRate) { + if (pDevice->byBBType == BB_TYPE_11B) { + if (pDevice->uConnectionRate >= RATE_11M) { + pDevice->wCurrentRate = RATE_11M; + } else { + pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; + } + } else { + if ((pDevice->byBBType == BB_TYPE_11A) && + (pDevice->uConnectionRate <= RATE_6M)) { + pDevice->wCurrentRate = RATE_6M; + } else { + if (pDevice->uConnectionRate >= RATE_54M) + pDevice->wCurrentRate = RATE_54M; + else + pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; + } + } + } + else { + if (pDevice->op_mode == NL80211_IFTYPE_ADHOC) { + // Adhoc Tx rate decided from node DB + 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.h_dest[0]), &uNodeIndex)) { + pDevice->wCurrentRate = pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate; + if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) { + pDevice->byPreambleType = pDevice->byShortPreamble; + + } + else { + pDevice->byPreambleType = PREAMBLE_LONG; + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Found Node Index is [%d] Tx Data Rate:[%d]\n",uNodeIndex, pDevice->wCurrentRate); + } + else { + if (pDevice->byBBType != BB_TYPE_11A) + pDevice->wCurrentRate = RATE_2M; + else + pDevice->wCurrentRate = RATE_24M; // refer to vMgrCreateOwnIBSS()'s + // abyCurrExtSuppRates[] + pDevice->byPreambleType = PREAMBLE_SHORT; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Not Found Node use highest basic Rate.....\n"); + } + } + } + if (pDevice->op_mode == NL80211_IFTYPE_STATION) { + // Infra STA rate decided from AP Node, index = 0 + pDevice->wCurrentRate = pMgmt->sNodeDBTable[0].wTxDataRate; + } + } if (pDevice->sTxEthHeader.h_proto == cpu_to_be16(ETH_P_PAE)) { if (pDevice->byBBType != BB_TYPE_11A) { @@ -2357,112 +2357,112 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, } } - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "dma_tx: pDevice->wCurrentRate = %d\n", - pDevice->wCurrentRate); - - if (wKeepRate != pDevice->wCurrentRate) { - bScheduleCommand((void *) pDevice, WLAN_CMD_SETPOWER, NULL); - } - - if (pDevice->wCurrentRate <= RATE_11M) { - byPktType = PK_TYPE_11B; - } - - if (bNeedEncryption == true) { - 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.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"); - } - else { - if (bTKIP_UseGTK == true) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"error: KEY is GTK!!~~\n"); - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", - pTransmitKey->dwKeyIndex); - bNeedEncryption = true; - } - } - } - - if (pDevice->bEnableHostWEP) { - if ((uNodeIndex != 0) && - (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", - pTransmitKey->dwKeyIndex); - bNeedEncryption = true; - } - } - } - else { - - if (pTransmitKey == NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"return no tx key\n"); - pContext->bBoolInUse = false; - dev_kfree_skb_irq(skb); - pStats->tx_dropped++; - return STATUS_FAILURE; - } - } - } + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "dma_tx: pDevice->wCurrentRate = %d\n", + pDevice->wCurrentRate); + + if (wKeepRate != pDevice->wCurrentRate) { + bScheduleCommand((void *) pDevice, WLAN_CMD_SETPOWER, NULL); + } + + if (pDevice->wCurrentRate <= RATE_11M) { + byPktType = PK_TYPE_11B; + } + + if (bNeedEncryption == true) { + 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.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"); + } + else { + if (bTKIP_UseGTK == true) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"error: KEY is GTK!!~~\n"); + } + else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", + pTransmitKey->dwKeyIndex); + bNeedEncryption = true; + } + } + } + + if (pDevice->bEnableHostWEP) { + if ((uNodeIndex != 0) && + (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", + pTransmitKey->dwKeyIndex); + bNeedEncryption = true; + } + } + } + else { + + if (pTransmitKey == NULL) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"return no tx key\n"); + pContext->bBoolInUse = false; + dev_kfree_skb_irq(skb); + pStats->tx_dropped++; + return STATUS_FAILURE; + } + } + } pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0]; - fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType, + fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType, pTX_Buffer, bNeedEncryption, - skb->len, uDMAIdx, &pDevice->sTxEthHeader, - (u8 *)skb->data, pTransmitKey, uNodeIndex, - pDevice->wCurrentRate, - &uHeaderLen, &BytesToWrite - ); - - if (fConvertedPacket == false) { - pContext->bBoolInUse = false; - dev_kfree_skb_irq(skb); - return STATUS_FAILURE; - } - - if ( pDevice->bEnablePSMode == true ) { - if ( !pDevice->bPSModeTxBurst ) { - bScheduleCommand((void *) pDevice, - WLAN_CMD_MAC_DISPOWERSAVING, - NULL); - pDevice->bPSModeTxBurst = true; - } - } - - 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 = (u16)BytesToWrite + 4 ; //USB header - - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), + skb->len, uDMAIdx, &pDevice->sTxEthHeader, + (u8 *)skb->data, pTransmitKey, uNodeIndex, + pDevice->wCurrentRate, + &uHeaderLen, &BytesToWrite + ); + + if (fConvertedPacket == false) { + pContext->bBoolInUse = false; + dev_kfree_skb_irq(skb); + return STATUS_FAILURE; + } + + if ( pDevice->bEnablePSMode == true ) { + if ( !pDevice->bPSModeTxBurst ) { + bScheduleCommand((void *) pDevice, + WLAN_CMD_MAC_DISPOWERSAVING, + NULL); + pDevice->bPSModeTxBurst = true; + } + } + + 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 = (u16)BytesToWrite + 4 ; //USB header + + s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), &pDevice->sTxEthHeader.h_dest[0], (u16)(BytesToWrite-uHeaderLen), pTX_Buffer->fifo_head.wFIFOCtl); - status = PIPEnsSendBulkOut(pDevice,pContext); + status = PIPEnsSendBulkOut(pDevice,pContext); - if (bNeedDeAuth == true) { - u16 wReason = WLAN_MGMT_REASON_MIC_FAILURE; + if (bNeedDeAuth == true) { + u16 wReason = WLAN_MGMT_REASON_MIC_FAILURE; - bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (u8 *) &wReason); - } + bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (u8 *) &wReason); + } - if(status!=STATUS_PENDING) { - pContext->bBoolInUse = false; - dev_kfree_skb_irq(skb); - return STATUS_FAILURE; - } - else - return 0; + if(status!=STATUS_PENDING) { + pContext->bBoolInUse = false; + dev_kfree_skb_irq(skb); + return STATUS_FAILURE; + } + else + return 0; } @@ -2482,7 +2482,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, */ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, - u32 uNodeIndex) + u32 uNodeIndex) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_tx_buffer *pTX_Buffer; @@ -2500,110 +2500,109 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, pContext = s_vGetFreeContext(pDevice); - if (NULL == pContext) { - return false; - } - - memcpy(pDevice->sTxEthHeader.h_dest, (u8 *)pbySkbData, ETH_HLEN); - - if (pDevice->bEncryptionEnable == true) { - bNeedEncryption = true; - // get group key - pbyBSSID = pDevice->abyBroadcastAddr; - if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { - pTransmitKey = NULL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"KEY is NULL. [%d]\n", pMgmt->eCurrMode); - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); - } - } - - if (pDevice->bEnableHostWEP) { - if (uNodeIndex < MAX_NODE_NUM + 1) { - pTransmitKey = &STempKey; - pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; - pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; - pTransmitKey->uKeyLength = pMgmt->sNodeDBTable[uNodeIndex].uWepKeyLength; - pTransmitKey->dwTSC47_16 = pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16; - pTransmitKey->wTSC15_0 = pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0; - memcpy(pTransmitKey->abyKey, - &pMgmt->sNodeDBTable[uNodeIndex].abyWepKey[0], - pTransmitKey->uKeyLength - ); - } - } - - if ( bNeedEncryption && (pTransmitKey == NULL) ) { - pContext->bBoolInUse = false; - return false; - } - - 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 = (u16)pDevice->uConnectionRate; - } - } else { - if ((pDevice->byBBType == BB_TYPE_11A) && - (pDevice->uConnectionRate <= RATE_6M)) { - pDevice->wCurrentRate = RATE_6M; - } else { - if (pDevice->uConnectionRate >= RATE_54M) - pDevice->wCurrentRate = RATE_54M; - else - pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; - } - } - } - else { - pDevice->wCurrentRate = pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate; - } - - if (wKeepRate != pDevice->wCurrentRate) { - bScheduleCommand((void *) pDevice, WLAN_CMD_SETPOWER, NULL); - } - - if (pDevice->wCurrentRate <= RATE_11M) - byPktType = PK_TYPE_11B; - - BytesToWrite = uDataLen + ETH_FCS_LEN; - - // Convert the packet to an usb frame and copy into our buffer - // and send the irp. + if (NULL == pContext) { + return false; + } + + memcpy(pDevice->sTxEthHeader.h_dest, (u8 *)pbySkbData, ETH_HLEN); + + if (pDevice->bEncryptionEnable == true) { + bNeedEncryption = true; + // get group key + pbyBSSID = pDevice->abyBroadcastAddr; + if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { + pTransmitKey = NULL; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"KEY is NULL. [%d]\n", pMgmt->eCurrMode); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); + } + } + + if (pDevice->bEnableHostWEP) { + if (uNodeIndex < MAX_NODE_NUM + 1) { + pTransmitKey = &STempKey; + pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; + pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; + pTransmitKey->uKeyLength = pMgmt->sNodeDBTable[uNodeIndex].uWepKeyLength; + pTransmitKey->dwTSC47_16 = pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16; + pTransmitKey->wTSC15_0 = pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0; + memcpy(pTransmitKey->abyKey, + &pMgmt->sNodeDBTable[uNodeIndex].abyWepKey[0], + pTransmitKey->uKeyLength + ); + } + } + + if ( bNeedEncryption && (pTransmitKey == NULL) ) { + pContext->bBoolInUse = false; + return false; + } + + 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 = (u16)pDevice->uConnectionRate; + } + } else { + if ((pDevice->byBBType == BB_TYPE_11A) && + (pDevice->uConnectionRate <= RATE_6M)) { + pDevice->wCurrentRate = RATE_6M; + } else { + if (pDevice->uConnectionRate >= RATE_54M) + pDevice->wCurrentRate = RATE_54M; + else + pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; + } + } + } + else { + pDevice->wCurrentRate = pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate; + } + + if (wKeepRate != pDevice->wCurrentRate) { + bScheduleCommand((void *) pDevice, WLAN_CMD_SETPOWER, NULL); + } + + if (pDevice->wCurrentRate <= RATE_11M) + byPktType = PK_TYPE_11B; + + BytesToWrite = uDataLen + ETH_FCS_LEN; + + // Convert the packet to an usb frame and copy into our buffer + // and send the irp. pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0]; - fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType, + fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType, pTX_Buffer, bNeedEncryption, - uDataLen, TYPE_AC0DMA, &pDevice->sTxEthHeader, - pbySkbData, pTransmitKey, uNodeIndex, - pDevice->wCurrentRate, - &uHeaderLen, &BytesToWrite - ); + uDataLen, TYPE_AC0DMA, &pDevice->sTxEthHeader, + pbySkbData, pTransmitKey, uNodeIndex, + pDevice->wCurrentRate, + &uHeaderLen, &BytesToWrite + ); - if (fConvertedPacket == false) { - pContext->bBoolInUse = false; - return false; - } + if (fConvertedPacket == false) { + pContext->bBoolInUse = false; + return false; + } - pTX_Buffer->byPKTNO = (u8) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); - pTX_Buffer->wTxByteCount = (u16)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 = (u16)BytesToWrite + 4 ; //USB header + pContext->pPacket = NULL; + pContext->type = CONTEXT_DATA_PACKET; + pContext->uBufLen = (u16)BytesToWrite + 4 ; //USB header - s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), - &pDevice->sTxEthHeader.h_dest[0], - (u16)(BytesToWrite - uHeaderLen), - pTX_Buffer->fifo_head.wFIFOCtl); + s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F), + &pDevice->sTxEthHeader.h_dest[0], + (u16)(BytesToWrite - uHeaderLen), + pTX_Buffer->fifo_head.wFIFOCtl); - status = PIPEnsSendBulkOut(pDevice,pContext); + status = PIPEnsSendBulkOut(pDevice,pContext); - return true; + return true; } - diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h index 6d6539d..530d26a 100644 --- a/drivers/staging/vt6656/rxtx.h +++ b/drivers/staging/vt6656/rxtx.h @@ -251,6 +251,6 @@ int nsDMA_tx_packet(struct vnt_private *, u32 uDMAIdx, struct sk_buff *skb); CMD_STATUS csMgmt_xmit(struct vnt_private *, struct vnt_tx_mgmt *); CMD_STATUS csBeacon_xmit(struct vnt_private *, struct vnt_tx_mgmt *); int bRelayPacketSend(struct vnt_private *, u8 *pbySkbData, u32 uDataLen, - u32 uNodeIndex); + u32 uNodeIndex); #endif /* __RXTX_H__ */ diff --git a/drivers/staging/vt6656/srom.h b/drivers/staging/vt6656/srom.h index 488192d..0a9d8f0 100644 --- a/drivers/staging/vt6656/srom.h +++ b/drivers/staging/vt6656/srom.h @@ -79,34 +79,34 @@ // 2048 bits = 256 bytes = 128 words // typedef struct tagSSromReg { - 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) + 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; #endif /* __EEPROM_H__ */ diff --git a/drivers/staging/vt6656/tcrc.c b/drivers/staging/vt6656/tcrc.c index 7229f26..8d0dc31 100644 --- a/drivers/staging/vt6656/tcrc.c +++ b/drivers/staging/vt6656/tcrc.c @@ -37,70 +37,70 @@ /* 32-bit CRC table */ static const u32 s_adwCrc32Table[256] = { - 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, - 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, - 0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L, - 0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L, - 0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL, - 0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L, - 0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL, - 0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L, - 0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L, - 0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL, - 0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L, - 0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L, - 0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L, - 0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL, - 0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L, - 0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL, - 0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL, - 0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L, - 0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L, - 0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L, - 0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL, - 0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L, - 0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL, - 0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L, - 0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L, - 0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL, - 0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L, - 0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L, - 0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L, - 0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL, - 0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L, - 0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL, - 0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL, - 0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L, - 0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L, - 0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L, - 0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL, - 0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L, - 0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL, - 0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L, - 0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L, - 0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL, - 0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L, - 0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L, - 0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L, - 0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL, - 0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L, - 0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL, - 0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL, - 0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L, - 0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L, - 0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L, - 0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL, - 0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L, - 0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL, - 0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L, - 0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L, - 0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL, - 0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L, - 0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L, - 0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L, - 0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL, - 0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L, - 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL + 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, + 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, + 0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L, + 0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L, + 0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL, + 0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L, + 0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL, + 0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L, + 0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L, + 0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL, + 0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L, + 0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L, + 0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L, + 0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL, + 0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L, + 0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL, + 0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL, + 0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L, + 0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L, + 0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L, + 0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL, + 0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L, + 0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL, + 0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L, + 0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L, + 0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL, + 0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L, + 0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L, + 0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L, + 0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL, + 0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L, + 0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL, + 0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL, + 0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L, + 0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L, + 0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L, + 0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL, + 0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L, + 0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL, + 0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L, + 0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L, + 0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL, + 0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L, + 0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L, + 0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L, + 0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL, + 0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L, + 0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL, + 0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL, + 0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L, + 0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L, + 0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L, + 0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL, + 0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L, + 0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL, + 0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L, + 0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L, + 0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL, + 0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L, + 0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L, + 0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L, + 0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL, + 0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L, + 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL }; /*+ @@ -118,7 +118,7 @@ static const u32 s_adwCrc32Table[256] = { * * Return Value: CRC-32 * --*/ + -*/ u32 CRCdwCrc32(u8 * pbyData, unsigned int cbByte, u32 dwCrcSeed) { u32 dwCrc; @@ -126,7 +126,7 @@ u32 CRCdwCrc32(u8 * pbyData, unsigned int cbByte, u32 dwCrcSeed) dwCrc = dwCrcSeed; while (cbByte--) { dwCrc = s_adwCrc32Table[(u8)((dwCrc ^ (*pbyData)) & 0xFF)] ^ - (dwCrc >> 8); + (dwCrc >> 8); pbyData++; } @@ -150,10 +150,10 @@ u32 CRCdwCrc32(u8 * pbyData, unsigned int cbByte, u32 dwCrcSeed) * * Return Value: CRC-32 * --*/ + -*/ u32 CRCdwGetCrc32(u8 * pbyData, unsigned int cbByte) { - return ~CRCdwCrc32(pbyData, cbByte, 0xFFFFFFFFL); + return ~CRCdwCrc32(pbyData, cbByte, 0xFFFFFFFFL); } /*+ @@ -175,9 +175,8 @@ u32 CRCdwGetCrc32(u8 * pbyData, unsigned int cbByte) * * Return Value: CRC-32 * --*/ + -*/ u32 CRCdwGetCrc32Ex(u8 * pbyData, unsigned int cbByte, u32 dwPreCRC) { - return CRCdwCrc32(pbyData, cbByte, dwPreCRC); + return CRCdwCrc32(pbyData, cbByte, dwPreCRC); } - diff --git a/drivers/staging/vt6656/tether.c b/drivers/staging/vt6656/tether.c index 1db1e84..d910bac 100644 --- a/drivers/staging/vt6656/tether.c +++ b/drivers/staging/vt6656/tether.c @@ -58,4 +58,3 @@ bool ETHbIsBufferCrc32Ok(u8 * pbyBuffer, unsigned int cbFrameLength) return false; return true; } - diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h index aec6b56..e575281 100644 --- a/drivers/staging/vt6656/tether.h +++ b/drivers/staging/vt6656/tether.h @@ -35,7 +35,7 @@ // constants // #define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1) - // Ethernet address string length +// Ethernet address string length #define U_MULTI_ADDR_LEN 8 // multicast address length #ifdef __BIG_ENDIAN diff --git a/drivers/staging/vt6656/tkip.c b/drivers/staging/vt6656/tkip.c index 28282f3..85439e1 100644 --- a/drivers/staging/vt6656/tkip.c +++ b/drivers/staging/vt6656/tkip.c @@ -40,73 +40,73 @@ /* bytes swapped. To allow an endian tolerant implementation, the byte */ /* halves have been expressed independently here. */ static 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, - 0xEC,0x67,0xFD,0xEA,0xBF,0xF7,0x96,0x5B, - 0xC2,0x1C,0xAE,0x6A,0x5A,0x41,0x02,0x4F, - 0x5C,0xF4,0x34,0x08,0x93,0x73,0x53,0x3F, - 0x0C,0x52,0x65,0x5E,0x28,0xA1,0x0F,0xB5, - 0x09,0x36,0x9B,0x3D,0x26,0x69,0xCD,0x9F, - 0x1B,0x9E,0x74,0x2E,0x2D,0xB2,0xEE,0xFB, - 0xF6,0x4D,0x61,0xCE,0x7B,0x3E,0x71,0x97, - 0xF5,0x68,0x00,0x2C,0x60,0x1F,0xC8,0xED, - 0xBE,0x46,0xD9,0x4B,0xDE,0xD4,0xE8,0x4A, - 0x6B,0x2A,0xE5,0x16,0xC5,0xD7,0x55,0x94, - 0xCF,0x10,0x06,0x81,0xF0,0x44,0xBA,0xE3, - 0xF3,0xFE,0xC0,0x8A,0xAD,0xBC,0x48,0x04, - 0xDF,0xC1,0x75,0x63,0x30,0x1A,0x0E,0x6D, - 0x4C,0x14,0x35,0x2F,0xE1,0xA2,0xCC,0x39, - 0x57,0xF2,0x82,0x47,0xAC,0xE7,0x2B,0x95, - 0xA0,0x98,0xD1,0x7F,0x66,0x7E,0xAB,0x83, - 0xCA,0x29,0xD3,0x3C,0x79,0xE2,0x1D,0x76, - 0x3B,0x56,0x4E,0x1E,0xDB,0x0A,0x6C,0xE4, - 0x5D,0x6E,0xEF,0xA6,0xA8,0xA4,0x37,0x8B, - 0x32,0x43,0x59,0xB7,0x8C,0x64,0xD2,0xE0, - 0xB4,0xFA,0x07,0x25,0xAF,0x8E,0xE9,0x18, - 0xD5,0x88,0x6F,0x72,0x24,0xF1,0xC7,0x51, - 0x23,0x7C,0x9C,0x21,0xDD,0xDC,0x86,0x85, - 0x90,0x42,0xC4,0xAA,0xD8,0x05,0x01,0x12, - 0xA3,0x5F,0xF9,0xD0,0x91,0x58,0x27,0xB9, - 0x38,0x13,0xB3,0x33,0xBB,0x70,0x89,0xA7, - 0xB6,0x22,0x92,0x20,0x49,0xFF,0x78,0x7A, - 0x8F,0xF8,0x80,0x17,0xDA,0x31,0xC6,0xB8, - 0xC3,0xB0,0x77,0x11,0xCB,0xFC,0xD6,0x3A + 0xA5,0x84,0x99,0x8D,0x0D,0xBD,0xB1,0x54, + 0x50,0x03,0xA9,0x7D,0x19,0x62,0xE6,0x9A, + 0x45,0x9D,0x40,0x87,0x15,0xEB,0xC9,0x0B, + 0xEC,0x67,0xFD,0xEA,0xBF,0xF7,0x96,0x5B, + 0xC2,0x1C,0xAE,0x6A,0x5A,0x41,0x02,0x4F, + 0x5C,0xF4,0x34,0x08,0x93,0x73,0x53,0x3F, + 0x0C,0x52,0x65,0x5E,0x28,0xA1,0x0F,0xB5, + 0x09,0x36,0x9B,0x3D,0x26,0x69,0xCD,0x9F, + 0x1B,0x9E,0x74,0x2E,0x2D,0xB2,0xEE,0xFB, + 0xF6,0x4D,0x61,0xCE,0x7B,0x3E,0x71,0x97, + 0xF5,0x68,0x00,0x2C,0x60,0x1F,0xC8,0xED, + 0xBE,0x46,0xD9,0x4B,0xDE,0xD4,0xE8,0x4A, + 0x6B,0x2A,0xE5,0x16,0xC5,0xD7,0x55,0x94, + 0xCF,0x10,0x06,0x81,0xF0,0x44,0xBA,0xE3, + 0xF3,0xFE,0xC0,0x8A,0xAD,0xBC,0x48,0x04, + 0xDF,0xC1,0x75,0x63,0x30,0x1A,0x0E,0x6D, + 0x4C,0x14,0x35,0x2F,0xE1,0xA2,0xCC,0x39, + 0x57,0xF2,0x82,0x47,0xAC,0xE7,0x2B,0x95, + 0xA0,0x98,0xD1,0x7F,0x66,0x7E,0xAB,0x83, + 0xCA,0x29,0xD3,0x3C,0x79,0xE2,0x1D,0x76, + 0x3B,0x56,0x4E,0x1E,0xDB,0x0A,0x6C,0xE4, + 0x5D,0x6E,0xEF,0xA6,0xA8,0xA4,0x37,0x8B, + 0x32,0x43,0x59,0xB7,0x8C,0x64,0xD2,0xE0, + 0xB4,0xFA,0x07,0x25,0xAF,0x8E,0xE9,0x18, + 0xD5,0x88,0x6F,0x72,0x24,0xF1,0xC7,0x51, + 0x23,0x7C,0x9C,0x21,0xDD,0xDC,0x86,0x85, + 0x90,0x42,0xC4,0xAA,0xD8,0x05,0x01,0x12, + 0xA3,0x5F,0xF9,0xD0,0x91,0x58,0x27,0xB9, + 0x38,0x13,0xB3,0x33,0xBB,0x70,0x89,0xA7, + 0xB6,0x22,0x92,0x20,0x49,0xFF,0x78,0x7A, + 0x8F,0xF8,0x80,0x17,0xDA,0x31,0xC6,0xB8, + 0xC3,0xB0,0x77,0x11,0xCB,0xFC,0xD6,0x3A }; static 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, - 0x41,0xB3,0x5F,0x45,0x23,0x53,0xE4,0x9B, - 0x75,0xE1,0x3D,0x4C,0x6C,0x7E,0xF5,0x83, - 0x68,0x51,0xD1,0xF9,0xE2,0xAB,0x62,0x2A, - 0x08,0x95,0x46,0x9D,0x30,0x37,0x0A,0x2F, - 0x0E,0x24,0x1B,0xDF,0xCD,0x4E,0x7F,0xEA, - 0x12,0x1D,0x58,0x34,0x36,0xDC,0xB4,0x5B, - 0xA4,0x76,0xB7,0x7D,0x52,0xDD,0x5E,0x13, - 0xA6,0xB9,0x00,0xC1,0x40,0xE3,0x79,0xB6, - 0xD4,0x8D,0x67,0x72,0x94,0x98,0xB0,0x85, - 0xBB,0xC5,0x4F,0xED,0x86,0x9A,0x66,0x11, - 0x8A,0xE9,0x04,0xFE,0xA0,0x78,0x25,0x4B, - 0xA2,0x5D,0x80,0x05,0x3F,0x21,0x70,0xF1, - 0x63,0x77,0xAF,0x42,0x20,0xE5,0xFD,0xBF, - 0x81,0x18,0x26,0xC3,0xBE,0x35,0x88,0x2E, - 0x93,0x55,0xFC,0x7A,0xC8,0xBA,0x32,0xE6, - 0xC0,0x19,0x9E,0xA3,0x44,0x54,0x3B,0x0B, - 0x8C,0xC7,0x6B,0x28,0xA7,0xBC,0x16,0xAD, - 0xDB,0x64,0x74,0x14,0x92,0x0C,0x48,0xB8, - 0x9F,0xBD,0x43,0xC4,0x39,0x31,0xD3,0xF2, - 0xD5,0x8B,0x6E,0xDA,0x01,0xB1,0x9C,0x49, - 0xD8,0xAC,0xF3,0xCF,0xCA,0xF4,0x47,0x10, - 0x6F,0xF0,0x4A,0x5C,0x38,0x57,0x73,0x97, - 0xCB,0xA1,0xE8,0x3E,0x96,0x61,0x0D,0x0F, - 0xE0,0x7C,0x71,0xCC,0x90,0x06,0xF7,0x1C, - 0xC2,0x6A,0xAE,0x69,0x17,0x99,0x3A,0x27, - 0xD9,0xEB,0x2B,0x22,0xD2,0xA9,0x07,0x33, - 0x2D,0x3C,0x15,0xC9,0x87,0xAA,0x50,0xA5, - 0x03,0x59,0x09,0x1A,0x65,0xD7,0x84,0xD0, - 0x82,0x29,0x5A,0x1E,0x7B,0xA8,0x6D,0x2C + 0xC6,0xF8,0xEE,0xF6,0xFF,0xD6,0xDE,0x91, + 0x60,0x02,0xCE,0x56,0xE7,0xB5,0x4D,0xEC, + 0x8F,0x1F,0x89,0xFA,0xEF,0xB2,0x8E,0xFB, + 0x41,0xB3,0x5F,0x45,0x23,0x53,0xE4,0x9B, + 0x75,0xE1,0x3D,0x4C,0x6C,0x7E,0xF5,0x83, + 0x68,0x51,0xD1,0xF9,0xE2,0xAB,0x62,0x2A, + 0x08,0x95,0x46,0x9D,0x30,0x37,0x0A,0x2F, + 0x0E,0x24,0x1B,0xDF,0xCD,0x4E,0x7F,0xEA, + 0x12,0x1D,0x58,0x34,0x36,0xDC,0xB4,0x5B, + 0xA4,0x76,0xB7,0x7D,0x52,0xDD,0x5E,0x13, + 0xA6,0xB9,0x00,0xC1,0x40,0xE3,0x79,0xB6, + 0xD4,0x8D,0x67,0x72,0x94,0x98,0xB0,0x85, + 0xBB,0xC5,0x4F,0xED,0x86,0x9A,0x66,0x11, + 0x8A,0xE9,0x04,0xFE,0xA0,0x78,0x25,0x4B, + 0xA2,0x5D,0x80,0x05,0x3F,0x21,0x70,0xF1, + 0x63,0x77,0xAF,0x42,0x20,0xE5,0xFD,0xBF, + 0x81,0x18,0x26,0xC3,0xBE,0x35,0x88,0x2E, + 0x93,0x55,0xFC,0x7A,0xC8,0xBA,0x32,0xE6, + 0xC0,0x19,0x9E,0xA3,0x44,0x54,0x3B,0x0B, + 0x8C,0xC7,0x6B,0x28,0xA7,0xBC,0x16,0xAD, + 0xDB,0x64,0x74,0x14,0x92,0x0C,0x48,0xB8, + 0x9F,0xBD,0x43,0xC4,0x39,0x31,0xD3,0xF2, + 0xD5,0x8B,0x6E,0xDA,0x01,0xB1,0x9C,0x49, + 0xD8,0xAC,0xF3,0xCF,0xCA,0xF4,0x47,0x10, + 0x6F,0xF0,0x4A,0x5C,0x38,0x57,0x73,0x97, + 0xCB,0xA1,0xE8,0x3E,0x96,0x61,0x0D,0x0F, + 0xE0,0x7C,0x71,0xCC,0x90,0x06,0xF7,0x1C, + 0xC2,0x6A,0xAE,0x69,0x17,0x99,0x3A,0x27, + 0xD9,0xEB,0x2B,0x22,0xD2,0xA9,0x07,0x33, + 0x2D,0x3C,0x15,0xC9,0x87,0xAA,0x50,0xA5, + 0x03,0x59,0x09,0x1A,0x65,0xD7,0x84,0xD0, + 0x82,0x29,0x5A,0x1E,0x7B,0xA8,0x6D,0x2C }; //STKIPKeyManagement sTKIPKeyTable[MAX_TKIP_KEY]; @@ -118,30 +118,30 @@ static const u8 TKIP_Sbox_Upper[256] = { /************************************************************/ static unsigned int tkip_sbox(unsigned int index) { - unsigned int index_low; - unsigned int index_high; - unsigned int left, right; + unsigned int index_low; + unsigned int index_high; + unsigned int left, right; - index_low = (index % 256); - index_high = ((index >> 8) % 256); + index_low = (index % 256); + index_high = ((index >> 8) % 256); - left = TKIP_Sbox_Lower[index_low] + (TKIP_Sbox_Upper[index_low] * 256); - right = TKIP_Sbox_Upper[index_high] + (TKIP_Sbox_Lower[index_high] * 256); + left = TKIP_Sbox_Lower[index_low] + (TKIP_Sbox_Upper[index_low] * 256); + right = TKIP_Sbox_Upper[index_high] + (TKIP_Sbox_Lower[index_high] * 256); - return (left ^ right); + return (left ^ right); }; static unsigned int rotr1(unsigned int a) { - unsigned int b; - - if ((a & 0x01) == 0x01) { - b = (a >> 1) | 0x8000; - } else { - b = (a >> 1) & 0x7fff; - } - b = b % 65536; - return b; + unsigned int b; + + if ((a & 0x01) == 0x01) { + b = (a >> 1) | 0x8000; + } else { + b = (a >> 1) & 0x7fff; + } + b = b % 65536; + return b; } /* @@ -159,12 +159,12 @@ static unsigned int rotr1(unsigned int a) * */ void TKIPvMixKey( - u8 * pbyTKey, - u8 * pbyTA, - u16 wTSC15_0, - u32 dwTSC47_16, - u8 * pbyRC4Key - ) + u8 * pbyTKey, + u8 * pbyTA, + u16 wTSC15_0, + u32 dwTSC47_16, + u8 * pbyRC4Key + ) { u32 p1k[5]; u32 tsc0, tsc1, tsc2; @@ -186,26 +186,26 @@ void TKIPvMixKey( p1k[3] = (u32)(pbyTA[2] + (pbyTA[3]*256)); p1k[4] = (u32)(pbyTA[4] + (pbyTA[5]*256)); - /* Phase 1, step 2 */ - for (i=0; i<8; i++) { - j = 2*(i & 1); - p1k[0] = (p1k[0] + tkip_sbox((p1k[4] ^ ((256*pbyTKey[1+j]) + pbyTKey[j])) % 65536)) % 65536; - p1k[1] = (p1k[1] + tkip_sbox((p1k[0] ^ ((256*pbyTKey[5+j]) + pbyTKey[4+j])) % 65536)) % 65536; - p1k[2] = (p1k[2] + tkip_sbox((p1k[1] ^ ((256*pbyTKey[9+j]) + pbyTKey[8+j])) % 65536)) % 65536; - p1k[3] = (p1k[3] + tkip_sbox((p1k[2] ^ ((256*pbyTKey[13+j]) + pbyTKey[12+j])) % 65536)) % 65536; - p1k[4] = (p1k[4] + tkip_sbox((p1k[3] ^ (((256*pbyTKey[1+j]) + pbyTKey[j]))) % 65536)) % 65536; - p1k[4] = (p1k[4] + i) % 65536; - } - - /* Phase 2, Step 1 */ - ppk0 = p1k[0]; - ppk1 = p1k[1]; - ppk2 = p1k[2]; - ppk3 = p1k[3]; - ppk4 = p1k[4]; - ppk5 = (p1k[4] + tsc2) % 65536; - - /* Phase2, Step 2 */ + /* Phase 1, step 2 */ + for (i=0; i<8; i++) { + j = 2*(i & 1); + p1k[0] = (p1k[0] + tkip_sbox((p1k[4] ^ ((256*pbyTKey[1+j]) + pbyTKey[j])) % 65536)) % 65536; + p1k[1] = (p1k[1] + tkip_sbox((p1k[0] ^ ((256*pbyTKey[5+j]) + pbyTKey[4+j])) % 65536)) % 65536; + p1k[2] = (p1k[2] + tkip_sbox((p1k[1] ^ ((256*pbyTKey[9+j]) + pbyTKey[8+j])) % 65536)) % 65536; + p1k[3] = (p1k[3] + tkip_sbox((p1k[2] ^ ((256*pbyTKey[13+j]) + pbyTKey[12+j])) % 65536)) % 65536; + p1k[4] = (p1k[4] + tkip_sbox((p1k[3] ^ (((256*pbyTKey[1+j]) + pbyTKey[j]))) % 65536)) % 65536; + p1k[4] = (p1k[4] + i) % 65536; + } + + /* Phase 2, Step 1 */ + ppk0 = p1k[0]; + ppk1 = p1k[1]; + ppk2 = p1k[2]; + ppk3 = p1k[3]; + ppk4 = p1k[4]; + ppk5 = (p1k[4] + tsc2) % 65536; + + /* Phase2, Step 2 */ ppk0 = ppk0 + tkip_sbox((ppk5 ^ ((256*pbyTKey[1]) + pbyTKey[0])) % 65536); ppk1 = ppk1 + tkip_sbox((ppk0 ^ ((256*pbyTKey[3]) + pbyTKey[2])) % 65536); ppk2 = ppk2 + tkip_sbox((ppk1 ^ ((256*pbyTKey[5]) + pbyTKey[4])) % 65536); @@ -220,27 +220,27 @@ void TKIPvMixKey( ppk4 = ppk4 + rotr1(ppk3); ppk5 = ppk5 + rotr1(ppk4); - /* Phase 2, Step 3 */ - pbyRC4Key[0] = (tsc2 >> 8) % 256; - pbyRC4Key[1] = (((tsc2 >> 8) % 256) | 0x20) & 0x7f; - pbyRC4Key[2] = tsc2 % 256; - pbyRC4Key[3] = ((ppk5 ^ ((256*pbyTKey[1]) + pbyTKey[0])) >> 1) % 256; + /* Phase 2, Step 3 */ + pbyRC4Key[0] = (tsc2 >> 8) % 256; + pbyRC4Key[1] = (((tsc2 >> 8) % 256) | 0x20) & 0x7f; + pbyRC4Key[2] = tsc2 % 256; + pbyRC4Key[3] = ((ppk5 ^ ((256*pbyTKey[1]) + pbyTKey[0])) >> 1) % 256; - pbyRC4Key[4] = ppk0 % 256; - pbyRC4Key[5] = (ppk0 >> 8) % 256; + pbyRC4Key[4] = ppk0 % 256; + pbyRC4Key[5] = (ppk0 >> 8) % 256; - pbyRC4Key[6] = ppk1 % 256; - pbyRC4Key[7] = (ppk1 >> 8) % 256; + pbyRC4Key[6] = ppk1 % 256; + pbyRC4Key[7] = (ppk1 >> 8) % 256; - pbyRC4Key[8] = ppk2 % 256; - pbyRC4Key[9] = (ppk2 >> 8) % 256; + pbyRC4Key[8] = ppk2 % 256; + pbyRC4Key[9] = (ppk2 >> 8) % 256; - pbyRC4Key[10] = ppk3 % 256; - pbyRC4Key[11] = (ppk3 >> 8) % 256; + pbyRC4Key[10] = ppk3 % 256; + pbyRC4Key[11] = (ppk3 >> 8) % 256; - pbyRC4Key[12] = ppk4 % 256; - pbyRC4Key[13] = (ppk4 >> 8) % 256; + pbyRC4Key[12] = ppk4 % 256; + pbyRC4Key[13] = (ppk4 >> 8) % 256; - pbyRC4Key[14] = ppk5 % 256; - pbyRC4Key[15] = (ppk5 >> 8) % 256; + pbyRC4Key[14] = ppk5 % 256; + pbyRC4Key[15] = (ppk5 >> 8) % 256; } diff --git a/drivers/staging/vt6656/tkip.h b/drivers/staging/vt6656/tkip.h index 4fba7ef..81f22c8 100644 --- a/drivers/staging/vt6656/tkip.h +++ b/drivers/staging/vt6656/tkip.h @@ -35,11 +35,11 @@ #define TKIP_KEY_LEN 16 void TKIPvMixKey( - u8 * pbyTKey, - u8 * pbyTA, - u16 wTSC15_0, - u32 dwTSC47_16, - u8 * pbyRC4Key - ); + u8 * pbyTKey, + u8 * pbyTA, + u16 wTSC15_0, + u32 dwTSC47_16, + u8 * pbyRC4Key + ); #endif /* __TKIP_H__ */ diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index c5838d9..4272d9c 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -67,55 +67,55 @@ static void s_nsControlInUsbIoCompleteRead(struct urb *urb); static void s_nsControlInUsbIoCompleteWrite(struct urb *urb); int PIPEnsControlOutAsyn(struct vnt_private *pDevice, u8 byRequest, - u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer) + u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer) { int ntStatus; - if (pDevice->Flags & fMP_DISCONNECTED) - return STATUS_FAILURE; - - if (pDevice->Flags & fMP_CONTROL_WRITES) - return STATUS_FAILURE; - - if (in_interrupt()) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"in_interrupt return ..byRequest %x\n", byRequest); - return STATUS_FAILURE; - } - - ntStatus = usb_control_msg( - pDevice->usb, - usb_sndctrlpipe(pDevice->usb , 0), - byRequest, - 0x40, // RequestType - wValue, - wIndex, - (void *) pbyBuffer, - wLength, - HZ - ); - if (ntStatus >= 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe ntStatus= %d\n", ntStatus); - ntStatus = 0; - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe fail, ntStatus= %d\n", ntStatus); - } - - return ntStatus; + if (pDevice->Flags & fMP_DISCONNECTED) + return STATUS_FAILURE; + + if (pDevice->Flags & fMP_CONTROL_WRITES) + return STATUS_FAILURE; + + if (in_interrupt()) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"in_interrupt return ..byRequest %x\n", byRequest); + return STATUS_FAILURE; + } + + ntStatus = usb_control_msg( + pDevice->usb, + usb_sndctrlpipe(pDevice->usb , 0), + byRequest, + 0x40, // RequestType + wValue, + wIndex, + (void *) pbyBuffer, + wLength, + HZ + ); + if (ntStatus >= 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe ntStatus= %d\n", ntStatus); + ntStatus = 0; + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe fail, ntStatus= %d\n", ntStatus); + } + + return ntStatus; } int PIPEnsControlOut(struct vnt_private *pDevice, u8 byRequest, u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer) - __releases(&pDevice->lock) - __acquires(&pDevice->lock) + __releases(&pDevice->lock) +__acquires(&pDevice->lock) { int ntStatus = 0; int ii; - if (pDevice->Flags & fMP_DISCONNECTED) - return STATUS_FAILURE; + if (pDevice->Flags & fMP_DISCONNECTED) + return STATUS_FAILURE; - if (pDevice->Flags & fMP_CONTROL_WRITES) - return STATUS_FAILURE; + if (pDevice->Flags & fMP_CONTROL_WRITES) + return STATUS_FAILURE; if (pDevice->Flags & fMP_CONTROL_READS) return STATUS_FAILURE; @@ -131,55 +131,55 @@ int PIPEnsControlOut(struct vnt_private *pDevice, u8 byRequest, u16 wValue, pDevice->sUsbCtlRequest.wIndex = cpu_to_le16p(&wIndex); pDevice->sUsbCtlRequest.wLength = cpu_to_le16p(&wLength); pDevice->pControlURB->transfer_flags |= URB_ASYNC_UNLINK; - pDevice->pControlURB->actual_length = 0; - // Notice, pbyBuffer limited point to variable buffer, can't be constant. - usb_fill_control_urb(pDevice->pControlURB, pDevice->usb, - usb_sndctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, - pbyBuffer, wLength, s_nsControlInUsbIoCompleteWrite, pDevice); + pDevice->pControlURB->actual_length = 0; + // Notice, pbyBuffer limited point to variable buffer, can't be constant. + usb_fill_control_urb(pDevice->pControlURB, pDevice->usb, + usb_sndctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, + pbyBuffer, wLength, s_nsControlInUsbIoCompleteWrite, pDevice); ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); if (ntStatus != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "control send request submission failed: %d\n", + "control send request submission failed: %d\n", ntStatus); MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); return STATUS_FAILURE; } spin_unlock_irq(&pDevice->lock); - for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { - - if (pDevice->Flags & fMP_CONTROL_WRITES) - mdelay(1); - else - break; - - if (ii >= USB_CTL_WAIT) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "control send request submission timeout\n"); - spin_lock_irq(&pDevice->lock); - MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); - return STATUS_FAILURE; - } - } + for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { + + if (pDevice->Flags & fMP_CONTROL_WRITES) + mdelay(1); + else + break; + + if (ii >= USB_CTL_WAIT) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "control send request submission timeout\n"); + spin_lock_irq(&pDevice->lock); + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); + return STATUS_FAILURE; + } + } spin_lock_irq(&pDevice->lock); - return STATUS_SUCCESS; + return STATUS_SUCCESS; } int PIPEnsControlIn(struct vnt_private *pDevice, u8 byRequest, u16 wValue, - u16 wIndex, u16 wLength, u8 *pbyBuffer) + u16 wIndex, u16 wLength, u8 *pbyBuffer) __releases(&pDevice->lock) - __acquires(&pDevice->lock) +__acquires(&pDevice->lock) { int ntStatus = 0; int ii; - if (pDevice->Flags & fMP_DISCONNECTED) - return STATUS_FAILURE; + if (pDevice->Flags & fMP_DISCONNECTED) + return STATUS_FAILURE; - if (pDevice->Flags & fMP_CONTROL_READS) - return STATUS_FAILURE; + if (pDevice->Flags & fMP_CONTROL_READS) + return STATUS_FAILURE; if (pDevice->Flags & fMP_CONTROL_WRITES) return STATUS_FAILURE; @@ -195,38 +195,38 @@ int PIPEnsControlIn(struct vnt_private *pDevice, u8 byRequest, u16 wValue, pDevice->sUsbCtlRequest.wIndex = cpu_to_le16p(&wIndex); pDevice->sUsbCtlRequest.wLength = cpu_to_le16p(&wLength); pDevice->pControlURB->transfer_flags |= URB_ASYNC_UNLINK; - pDevice->pControlURB->actual_length = 0; + pDevice->pControlURB->actual_length = 0; usb_fill_control_urb(pDevice->pControlURB, pDevice->usb, - usb_rcvctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, - pbyBuffer, wLength, s_nsControlInUsbIoCompleteRead, pDevice); + usb_rcvctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, + pbyBuffer, wLength, s_nsControlInUsbIoCompleteRead, pDevice); ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); if (ntStatus != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "control request submission failed: %d\n", ntStatus); + "control request submission failed: %d\n", ntStatus); MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); return STATUS_FAILURE; } spin_unlock_irq(&pDevice->lock); - for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { - - if (pDevice->Flags & fMP_CONTROL_READS) - mdelay(1); - else - break; - - if (ii >= USB_CTL_WAIT) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "control rcv request submission timeout\n"); - spin_lock_irq(&pDevice->lock); - MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); - return STATUS_FAILURE; - } - } + for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { + + if (pDevice->Flags & fMP_CONTROL_READS) + mdelay(1); + else + break; + + if (ii >= USB_CTL_WAIT) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "control rcv request submission timeout\n"); + spin_lock_irq(&pDevice->lock); + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); + return STATUS_FAILURE; + } + } spin_lock_irq(&pDevice->lock); - return ntStatus; + return ntStatus; } static void s_nsControlInUsbIoCompleteWrite(struct urb *urb) @@ -247,7 +247,7 @@ static void s_nsControlInUsbIoCompleteWrite(struct urb *urb) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status %d\n", urb->status); } - MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); } /* @@ -282,7 +282,7 @@ static void s_nsControlInUsbIoCompleteRead(struct urb *urb) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status %d\n", urb->status); } - MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); } /* @@ -312,23 +312,23 @@ int PIPEnsInterruptRead(struct vnt_private *priv) priv->int_buf.in_use = true; usb_fill_int_urb(priv->pInterruptURB, - priv->usb, - usb_rcvintpipe(priv->usb, 1), - priv->int_buf.data_buf, - MAX_INTERRUPT_SIZE, - s_nsInterruptUsbIoCompleteRead, - priv, - priv->int_interval); + priv->usb, + usb_rcvintpipe(priv->usb, 1), + priv->int_buf.data_buf, + MAX_INTERRUPT_SIZE, + s_nsInterruptUsbIoCompleteRead, + priv, + priv->int_interval); status = usb_submit_urb(priv->pInterruptURB, GFP_ATOMIC); if (status) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Submit int URB failed %d\n", status); + "Submit int URB failed %d\n", status); priv->int_buf.in_use = false; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "<----s_nsStartInterruptUsbRead Return(%x)\n", status); + "<----s_nsStartInterruptUsbRead Return(%x)\n", status); return status; } @@ -372,13 +372,13 @@ static void s_nsInterruptUsbIoCompleteRead(struct urb *urb) status = urb->status; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "s_nsInterruptUsbIoCompleteRead Status %d\n", status); + "s_nsInterruptUsbIoCompleteRead Status %d\n", status); if (status != STATUS_SUCCESS) { priv->int_buf.in_use = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "IntUSBIoCompleteControl STATUS = %d\n", status); + "IntUSBIoCompleteControl STATUS = %d\n", status); } else { INTnsProcessData(priv); } @@ -386,7 +386,7 @@ static void s_nsInterruptUsbIoCompleteRead(struct urb *urb) status = usb_submit_urb(priv->pInterruptURB, GFP_ATOMIC); if (status) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Submit int URB failed %d\n", status); + "Submit int URB failed %d\n", status); } else { priv->int_buf.in_use = true; } @@ -425,12 +425,12 @@ int PIPEnsBulkInUsbRead(struct vnt_private *priv, struct vnt_rcb *rcb) } usb_fill_bulk_urb(urb, - priv->usb, - usb_rcvbulkpipe(priv->usb, 2), - (void *) (rcb->skb->data), - MAX_TOTAL_SIZE_WITH_ALL_HEADERS, - s_nsBulkInUsbIoCompleteRead, - rcb); + priv->usb, + usb_rcvbulkpipe(priv->usb, 2), + (void *) (rcb->skb->data), + MAX_TOTAL_SIZE_WITH_ALL_HEADERS, + s_nsBulkInUsbIoCompleteRead, + rcb); status = usb_submit_urb(urb, GFP_ATOMIC); if (status != 0) { @@ -494,7 +494,7 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb) rcb->Ref--; if (rcb->Ref == 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RxvFreeNormal %d\n", - priv->NumRecvFreeList); + priv->NumRecvFreeList); spin_lock(&priv->lock); RXvFreeRCB(rcb, re_alloc_skb); @@ -520,7 +520,7 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb) */ int PIPEnsSendBulkOut(struct vnt_private *priv, - struct vnt_usb_send_context *context) + struct vnt_usb_send_context *context) { int status; struct urb *urb; @@ -594,7 +594,7 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb) switch (urb->status) { case 0: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "Write %d bytes\n", context->uBufLen); + "Write %d bytes\n", context->uBufLen); break; case -ECONNRESET: case -ENOENT: @@ -616,7 +616,7 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb) dev_kfree_skb_irq(context->pPacket); context->pPacket = NULL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "tx %d bytes\n", context->uBufLen); + "tx %d bytes\n", context->uBufLen); } priv->dev->trans_start = jiffies; diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h index f537703..6de726f 100644 --- a/drivers/staging/vt6656/usbpipe.h +++ b/drivers/staging/vt6656/usbpipe.h @@ -35,13 +35,13 @@ int PIPEnsControlOut(struct vnt_private *, u8 byRequest, u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer); int PIPEnsControlOutAsyn(struct vnt_private *, u8 byRequest, - u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer); + u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer); int PIPEnsControlIn(struct vnt_private *, u8 byRequest, u16 wValue, - u16 wIndex, u16 wLength, u8 *pbyBuffer); + u16 wIndex, u16 wLength, u8 *pbyBuffer); int PIPEnsInterruptRead(struct vnt_private *); int PIPEnsBulkInUsbRead(struct vnt_private *, struct vnt_rcb *pRCB); int PIPEnsSendBulkOut(struct vnt_private *, - struct vnt_usb_send_context *pContext); + struct vnt_usb_send_context *pContext); #endif /* __USBPIPE_H__ */ diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 3cf3f24..66c7c53 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -61,8 +61,8 @@ static int msglevel = MSG_LEVEL_INFO; static void s_vProbeChannel(struct vnt_private *); static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *, - struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); + 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 *); @@ -100,9 +100,9 @@ static void vAdHocBeaconStop(struct vnt_private *pDevice) */ bStop = false; if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && - (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { + (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) && - (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { + (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { bStop = true; } if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) @@ -134,14 +134,14 @@ static void vAdHocBeaconRestart(struct vnt_private *pDevice) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - /* - * Restart Beacon packet for AdHoc Server - * if all of the following coditions are met: - * (1) STA is in AdHoc mode - * (2) VT3253 is programmed as automatic Beacon Transmitting - */ + /* + * Restart Beacon packet for AdHoc Server + * if all of the following coditions are met: + * (1) STA is in AdHoc mode + * (2) VT3253 is programmed as automatic Beacon Transmitting + */ if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && - (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { + (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { //PMESG(("RESTART_BEACON\n")); MACvRegBitsOn(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); } @@ -157,22 +157,22 @@ static void vAdHocBeaconRestart(struct vnt_private *pDevice) * Return Value: * none. * --*/ + -*/ static void s_vProbeChannel(struct vnt_private *pDevice) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_tx_mgmt *pTxPacket; u8 abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, - 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; - /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M*/ + 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; + /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M*/ u8 abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, - 4, 0x0C, 0x12, 0x18, 0x60}; - /* 6M, 9M, 12M, 48M*/ + 4, 0x0C, 0x12, 0x18, 0x60}; + /* 6M, 9M, 12M, 48M*/ u8 abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, - 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; + 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; u8 abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, - 4, 0x02, 0x04, 0x0B, 0x16}; + 4, 0x02, 0x04, 0x0B, 0x16}; u8 *pbyRate; int ii; @@ -185,14 +185,14 @@ static void s_vProbeChannel(struct vnt_private *pDevice) // build an assocreq frame and send it pTxPacket = s_MgrMakeProbeRequest - ( - pDevice, - pMgmt, - pMgmt->abyScanBSSID, - (PWLAN_IE_SSID)pMgmt->abyScanSSID, - (PWLAN_IE_SUPP_RATES)pbyRate, - (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRatesG - ); + ( + pDevice, + pMgmt, + pMgmt->abyScanBSSID, + (PWLAN_IE_SSID)pMgmt->abyScanSSID, + (PWLAN_IE_SUPP_RATES)pbyRate, + (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRatesG + ); if (pTxPacket != NULL) { for (ii = 0; ii < 1; ii++) { @@ -215,28 +215,28 @@ static void s_vProbeChannel(struct vnt_private *pDevice) * Return Value: * A ptr to Tx frame or NULL on allocation failure * --*/ + -*/ static 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) + struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { 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); + + WLAN_PROBEREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (u8 *)pTxPacket->p80211Header; sFrame.len = WLAN_PROBEREQ_FR_MAXLEN; vMgrEncodeProbeRequest(&sFrame); sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBEREQ) - )); + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBEREQ) + )); memcpy(sFrame.pHdr->sA3.abyAddr1, pScanBSSID, WLAN_ADDR_LEN); memcpy(sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); memcpy(sFrame.pHdr->sA3.abyAddr3, pScanBSSID, WLAN_BSSID_LEN); @@ -259,17 +259,17 @@ static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, return pTxPacket; } -static void + static void vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond) { schedule_delayed_work(&pDevice->run_command_work, - msecs_to_jiffies(MSecond)); + msecs_to_jiffies(MSecond)); } void vRunCommand(struct work_struct *work) { struct vnt_private *pDevice = - container_of(work, struct vnt_private, run_command_work.work); + container_of(work, struct vnt_private, run_command_work.work); struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PWLAN_IE_SSID pItemSSID; PWLAN_IE_SSID pItemSSIDCurr; @@ -333,11 +333,11 @@ void vRunCommand(struct work_struct *work) //lucas vAdHocBeaconStop(pDevice); if ((pDevice->byBBType != BB_TYPE_11A) && - (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { + (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { pDevice->byBBType = BB_TYPE_11A; CARDvSetBSSMode(pDevice); } else if ((pDevice->byBBType == BB_TYPE_11A) && - (pMgmt->uScanChannel <= CB_MAX_CHANNEL_24G)) { + (pMgmt->uScanChannel <= CB_MAX_CHANNEL_24G)) { pDevice->byBBType = BB_TYPE_11G; CARDvSetBSSMode(pDevice); } @@ -354,7 +354,7 @@ void vRunCommand(struct work_struct *work) pMgmt->uScanChannel++; while (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel) && - pMgmt->uScanChannel <= pDevice->byMaxChannel){ + pMgmt->uScanChannel <= pDevice->byMaxChannel){ pMgmt->uScanChannel++; } @@ -363,7 +363,7 @@ void vRunCommand(struct work_struct *work) pDevice->eCommandState = WLAN_CMD_SCAN_END; } if ((pMgmt->b11hEnable == false) || - (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { + (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { s_vProbeChannel(pDevice); spin_unlock_irq(&pDevice->lock); vCommandTimerWait((void *) pDevice, 100); @@ -415,7 +415,7 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_DISASSOCIATE_START: pDevice->byReAssocCount = 0; if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && - (pMgmt->eCurrState != WMAC_STATE_ASSOC)) { + (pMgmt->eCurrState != WMAC_STATE_ASSOC)) { break; } else { pDevice->bwextstep0 = false; @@ -428,10 +428,10 @@ void vRunCommand(struct work_struct *work) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); // reason = 8 : disassoc because sta has left vMgrDisassocBeginSta((void *) pDevice, - pMgmt, - pMgmt->abyCurrBSSID, - (8), - &Status); + pMgmt, + pMgmt->abyCurrBSSID, + (8), + &Status); pDevice->bLinkPass = false; ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); // unlock command busy @@ -440,7 +440,7 @@ void vRunCommand(struct work_struct *work) memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->sNodeDBTable[0].bActive = false; -// pDevice->bBeaconBufReady = false; + // pDevice->bBeaconBufReady = false; } netif_stop_queue(pDevice->dev); if (pDevice->bNeedRadioOFF == true) @@ -455,7 +455,7 @@ void vRunCommand(struct work_struct *work) break; memcpy(pMgmt->abyAdHocSSID, pMgmt->abyDesireSSID, - ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); + ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; @@ -471,10 +471,10 @@ void vRunCommand(struct work_struct *work) } if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || - ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { + ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { if (pItemSSID->len == pItemSSIDCurr->len) { if (!memcmp(pItemSSID->abySSID, - pItemSSIDCurr->abySSID, pItemSSID->len)) + pItemSSIDCurr->abySSID, pItemSSID->len)) break; } netif_stop_queue(pDevice->dev); @@ -493,10 +493,10 @@ void vRunCommand(struct work_struct *work) // reason = (3) because sta has left ESS if (pMgmt->eCurrState >= WMAC_STATE_AUTH) { vMgrDeAuthenBeginSta((void *)pDevice, - pMgmt, - pMgmt->abyCurrBSSID, - (3), - &Status); + pMgmt, + pMgmt->abyCurrBSSID, + (3), + &Status); } // Call mgr to begin the authentication vMgrAuthenBeginSta((void *) pDevice, pMgmt, &Status); @@ -524,7 +524,7 @@ void vRunCommand(struct work_struct *work) vMgrCreateOwnIBSS((void *) pDevice, &Status); if (Status != CMD_STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); + KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); } BSSvAddMulticastNode(pDevice); } @@ -533,25 +533,25 @@ void vRunCommand(struct work_struct *work) // if SSID not found else if (pMgmt->eCurrMode == WMAC_MODE_STANDBY) { if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA || - pMgmt->eConfigMode == WMAC_CONFIG_AUTO) { + pMgmt->eConfigMode == WMAC_CONFIG_AUTO) { // start own IBSS DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "CreateOwn IBSS by CurrMode = STANDBY\n"); + KERN_INFO "CreateOwn IBSS by CurrMode = STANDBY\n"); vMgrCreateOwnIBSS((void *) pDevice, &Status); if (Status != CMD_STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); + KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); } BSSvAddMulticastNode(pDevice); s_bClearBSSID_SCAN(pDevice); -/* - pDevice->bLinkPass = true; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); - if (netif_queue_stopped(pDevice->dev)){ - netif_wake_queue(pDevice->dev); - } - s_bClearBSSID_SCAN(pDevice); -*/ + /* + pDevice->bLinkPass = true; + ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); + if (netif_queue_stopped(pDevice->dev)){ + netif_wake_queue(pDevice->dev); + } + s_bClearBSSID_SCAN(pDevice); + */ } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); // if(pDevice->bWPASuppWextEnabled == true) @@ -602,11 +602,11 @@ void vRunCommand(struct work_struct *work) PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval); } -/* - if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) { - KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); - } -*/ + /* + if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) { + KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); + } + */ pDevice->byLinkWaitCount = 0; pDevice->byReAssocCount = 0; pDevice->bLinkPass = true; @@ -649,7 +649,7 @@ void vRunCommand(struct work_struct *work) vMgrCreateOwnIBSS((void *) pDevice, &Status); if (Status != CMD_STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "vMgrCreateOwnIBSS fail!\n"); + KERN_INFO "vMgrCreateOwnIBSS fail!\n"); } // always turn off unicast bit MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_UNICAST); @@ -685,14 +685,14 @@ void vRunCommand(struct work_struct *work) // PS nodes tx for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive && - pMgmt->sNodeDBTable[ii].bRxPSPoll) { + pMgmt->sNodeDBTable[ii].bRxPSPoll) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n", ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) { if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { // clear tx map pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= - ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; + ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; pDevice->bMoreData = false; } else { pDevice->bMoreData = true; @@ -721,10 +721,10 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_RADIO_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_RADIO_START\n"); -// if (pDevice->bRadioCmd == true) -// CARDbRadioPowerOn(pDevice); -// else -// CARDbRadioPowerOff(pDevice); + // if (pDevice->bRadioCmd == true) + // CARDbRadioPowerOn(pDevice); + // else + // CARDbRadioPowerOff(pDevice); { int ntStatus = STATUS_SUCCESS; u8 byTmp; @@ -915,14 +915,14 @@ static int s_bCommandComplete(struct vnt_private *pDevice) memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); else memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); -/* - if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { - if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && - ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { - pDevice->eCommandState = WLAN_CMD_IDLE; - } - } -*/ + /* + if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { + if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && + ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { + pDevice->eCommandState = WLAN_CMD_IDLE; + } + } + */ break; case WLAN_CMD_SSID: pDevice->eCommandState = WLAN_CMD_SSID_START; @@ -979,7 +979,7 @@ static int s_bCommandComplete(struct vnt_private *pDevice) case WLAN_CMD_CONFIGURE_FILTER: pDevice->eCommandState = - WLAN_CMD_CONFIGURE_FILTER_START; + WLAN_CMD_CONFIGURE_FILTER_START; break; default: @@ -1005,22 +1005,22 @@ int bScheduleCommand(struct vnt_private *pDevice, case WLAN_CMD_BSSID_SCAN: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false; memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, - pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); break; case WLAN_CMD_SSID: memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, - pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); break; case WLAN_CMD_DISASSOCIATE: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0); break; -/* - case WLAN_CMD_DEAUTH: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((u16 *)pbyItem0); - break; -*/ + /* + case WLAN_CMD_DEAUTH: + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((u16 *)pbyItem0); + break; + */ case WLAN_CMD_RADIO: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0); diff --git a/drivers/staging/vt6656/wcmd.h b/drivers/staging/vt6656/wcmd.h index 7365721..87d7de4 100644 --- a/drivers/staging/vt6656/wcmd.h +++ b/drivers/staging/vt6656/wcmd.h @@ -37,68 +37,68 @@ // Command code typedef enum tagCMD_CODE { - WLAN_CMD_BSSID_SCAN, - WLAN_CMD_SSID, - WLAN_CMD_DISASSOCIATE, - WLAN_CMD_DEAUTH, - WLAN_CMD_RX_PSPOLL, - WLAN_CMD_RADIO, - WLAN_CMD_CHANGE_BBSENSITIVITY, - WLAN_CMD_SETPOWER, - WLAN_CMD_TBTT_WAKEUP, - WLAN_CMD_BECON_SEND, - WLAN_CMD_CHANGE_ANTENNA, - WLAN_CMD_REMOVE_ALLKEY, - WLAN_CMD_MAC_DISPOWERSAVING, - WLAN_CMD_11H_CHSW, - WLAN_CMD_RUN_AP, - WLAN_CMD_CONFIGURE_FILTER + WLAN_CMD_BSSID_SCAN, + WLAN_CMD_SSID, + WLAN_CMD_DISASSOCIATE, + WLAN_CMD_DEAUTH, + WLAN_CMD_RX_PSPOLL, + WLAN_CMD_RADIO, + WLAN_CMD_CHANGE_BBSENSITIVITY, + WLAN_CMD_SETPOWER, + WLAN_CMD_TBTT_WAKEUP, + WLAN_CMD_BECON_SEND, + WLAN_CMD_CHANGE_ANTENNA, + WLAN_CMD_REMOVE_ALLKEY, + WLAN_CMD_MAC_DISPOWERSAVING, + WLAN_CMD_11H_CHSW, + WLAN_CMD_RUN_AP, + WLAN_CMD_CONFIGURE_FILTER } CMD_CODE, *PCMD_CODE; #define CMD_Q_SIZE 32 typedef enum tagCMD_STATUS { - CMD_STATUS_SUCCESS = 0, - CMD_STATUS_FAILURE, - CMD_STATUS_RESOURCES, - CMD_STATUS_TIMEOUT, - CMD_STATUS_PENDING + CMD_STATUS_SUCCESS = 0, + CMD_STATUS_FAILURE, + CMD_STATUS_RESOURCES, + CMD_STATUS_TIMEOUT, + CMD_STATUS_PENDING } CMD_STATUS, *PCMD_STATUS; typedef struct tagCMD_ITEM { - CMD_CODE eCmd; - u8 abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - bool bNeedRadioOFF; - bool bRadioCmd; - bool bForceSCAN; - u16 wDeAuthenReason; + CMD_CODE eCmd; + u8 abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + bool bNeedRadioOFF; + bool bRadioCmd; + bool bForceSCAN; + u16 wDeAuthenReason; } CMD_ITEM, *PCMD_ITEM; // Command state typedef enum tagCMD_STATE { - WLAN_CMD_SCAN_START, - WLAN_CMD_SCAN_END, - WLAN_CMD_DISASSOCIATE_START, - WLAN_CMD_DEAUTHEN_START, - WLAN_CMD_SSID_START, - WLAN_AUTHENTICATE_WAIT, - WLAN_ASSOCIATE_WAIT, - WLAN_DISASSOCIATE_WAIT, - WLAN_CMD_TX_PSPACKET_START, - WLAN_CMD_RADIO_START, - WLAN_CMD_CHANGE_BBSENSITIVITY_START, - WLAN_CMD_SETPOWER_START, - WLAN_CMD_AP_MODE_START, - WLAN_CMD_TBTT_WAKEUP_START, - WLAN_CMD_BECON_SEND_START, - WLAN_CMD_CHANGE_ANTENNA_START, - WLAN_CMD_REMOVE_ALLKEY_START, - WLAN_CMD_MAC_DISPOWERSAVING_START, - WLAN_CMD_11H_CHSW_START, - WLAN_CMD_CONFIGURE_FILTER_START, - WLAN_CMD_IDLE + WLAN_CMD_SCAN_START, + WLAN_CMD_SCAN_END, + WLAN_CMD_DISASSOCIATE_START, + WLAN_CMD_DEAUTHEN_START, + WLAN_CMD_SSID_START, + WLAN_AUTHENTICATE_WAIT, + WLAN_ASSOCIATE_WAIT, + WLAN_DISASSOCIATE_WAIT, + WLAN_CMD_TX_PSPACKET_START, + WLAN_CMD_RADIO_START, + WLAN_CMD_CHANGE_BBSENSITIVITY_START, + WLAN_CMD_SETPOWER_START, + WLAN_CMD_AP_MODE_START, + WLAN_CMD_TBTT_WAKEUP_START, + WLAN_CMD_BECON_SEND_START, + WLAN_CMD_CHANGE_ANTENNA_START, + WLAN_CMD_REMOVE_ALLKEY_START, + WLAN_CMD_MAC_DISPOWERSAVING_START, + WLAN_CMD_11H_CHSW_START, + WLAN_CMD_CONFIGURE_FILTER_START, + WLAN_CMD_IDLE } CMD_STATE, *PCMD_STATE; struct vnt_private; diff --git a/drivers/staging/vt6656/wctl.c b/drivers/staging/vt6656/wctl.c index 814342c..d79575a 100644 --- a/drivers/staging/vt6656/wctl.c +++ b/drivers/staging/vt6656/wctl.c @@ -59,32 +59,32 @@ bool WCTLbIsDuplicate (PSCache pCache, struct ieee80211_hdr *pMACHeader) { - unsigned int uIndex; - unsigned int ii; - PSCacheEntry pCacheEntry; - - if (IS_FC_RETRY(pMACHeader)) { - - uIndex = pCache->uInPtr; - for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) { - pCacheEntry = &(pCache->asCacheEntry[uIndex]); - if ((pCacheEntry->wFmSequence == pMACHeader->seq_ctrl) && - ether_addr_equal(pCacheEntry->abyAddr2, pMACHeader->addr2) && - (LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->frame_control)) - ) { - /* Duplicate match */ - return true; - } - ADD_ONE_WITH_WRAP_AROUND(uIndex, DUPLICATE_RX_CACHE_LENGTH); - } - } - /* Not found in cache - insert */ - pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr]; - 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; + unsigned int uIndex; + unsigned int ii; + PSCacheEntry pCacheEntry; + + if (IS_FC_RETRY(pMACHeader)) { + + uIndex = pCache->uInPtr; + for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) { + pCacheEntry = &(pCache->asCacheEntry[uIndex]); + if ((pCacheEntry->wFmSequence == pMACHeader->seq_ctrl) && + ether_addr_equal(pCacheEntry->abyAddr2, pMACHeader->addr2) && + (LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->frame_control)) + ) { + /* Duplicate match */ + return true; + } + ADD_ONE_WITH_WRAP_AROUND(uIndex, DUPLICATE_RX_CACHE_LENGTH); + } + } + /* Not found in cache - insert */ + pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr]; + 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; } /* @@ -103,14 +103,14 @@ bool WCTLbIsDuplicate (PSCache pCache, struct ieee80211_hdr *pMACHeader) */ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, - struct ieee80211_hdr *pMACHeader) + struct ieee80211_hdr *pMACHeader) { unsigned int ii; for (ii = 0; ii < pDevice->cbDFCB; ii++) { if ((pDevice->sRxDFCB[ii].bInUse == true) && - ether_addr_equal(pDevice->sRxDFCB[ii].abyAddr2, - pMACHeader->addr2)) { + ether_addr_equal(pDevice->sRxDFCB[ii].abyAddr2, + pMACHeader->addr2)) { return ii; } } @@ -132,26 +132,26 @@ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, * */ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, - struct ieee80211_hdr *pMACHeader) + struct ieee80211_hdr *pMACHeader) { unsigned int ii; - if (pDevice->cbFreeDFCB == 0) - return(pDevice->cbDFCB); - for (ii = 0; ii < pDevice->cbDFCB; ii++) { - if (pDevice->sRxDFCB[ii].bInUse == false) { - pDevice->cbFreeDFCB--; - pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime; - pDevice->sRxDFCB[ii].bInUse = true; - pDevice->sRxDFCB[ii].wSequence = (pMACHeader->seq_ctrl >> 4); - pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->seq_ctrl & 0x000F); - memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), - &(pMACHeader->addr2[0]), - ETH_ALEN); - return(ii); - } - } - return(pDevice->cbDFCB); + if (pDevice->cbFreeDFCB == 0) + return(pDevice->cbDFCB); + for (ii = 0; ii < pDevice->cbDFCB; ii++) { + if (pDevice->sRxDFCB[ii].bInUse == false) { + pDevice->cbFreeDFCB--; + pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime; + pDevice->sRxDFCB[ii].bInUse = true; + pDevice->sRxDFCB[ii].wSequence = (pMACHeader->seq_ctrl >> 4); + pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->seq_ctrl & 0x000F); + memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), + &(pMACHeader->addr2[0]), + ETH_ALEN); + return(ii); + } + } + return(pDevice->cbDFCB); } /* @@ -174,71 +174,70 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, struct ieee80211_hdr *pMAC { unsigned int uHeaderSize; - if (bWEP == true) { - uHeaderSize = 28; - if (bExtIV) - // ExtIV - uHeaderSize +=4; - } - else { - uHeaderSize = 24; - } - - if (IS_FIRST_FRAGMENT_PKT(pMACHeader)) { - pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, 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->seq_ctrl >> 4); - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->seq_ctrl & 0x000F); - } - else { - pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader); - if (pDevice->uCurrentDFCBIdx == pDevice->cbDFCB) { - return(false); - } - } - // reserve 8 byte to match MAC RX Buffer - 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; - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum++; - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "First pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); - return(false); - } - else { - pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, pMACHeader); - if (pDevice->uCurrentDFCBIdx != pDevice->cbDFCB) { - 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)) { + if (bWEP == true) { + uHeaderSize = 28; + if (bExtIV) + // ExtIV + uHeaderSize +=4; + } + else { + uHeaderSize = 24; + } - 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++; - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Second pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); - } - else { - // seq error or frag # error flush DFCB - pDevice->cbFreeDFCB++; - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = false; - return(false); - } - } - else { - return(false); - } - if (IS_LAST_FRAGMENT_PKT(pMACHeader)) { - //enq defragcontrolblock - pDevice->cbFreeDFCB++; - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = false; - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); - return(true); - } - return(false); - } + if (IS_FIRST_FRAGMENT_PKT(pMACHeader)) { + pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, 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->seq_ctrl >> 4); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->seq_ctrl & 0x000F); + } + else { + pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader); + if (pDevice->uCurrentDFCBIdx == pDevice->cbDFCB) { + return(false); + } + } + // reserve 8 byte to match MAC RX Buffer + 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; + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum++; + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "First pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); + return(false); + } + else { + pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, pMACHeader); + if (pDevice->uCurrentDFCBIdx != pDevice->cbDFCB) { + 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, ((u8 *) (pMACHeader) + uHeaderSize), (cbFrameLength - uHeaderSize)); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength += (cbFrameLength - uHeaderSize); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer += (cbFrameLength - uHeaderSize); + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum++; + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Second pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); + } + else { + // seq error or frag # error flush DFCB + pDevice->cbFreeDFCB++; + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = false; + return(false); + } + } + else { + return(false); + } + if (IS_LAST_FRAGMENT_PKT(pMACHeader)) { + //enq defragcontrolblock + pDevice->cbFreeDFCB++; + pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = false; + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); + return(true); + } + return(false); + } } - diff --git a/drivers/staging/vt6656/wctl.h b/drivers/staging/vt6656/wctl.h index 14cb411..3406b74 100644 --- a/drivers/staging/vt6656/wctl.h +++ b/drivers/staging/vt6656/wctl.h @@ -33,57 +33,57 @@ #include "device.h" #define IS_TYPE_DATA(pMACHeader) \ - ((((struct ieee80211_hdr *) pMACHeader)->frame_control & 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) \ - ((((struct ieee80211_hdr *) pMACHeader)->frame_control & 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) \ - ((((struct ieee80211_hdr *) pMACHeader)->frame_control & 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) \ - ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREDATA) == FC_MOREDATA) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREDATA) == FC_MOREDATA) #define IS_FC_POWERMGT(pMACHeader) \ - ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_POWERMGT) == FC_POWERMGT) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_POWERMGT) == FC_POWERMGT) #define IS_FC_RETRY(pMACHeader) \ - ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_RETRY) == FC_RETRY) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_RETRY) == FC_RETRY) #define IS_FC_WEP(pMACHeader) \ - ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_WEP) == FC_WEP) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_WEP) == FC_WEP) #ifdef __BIG_ENDIAN #define IS_FRAGMENT_PKT(pMACHeader) \ - (((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \ - ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 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) \ - ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) == 0) + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) == 0) #else #define IS_FRAGMENT_PKT(pMACHeader) \ - (((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \ - ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 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) \ - ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) == 0) + ((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) == 0) #endif//#ifdef __BIG_ENDIAN #define IS_LAST_FRAGMENT_PKT(pMACHeader) \ - ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) == 0) + ((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) == 0) #define IS_CTL_PSPOLL(pMACHeader) \ - ((((struct ieee80211_hdr *) pMACHeader)->frame_control & 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)) \ - (uVar) = 0; \ - else \ - (uVar)++; \ + if ((uVar) >= ((uModulo) - 1)) \ + (uVar) = 0; \ + else \ + (uVar)++; \ } bool WCTLbIsDuplicate(PSCache pCache, struct ieee80211_hdr *pMACHeader); diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index 0d69719..16f4eed 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -88,100 +88,100 @@ static int ChannelExceedZoneType(struct vnt_private *, u8 byCurrChannel); /* Association/diassociation functions */ static struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *, - struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, - u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); static void s_vMgrRxAssocRequest(struct vnt_private *, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, - u32 uNodeIndex); + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + u32 uNodeIndex); static struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *, - struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, - u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); static void s_vMgrRxAssocResponse(struct vnt_private *, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, - int bReAssocType); + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bReAssocType); static void s_vMgrRxDisassociation(struct vnt_private *, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); /* Authentication/deauthen functions */ static void s_vMgrRxAuthenSequence_1(struct vnt_private *, - struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); static void s_vMgrRxAuthenSequence_2(struct vnt_private *, - struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); static void s_vMgrRxAuthenSequence_3(struct vnt_private *, - struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); static void s_vMgrRxAuthenSequence_4(struct vnt_private *, - struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); static void s_vMgrRxAuthentication(struct vnt_private *, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); static void s_vMgrRxDeauthentication(struct vnt_private *, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); /* Scan functions -* probe request/response functions */ + * probe request/response functions */ static void s_vMgrRxProbeRequest(struct vnt_private *, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); static void s_vMgrRxProbeResponse(struct vnt_private *, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); /* beacon functions */ static void s_vMgrRxBeacon(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, - int bInScan); + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bInScan); static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM); static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, - u32 uCurrChannel, u16 wCurrATIMWinodw, PWLAN_IE_SSID pCurrSSID, - u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates); + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, PWLAN_IE_SSID pCurrSSID, + u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates); /* Association response */ static struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *, - struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, - u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates); + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates); /* ReAssociation response */ static struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *, - struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, - u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates); + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates); /* Probe response */ static struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *, - struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, - u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, - PWLAN_IE_SSID pCurrSSID, u8 *pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates, u8 byPHYType); + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, + PWLAN_IE_SSID pCurrSSID, u8 *pCurrBSSID, + PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates, u8 byPHYType); /* received status */ static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus); static void s_vMgrSynchBSS(struct vnt_private *, u32 uBSSMode, - PKnownBSS pCurr, PCMD_STATUS pStatus); + PKnownBSS pCurr, PCMD_STATUS pStatus); static bool s_bCipherMatch ( - PKnownBSS pBSSNode, - NDIS_802_11_ENCRYPTION_STATUS EncStatus, - u8 * pbyCCSPK, - u8 * pbyCCSGK - ); + PKnownBSS pBSSNode, + NDIS_802_11_ENCRYPTION_STATUS EncStatus, + u8 * pbyCCSPK, + u8 * pbyCCSGK + ); static void Encyption_Rebuild(struct vnt_private *, PKnownBSS pCurr); @@ -193,34 +193,34 @@ static void Encyption_Rebuild(struct vnt_private *, PKnownBSS pCurr); * Return Value: * Ndis_staus. * --*/ + -*/ 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; - for (ii = 0; ii < WLAN_BSSID_LEN; ii++) - pMgmt->abyDesireBSSID[ii] = 0xFF; - - pMgmt->sAssocInfo.AssocInfo.Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); - //memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN +1); - pMgmt->byCSSPK = KEY_CTL_NONE; - pMgmt->byCSSGK = KEY_CTL_NONE; - pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI; - BSSvClearBSSList((void *) pDevice, false); - - pDevice->cbFreeCmdQueue = CMD_Q_SIZE; - pDevice->uCmdDequeueIdx = 0; - pDevice->uCmdEnqueueIdx = 0; - pDevice->eCommandState = WLAN_CMD_IDLE; - pDevice->bCmdRunning = false; - pDevice->bCmdClear = false; - - return; + pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0]; + pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0]; + pMgmt->uCurrChannel = pDevice->uChannel; + for (ii = 0; ii < WLAN_BSSID_LEN; ii++) + pMgmt->abyDesireBSSID[ii] = 0xFF; + + pMgmt->sAssocInfo.AssocInfo.Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); + //memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN +1); + pMgmt->byCSSPK = KEY_CTL_NONE; + pMgmt->byCSSGK = KEY_CTL_NONE; + pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI; + BSSvClearBSSList((void *) pDevice, false); + + pDevice->cbFreeCmdQueue = CMD_Q_SIZE; + pDevice->uCmdDequeueIdx = 0; + pDevice->uCmdEnqueueIdx = 0; + pDevice->eCommandState = WLAN_CMD_IDLE; + pDevice->bCmdRunning = false; + pDevice->bCmdClear = false; + + return; } /*+ @@ -232,65 +232,65 @@ void vMgrObjectInit(struct vnt_private *pDevice) * Return Value: * None. * --*/ + -*/ void vMgrAssocBeginSta(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, PCMD_STATUS pStatus) + struct vnt_manager *pMgmt, PCMD_STATUS pStatus) { struct vnt_tx_mgmt *pTxPacket; - pMgmt->wCurrCapInfo = 0; - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); - if (pDevice->bEncryptionEnable) { - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1); - } - // always allow receive short preamble - //if (pDevice->byPreambleType == 1) { - // pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - //} - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - 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); - if (pDevice->bShortSlotTime == true) - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); - - } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { - if (pDevice->byPreambleType == 1) { - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - } - } - if (pMgmt->b11hEnable == true) - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); - - // build an assocreq frame and send it - pTxPacket = s_MgrMakeAssocRequest - ( - pDevice, - pMgmt, - pMgmt->abyCurrBSSID, - pMgmt->wCurrCapInfo, - pMgmt->wListenInterval, - (PWLAN_IE_SSID)pMgmt->abyCurrSSID, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates - ); - - if (pTxPacket != NULL ){ - // send the frame - *pStatus = csMgmt_xmit(pDevice, pTxPacket); - if (*pStatus == CMD_STATUS_PENDING) { - pMgmt->eCurrState = WMAC_STATE_ASSOCPENDING; - *pStatus = CMD_STATUS_SUCCESS; - } - } - else - *pStatus = CMD_STATUS_RESOURCES; - - return ; + pMgmt->wCurrCapInfo = 0; + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); + if (pDevice->bEncryptionEnable) { + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1); + } + // always allow receive short preamble + //if (pDevice->byPreambleType == 1) { + // pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); + //} + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); + 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); + if (pDevice->bShortSlotTime == true) + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); + + } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { + if (pDevice->byPreambleType == 1) { + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); + } + } + if (pMgmt->b11hEnable == true) + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); + + // build an assocreq frame and send it + pTxPacket = s_MgrMakeAssocRequest + ( + pDevice, + pMgmt, + pMgmt->abyCurrBSSID, + pMgmt->wCurrCapInfo, + pMgmt->wListenInterval, + (PWLAN_IE_SSID)pMgmt->abyCurrSSID, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates + ); + + if (pTxPacket != NULL ){ + // send the frame + *pStatus = csMgmt_xmit(pDevice, pTxPacket); + if (*pStatus == CMD_STATUS_PENDING) { + pMgmt->eCurrState = WMAC_STATE_ASSOCPENDING; + *pStatus = CMD_STATUS_SUCCESS; + } + } + else + *pStatus = CMD_STATUS_RESOURCES; + + return ; } /*+ @@ -301,65 +301,65 @@ void vMgrAssocBeginSta(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ void vMgrReAssocBeginSta(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, PCMD_STATUS pStatus) + struct vnt_manager *pMgmt, PCMD_STATUS pStatus) { struct vnt_tx_mgmt *pTxPacket; - pMgmt->wCurrCapInfo = 0; - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); - if (pDevice->bEncryptionEnable) { - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1); - } - - //if (pDevice->byPreambleType == 1) { - // pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - //} - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - - 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); - if (pDevice->bShortSlotTime == true) - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); - - } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { - if (pDevice->byPreambleType == 1) { - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - } - } - if (pMgmt->b11hEnable == true) - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); - - pTxPacket = s_MgrMakeReAssocRequest - ( - pDevice, - pMgmt, - pMgmt->abyCurrBSSID, - pMgmt->wCurrCapInfo, - pMgmt->wListenInterval, - (PWLAN_IE_SSID)pMgmt->abyCurrSSID, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates - ); - - if (pTxPacket != NULL ){ - // send the frame - *pStatus = csMgmt_xmit(pDevice, pTxPacket); - if (*pStatus != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx failed.\n"); - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx sending.\n"); - } - } - - return ; + pMgmt->wCurrCapInfo = 0; + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); + if (pDevice->bEncryptionEnable) { + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1); + } + + //if (pDevice->byPreambleType == 1) { + // pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); + //} + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); + + 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); + if (pDevice->bShortSlotTime == true) + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); + + } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { + if (pDevice->byPreambleType == 1) { + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); + } + } + if (pMgmt->b11hEnable == true) + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); + + pTxPacket = s_MgrMakeReAssocRequest + ( + pDevice, + pMgmt, + pMgmt->abyCurrBSSID, + pMgmt->wCurrCapInfo, + pMgmt->wListenInterval, + (PWLAN_IE_SSID)pMgmt->abyCurrSSID, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates + ); + + if (pTxPacket != NULL ){ + // send the frame + *pStatus = csMgmt_xmit(pDevice, pTxPacket); + if (*pStatus != CMD_STATUS_PENDING) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx failed.\n"); + } + else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx sending.\n"); + } + } + + return ; } /*+ @@ -370,52 +370,52 @@ void vMgrReAssocBeginSta(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ void vMgrDisassocBeginSta(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, u8 *abyDestAddress, u16 wReason, - PCMD_STATUS pStatus) + struct vnt_manager *pMgmt, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus) { struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_DISASSOC sFrame; pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_DISASSOC_FR_MAXLEN); + + WLAN_DISASSOC_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - - // Setup the sFrame structure - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_DISASSOC_FR_MAXLEN; - - // format fixed field frame structure - vMgrEncodeDisassociation(&sFrame); - - // Setup the header - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_DISASSOC) - )); - - memcpy( sFrame.pHdr->sA3.abyAddr1, abyDestAddress, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - - // Set reason code - *(sFrame.pwReason) = cpu_to_le16(wReason); - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - - // send the frame - *pStatus = csMgmt_xmit(pDevice, pTxPacket); - if (*pStatus == CMD_STATUS_PENDING) { - pMgmt->eCurrState = WMAC_STATE_IDLE; - *pStatus = CMD_STATUS_SUCCESS; - } - - return; + + sizeof(struct vnt_tx_mgmt)); + + // Setup the sFrame structure + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_DISASSOC_FR_MAXLEN; + + // format fixed field frame structure + vMgrEncodeDisassociation(&sFrame); + + // Setup the header + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_DISASSOC) + )); + + memcpy( sFrame.pHdr->sA3.abyAddr1, abyDestAddress, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + + // Set reason code + *(sFrame.pwReason) = cpu_to_le16(wReason); + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + + // send the frame + *pStatus = csMgmt_xmit(pDevice, pTxPacket); + if (*pStatus == CMD_STATUS_PENDING) { + pMgmt->eCurrState = WMAC_STATE_IDLE; + *pStatus = CMD_STATUS_SUCCESS; + } + + return; } /*+ @@ -426,11 +426,11 @@ void vMgrDisassocBeginSta(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, - u32 uNodeIndex) + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + u32 uNodeIndex) { WLAN_FR_ASSOCREQ sFrame; CMD_STATUS Status; @@ -441,122 +441,122 @@ 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 - if (!uNodeIndex) - return; - - //check if node is authenticated - //decode the frame - memset(&sFrame, 0, sizeof(WLAN_FR_ASSOCREQ)); - 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 = (u8 *)pRxPacket->p80211Header; - - vMgrDecodeAssocRequest(&sFrame); - - if (pMgmt->sNodeDBTable[uNodeIndex].eNodeState >= NODE_AUTH) { - pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; - pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = cpu_to_le16(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = cpu_to_le16(*sFrame.pwListenInterval); - pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = - WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? true : false; - // Todo: check sta basic rate, if ap can't support, set status code - if (pDevice->byBBType == BB_TYPE_11B) { - uRateLen = WLAN_RATES_MAXLEN_11B; - } - abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES; - abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, - (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, - uRateLen); - abyCurrExtSuppRates[0] = WLAN_EID_EXTSUPP_RATES; - if (pDevice->byBBType == BB_TYPE_11G) { - abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pExtSuppRates, - (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, - uRateLen); - } else { - abyCurrExtSuppRates[1] = 0; - } + if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) + return; + // node index not found + if (!uNodeIndex) + return; + + //check if node is authenticated + //decode the frame + memset(&sFrame, 0, sizeof(WLAN_FR_ASSOCREQ)); + 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 = (u8 *)pRxPacket->p80211Header; + + vMgrDecodeAssocRequest(&sFrame); + + if (pMgmt->sNodeDBTable[uNodeIndex].eNodeState >= NODE_AUTH) { + pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; + pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = cpu_to_le16(*sFrame.pwCapInfo); + pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = cpu_to_le16(*sFrame.pwListenInterval); + pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = + WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? true : false; + // Todo: check sta basic rate, if ap can't support, set status code + if (pDevice->byBBType == BB_TYPE_11B) { + uRateLen = WLAN_RATES_MAXLEN_11B; + } + abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES; + abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, + (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, + uRateLen); + abyCurrExtSuppRates[0] = WLAN_EID_EXTSUPP_RATES; + if (pDevice->byBBType == BB_TYPE_11G) { + abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pExtSuppRates, + (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, + uRateLen); + } else { + abyCurrExtSuppRates[1] = 0; + } - RATEvParseMaxRate((void *)pDevice, - (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, - false, // do not change our basic rate - &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), - &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), - &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), - &(pMgmt->sNodeDBTable[uNodeIndex].byTopCCKBasicRate), - &(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate) - ); - - // set max tx rate - pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = - pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; - // Todo: check sta preamble, if ap can't support, set status code - pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = - WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = - WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].wAID = (u16)uNodeIndex; - wAssocStatus = WLAN_MGMT_STATUS_SUCCESS; - wAssocAID = (u16)uNodeIndex; - // check if ERP support - if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) - pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; - - if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate <= RATE_11M) { - // B only STA join - pDevice->bProtectMode = true; - pDevice->bNonERPPresent = true; - } - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { - pDevice->bBarkerPreambleMd = true; - } - - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Associate AID= %d \n", wAssocAID); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", - sFrame.pHdr->sA3.abyAddr2[0], - sFrame.pHdr->sA3.abyAddr2[1], - sFrame.pHdr->sA3.abyAddr2[2], - sFrame.pHdr->sA3.abyAddr2[3], - sFrame.pHdr->sA3.abyAddr2[4], - sFrame.pHdr->sA3.abyAddr2[5] - ) ; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d \n", - pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); - } - - // assoc response reply.. - pTxPacket = s_MgrMakeAssocResponse - ( - pDevice, - pMgmt, - pMgmt->wCurrCapInfo, - wAssocStatus, - wAssocAID, - sFrame.pHdr->sA3.abyAddr2, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates - ); - if (pTxPacket != NULL ){ - - if (pDevice->bEnableHostapd) { - return; - } - /* send the frame */ - Status = csMgmt_xmit(pDevice, pTxPacket); - if (Status != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx failed\n"); - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx sending..\n"); - } - - } - - return; + RATEvParseMaxRate((void *)pDevice, + (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, + false, // do not change our basic rate + &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), + &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), + &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), + &(pMgmt->sNodeDBTable[uNodeIndex].byTopCCKBasicRate), + &(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate) + ); + + // set max tx rate + pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = + pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; + // Todo: check sta preamble, if ap can't support, set status code + pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = + WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); + pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = + WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); + pMgmt->sNodeDBTable[uNodeIndex].wAID = (u16)uNodeIndex; + wAssocStatus = WLAN_MGMT_STATUS_SUCCESS; + wAssocAID = (u16)uNodeIndex; + // check if ERP support + if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) + pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; + + if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate <= RATE_11M) { + // B only STA join + pDevice->bProtectMode = true; + pDevice->bNonERPPresent = true; + } + if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { + pDevice->bBarkerPreambleMd = true; + } + + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Associate AID= %d\n", wAssocAID); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", + sFrame.pHdr->sA3.abyAddr2[0], + sFrame.pHdr->sA3.abyAddr2[1], + sFrame.pHdr->sA3.abyAddr2[2], + sFrame.pHdr->sA3.abyAddr2[3], + sFrame.pHdr->sA3.abyAddr2[4], + sFrame.pHdr->sA3.abyAddr2[5] + ) ; + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n", + pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); + } + + // assoc response reply.. + pTxPacket = s_MgrMakeAssocResponse + ( + pDevice, + pMgmt, + pMgmt->wCurrCapInfo, + wAssocStatus, + wAssocAID, + sFrame.pHdr->sA3.abyAddr2, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates + ); + if (pTxPacket != NULL ){ + + if (pDevice->bEnableHostapd) { + return; + } + /* send the frame */ + Status = csMgmt_xmit(pDevice, pTxPacket); + if (Status != CMD_STATUS_PENDING) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx failed\n"); + } + else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx sending..\n"); + } + + } + + return; } /*+ @@ -573,11 +573,11 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, * * Return Value: None. * --*/ + -*/ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, - u32 uNodeIndex) + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + u32 uNodeIndex) { WLAN_FR_REASSOCREQ sFrame; CMD_STATUS Status; @@ -588,120 +588,120 @@ static void s_vMgrRxReAssocRequest(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 - if (!uNodeIndex) - return; - //check if node is authenticated - //decode the frame - memset(&sFrame, 0, sizeof(WLAN_FR_REASSOCREQ)); - sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (u8 *)pRxPacket->p80211Header; - vMgrDecodeReassocRequest(&sFrame); - - if (pMgmt->sNodeDBTable[uNodeIndex].eNodeState >= NODE_AUTH) { - pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; - pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = cpu_to_le16(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = cpu_to_le16(*sFrame.pwListenInterval); - pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = - WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? true : false; - // Todo: check sta basic rate, if ap can't support, set status code - - if (pDevice->byBBType == BB_TYPE_11B) { - uRateLen = WLAN_RATES_MAXLEN_11B; - } - - abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES; - abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, - (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, - uRateLen); - abyCurrExtSuppRates[0] = WLAN_EID_EXTSUPP_RATES; - if (pDevice->byBBType == BB_TYPE_11G) { - abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pExtSuppRates, - (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, - uRateLen); - } else { - abyCurrExtSuppRates[1] = 0; - } + if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) + return; + // node index not found + if (!uNodeIndex) + return; + //check if node is authenticated + //decode the frame + memset(&sFrame, 0, sizeof(WLAN_FR_REASSOCREQ)); + sFrame.len = pRxPacket->cbMPDULen; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; + vMgrDecodeReassocRequest(&sFrame); + + if (pMgmt->sNodeDBTable[uNodeIndex].eNodeState >= NODE_AUTH) { + pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; + pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = cpu_to_le16(*sFrame.pwCapInfo); + pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = cpu_to_le16(*sFrame.pwListenInterval); + pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = + WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? true : false; + // Todo: check sta basic rate, if ap can't support, set status code + + if (pDevice->byBBType == BB_TYPE_11B) { + uRateLen = WLAN_RATES_MAXLEN_11B; + } - RATEvParseMaxRate((void *)pDevice, - (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, - false, // do not change our basic rate - &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), - &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), - &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), - &(pMgmt->sNodeDBTable[uNodeIndex].byTopCCKBasicRate), - &(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate) - ); - - // set max tx rate - pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = - pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; - // Todo: check sta preamble, if ap can't support, set status code - pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = - WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = - WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].wAID = (u16)uNodeIndex; - wAssocStatus = WLAN_MGMT_STATUS_SUCCESS; - wAssocAID = (u16)uNodeIndex; - - // if suppurt ERP - if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) - pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; - - if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate <= RATE_11M) { - // B only STA join - pDevice->bProtectMode = true; - pDevice->bNonERPPresent = true; - } - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { - pDevice->bBarkerPreambleMd = true; - } - - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Rx ReAssociate AID= %d \n", wAssocAID); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", - sFrame.pHdr->sA3.abyAddr2[0], - sFrame.pHdr->sA3.abyAddr2[1], - sFrame.pHdr->sA3.abyAddr2[2], - sFrame.pHdr->sA3.abyAddr2[3], - sFrame.pHdr->sA3.abyAddr2[4], - sFrame.pHdr->sA3.abyAddr2[5] - ) ; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d \n", - pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); - - } - - // assoc response reply.. - pTxPacket = s_MgrMakeReAssocResponse - ( - pDevice, - pMgmt, - pMgmt->wCurrCapInfo, - wAssocStatus, - wAssocAID, - sFrame.pHdr->sA3.abyAddr2, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates - ); - - if (pTxPacket != NULL ){ - /* send the frame */ - if (pDevice->bEnableHostapd) { - return; - } - Status = csMgmt_xmit(pDevice, pTxPacket); - if (Status != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx failed\n"); - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx sending..\n"); - } - } - return; + abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES; + abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, + (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, + uRateLen); + abyCurrExtSuppRates[0] = WLAN_EID_EXTSUPP_RATES; + if (pDevice->byBBType == BB_TYPE_11G) { + abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pExtSuppRates, + (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, + uRateLen); + } else { + abyCurrExtSuppRates[1] = 0; + } + + RATEvParseMaxRate((void *)pDevice, + (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, + false, // do not change our basic rate + &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), + &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), + &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), + &(pMgmt->sNodeDBTable[uNodeIndex].byTopCCKBasicRate), + &(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate) + ); + + // set max tx rate + pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = + pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; + // Todo: check sta preamble, if ap can't support, set status code + pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = + WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); + pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = + WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); + pMgmt->sNodeDBTable[uNodeIndex].wAID = (u16)uNodeIndex; + wAssocStatus = WLAN_MGMT_STATUS_SUCCESS; + wAssocAID = (u16)uNodeIndex; + + // if suppurt ERP + if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) + pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; + + if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate <= RATE_11M) { + // B only STA join + pDevice->bProtectMode = true; + pDevice->bNonERPPresent = true; + } + if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { + pDevice->bBarkerPreambleMd = true; + } + + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Rx ReAssociate AID= %d\n", wAssocAID); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", + sFrame.pHdr->sA3.abyAddr2[0], + sFrame.pHdr->sA3.abyAddr2[1], + sFrame.pHdr->sA3.abyAddr2[2], + sFrame.pHdr->sA3.abyAddr2[3], + sFrame.pHdr->sA3.abyAddr2[4], + sFrame.pHdr->sA3.abyAddr2[5] + ) ; + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n", + pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); + + } + + // assoc response reply.. + pTxPacket = s_MgrMakeReAssocResponse + ( + pDevice, + pMgmt, + pMgmt->wCurrCapInfo, + wAssocStatus, + wAssocAID, + sFrame.pHdr->sA3.abyAddr2, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates + ); + + if (pTxPacket != NULL ){ + /* send the frame */ + if (pDevice->bEnableHostapd) { + return; + } + Status = csMgmt_xmit(pDevice, pTxPacket); + if (Status != CMD_STATUS_PENDING) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx failed\n"); + } + else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx sending..\n"); + } + } + return; } /*+ @@ -712,124 +712,124 @@ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, - int bReAssocType) + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bReAssocType) { WLAN_FR_ASSOCRESP sFrame; PWLAN_IE_SSID pItemSSID; u8 *pbyIEs; - if (pMgmt->eCurrState == WMAC_STATE_ASSOCPENDING || - pMgmt->eCurrState == WMAC_STATE_ASSOC) { - - sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (u8 *)pRxPacket->p80211Header; - // decode the frame - vMgrDecodeAssocResponse(&sFrame); - if ((sFrame.pwCapInfo == NULL) - || (sFrame.pwStatus == NULL) - || (sFrame.pwAid == NULL) - || (sFrame.pSuppRates == NULL)) { - return; - } - - pMgmt->sAssocInfo.AssocInfo.ResponseFixedIEs.Capabilities = *(sFrame.pwCapInfo); - pMgmt->sAssocInfo.AssocInfo.ResponseFixedIEs.StatusCode = *(sFrame.pwStatus); - pMgmt->sAssocInfo.AssocInfo.ResponseFixedIEs.AssociationId = *(sFrame.pwAid); - pMgmt->sAssocInfo.AssocInfo.AvailableResponseFixedIEs |= 0x07; - - pMgmt->sAssocInfo.AssocInfo.ResponseIELength = sFrame.len - 24 - 6; - pMgmt->sAssocInfo.AssocInfo.OffsetResponseIEs = pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs + pMgmt->sAssocInfo.AssocInfo.RequestIELength; - pbyIEs = pMgmt->sAssocInfo.abyIEs; - pbyIEs += pMgmt->sAssocInfo.AssocInfo.RequestIELength; - memcpy(pbyIEs, (sFrame.pBuf + 24 +6), pMgmt->sAssocInfo.AssocInfo.ResponseIELength); - - // save values and set current BSS state - if (cpu_to_le16((*(sFrame.pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ - // set AID - pMgmt->wCurrAID = cpu_to_le16((*(sFrame.pwAid))); - if ( (pMgmt->wCurrAID >> 14) != (BIT0 | BIT1) ) - { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AID from AP, has two msb clear.\n"); - } - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Association Successful, AID=%d.\n", pMgmt->wCurrAID & ~(BIT14|BIT15)); - pMgmt->eCurrState = WMAC_STATE_ASSOC; - BSSvUpdateAPNode((void *) pDevice, - sFrame.pwCapInfo, - sFrame.pSuppRates, - sFrame.pExtSuppRates); - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID); - pDevice->bLinkPass = true; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); - - //if(pDevice->bWPASuppWextEnabled == true) - { - u8 buf[512]; - size_t len; - union iwreq_data wrqu; - int we_event; - - memset(buf, 0, 512); - - len = pMgmt->sAssocInfo.AssocInfo.RequestIELength; - if(len) { - memcpy(buf, pMgmt->sAssocInfo.abyIEs, len); - memset(&wrqu, 0, sizeof (wrqu)); - wrqu.data.length = len; - we_event = IWEVASSOCREQIE; - PRINT_K("wireless_send_event--->IWEVASSOCREQIE\n"); - wireless_send_event(pDevice->dev, we_event, &wrqu, buf); + if (pMgmt->eCurrState == WMAC_STATE_ASSOCPENDING || + pMgmt->eCurrState == WMAC_STATE_ASSOC) { + + sFrame.len = pRxPacket->cbMPDULen; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; + // decode the frame + vMgrDecodeAssocResponse(&sFrame); + if ((sFrame.pwCapInfo == NULL) + || (sFrame.pwStatus == NULL) + || (sFrame.pwAid == NULL) + || (sFrame.pSuppRates == NULL)) { + return; } - memset(buf, 0, 512); - len = pMgmt->sAssocInfo.AssocInfo.ResponseIELength; + pMgmt->sAssocInfo.AssocInfo.ResponseFixedIEs.Capabilities = *(sFrame.pwCapInfo); + pMgmt->sAssocInfo.AssocInfo.ResponseFixedIEs.StatusCode = *(sFrame.pwStatus); + pMgmt->sAssocInfo.AssocInfo.ResponseFixedIEs.AssociationId = *(sFrame.pwAid); + pMgmt->sAssocInfo.AssocInfo.AvailableResponseFixedIEs |= 0x07; + + pMgmt->sAssocInfo.AssocInfo.ResponseIELength = sFrame.len - 24 - 6; + pMgmt->sAssocInfo.AssocInfo.OffsetResponseIEs = pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs + pMgmt->sAssocInfo.AssocInfo.RequestIELength; + pbyIEs = pMgmt->sAssocInfo.abyIEs; + pbyIEs += pMgmt->sAssocInfo.AssocInfo.RequestIELength; + memcpy(pbyIEs, (sFrame.pBuf + 24 +6), pMgmt->sAssocInfo.AssocInfo.ResponseIELength); + + // save values and set current BSS state + if (cpu_to_le16((*(sFrame.pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ + // set AID + pMgmt->wCurrAID = cpu_to_le16((*(sFrame.pwAid))); + if ( (pMgmt->wCurrAID >> 14) != (BIT0 | BIT1) ) + { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AID from AP, has two msb clear.\n"); + } + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Association Successful, AID=%d.\n", pMgmt->wCurrAID & ~(BIT14|BIT15)); + pMgmt->eCurrState = WMAC_STATE_ASSOC; + BSSvUpdateAPNode((void *) pDevice, + sFrame.pwCapInfo, + sFrame.pSuppRates, + sFrame.pExtSuppRates); + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID); + pDevice->bLinkPass = true; + ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); + + //if(pDevice->bWPASuppWextEnabled == true) + { + u8 buf[512]; + size_t len; + union iwreq_data wrqu; + int we_event; + + memset(buf, 0, 512); + + len = pMgmt->sAssocInfo.AssocInfo.RequestIELength; + if(len) { + memcpy(buf, pMgmt->sAssocInfo.abyIEs, len); + memset(&wrqu, 0, sizeof (wrqu)); + wrqu.data.length = len; + we_event = IWEVASSOCREQIE; + PRINT_K("wireless_send_event--->IWEVASSOCREQIE\n"); + wireless_send_event(pDevice->dev, we_event, &wrqu, buf); + } + + memset(buf, 0, 512); + len = pMgmt->sAssocInfo.AssocInfo.ResponseIELength; + + if(len) { + memcpy(buf, pbyIEs, len); + memset(&wrqu, 0, sizeof (wrqu)); + wrqu.data.length = len; + we_event = IWEVASSOCRESPIE; + PRINT_K("wireless_send_event--->IWEVASSOCRESPIE\n"); + wireless_send_event(pDevice->dev, we_event, &wrqu, buf); + } + + memset(&wrqu, 0, sizeof (wrqu)); + memcpy(wrqu.ap_addr.sa_data, &pMgmt->abyCurrBSSID[0], ETH_ALEN); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + PRINT_K("wireless_send_event--->SIOCGIWAP(associated)\n"); + wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); + + } - if(len) { - memcpy(buf, pbyIEs, len); - memset(&wrqu, 0, sizeof (wrqu)); - wrqu.data.length = len; - we_event = IWEVASSOCRESPIE; - PRINT_K("wireless_send_event--->IWEVASSOCRESPIE\n"); - wireless_send_event(pDevice->dev, we_event, &wrqu, buf); } - - memset(&wrqu, 0, sizeof (wrqu)); - memcpy(wrqu.ap_addr.sa_data, &pMgmt->abyCurrBSSID[0], ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - PRINT_K("wireless_send_event--->SIOCGIWAP(associated)\n"); - wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); + else { + if (bReAssocType) { + pMgmt->eCurrState = WMAC_STATE_IDLE; + } + else { + // jump back to the auth state and indicate the error + pMgmt->eCurrState = WMAC_STATE_AUTH; + } + s_vMgrLogStatus(pMgmt,cpu_to_le16((*(sFrame.pwStatus)))); + } } - } - else { - if (bReAssocType) { - pMgmt->eCurrState = WMAC_STATE_IDLE; - } - else { - // jump back to the auth state and indicate the error - pMgmt->eCurrState = WMAC_STATE_AUTH; - } - s_vMgrLogStatus(pMgmt,cpu_to_le16((*(sFrame.pwStatus)))); - } - - } - -//need clear flags related to Networkmanager - pDevice->bwextstep0 = false; - pDevice->bwextstep1 = false; - pDevice->bwextstep2 = false; - pDevice->bwextstep3 = false; - pDevice->bWPASuppWextEnabled = false; + //need clear flags related to Networkmanager + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = false; + pDevice->bWPASuppWextEnabled = false; if (pMgmt->eCurrState == WMAC_STATE_ASSOC) schedule_delayed_work(&pDevice->run_command_work, 0); - return; + return; } /*+ @@ -841,48 +841,48 @@ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ void vMgrAuthenBeginSta(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, PCMD_STATUS pStatus) + struct vnt_manager *pMgmt, PCMD_STATUS pStatus) { WLAN_FR_AUTHEN sFrame; struct vnt_tx_mgmt *pTxPacket = - (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_AUTHEN_FR_MAXLEN); + + WLAN_AUTHEN_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_AUTHEN_FR_MAXLEN; - vMgrEncodeAuthen(&sFrame); - /* insert values */ - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_AUTHEN) - )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - if (pMgmt->bShareKeyAlgorithm) - *(sFrame.pwAuthAlgorithm) = cpu_to_le16(WLAN_AUTH_ALG_SHAREDKEY); - else - *(sFrame.pwAuthAlgorithm) = cpu_to_le16(WLAN_AUTH_ALG_OPENSYSTEM); - - *(sFrame.pwAuthSequence) = cpu_to_le16(1); - /* Adjust the length fields */ - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - - *pStatus = csMgmt_xmit(pDevice, pTxPacket); - if (*pStatus == CMD_STATUS_PENDING){ - pMgmt->eCurrState = WMAC_STATE_AUTHPENDING; - *pStatus = CMD_STATUS_SUCCESS; - } - - return ; + + sizeof(struct vnt_tx_mgmt)); + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_AUTHEN_FR_MAXLEN; + vMgrEncodeAuthen(&sFrame); + /* insert values */ + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_AUTHEN) + )); + memcpy( sFrame.pHdr->sA3.abyAddr1, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + if (pMgmt->bShareKeyAlgorithm) + *(sFrame.pwAuthAlgorithm) = cpu_to_le16(WLAN_AUTH_ALG_SHAREDKEY); + else + *(sFrame.pwAuthAlgorithm) = cpu_to_le16(WLAN_AUTH_ALG_OPENSYSTEM); + + *(sFrame.pwAuthSequence) = cpu_to_le16(1); + /* Adjust the length fields */ + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + + *pStatus = csMgmt_xmit(pDevice, pTxPacket); + if (*pStatus == CMD_STATUS_PENDING){ + pMgmt->eCurrState = WMAC_STATE_AUTHPENDING; + *pStatus = CMD_STATUS_SUCCESS; + } + + return ; } /*+ @@ -894,45 +894,45 @@ void vMgrAuthenBeginSta(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, u8 *abyDestAddress, u16 wReason, - PCMD_STATUS pStatus) + struct vnt_manager *pMgmt, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus) { WLAN_FR_DEAUTHEN sFrame; struct vnt_tx_mgmt *pTxPacket = - (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_DEAUTHEN_FR_MAXLEN); + + WLAN_DEAUTHEN_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_DEAUTHEN_FR_MAXLEN; - vMgrEncodeDeauthen(&sFrame); - /* insert values */ - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_DEAUTHEN) - )); - - memcpy( sFrame.pHdr->sA3.abyAddr1, abyDestAddress, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - - *(sFrame.pwReason) = cpu_to_le16(wReason); // deauthen. bcs left BSS - /* Adjust the length fields */ - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - - *pStatus = csMgmt_xmit(pDevice, pTxPacket); - if (*pStatus == CMD_STATUS_PENDING){ - *pStatus = CMD_STATUS_SUCCESS; - } - - return ; + + sizeof(struct vnt_tx_mgmt)); + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_DEAUTHEN_FR_MAXLEN; + vMgrEncodeDeauthen(&sFrame); + /* insert values */ + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_DEAUTHEN) + )); + + memcpy( sFrame.pHdr->sA3.abyAddr1, abyDestAddress, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + + *(sFrame.pwReason) = cpu_to_le16(wReason); // deauthen. bcs left BSS + /* Adjust the length fields */ + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + + *pStatus = csMgmt_xmit(pDevice, pTxPacket); + if (*pStatus == CMD_STATUS_PENDING){ + *pStatus = CMD_STATUS_SUCCESS; + } + + return ; } /*+ @@ -943,44 +943,44 @@ void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ static void s_vMgrRxAuthentication(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { WLAN_FR_AUTHEN sFrame; - // we better be an AP or a STA in AUTHPENDING otherwise ignore - if (!(pMgmt->eCurrMode == WMAC_MODE_ESS_AP || - pMgmt->eCurrState == WMAC_STATE_AUTHPENDING)) { - return; - } - - // decode the frame - sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (u8 *)pRxPacket->p80211Header; - vMgrDecodeAuthen(&sFrame); - switch (cpu_to_le16((*(sFrame.pwAuthSequence )))){ - case 1: - //AP funciton - s_vMgrRxAuthenSequence_1(pDevice,pMgmt, &sFrame); - break; - case 2: - s_vMgrRxAuthenSequence_2(pDevice, pMgmt, &sFrame); - break; - case 3: - //AP funciton - s_vMgrRxAuthenSequence_3(pDevice, pMgmt, &sFrame); - break; - case 4: - s_vMgrRxAuthenSequence_4(pDevice, pMgmt, &sFrame); - break; - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Auth Sequence error, seq = %d\n", - cpu_to_le16((*(sFrame.pwAuthSequence)))); - break; - } - return; + // we better be an AP or a STA in AUTHPENDING otherwise ignore + if (!(pMgmt->eCurrMode == WMAC_MODE_ESS_AP || + pMgmt->eCurrState == WMAC_STATE_AUTHPENDING)) { + return; + } + + // decode the frame + sFrame.len = pRxPacket->cbMPDULen; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; + vMgrDecodeAuthen(&sFrame); + switch (cpu_to_le16((*(sFrame.pwAuthSequence )))){ + case 1: + //AP funciton + s_vMgrRxAuthenSequence_1(pDevice,pMgmt, &sFrame); + break; + case 2: + s_vMgrRxAuthenSequence_2(pDevice, pMgmt, &sFrame); + break; + case 3: + //AP funciton + s_vMgrRxAuthenSequence_3(pDevice, pMgmt, &sFrame); + break; + case 4: + s_vMgrRxAuthenSequence_4(pDevice, pMgmt, &sFrame); + break; + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Auth Sequence error, seq = %d\n", + cpu_to_le16((*(sFrame.pwAuthSequence)))); + break; + } + return; } /*+ @@ -993,10 +993,10 @@ static void s_vMgrRxAuthentication(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { struct vnt_tx_mgmt *pTxPacket = NULL; u32 uNodeIndex; @@ -1005,84 +1005,84 @@ static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, /* Insert a Node entry */ if (!BSSbIsSTAInNodeDB(pDevice, pFrame->pHdr->sA3.abyAddr2, - &uNodeIndex)) { + &uNodeIndex)) { BSSvCreateOneNode(pDevice, &uNodeIndex); memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, - pFrame->pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); + pFrame->pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); } - if (pMgmt->bShareKeyAlgorithm) { - pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_KNOWN; - pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence = 1; - } - else { - pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_AUTH; - } + if (pMgmt->bShareKeyAlgorithm) { + pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_KNOWN; + pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence = 1; + } + else { + pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_AUTH; + } - // send auth reply + // send auth reply pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_AUTHEN_FR_MAXLEN); + + WLAN_AUTHEN_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_AUTHEN_FR_MAXLEN; - // format buffer structure - vMgrEncodeAuthen(&sFrame); - // insert values - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_AUTHEN)| - WLAN_SET_FC_ISWEP(0) - )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pFrame->pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - *(sFrame.pwAuthAlgorithm) = *(pFrame->pwAuthAlgorithm); - *(sFrame.pwAuthSequence) = cpu_to_le16(2); - - if (cpu_to_le16(*(pFrame->pwAuthAlgorithm)) == WLAN_AUTH_ALG_SHAREDKEY) { - if (pMgmt->bShareKeyAlgorithm) - *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_SUCCESS); - else - *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG); - } - else { - if (pMgmt->bShareKeyAlgorithm) - *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG); - else - *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_SUCCESS); - } - - if (pMgmt->bShareKeyAlgorithm && - (cpu_to_le16(*(sFrame.pwStatus)) == WLAN_MGMT_STATUS_SUCCESS)) { - - sFrame.pChallenge = (PWLAN_IE_CHALLENGE)(sFrame.pBuf + sFrame.len); - sFrame.len += WLAN_CHALLENGE_IE_LEN; - sFrame.pChallenge->byElementID = WLAN_EID_CHALLENGE; - sFrame.pChallenge->len = WLAN_CHALLENGE_LEN; - memset(pMgmt->abyChallenge, 0, WLAN_CHALLENGE_LEN); - // get group key - if(KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, GROUP_KEY, &pTransmitKey) == true) { - rc4_init(&pDevice->SBox, pDevice->abyPRNG, pTransmitKey->uKeyLength+3); - rc4_encrypt(&pDevice->SBox, pMgmt->abyChallenge, pMgmt->abyChallenge, WLAN_CHALLENGE_LEN); - } - memcpy(sFrame.pChallenge->abyChallenge, pMgmt->abyChallenge , WLAN_CHALLENGE_LEN); - } - - /* Adjust the length fields */ - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - // send the frame - if (pDevice->bEnableHostapd) { - return; - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx.. \n"); - if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx failed.\n"); - } - return; + + sizeof(struct vnt_tx_mgmt)); + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_AUTHEN_FR_MAXLEN; + // format buffer structure + vMgrEncodeAuthen(&sFrame); + // insert values + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_AUTHEN)| + WLAN_SET_FC_ISWEP(0) + )); + memcpy( sFrame.pHdr->sA3.abyAddr1, pFrame->pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + *(sFrame.pwAuthAlgorithm) = *(pFrame->pwAuthAlgorithm); + *(sFrame.pwAuthSequence) = cpu_to_le16(2); + + if (cpu_to_le16(*(pFrame->pwAuthAlgorithm)) == WLAN_AUTH_ALG_SHAREDKEY) { + if (pMgmt->bShareKeyAlgorithm) + *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_SUCCESS); + else + *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG); + } + else { + if (pMgmt->bShareKeyAlgorithm) + *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG); + else + *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_SUCCESS); + } + + if (pMgmt->bShareKeyAlgorithm && + (cpu_to_le16(*(sFrame.pwStatus)) == WLAN_MGMT_STATUS_SUCCESS)) { + + sFrame.pChallenge = (PWLAN_IE_CHALLENGE)(sFrame.pBuf + sFrame.len); + sFrame.len += WLAN_CHALLENGE_IE_LEN; + sFrame.pChallenge->byElementID = WLAN_EID_CHALLENGE; + sFrame.pChallenge->len = WLAN_CHALLENGE_LEN; + memset(pMgmt->abyChallenge, 0, WLAN_CHALLENGE_LEN); + // get group key + if(KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, GROUP_KEY, &pTransmitKey) == true) { + rc4_init(&pDevice->SBox, pDevice->abyPRNG, pTransmitKey->uKeyLength+3); + rc4_encrypt(&pDevice->SBox, pMgmt->abyChallenge, pMgmt->abyChallenge, WLAN_CHALLENGE_LEN); + } + memcpy(sFrame.pChallenge->abyChallenge, pMgmt->abyChallenge , WLAN_CHALLENGE_LEN); + } + + /* Adjust the length fields */ + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + // send the frame + if (pDevice->bEnableHostapd) { + return; + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx..\n"); + if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx failed.\n"); + } + return; } /*+ @@ -1095,90 +1095,90 @@ static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { WLAN_FR_AUTHEN sFrame; struct vnt_tx_mgmt *pTxPacket = NULL; - switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) - { - case WLAN_AUTH_ALG_OPENSYSTEM: - if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n"); - pMgmt->eCurrState = WMAC_STATE_AUTH; - schedule_delayed_work(&pDevice->run_command_work, 0); - } - else { - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n"); - s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); - pMgmt->eCurrState = WMAC_STATE_IDLE; - } - if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) { - /* spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((void *) pDevice, 0); - spin_lock_irq(&pDevice->lock); */ - } - break; + switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) + { + case WLAN_AUTH_ALG_OPENSYSTEM: + if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n"); + pMgmt->eCurrState = WMAC_STATE_AUTH; + schedule_delayed_work(&pDevice->run_command_work, 0); + } + else { + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n"); + s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); + pMgmt->eCurrState = WMAC_STATE_IDLE; + } + if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) { + /* spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, 0); + spin_lock_irq(&pDevice->lock); */ + } + break; - case WLAN_AUTH_ALG_SHAREDKEY: + case WLAN_AUTH_ALG_SHAREDKEY: - if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) { + if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) { pTxPacket = (struct vnt_tx_mgmt *) - pMgmt->pbyMgmtPacketPool; + pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_AUTHEN_FR_MAXLEN); + + WLAN_AUTHEN_FR_MAXLEN); pTxPacket->p80211Header - = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_AUTHEN_FR_MAXLEN; - // format buffer structure - vMgrEncodeAuthen(&sFrame); - // insert values - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_AUTHEN)| - WLAN_SET_FC_ISWEP(1) - )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - *(sFrame.pwAuthAlgorithm) = *(pFrame->pwAuthAlgorithm); - *(sFrame.pwAuthSequence) = cpu_to_le16(3); - *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_SUCCESS); - sFrame.pChallenge = (PWLAN_IE_CHALLENGE)(sFrame.pBuf + sFrame.len); - sFrame.len += WLAN_CHALLENGE_IE_LEN; - sFrame.pChallenge->byElementID = WLAN_EID_CHALLENGE; - sFrame.pChallenge->len = WLAN_CHALLENGE_LEN; - memcpy( sFrame.pChallenge->abyChallenge, pFrame->pChallenge->abyChallenge, WLAN_CHALLENGE_LEN); - // Adjust the length fields - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - // send the frame - if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx failed.\n"); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx ...\n"); - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:rx Auth_reply sequence_2 status error ...\n"); - if ( pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT ) { - /* spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((void *) pDevice, 0); - spin_lock_irq(&pDevice->lock); */ - } - s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); - } - break; - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt: rx auth.seq = 2 unknown AuthAlgorithm=%d\n", cpu_to_le16((*(pFrame->pwAuthAlgorithm)))); - break; - } - return; + = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_AUTHEN_FR_MAXLEN; + // format buffer structure + vMgrEncodeAuthen(&sFrame); + // insert values + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_AUTHEN)| + WLAN_SET_FC_ISWEP(1) + )); + memcpy( sFrame.pHdr->sA3.abyAddr1, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + *(sFrame.pwAuthAlgorithm) = *(pFrame->pwAuthAlgorithm); + *(sFrame.pwAuthSequence) = cpu_to_le16(3); + *(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_SUCCESS); + sFrame.pChallenge = (PWLAN_IE_CHALLENGE)(sFrame.pBuf + sFrame.len); + sFrame.len += WLAN_CHALLENGE_IE_LEN; + sFrame.pChallenge->byElementID = WLAN_EID_CHALLENGE; + sFrame.pChallenge->len = WLAN_CHALLENGE_LEN; + memcpy( sFrame.pChallenge->abyChallenge, pFrame->pChallenge->abyChallenge, WLAN_CHALLENGE_LEN); + // Adjust the length fields + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + // send the frame + if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx failed.\n"); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx ...\n"); + } + else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:rx Auth_reply sequence_2 status error ...\n"); + if ( pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT ) { + /* spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, 0); + spin_lock_irq(&pDevice->lock); */ + } + s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); + } + break; + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt: rx auth.seq = 2 unknown AuthAlgorithm=%d\n", cpu_to_le16((*(pFrame->pwAuthAlgorithm)))); + break; + } + return; } /*+ @@ -1192,78 +1192,78 @@ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ static void s_vMgrRxAuthenSequence_3(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { struct vnt_tx_mgmt *pTxPacket = NULL; u32 uStatusCode = 0 ; u32 uNodeIndex = 0; WLAN_FR_AUTHEN sFrame; - if (!WLAN_GET_FC_ISWEP(pFrame->pHdr->sA3.wFrameCtl)) { - uStatusCode = WLAN_MGMT_STATUS_CHALLENGE_FAIL; - goto reply; - } - if (BSSbIsSTAInNodeDB(pDevice, pFrame->pHdr->sA3.abyAddr2, &uNodeIndex)) { - if (pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence != 1) { - uStatusCode = WLAN_MGMT_STATUS_RX_AUTH_NOSEQ; - goto reply; - } - if (memcmp(pMgmt->abyChallenge, pFrame->pChallenge->abyChallenge, WLAN_CHALLENGE_LEN) != 0) { - uStatusCode = WLAN_MGMT_STATUS_CHALLENGE_FAIL; - goto reply; - } - } - else { - uStatusCode = WLAN_MGMT_STATUS_UNSPEC_FAILURE; - goto reply; - } - - if (uNodeIndex) { - pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_AUTH; - pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence = 0; - } - uStatusCode = WLAN_MGMT_STATUS_SUCCESS; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Challenge text check ok..\n"); + if (!WLAN_GET_FC_ISWEP(pFrame->pHdr->sA3.wFrameCtl)) { + uStatusCode = WLAN_MGMT_STATUS_CHALLENGE_FAIL; + goto reply; + } + if (BSSbIsSTAInNodeDB(pDevice, pFrame->pHdr->sA3.abyAddr2, &uNodeIndex)) { + if (pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence != 1) { + uStatusCode = WLAN_MGMT_STATUS_RX_AUTH_NOSEQ; + goto reply; + } + if (memcmp(pMgmt->abyChallenge, pFrame->pChallenge->abyChallenge, WLAN_CHALLENGE_LEN) != 0) { + uStatusCode = WLAN_MGMT_STATUS_CHALLENGE_FAIL; + goto reply; + } + } + else { + uStatusCode = WLAN_MGMT_STATUS_UNSPEC_FAILURE; + goto reply; + } + + if (uNodeIndex) { + pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_AUTH; + pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence = 0; + } + uStatusCode = WLAN_MGMT_STATUS_SUCCESS; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Challenge text check ok..\n"); reply: - // send auth reply + // send auth reply pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_AUTHEN_FR_MAXLEN); + + WLAN_AUTHEN_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_AUTHEN_FR_MAXLEN; - // format buffer structure - vMgrEncodeAuthen(&sFrame); - /* insert values */ - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_AUTHEN)| - WLAN_SET_FC_ISWEP(0) - )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pFrame->pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - *(sFrame.pwAuthAlgorithm) = *(pFrame->pwAuthAlgorithm); - *(sFrame.pwAuthSequence) = cpu_to_le16(4); - *(sFrame.pwStatus) = cpu_to_le16(uStatusCode); - - /* Adjust the length fields */ - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - // send the frame - if (pDevice->bEnableHostapd) { - return; - } - if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_4 tx failed.\n"); - } - return; + + sizeof(struct vnt_tx_mgmt)); + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_AUTHEN_FR_MAXLEN; + // format buffer structure + vMgrEncodeAuthen(&sFrame); + /* insert values */ + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_AUTHEN)| + WLAN_SET_FC_ISWEP(0) + )); + memcpy( sFrame.pHdr->sA3.abyAddr1, pFrame->pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + *(sFrame.pwAuthAlgorithm) = *(pFrame->pwAuthAlgorithm); + *(sFrame.pwAuthSequence) = cpu_to_le16(4); + *(sFrame.pwStatus) = cpu_to_le16(uStatusCode); + + /* Adjust the length fields */ + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + // send the frame + if (pDevice->bEnableHostapd) { + return; + } + if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_4 tx failed.\n"); + } + return; } @@ -1276,27 +1276,27 @@ reply: * Return Value: * None. * --*/ + -*/ static void s_vMgrRxAuthenSequence_4(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { - if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n"); - pMgmt->eCurrState = WMAC_STATE_AUTH; - schedule_delayed_work(&pDevice->run_command_work, 0); - } - else{ - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n"); - s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))) ); - pMgmt->eCurrState = WMAC_STATE_IDLE; - } - - if ( pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT ) { - /* spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((void *) pDevice, 0); - spin_lock_irq(&pDevice->lock); */ - } + if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n"); + pMgmt->eCurrState = WMAC_STATE_AUTH; + schedule_delayed_work(&pDevice->run_command_work, 0); + } + else{ + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n"); + s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))) ); + pMgmt->eCurrState = WMAC_STATE_IDLE; + } + + if ( pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT ) { + /* spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, 0); + spin_lock_irq(&pDevice->lock); */ + } } /*+ @@ -1308,62 +1308,62 @@ static void s_vMgrRxAuthenSequence_4(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ static void s_vMgrRxDisassociation(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { WLAN_FR_DISASSOC sFrame; u32 uNodeIndex = 0; CMD_STATUS CmdStatus; - if ( pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){ - // if is acting an AP.. - // a STA is leaving this BSS.. - sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (u8 *)pRxPacket->p80211Header; - if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) { - BSSvRemoveOneNode(pDevice, uNodeIndex); - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx disassoc, sta not found\n"); - } - } - else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA ){ - sFrame.len = pRxPacket->cbMPDULen; - 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))); - - pDevice->fWPA_Authened = false; - - //TODO: do something let upper layer know or - //try to send associate packet again because of inactivity timeout - if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { - pDevice->bLinkPass = false; - pMgmt->sNodeDBTable[0].bActive = false; - pDevice->byReAssocCount = 0; - pMgmt->eCurrState = WMAC_STATE_AUTH; // jump back to the auth state! - pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; - vMgrReAssocBeginSta(pDevice, pMgmt, &CmdStatus); - if(CmdStatus == CMD_STATUS_PENDING) { - pDevice->byReAssocCount ++; - return; //mike add: you'll retry for many times, so it cann't be regarded as disconnected! - } - } - - // if(pDevice->bWPASuppWextEnabled == true) - { - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof (wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); - wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); - } - } - /* else, ignore it */ - - return; + if ( pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){ + // if is acting an AP.. + // a STA is leaving this BSS.. + sFrame.len = pRxPacket->cbMPDULen; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; + if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) { + BSSvRemoveOneNode(pDevice, uNodeIndex); + } + else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx disassoc, sta not found\n"); + } + } + else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA ){ + sFrame.len = pRxPacket->cbMPDULen; + 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))); + + pDevice->fWPA_Authened = false; + + //TODO: do something let upper layer know or + //try to send associate packet again because of inactivity timeout + if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { + pDevice->bLinkPass = false; + pMgmt->sNodeDBTable[0].bActive = false; + pDevice->byReAssocCount = 0; + pMgmt->eCurrState = WMAC_STATE_AUTH; // jump back to the auth state! + pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; + vMgrReAssocBeginSta(pDevice, pMgmt, &CmdStatus); + if(CmdStatus == CMD_STATUS_PENDING) { + pDevice->byReAssocCount ++; + return; //mike add: you'll retry for many times, so it cann't be regarded as disconnected! + } + } + + // if(pDevice->bWPASuppWextEnabled == true) + { + union iwreq_data wrqu; + memset(&wrqu, 0, sizeof (wrqu)); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); + wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); + } + } + /* else, ignore it */ + + return; } /*+ @@ -1375,61 +1375,61 @@ static void s_vMgrRxDisassociation(struct vnt_private *pDevice, * Return Value: * None. * --*/ + -*/ static void s_vMgrRxDeauthentication(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { 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 = (u8 *)pRxPacket->p80211Header; - if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) { - BSSvRemoveOneNode(pDevice, uNodeIndex); - } - else { - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Rx deauth, sta not found\n"); - } - } - else { - if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA ) { - sFrame.len = pRxPacket->cbMPDULen; - 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)))); - // TODO: update BSS list for specific BSSID if pre-authentication case - if (ether_addr_equal(sFrame.pHdr->sA3.abyAddr3, - pMgmt->abyCurrBSSID)) { - if (pMgmt->eCurrState >= WMAC_STATE_AUTHPENDING) { - pMgmt->sNodeDBTable[0].bActive = false; - pMgmt->eCurrMode = WMAC_MODE_STANDBY; - pMgmt->eCurrState = WMAC_STATE_IDLE; - netif_stop_queue(pDevice->dev); - pDevice->bLinkPass = false; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); - } - } - - // if(pDevice->bWPASuppWextEnabled == true) - { - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof (wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - PRINT_K("wireless_send_event--->SIOCGIWAP(disauthen)\n"); - wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); - } - - } - /* else, ignore it. TODO: IBSS authentication service - would be implemented here */ - }; - return; + 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 = (u8 *)pRxPacket->p80211Header; + if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) { + BSSvRemoveOneNode(pDevice, uNodeIndex); + } + else { + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Rx deauth, sta not found\n"); + } + } + else { + if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA ) { + sFrame.len = pRxPacket->cbMPDULen; + 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)))); + // TODO: update BSS list for specific BSSID if pre-authentication case + if (ether_addr_equal(sFrame.pHdr->sA3.abyAddr3, + pMgmt->abyCurrBSSID)) { + if (pMgmt->eCurrState >= WMAC_STATE_AUTHPENDING) { + pMgmt->sNodeDBTable[0].bActive = false; + pMgmt->eCurrMode = WMAC_MODE_STANDBY; + pMgmt->eCurrState = WMAC_STATE_IDLE; + netif_stop_queue(pDevice->dev); + pDevice->bLinkPass = false; + ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); + } + } + + // if(pDevice->bWPASuppWextEnabled == true) + { + union iwreq_data wrqu; + memset(&wrqu, 0, sizeof (wrqu)); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + PRINT_K("wireless_send_event--->SIOCGIWAP(disauthen)\n"); + wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); + } + + } + /* else, ignore it. TODO: IBSS authentication service + would be implemented here */ + }; + return; } /*+ @@ -1442,26 +1442,26 @@ static void s_vMgrRxDeauthentication(struct vnt_private *pDevice, * Return Value: * True:exceed; * False:normal case --*/ + -*/ static int ChannelExceedZoneType(struct vnt_private *pDevice, u8 byCurrChannel) { int exceed = false; - switch(pDevice->byZoneType) { - case 0x00: //USA:1~11 - if((byCurrChannel<1) ||(byCurrChannel>11)) - exceed = true; - break; + switch(pDevice->byZoneType) { + case 0x00: //USA:1~11 + if((byCurrChannel<1) ||(byCurrChannel>11)) + exceed = true; + break; case 0x01: //Japan:1~13 case 0x02: //Europe:1~13 - if((byCurrChannel<1) ||(byCurrChannel>13)) - exceed = true; - break; + if((byCurrChannel<1) ||(byCurrChannel>13)) + exceed = true; + break; default: //reserve for other zonetype break; - } + } - return exceed; + return exceed; } /*+ @@ -1473,11 +1473,11 @@ static int ChannelExceedZoneType(struct vnt_private *pDevice, u8 byCurrChannel) * Return Value: * None. * --*/ + -*/ static void s_vMgrRxBeacon(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, - int bInScan) + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bInScan) { PKnownBSS pBSSList; WLAN_FR_BEACON sFrame; @@ -1503,464 +1503,464 @@ static void s_vMgrRxBeacon(struct vnt_private *pDevice, int bChannelHit = false; u8 byOldPreambleType; - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) - return; + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) + return; + + memset(&sFrame, 0, sizeof(WLAN_FR_BEACON)); + sFrame.len = pRxPacket->cbMPDULen; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; - memset(&sFrame, 0, sizeof(WLAN_FR_BEACON)); - sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (u8 *)pRxPacket->p80211Header; + // decode the beacon frame + vMgrDecodeBeacon(&sFrame); - // decode the beacon frame - vMgrDecodeBeacon(&sFrame); + if ((sFrame.pwBeaconInterval == NULL) + || (sFrame.pwCapInfo == NULL) + || (sFrame.pSSID == NULL) + || (sFrame.pSuppRates == NULL)) { - if ((sFrame.pwBeaconInterval == NULL) - || (sFrame.pwCapInfo == NULL) - || (sFrame.pSSID == NULL) - || (sFrame.pSuppRates == NULL)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n"); + return; + } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n"); - return; - } - - if( byCurrChannel > CB_MAX_CHANNEL_24G ) - { - if (sFrame.pDSParms != NULL) { - if (byCurrChannel == RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]) - bChannelHit = true; - byCurrChannel = RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]; - } else { - bChannelHit = true; - } - - } else { - if (sFrame.pDSParms != NULL) { - if (byCurrChannel == sFrame.pDSParms->byCurrChannel) - bChannelHit = true; - byCurrChannel = sFrame.pDSParms->byCurrChannel; - } else { - bChannelHit = true; - } - } - -if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) - return; - - if (sFrame.pERP != NULL) { - sERP.byERP = sFrame.pERP->byContext; - sERP.bERPExist = true; - - } else { - sERP.bERPExist = false; - sERP.byERP = 0; - } - - pBSSList = BSSpAddrIsInBSSList((void *) pDevice, - sFrame.pHdr->sA3.abyAddr3, - sFrame.pSSID); - if (pBSSList == NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon/insert: RxChannel = : %d\n", byCurrChannel); - BSSbInsertToBSSList((void *) pDevice, - sFrame.pHdr->sA3.abyAddr3, - *sFrame.pqwTimestamp, - *sFrame.pwBeaconInterval, - *sFrame.pwCapInfo, - byCurrChannel, - sFrame.pSSID, - sFrame.pSuppRates, - sFrame.pExtSuppRates, - &sERP, - sFrame.pRSN, - sFrame.pRSNWPA, - sFrame.pIE_Country, - sFrame.pIE_Quiet, - sFrame.len - WLAN_HDR_ADDR3_LEN, - sFrame.pHdr->sA4.abyAddr4, // payload of beacon - (void *) pRxPacket); - } - else { -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"update bcn: RxChannel = : %d\n", byCurrChannel); - BSSbUpdateToBSSList((void *) pDevice, - *sFrame.pqwTimestamp, - *sFrame.pwBeaconInterval, - *sFrame.pwCapInfo, - byCurrChannel, - bChannelHit, - sFrame.pSSID, - sFrame.pSuppRates, - sFrame.pExtSuppRates, - &sERP, - sFrame.pRSN, - sFrame.pRSNWPA, - sFrame.pIE_Country, - sFrame.pIE_Quiet, - pBSSList, - sFrame.len - WLAN_HDR_ADDR3_LEN, - sFrame.pHdr->sA4.abyAddr4, // payload of probresponse - (void *) pRxPacket); - - } - - if (bInScan) { - return; - } - - if(byCurrChannel == (u8)pMgmt->uCurrChannel) - bIsChannelEqual = true; - - if (bIsChannelEqual && (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { - - // if rx beacon without ERP field - if (sERP.bERPExist) { - if (WLAN_GET_ERP_USE_PROTECTION(sERP.byERP)){ - pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1); - pDevice->wUseProtectCntDown = USE_PROTECT_PERIOD; - } - } - else { - pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1); - pDevice->wUseProtectCntDown = USE_PROTECT_PERIOD; - } - - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - if(!WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo)) - pDevice->byERPFlag |= WLAN_SET_ERP_BARKER_MODE(1); - if(!sERP.bERPExist) - pDevice->byERPFlag |= WLAN_SET_ERP_NONERP_PRESENT(1); - } - } - - // check if BSSID the same - if (memcmp(sFrame.pHdr->sA3.abyAddr3, - pMgmt->abyCurrBSSID, - WLAN_BSSID_LEN) == 0) { - - bIsBSSIDEqual = true; - pDevice->uCurrRSSI = pRxPacket->uRSSI; - pDevice->byCurrSQ = pRxPacket->bySQ; - if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) { - pMgmt->sNodeDBTable[0].uInActiveCount = 0; - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BCN:Wake Count= [%d]\n", pMgmt->wCountToWakeUp); - } - } - // check if SSID the same - if (sFrame.pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) { - if (memcmp(sFrame.pSSID->abySSID, - ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, - sFrame.pSSID->len - ) == 0) { - bIsSSIDEqual = true; - } - } - - if ((WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)== true) && - (bIsBSSIDEqual == true) && - (bIsSSIDEqual == true) && - (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && - (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { - // add state check to prevent reconnect fail since we'll receive Beacon - - bIsAPBeacon = true; - if (pBSSList != NULL) { - - // Sync ERP field - if ((pBSSList->sERP.bERPExist == true) && (pDevice->byBBType == BB_TYPE_11G)) { - if ((pBSSList->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION) != pDevice->bProtectMode) {//0000 0010 - pDevice->bProtectMode = (pBSSList->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION); - if (pDevice->bProtectMode) { - MACvEnableProtectMD(pDevice); - } else { - MACvDisableProtectMD(pDevice); - } - vUpdateIFS(pDevice); - } - if ((pBSSList->sERP.byERP & WLAN_EID_ERP_NONERP_PRESENT) != pDevice->bNonERPPresent) {//0000 0001 - pDevice->bNonERPPresent = (pBSSList->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION); - } - if ((pBSSList->sERP.byERP & WLAN_EID_ERP_BARKER_MODE) != pDevice->bBarkerPreambleMd) {//0000 0100 - pDevice->bBarkerPreambleMd = (pBSSList->sERP.byERP & WLAN_EID_ERP_BARKER_MODE); - //BarkerPreambleMd has higher priority than shortPreamble bit in Cap - if (pDevice->bBarkerPreambleMd) { - MACvEnableBarkerPreambleMd(pDevice); - } else { - MACvDisableBarkerPreambleMd(pDevice); - } - } - } - // Sync Short Slot Time - if (WLAN_GET_CAP_INFO_SHORTSLOTTIME(pBSSList->wCapInfo) != pDevice->bShortSlotTime) { - bool bShortSlotTime; - - bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(pBSSList->wCapInfo); - //DBG_PRN_WLAN05(("Set Short Slot Time: %d\n", pDevice->bShortSlotTime)); - //Kyle check if it is OK to set G. - if (pDevice->byBBType == BB_TYPE_11A) { - bShortSlotTime = true; - } - else if (pDevice->byBBType == BB_TYPE_11B) { - bShortSlotTime = false; - } - if (bShortSlotTime != pDevice->bShortSlotTime) { - pDevice->bShortSlotTime = bShortSlotTime; - BBvSetShortSlotTime(pDevice); - vUpdateIFS(pDevice); - } - } - - // - // Preamble may change dynamically - // - byOldPreambleType = pDevice->byPreambleType; - if (WLAN_GET_CAP_INFO_SHORTPREAMBLE(pBSSList->wCapInfo)) { - pDevice->byPreambleType = pDevice->byShortPreamble; - } - else { - pDevice->byPreambleType = 0; - } - if (pDevice->byPreambleType != byOldPreambleType) - CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); - // - // Basic Rate Set may change dynamically - // - if (pBSSList->eNetworkTypeInUse == PHY_TYPE_11B) { - uRateLen = WLAN_RATES_MAXLEN_11B; - } - pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pBSSList->abySuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - uRateLen); - pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pBSSList->abyExtSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, - uRateLen); - RATEvParseMaxRate((void *)pDevice, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, - true, - &(pMgmt->sNodeDBTable[0].wMaxBasicRate), - &(pMgmt->sNodeDBTable[0].wMaxSuppRate), - &(pMgmt->sNodeDBTable[0].wSuppRate), - &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), - &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate) - ); - - } - } - -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon 2 \n"); - // check if CF field exisit - if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)) { - if (sFrame.pCFParms->wCFPDurRemaining > 0) { - // TODO: deal with CFP period to set NAV - } - } + if( byCurrChannel > CB_MAX_CHANNEL_24G ) + { + if (sFrame.pDSParms != NULL) { + if (byCurrChannel == RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]) + bChannelHit = true; + byCurrChannel = RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]; + } else { + bChannelHit = true; + } + + } else { + if (sFrame.pDSParms != NULL) { + if (byCurrChannel == sFrame.pDSParms->byCurrChannel) + bChannelHit = true; + byCurrChannel = sFrame.pDSParms->byCurrChannel; + } else { + bChannelHit = true; + } + } + + if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) + return; + + if (sFrame.pERP != NULL) { + sERP.byERP = sFrame.pERP->byContext; + sERP.bERPExist = true; + + } else { + sERP.bERPExist = false; + sERP.byERP = 0; + } + + pBSSList = BSSpAddrIsInBSSList((void *) pDevice, + sFrame.pHdr->sA3.abyAddr3, + sFrame.pSSID); + if (pBSSList == NULL) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon/insert: RxChannel = : %d\n", byCurrChannel); + BSSbInsertToBSSList((void *) pDevice, + sFrame.pHdr->sA3.abyAddr3, + *sFrame.pqwTimestamp, + *sFrame.pwBeaconInterval, + *sFrame.pwCapInfo, + byCurrChannel, + sFrame.pSSID, + sFrame.pSuppRates, + sFrame.pExtSuppRates, + &sERP, + sFrame.pRSN, + sFrame.pRSNWPA, + sFrame.pIE_Country, + sFrame.pIE_Quiet, + sFrame.len - WLAN_HDR_ADDR3_LEN, + sFrame.pHdr->sA4.abyAddr4, // payload of beacon + (void *) pRxPacket); + } + else { + // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"update bcn: RxChannel = : %d\n", byCurrChannel); + BSSbUpdateToBSSList((void *) pDevice, + *sFrame.pqwTimestamp, + *sFrame.pwBeaconInterval, + *sFrame.pwCapInfo, + byCurrChannel, + bChannelHit, + sFrame.pSSID, + sFrame.pSuppRates, + sFrame.pExtSuppRates, + &sERP, + sFrame.pRSN, + sFrame.pRSNWPA, + sFrame.pIE_Country, + sFrame.pIE_Quiet, + pBSSList, + sFrame.len - WLAN_HDR_ADDR3_LEN, + sFrame.pHdr->sA4.abyAddr4, // payload of probresponse + (void *) pRxPacket); + + } + + if (bInScan) { + return; + } + + if(byCurrChannel == (u8)pMgmt->uCurrChannel) + bIsChannelEqual = true; + + if (bIsChannelEqual && (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { + + // if rx beacon without ERP field + if (sERP.bERPExist) { + if (WLAN_GET_ERP_USE_PROTECTION(sERP.byERP)){ + pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1); + pDevice->wUseProtectCntDown = USE_PROTECT_PERIOD; + } + } + else { + pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1); + pDevice->wUseProtectCntDown = USE_PROTECT_PERIOD; + } + + if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + if(!WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo)) + pDevice->byERPFlag |= WLAN_SET_ERP_BARKER_MODE(1); + if(!sERP.bERPExist) + pDevice->byERPFlag |= WLAN_SET_ERP_NONERP_PRESENT(1); + } + } + + // check if BSSID the same + if (memcmp(sFrame.pHdr->sA3.abyAddr3, + pMgmt->abyCurrBSSID, + WLAN_BSSID_LEN) == 0) { + + bIsBSSIDEqual = true; + pDevice->uCurrRSSI = pRxPacket->uRSSI; + pDevice->byCurrSQ = pRxPacket->bySQ; + if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) { + pMgmt->sNodeDBTable[0].uInActiveCount = 0; + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BCN:Wake Count= [%d]\n", pMgmt->wCountToWakeUp); + } + } + // check if SSID the same + if (sFrame.pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) { + if (memcmp(sFrame.pSSID->abySSID, + ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, + sFrame.pSSID->len + ) == 0) { + bIsSSIDEqual = true; + } + } + + if ((WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)== true) && + (bIsBSSIDEqual == true) && + (bIsSSIDEqual == true) && + (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && + (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { + // add state check to prevent reconnect fail since we'll receive Beacon + + bIsAPBeacon = true; + if (pBSSList != NULL) { + + // Sync ERP field + if ((pBSSList->sERP.bERPExist == true) && (pDevice->byBBType == BB_TYPE_11G)) { + if ((pBSSList->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION) != pDevice->bProtectMode) {//0000 0010 + pDevice->bProtectMode = (pBSSList->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION); + if (pDevice->bProtectMode) { + MACvEnableProtectMD(pDevice); + } else { + MACvDisableProtectMD(pDevice); + } + vUpdateIFS(pDevice); + } + if ((pBSSList->sERP.byERP & WLAN_EID_ERP_NONERP_PRESENT) != pDevice->bNonERPPresent) {//0000 0001 + pDevice->bNonERPPresent = (pBSSList->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION); + } + if ((pBSSList->sERP.byERP & WLAN_EID_ERP_BARKER_MODE) != pDevice->bBarkerPreambleMd) {//0000 0100 + pDevice->bBarkerPreambleMd = (pBSSList->sERP.byERP & WLAN_EID_ERP_BARKER_MODE); + //BarkerPreambleMd has higher priority than shortPreamble bit in Cap + if (pDevice->bBarkerPreambleMd) { + MACvEnableBarkerPreambleMd(pDevice); + } else { + MACvDisableBarkerPreambleMd(pDevice); + } + } + } + // Sync Short Slot Time + if (WLAN_GET_CAP_INFO_SHORTSLOTTIME(pBSSList->wCapInfo) != pDevice->bShortSlotTime) { + bool bShortSlotTime; + + bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(pBSSList->wCapInfo); + //DBG_PRN_WLAN05(("Set Short Slot Time: %d\n", pDevice->bShortSlotTime)); + //Kyle check if it is OK to set G. + if (pDevice->byBBType == BB_TYPE_11A) { + bShortSlotTime = true; + } + else if (pDevice->byBBType == BB_TYPE_11B) { + bShortSlotTime = false; + } + if (bShortSlotTime != pDevice->bShortSlotTime) { + pDevice->bShortSlotTime = bShortSlotTime; + BBvSetShortSlotTime(pDevice); + vUpdateIFS(pDevice); + } + } + + // + // Preamble may change dynamically + // + byOldPreambleType = pDevice->byPreambleType; + if (WLAN_GET_CAP_INFO_SHORTPREAMBLE(pBSSList->wCapInfo)) { + pDevice->byPreambleType = pDevice->byShortPreamble; + } + else { + pDevice->byPreambleType = 0; + } + if (pDevice->byPreambleType != byOldPreambleType) + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); + // + // Basic Rate Set may change dynamically + // + if (pBSSList->eNetworkTypeInUse == PHY_TYPE_11B) { + uRateLen = WLAN_RATES_MAXLEN_11B; + } + pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pBSSList->abySuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + uRateLen); + pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pBSSList->abyExtSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, + uRateLen); + RATEvParseMaxRate((void *)pDevice, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, + true, + &(pMgmt->sNodeDBTable[0].wMaxBasicRate), + &(pMgmt->sNodeDBTable[0].wMaxSuppRate), + &(pMgmt->sNodeDBTable[0].wSuppRate), + &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), + &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate) + ); + + } + } + + // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon 2\n"); + // check if CF field exisit + if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)) { + if (sFrame.pCFParms->wCFPDurRemaining > 0) { + // TODO: deal with CFP period to set NAV + } + } qwTimestamp = cpu_to_le64(*sFrame.pqwTimestamp); qwLocalTSF = pRxPacket->qwLocalTSF; - // check if beacon TSF larger or small than our local TSF + // check if beacon TSF larger or small than our local TSF if (qwTimestamp >= qwLocalTSF) bTSFOffsetPostive = true; else bTSFOffsetPostive = false; - if (bTSFOffsetPostive) { - qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF)); - } - else { - qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp)); - } + if (bTSFOffsetPostive) { + qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF)); + } + else { + qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp)); + } if (qwTSFOffset > TRIVIAL_SYNC_DIFFERENCE) bTSFLargeDiff = true; - // if infra mode - if (bIsAPBeacon == true) { - - // Infra mode: Local TSF always follow AP's TSF if Difference huge. - if (bTSFLargeDiff) - bUpdateTSF = true; - - if ((pDevice->bEnablePSMode == true) && (sFrame.pTIM)) { - - /* deal with DTIM, analysis TIM */ - pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? true : false ; - pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount; - pMgmt->byDTIMPeriod = sFrame.pTIM->byDTIMPeriod; - wAIDNumber = pMgmt->wCurrAID & ~(BIT14|BIT15); - - // check if AID in TIM field bit on - // wStartIndex = N1 - wStartIndex = WLAN_MGMT_GET_TIM_OFFSET(sFrame.pTIM->byBitMapCtl) << 1; - // AIDIndex = N2 - wAIDIndex = (wAIDNumber >> 3); - if ((wAIDNumber > 0) && (wAIDIndex >= wStartIndex)) { - uLocateByteIndex = wAIDIndex - wStartIndex; - // len = byDTIMCount + byDTIMPeriod + byDTIMPeriod + byVirtBitMap[0~250] - if (sFrame.pTIM->len >= (uLocateByteIndex + 4)) { - byTIMBitOn = (0x01) << ((wAIDNumber) % 8); - pMgmt->bInTIM = sFrame.pTIM->byVirtBitMap[uLocateByteIndex] & byTIMBitOn ? true : false; - } - else { - pMgmt->bInTIM = false; - }; - } - else { - pMgmt->bInTIM = false; - }; - - if (pMgmt->bInTIM || - (pMgmt->bMulticastTIM && (pMgmt->byDTIMCount == 0))) { - pMgmt->bInTIMWake = true; - /* send out ps-poll packet */ - if (pMgmt->bInTIM) - PSvSendPSPOLL(pDevice); - - } - else { - pMgmt->bInTIMWake = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n"); - if (pDevice->bPWBitOn == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Send Null Packet\n"); - if (PSbSendNullPacket(pDevice)) - pDevice->bPWBitOn = true; - } - if(PSbConsiderPowerDown(pDevice, false, false)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Power down now...\n"); - } - } - - } - - } - // if adhoc mode - if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && !bIsAPBeacon && bIsChannelEqual) { - if (bIsBSSIDEqual) { - // Use sNodeDBTable[0].uInActiveCount as IBSS beacons received count. - if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) - pMgmt->sNodeDBTable[0].uInActiveCount = 0; - - // adhoc mode:TSF updated only when beacon larger then local TSF - if (bTSFLargeDiff && bTSFOffsetPostive && - (pMgmt->eCurrState == WMAC_STATE_JOINTED)) - bUpdateTSF = true; - - // During dpc, already in spinlocked. - if (BSSbIsSTAInNodeDB(pDevice, sFrame.pHdr->sA3.abyAddr2, &uNodeIndex)) { - - // Update the STA, (Technically the Beacons of all the IBSS nodes - // should be identical, but that's not happening in practice. - pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - WLAN_RATES_MAXLEN_11B); - RATEvParseMaxRate((void *)pDevice, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - NULL, - true, - &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), - &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), - &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), - &(pMgmt->sNodeDBTable[uNodeIndex].byTopCCKBasicRate), - &(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate) - ); - pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].uInActiveCount = 0; - } - else { - /* Todo, initial Node content */ - BSSvCreateOneNode(pDevice, &uNodeIndex); + // if infra mode + if (bIsAPBeacon == true) { + + // Infra mode: Local TSF always follow AP's TSF if Difference huge. + if (bTSFLargeDiff) + bUpdateTSF = true; + + if ((pDevice->bEnablePSMode == true) && (sFrame.pTIM)) { + + /* deal with DTIM, analysis TIM */ + pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? true : false ; + pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount; + pMgmt->byDTIMPeriod = sFrame.pTIM->byDTIMPeriod; + wAIDNumber = pMgmt->wCurrAID & ~(BIT14|BIT15); + + // check if AID in TIM field bit on + // wStartIndex = N1 + wStartIndex = WLAN_MGMT_GET_TIM_OFFSET(sFrame.pTIM->byBitMapCtl) << 1; + // AIDIndex = N2 + wAIDIndex = (wAIDNumber >> 3); + if ((wAIDNumber > 0) && (wAIDIndex >= wStartIndex)) { + uLocateByteIndex = wAIDIndex - wStartIndex; + // len = byDTIMCount + byDTIMPeriod + byDTIMPeriod + byVirtBitMap[0~250] + if (sFrame.pTIM->len >= (uLocateByteIndex + 4)) { + byTIMBitOn = (0x01) << ((wAIDNumber) % 8); + pMgmt->bInTIM = sFrame.pTIM->byVirtBitMap[uLocateByteIndex] & byTIMBitOn ? true : false; + } + else { + pMgmt->bInTIM = false; + }; + } + else { + pMgmt->bInTIM = false; + }; + + if (pMgmt->bInTIM || + (pMgmt->bMulticastTIM && (pMgmt->byDTIMCount == 0))) { + pMgmt->bInTIMWake = true; + /* send out ps-poll packet */ + if (pMgmt->bInTIM) + PSvSendPSPOLL(pDevice); + + } + else { + pMgmt->bInTIMWake = false; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n"); + if (pDevice->bPWBitOn == false) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Send Null Packet\n"); + if (PSbSendNullPacket(pDevice)) + pDevice->bPWBitOn = true; + } + if(PSbConsiderPowerDown(pDevice, false, false)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Power down now...\n"); + } + } - pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - WLAN_RATES_MAXLEN_11B); - RATEvParseMaxRate((void *)pDevice, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - NULL, - true, - &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), - &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), - &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), - &(pMgmt->sNodeDBTable[uNodeIndex].byTopCCKBasicRate), - &(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate) - ); - - memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, sFrame.pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); - pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); - pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; -/* - pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); - if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) - pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; -*/ - } - - // if other stations jointed, indicate connect to upper layer.. - if (pMgmt->eCurrState == WMAC_STATE_STARTED) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed] \n"); - pMgmt->eCurrState = WMAC_STATE_JOINTED; - pDevice->bLinkPass = true; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); - if (netif_queue_stopped(pDevice->dev)){ - netif_wake_queue(pDevice->dev); - } - pMgmt->sNodeDBTable[0].bActive = true; - pMgmt->sNodeDBTable[0].uInActiveCount = 0; - - } - } - else if (bIsSSIDEqual) { - - // See other adhoc sta with the same SSID but BSSID is different. - // adpot this vars only when TSF larger then us. - if (bTSFLargeDiff && bTSFOffsetPostive) { - // we don't support ATIM under adhoc mode - // if ( sFrame.pIBSSParms->wATIMWindow == 0) { - // adpot this vars - // TODO: check sFrame cap if privacy on, and support rate syn - memcpy(pMgmt->abyCurrBSSID, sFrame.pHdr->sA3.abyAddr3, WLAN_BSSID_LEN); - memcpy(pDevice->abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - pMgmt->wCurrATIMWindow = cpu_to_le16(sFrame.pIBSSParms->wATIMWindow); - pMgmt->wCurrBeaconPeriod = cpu_to_le16(*sFrame.pwBeaconInterval); - pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - WLAN_RATES_MAXLEN_11B); - // set HW beacon interval and re-synchronizing.... - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rejoining to Other Adhoc group with same SSID........\n"); - - MACvWriteBeaconInterval(pDevice, pMgmt->wCurrBeaconPeriod); - CARDvAdjustTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, pRxPacket->qwLocalTSF); - CARDvUpdateNextTBTT(pDevice, qwTimestamp, pMgmt->wCurrBeaconPeriod); - - // Turn off bssid filter to avoid filter others adhoc station which bssid is different. - MACvWriteBSSIDAddress(pDevice, pMgmt->abyCurrBSSID); - - byOldPreambleType = pDevice->byPreambleType; - if (WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo)) { - pDevice->byPreambleType = pDevice->byShortPreamble; - } - else { - pDevice->byPreambleType = 0; - } - if (pDevice->byPreambleType != byOldPreambleType) - CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); - - // MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID); - // set highest basic rate - // s_vSetHighestBasicRate(pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates); - // Prepare beacon frame - bMgrPrepareBeaconToSend((void *) pDevice, pMgmt); - // } - } - } - } - // endian issue ??? - // Update TSF - if (bUpdateTSF) { - CARDbGetCurrentTSF(pDevice, &qwCurrTSF); - CARDvAdjustTSF(pDevice, pRxPacket->byRxRate, qwTimestamp , pRxPacket->qwLocalTSF); - CARDbGetCurrentTSF(pDevice, &qwCurrTSF); - CARDvUpdateNextTBTT(pDevice, qwTimestamp, pMgmt->wCurrBeaconPeriod); - } - - return; + } + + } + // if adhoc mode + if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && !bIsAPBeacon && bIsChannelEqual) { + if (bIsBSSIDEqual) { + // Use sNodeDBTable[0].uInActiveCount as IBSS beacons received count. + if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) + pMgmt->sNodeDBTable[0].uInActiveCount = 0; + + // adhoc mode:TSF updated only when beacon larger then local TSF + if (bTSFLargeDiff && bTSFOffsetPostive && + (pMgmt->eCurrState == WMAC_STATE_JOINTED)) + bUpdateTSF = true; + + // During dpc, already in spinlocked. + if (BSSbIsSTAInNodeDB(pDevice, sFrame.pHdr->sA3.abyAddr2, &uNodeIndex)) { + + // Update the STA, (Technically the Beacons of all the IBSS nodes + // should be identical, but that's not happening in practice. + pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + WLAN_RATES_MAXLEN_11B); + RATEvParseMaxRate((void *)pDevice, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + NULL, + true, + &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), + &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), + &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), + &(pMgmt->sNodeDBTable[uNodeIndex].byTopCCKBasicRate), + &(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate) + ); + pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); + pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); + pMgmt->sNodeDBTable[uNodeIndex].uInActiveCount = 0; + } + else { + /* Todo, initial Node content */ + BSSvCreateOneNode(pDevice, &uNodeIndex); + + pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + WLAN_RATES_MAXLEN_11B); + RATEvParseMaxRate((void *)pDevice, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + NULL, + true, + &(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate), + &(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate), + &(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate), + &(pMgmt->sNodeDBTable[uNodeIndex].byTopCCKBasicRate), + &(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate) + ); + + memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, sFrame.pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); + pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo); + pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; + /* + pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo); + if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M) + pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true; + */ + } + + // if other stations jointed, indicate connect to upper layer.. + if (pMgmt->eCurrState == WMAC_STATE_STARTED) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed]\n"); + pMgmt->eCurrState = WMAC_STATE_JOINTED; + pDevice->bLinkPass = true; + ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); + if (netif_queue_stopped(pDevice->dev)){ + netif_wake_queue(pDevice->dev); + } + pMgmt->sNodeDBTable[0].bActive = true; + pMgmt->sNodeDBTable[0].uInActiveCount = 0; + + } + } + else if (bIsSSIDEqual) { + + // See other adhoc sta with the same SSID but BSSID is different. + // adpot this vars only when TSF larger then us. + if (bTSFLargeDiff && bTSFOffsetPostive) { + // we don't support ATIM under adhoc mode + // if ( sFrame.pIBSSParms->wATIMWindow == 0) { + // adpot this vars + // TODO: check sFrame cap if privacy on, and support rate syn + memcpy(pMgmt->abyCurrBSSID, sFrame.pHdr->sA3.abyAddr3, WLAN_BSSID_LEN); + memcpy(pDevice->abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + pMgmt->wCurrATIMWindow = cpu_to_le16(sFrame.pIBSSParms->wATIMWindow); + pMgmt->wCurrBeaconPeriod = cpu_to_le16(*sFrame.pwBeaconInterval); + pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + WLAN_RATES_MAXLEN_11B); + // set HW beacon interval and re-synchronizing.... + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rejoining to Other Adhoc group with same SSID........\n"); + + MACvWriteBeaconInterval(pDevice, pMgmt->wCurrBeaconPeriod); + CARDvAdjustTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, pRxPacket->qwLocalTSF); + CARDvUpdateNextTBTT(pDevice, qwTimestamp, pMgmt->wCurrBeaconPeriod); + + // Turn off bssid filter to avoid filter others adhoc station which bssid is different. + MACvWriteBSSIDAddress(pDevice, pMgmt->abyCurrBSSID); + + byOldPreambleType = pDevice->byPreambleType; + if (WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo)) { + pDevice->byPreambleType = pDevice->byShortPreamble; + } + else { + pDevice->byPreambleType = 0; + } + if (pDevice->byPreambleType != byOldPreambleType) + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); + + // MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID); + // set highest basic rate + // s_vSetHighestBasicRate(pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates); + // Prepare beacon frame + bMgrPrepareBeaconToSend((void *) pDevice, pMgmt); + // } + } + } + } + // endian issue ??? + // Update TSF + if (bUpdateTSF) { + CARDbGetCurrentTSF(pDevice, &qwCurrTSF); + CARDvAdjustTSF(pDevice, pRxPacket->byRxRate, qwTimestamp , pRxPacket->qwLocalTSF); + CARDbGetCurrentTSF(pDevice, &qwCurrTSF); + CARDvUpdateNextTBTT(pDevice, qwTimestamp, pMgmt->wCurrBeaconPeriod); + } + + return; } /*+ @@ -1974,7 +1974,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) * Return Value: * CMD_STATUS * --*/ + -*/ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) { @@ -1991,542 +1991,542 @@ 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) { - if ((pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) && - (pDevice->eEncryptionStatus != Ndis802_11Encryption2Enabled) && - (pDevice->eEncryptionStatus != Ndis802_11Encryption3Enabled)) { - // encryption mode error - *pStatus = CMD_STATUS_FAILURE; - return; - } - } - - pMgmt->abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES; - pMgmt->abyCurrExtSuppRates[0] = WLAN_EID_EXTSUPP_RATES; - - if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { - pMgmt->eCurrentPHYMode = pMgmt->byAPBBType; - } else { - if (pDevice->byBBType == BB_TYPE_11G) - pMgmt->eCurrentPHYMode = PHY_TYPE_11G; - if (pDevice->byBBType == BB_TYPE_11B) - pMgmt->eCurrentPHYMode = PHY_TYPE_11B; - if (pDevice->byBBType == BB_TYPE_11A) - pMgmt->eCurrentPHYMode = PHY_TYPE_11A; - } - - if (pMgmt->eCurrentPHYMode != PHY_TYPE_11A) { - pMgmt->abyCurrSuppRates[1] = WLAN_RATES_MAXLEN_11B; - pMgmt->abyCurrExtSuppRates[1] = 0; - for (ii = 0; ii < 4; ii++) - pMgmt->abyCurrSuppRates[2+ii] = abyRATE[ii]; - } else { - pMgmt->abyCurrSuppRates[1] = 8; - pMgmt->abyCurrExtSuppRates[1] = 0; - for (ii = 0; ii < 8; ii++) - pMgmt->abyCurrSuppRates[2+ii] = abyRATE[ii]; - } - - if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { - pMgmt->abyCurrSuppRates[1] = 8; - pMgmt->abyCurrExtSuppRates[1] = 4; - for (ii = 0; ii < 4; ii++) - pMgmt->abyCurrSuppRates[2+ii] = abyCCK_RATE[ii]; - for (ii = 4; ii < 8; ii++) - pMgmt->abyCurrSuppRates[2+ii] = abyOFDM_RATE[ii-4]; - for (ii = 0; ii < 4; ii++) - pMgmt->abyCurrExtSuppRates[2+ii] = abyOFDM_RATE[ii+4]; - } - - // Disable Protect Mode - pDevice->bProtectMode = 0; - MACvDisableProtectMD(pDevice); - - pDevice->bBarkerPreambleMd = 0; - MACvDisableBarkerPreambleMd(pDevice); - - // Kyle Test 2003.11.04 - - // set HW beacon interval - if (pMgmt->wIBSSBeaconPeriod == 0) - pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI; - MACvWriteBeaconInterval(pDevice, pMgmt->wIBSSBeaconPeriod); - - CARDbGetCurrentTSF(pDevice, &qwCurrTSF); - // clear TSF counter - CARDbClearCurrentTSF(pDevice); - - // enable TSF counter - MACvRegBitsOn(pDevice,MAC_REG_TFTCTL,TFTCTL_TSFCNTREN); - // set Next TBTT - CARDvSetFirstNextTBTT(pDevice, pMgmt->wIBSSBeaconPeriod); - - pMgmt->uIBSSChannel = pDevice->uChannel; - - if (pMgmt->uIBSSChannel == 0) - pMgmt->uIBSSChannel = DEFAULT_IBSS_CHANNEL; - - // set channel and clear NAV - CARDbSetMediaChannel(pDevice, pMgmt->uIBSSChannel); - pMgmt->uCurrChannel = pMgmt->uIBSSChannel; - - pDevice->byPreambleType = pDevice->byShortPreamble; - - // set basic rate - - RATEvParseMaxRate((void *)pDevice, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, true, - &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, - &byTopCCKBasicRate, &byTopOFDMBasicRate); - - if (pDevice->byBBType == BB_TYPE_11A) { - pDevice->bShortSlotTime = true; - } else { - pDevice->bShortSlotTime = false; - } - BBvSetShortSlotTime(pDevice); - // vUpdateIFS() use pDevice->bShortSlotTime as parameter so it must be called - // after setting ShortSlotTime. - // CARDvSetBSSMode call vUpdateIFS() - CARDvSetBSSMode(pDevice); - - if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { - MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_AP); - pMgmt->eCurrMode = WMAC_MODE_ESS_AP; - } - - if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) { - MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_ADHOC); - pMgmt->eCurrMode = WMAC_MODE_IBSS_STA; - } - - // Adopt pre-configured IBSS vars to current vars - pMgmt->eCurrState = WMAC_STATE_STARTED; - pMgmt->wCurrBeaconPeriod = pMgmt->wIBSSBeaconPeriod; - pMgmt->uCurrChannel = pMgmt->uIBSSChannel; - pMgmt->wCurrATIMWindow = pMgmt->wIBSSATIMWindow; - pDevice->uCurrRSSI = 0; - pDevice->byCurrSQ = 0; - - memcpy(pMgmt->abyDesireSSID,pMgmt->abyAdHocSSID, - ((PWLAN_IE_SSID)pMgmt->abyAdHocSSID)->len + WLAN_IEHDR_LEN); - - memset(pMgmt->abyCurrSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - memcpy(pMgmt->abyCurrSSID, - pMgmt->abyDesireSSID, - ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN - ); - - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - // AP mode BSSID = MAC addr - memcpy(pMgmt->abyCurrBSSID, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"AP beacon created BSSID:" - "%pM\n", pMgmt->abyCurrBSSID); - } - - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - - // BSSID selected must be randomized as spec 11.1.3 - pMgmt->abyCurrBSSID[5] = (u8)(qwCurrTSF & 0x000000ff); - pMgmt->abyCurrBSSID[4] = (u8)((qwCurrTSF & 0x0000ff00) >> 8); - pMgmt->abyCurrBSSID[3] = (u8)((qwCurrTSF & 0x00ff0000) >> 16); - pMgmt->abyCurrBSSID[2] = (u8)((qwCurrTSF & 0x00000ff0) >> 4); - pMgmt->abyCurrBSSID[1] = (u8)((qwCurrTSF & 0x000ff000) >> 12); - pMgmt->abyCurrBSSID[0] = (u8)((qwCurrTSF & 0x0ff00000) >> 20); - pMgmt->abyCurrBSSID[5] ^= pMgmt->abyMACAddr[0]; - pMgmt->abyCurrBSSID[4] ^= pMgmt->abyMACAddr[1]; - pMgmt->abyCurrBSSID[3] ^= pMgmt->abyMACAddr[2]; - pMgmt->abyCurrBSSID[2] ^= pMgmt->abyMACAddr[3]; - pMgmt->abyCurrBSSID[1] ^= pMgmt->abyMACAddr[4]; - pMgmt->abyCurrBSSID[0] ^= pMgmt->abyMACAddr[5]; - pMgmt->abyCurrBSSID[0] &= ~IEEE_ADDR_GROUP; - pMgmt->abyCurrBSSID[0] |= IEEE_ADDR_UNIVERSAL; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n"); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"Adhoc beacon created bssid:" - "%pM\n", pMgmt->abyCurrBSSID); - } - - // set BSSID filter - MACvWriteBSSIDAddress(pDevice, pMgmt->abyCurrBSSID); - memcpy(pDevice->abyBSSID, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN); - - MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); - pDevice->byRxMode |= RCR_BSSID; - pMgmt->bCurrBSSIDFilterOn = true; - - // Set Capability Info - pMgmt->wCurrCapInfo = 0; - - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); - pMgmt->byDTIMPeriod = DEFAULT_DTIM_PERIOD; - pMgmt->byDTIMCount = pMgmt->byDTIMPeriod - 1; - pDevice->op_mode = NL80211_IFTYPE_AP; - } - - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_IBSS(1); - pDevice->op_mode = NL80211_IFTYPE_ADHOC; - } - - if (pDevice->bEncryptionEnable) { - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1); - if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { - if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { - pMgmt->byCSSPK = KEY_CTL_CCMP; - pMgmt->byCSSGK = KEY_CTL_CCMP; - } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { - pMgmt->byCSSPK = KEY_CTL_TKIP; - pMgmt->byCSSGK = KEY_CTL_TKIP; - } else { - pMgmt->byCSSPK = KEY_CTL_NONE; - pMgmt->byCSSGK = KEY_CTL_WEP; - } - } else { - pMgmt->byCSSPK = KEY_CTL_WEP; - pMgmt->byCSSGK = KEY_CTL_WEP; - } - } - - pMgmt->byERPContext = 0; - - if (pDevice->byPreambleType == 1) { - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - } else { - pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SHORTPREAMBLE(1)); - } - - pMgmt->eCurrState = WMAC_STATE_STARTED; - // Prepare beacon to send - if (bMgrPrepareBeaconToSend((void *) pDevice, pMgmt)) - *pStatus = CMD_STATUS_SUCCESS; + if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) { + if ((pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) && + (pDevice->eEncryptionStatus != Ndis802_11Encryption2Enabled) && + (pDevice->eEncryptionStatus != Ndis802_11Encryption3Enabled)) { + // encryption mode error + *pStatus = CMD_STATUS_FAILURE; + return; + } + } - return; -} + pMgmt->abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES; + pMgmt->abyCurrExtSuppRates[0] = WLAN_EID_EXTSUPP_RATES; -/*+ - * - * Routine Description: - * Instructs wmac to join a bss using the supplied attributes. - * The arguments may the BSSID or SSID and the rest of the - * attributes are obtained from the scan result of known bss list. - * - * - * Return Value: - * None. - * --*/ + if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { + pMgmt->eCurrentPHYMode = pMgmt->byAPBBType; + } else { + if (pDevice->byBBType == BB_TYPE_11G) + pMgmt->eCurrentPHYMode = PHY_TYPE_11G; + if (pDevice->byBBType == BB_TYPE_11B) + pMgmt->eCurrentPHYMode = PHY_TYPE_11B; + if (pDevice->byBBType == BB_TYPE_11A) + pMgmt->eCurrentPHYMode = PHY_TYPE_11A; + } -void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) -{ - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - PKnownBSS pCurr = NULL; - int ii, uu; - PWLAN_IE_SUPP_RATES pItemRates = NULL; - PWLAN_IE_SUPP_RATES pItemExtRates = NULL; - PWLAN_IE_SSID pItemSSID; - u32 uRateLen = WLAN_RATES_MAXLEN; - u16 wMaxBasicRate = RATE_1M; - u16 wMaxSuppRate = RATE_1M; - u16 wSuppRate; - u8 byTopCCKBasicRate = RATE_1M; - u8 byTopOFDMBasicRate = RATE_1M; - u8 bShortSlotTime = false; + if (pMgmt->eCurrentPHYMode != PHY_TYPE_11A) { + pMgmt->abyCurrSuppRates[1] = WLAN_RATES_MAXLEN_11B; + pMgmt->abyCurrExtSuppRates[1] = 0; + for (ii = 0; ii < 4; ii++) + pMgmt->abyCurrSuppRates[2+ii] = abyRATE[ii]; + } else { + pMgmt->abyCurrSuppRates[1] = 8; + pMgmt->abyCurrExtSuppRates[1] = 0; + for (ii = 0; ii < 8; ii++) + pMgmt->abyCurrSuppRates[2+ii] = abyRATE[ii]; + } - for (ii = 0; ii < MAX_BSS_NUM; ii++) { - if (pMgmt->sBSSList[ii].bActive == true) - break; - } + if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { + pMgmt->abyCurrSuppRates[1] = 8; + pMgmt->abyCurrExtSuppRates[1] = 4; + for (ii = 0; ii < 4; ii++) + pMgmt->abyCurrSuppRates[2+ii] = abyCCK_RATE[ii]; + for (ii = 4; ii < 8; ii++) + pMgmt->abyCurrSuppRates[2+ii] = abyOFDM_RATE[ii-4]; + for (ii = 0; ii < 4; ii++) + pMgmt->abyCurrExtSuppRates[2+ii] = abyOFDM_RATE[ii+4]; + } - if (ii == MAX_BSS_NUM) { - *pStatus = CMD_STATUS_RESOURCES; - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "BSS finding:BSS list is empty.\n"); - return; - } + // Disable Protect Mode + pDevice->bProtectMode = 0; + MACvDisableProtectMD(pDevice); - // memset(pMgmt->abyDesireBSSID, 0, WLAN_BSSID_LEN); - // Search known BSS list for prefer BSSID or SSID + pDevice->bBarkerPreambleMd = 0; + MACvDisableBarkerPreambleMd(pDevice); - pCurr = BSSpSearchBSSList(pDevice, - pMgmt->abyDesireBSSID, - pMgmt->abyDesireSSID, - pDevice->eConfigPHYMode - ); + // Kyle Test 2003.11.04 - if (pCurr == NULL){ - *pStatus = CMD_STATUS_RESOURCES; - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Scanning [%s] not found, disconnected !\n", pItemSSID->abySSID); - return; - } + // set HW beacon interval + if (pMgmt->wIBSSBeaconPeriod == 0) + pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI; + MACvWriteBeaconInterval(pDevice, pMgmt->wIBSSBeaconPeriod); - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP(BSS) finding:Found a AP(BSS)..\n"); + CARDbGetCurrentTSF(pDevice, &qwCurrTSF); + // clear TSF counter + CARDbClearCurrentTSF(pDevice); - if (WLAN_GET_CAP_INFO_ESS(cpu_to_le16(pCurr->wCapInfo))){ + // enable TSF counter + MACvRegBitsOn(pDevice,MAC_REG_TFTCTL,TFTCTL_TSFCNTREN); + // set Next TBTT + CARDvSetFirstNextTBTT(pDevice, pMgmt->wIBSSBeaconPeriod); - if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) { - /* - if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { - if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); - // encryption mode error - pMgmt->eCurrState = WMAC_STATE_IDLE; - return; - } - } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { - if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); - // encryption mode error - pMgmt->eCurrState = WMAC_STATE_IDLE; - return; - } - } -*/ - } - - //if(pDevice->bWPASuppWextEnabled == true) - Encyption_Rebuild(pDevice, pCurr); - - // Infrastructure BSS - s_vMgrSynchBSS(pDevice, - WMAC_MODE_ESS_STA, - pCurr, - pStatus - ); - - if (*pStatus == CMD_STATUS_SUCCESS){ - - // Adopt this BSS state vars in Mgmt Object - pMgmt->uCurrChannel = pCurr->uChannel; - - memset(pMgmt->abyCurrSuppRates, 0 , WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); - memset(pMgmt->abyCurrExtSuppRates, 0 , WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); - - if (pCurr->eNetworkTypeInUse == PHY_TYPE_11B) { - uRateLen = WLAN_RATES_MAXLEN_11B; - } - - pItemRates = (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates; - pItemExtRates = (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates; - - // Parse Support Rate IE - pItemRates->byElementID = WLAN_EID_SUPP_RATES; - pItemRates->len = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abySuppRates, - pItemRates, - uRateLen); - - // Parse Extension Support Rate IE - pItemExtRates->byElementID = WLAN_EID_EXTSUPP_RATES; - pItemExtRates->len = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abyExtSuppRates, - pItemExtRates, - uRateLen); - // Stuffing Rate IE - if ((pItemExtRates->len > 0) && (pItemRates->len < 8)) { - for (ii = 0; ii < (unsigned int) (8 - pItemRates->len); ) { - pItemRates->abyRates[pItemRates->len + ii] = - pItemExtRates->abyRates[ii]; - ii++; - if (pItemExtRates->len <= ii) - break; - } - pItemRates->len += (u8)ii; - if (pItemExtRates->len - ii > 0) { - pItemExtRates->len -= (u8)ii; - for (uu = 0; uu < pItemExtRates->len; uu ++) { - pItemExtRates->abyRates[uu] = pItemExtRates->abyRates[uu + ii]; - } - } else { - pItemExtRates->len = 0; - } - } - - RATEvParseMaxRate((void *)pDevice, pItemRates, pItemExtRates, true, - &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, - &byTopCCKBasicRate, &byTopOFDMBasicRate); - vUpdateIFS(pDevice); - // TODO: deal with if wCapInfo the privacy is on, but station WEP is off - // TODO: deal with if wCapInfo the PS-Pollable is on. - pMgmt->wCurrBeaconPeriod = pCurr->wBeaconInterval; - memset(pMgmt->abyCurrSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - memcpy(pMgmt->abyCurrBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); - memcpy(pMgmt->abyCurrSSID, pCurr->abySSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - - pMgmt->eCurrMode = WMAC_MODE_ESS_STA; - - pMgmt->eCurrState = WMAC_STATE_JOINTED; - // Adopt BSS state in Adapter Device Object - pDevice->op_mode = NL80211_IFTYPE_STATION; - memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); - - // Add current BSS to Candidate list - // This should only work for WPA2 BSS, and WPA2 BSS check must be done before. - if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { - bool bResult = bAdd_PMKID_Candidate((void *) pDevice, - pMgmt->abyCurrBSSID, - &pCurr->sRSNCapObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate: 1(%d)\n", bResult); - if (bResult == false) { - vFlush_PMKID_Candidate((void *) pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "vFlush_PMKID_Candidate: 4\n"); - bAdd_PMKID_Candidate((void *) pDevice, - pMgmt->abyCurrBSSID, - &pCurr->sRSNCapObj); - } - } - - // Preamble type auto-switch: if AP can receive short-preamble cap, - // we can turn on too. - if (WLAN_GET_CAP_INFO_SHORTPREAMBLE(pCurr->wCapInfo)) { - pDevice->byPreambleType = pDevice->byShortPreamble; - } - else { - pDevice->byPreambleType = 0; - } - // Change PreambleType must set RSPINF again - CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join ESS\n"); - - if (pCurr->eNetworkTypeInUse == PHY_TYPE_11G) { - - if ((pCurr->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION) != pDevice->bProtectMode) {//0000 0010 - pDevice->bProtectMode = (pCurr->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION); - if (pDevice->bProtectMode) { - MACvEnableProtectMD(pDevice); - } else { - MACvDisableProtectMD(pDevice); - } - vUpdateIFS(pDevice); - } - if ((pCurr->sERP.byERP & WLAN_EID_ERP_NONERP_PRESENT) != pDevice->bNonERPPresent) {//0000 0001 - pDevice->bNonERPPresent = (pCurr->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION); - } - if ((pCurr->sERP.byERP & WLAN_EID_ERP_BARKER_MODE) != pDevice->bBarkerPreambleMd) {//0000 0100 - pDevice->bBarkerPreambleMd = (pCurr->sERP.byERP & WLAN_EID_ERP_BARKER_MODE); - //BarkerPreambleMd has higher priority than shortPreamble bit in Cap - if (pDevice->bBarkerPreambleMd) { - MACvEnableBarkerPreambleMd(pDevice); - } else { - MACvDisableBarkerPreambleMd(pDevice); - } - } - } - //DBG_PRN_WLAN05(("wCapInfo: %X\n", pCurr->wCapInfo)); - if (WLAN_GET_CAP_INFO_SHORTSLOTTIME(pCurr->wCapInfo) != pDevice->bShortSlotTime) { - if (pDevice->byBBType == BB_TYPE_11A) { - bShortSlotTime = true; - } - else if (pDevice->byBBType == BB_TYPE_11B) { - bShortSlotTime = false; - } - else { - bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(pCurr->wCapInfo); - } - //DBG_PRN_WLAN05(("Set Short Slot Time: %d\n", pDevice->bShortSlotTime)); - if (bShortSlotTime != pDevice->bShortSlotTime) { - pDevice->bShortSlotTime = bShortSlotTime; - BBvSetShortSlotTime(pDevice); - vUpdateIFS(pDevice); - } - } - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"End of Join AP -- A/B/G Action\n"); - } - else { - pMgmt->eCurrState = WMAC_STATE_IDLE; - }; - - } - else { - // ad-hoc mode BSS - if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { - - if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { -/* - if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) { - // encryption mode error - pMgmt->eCurrState = WMAC_STATE_IDLE; - return; - } -*/ - } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { -/* - if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) { - // encryption mode error - pMgmt->eCurrState = WMAC_STATE_IDLE; - return; - } -*/ - } else { - // encryption mode error - pMgmt->eCurrState = WMAC_STATE_IDLE; - return; - } - } - - s_vMgrSynchBSS(pDevice, - WMAC_MODE_IBSS_STA, - pCurr, - pStatus - ); - - if (*pStatus == CMD_STATUS_SUCCESS){ - // Adopt this BSS state vars in Mgmt Object - // 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, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - WLAN_RATES_MAXLEN_11B); - // set basic rate - RATEvParseMaxRate((void *)pDevice, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - NULL, true, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, - &byTopCCKBasicRate, &byTopOFDMBasicRate); - vUpdateIFS(pDevice); - pMgmt->wCurrCapInfo = pCurr->wCapInfo; - pMgmt->wCurrBeaconPeriod = pCurr->wBeaconInterval; - memset(pMgmt->abyCurrSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN); - memcpy(pMgmt->abyCurrBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); - memcpy(pMgmt->abyCurrSSID, pCurr->abySSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN); -// pMgmt->wCurrATIMWindow = pCurr->wATIMWindow; - pMgmt->eCurrMode = WMAC_MODE_IBSS_STA; - pMgmt->eCurrState = WMAC_STATE_STARTED; - // Adopt BSS state in Adapter Device Object - pDevice->op_mode = NL80211_IFTYPE_ADHOC; - pDevice->bLinkPass = true; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); - memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join IBSS ok:%pM\n", - pMgmt->abyCurrBSSID); - // Preamble type auto-switch: if AP can receive short-preamble cap, - // and if registry setting is short preamble we can turn on too. - - if (WLAN_GET_CAP_INFO_SHORTPREAMBLE(pCurr->wCapInfo)) { - pDevice->byPreambleType = pDevice->byShortPreamble; - } - else { - pDevice->byPreambleType = 0; - } - // Change PreambleType must set RSPINF again - CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); - - // Prepare beacon - bMgrPrepareBeaconToSend((void *) pDevice, pMgmt); - } - else { - pMgmt->eCurrState = WMAC_STATE_IDLE; - }; - }; - return; + pMgmt->uIBSSChannel = pDevice->uChannel; + + if (pMgmt->uIBSSChannel == 0) + pMgmt->uIBSSChannel = DEFAULT_IBSS_CHANNEL; + + // set channel and clear NAV + CARDbSetMediaChannel(pDevice, pMgmt->uIBSSChannel); + pMgmt->uCurrChannel = pMgmt->uIBSSChannel; + + pDevice->byPreambleType = pDevice->byShortPreamble; + + // set basic rate + + RATEvParseMaxRate((void *)pDevice, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, true, + &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, + &byTopCCKBasicRate, &byTopOFDMBasicRate); + + if (pDevice->byBBType == BB_TYPE_11A) { + pDevice->bShortSlotTime = true; + } else { + pDevice->bShortSlotTime = false; + } + BBvSetShortSlotTime(pDevice); + // vUpdateIFS() use pDevice->bShortSlotTime as parameter so it must be called + // after setting ShortSlotTime. + // CARDvSetBSSMode call vUpdateIFS() + CARDvSetBSSMode(pDevice); + + if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { + MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_AP); + pMgmt->eCurrMode = WMAC_MODE_ESS_AP; + } + + if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) { + MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_ADHOC); + pMgmt->eCurrMode = WMAC_MODE_IBSS_STA; + } + + // Adopt pre-configured IBSS vars to current vars + pMgmt->eCurrState = WMAC_STATE_STARTED; + pMgmt->wCurrBeaconPeriod = pMgmt->wIBSSBeaconPeriod; + pMgmt->uCurrChannel = pMgmt->uIBSSChannel; + pMgmt->wCurrATIMWindow = pMgmt->wIBSSATIMWindow; + pDevice->uCurrRSSI = 0; + pDevice->byCurrSQ = 0; + + memcpy(pMgmt->abyDesireSSID,pMgmt->abyAdHocSSID, + ((PWLAN_IE_SSID)pMgmt->abyAdHocSSID)->len + WLAN_IEHDR_LEN); + + memset(pMgmt->abyCurrSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + memcpy(pMgmt->abyCurrSSID, + pMgmt->abyDesireSSID, + ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN + ); + + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + // AP mode BSSID = MAC addr + memcpy(pMgmt->abyCurrBSSID, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"AP beacon created BSSID:" + "%pM\n", pMgmt->abyCurrBSSID); + } + + if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + + // BSSID selected must be randomized as spec 11.1.3 + pMgmt->abyCurrBSSID[5] = (u8)(qwCurrTSF & 0x000000ff); + pMgmt->abyCurrBSSID[4] = (u8)((qwCurrTSF & 0x0000ff00) >> 8); + pMgmt->abyCurrBSSID[3] = (u8)((qwCurrTSF & 0x00ff0000) >> 16); + pMgmt->abyCurrBSSID[2] = (u8)((qwCurrTSF & 0x00000ff0) >> 4); + pMgmt->abyCurrBSSID[1] = (u8)((qwCurrTSF & 0x000ff000) >> 12); + pMgmt->abyCurrBSSID[0] = (u8)((qwCurrTSF & 0x0ff00000) >> 20); + pMgmt->abyCurrBSSID[5] ^= pMgmt->abyMACAddr[0]; + pMgmt->abyCurrBSSID[4] ^= pMgmt->abyMACAddr[1]; + pMgmt->abyCurrBSSID[3] ^= pMgmt->abyMACAddr[2]; + pMgmt->abyCurrBSSID[2] ^= pMgmt->abyMACAddr[3]; + pMgmt->abyCurrBSSID[1] ^= pMgmt->abyMACAddr[4]; + pMgmt->abyCurrBSSID[0] ^= pMgmt->abyMACAddr[5]; + 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); + } + + // set BSSID filter + MACvWriteBSSIDAddress(pDevice, pMgmt->abyCurrBSSID); + memcpy(pDevice->abyBSSID, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN); + + MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); + pDevice->byRxMode |= RCR_BSSID; + pMgmt->bCurrBSSIDFilterOn = true; + + // Set Capability Info + pMgmt->wCurrCapInfo = 0; + + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); + pMgmt->byDTIMPeriod = DEFAULT_DTIM_PERIOD; + pMgmt->byDTIMCount = pMgmt->byDTIMPeriod - 1; + pDevice->op_mode = NL80211_IFTYPE_AP; + } + + if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_IBSS(1); + pDevice->op_mode = NL80211_IFTYPE_ADHOC; + } + + if (pDevice->bEncryptionEnable) { + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1); + if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { + if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { + pMgmt->byCSSPK = KEY_CTL_CCMP; + pMgmt->byCSSGK = KEY_CTL_CCMP; + } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { + pMgmt->byCSSPK = KEY_CTL_TKIP; + pMgmt->byCSSGK = KEY_CTL_TKIP; + } else { + pMgmt->byCSSPK = KEY_CTL_NONE; + pMgmt->byCSSGK = KEY_CTL_WEP; + } + } else { + pMgmt->byCSSPK = KEY_CTL_WEP; + pMgmt->byCSSGK = KEY_CTL_WEP; + } + } + + pMgmt->byERPContext = 0; + + if (pDevice->byPreambleType == 1) { + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); + } else { + pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SHORTPREAMBLE(1)); + } + + pMgmt->eCurrState = WMAC_STATE_STARTED; + // Prepare beacon to send + if (bMgrPrepareBeaconToSend((void *) pDevice, pMgmt)) + *pStatus = CMD_STATUS_SUCCESS; + + return; +} + +/*+ + * + * Routine Description: + * Instructs wmac to join a bss using the supplied attributes. + * The arguments may the BSSID or SSID and the rest of the + * attributes are obtained from the scan result of known bss list. + * + * + * Return Value: + * None. + * + -*/ + +void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) +{ + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PKnownBSS pCurr = NULL; + int ii, uu; + PWLAN_IE_SUPP_RATES pItemRates = NULL; + PWLAN_IE_SUPP_RATES pItemExtRates = NULL; + PWLAN_IE_SSID pItemSSID; + u32 uRateLen = WLAN_RATES_MAXLEN; + u16 wMaxBasicRate = RATE_1M; + u16 wMaxSuppRate = RATE_1M; + u16 wSuppRate; + u8 byTopCCKBasicRate = RATE_1M; + u8 byTopOFDMBasicRate = RATE_1M; + u8 bShortSlotTime = false; + + for (ii = 0; ii < MAX_BSS_NUM; ii++) { + if (pMgmt->sBSSList[ii].bActive == true) + break; + } + + if (ii == MAX_BSS_NUM) { + *pStatus = CMD_STATUS_RESOURCES; + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "BSS finding:BSS list is empty.\n"); + return; + } + + // memset(pMgmt->abyDesireBSSID, 0, WLAN_BSSID_LEN); + // Search known BSS list for prefer BSSID or SSID + + pCurr = BSSpSearchBSSList(pDevice, + pMgmt->abyDesireBSSID, + pMgmt->abyDesireSSID, + pDevice->eConfigPHYMode + ); + + if (pCurr == NULL){ + *pStatus = CMD_STATUS_RESOURCES; + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Scanning [%s] not found, disconnected !\n", pItemSSID->abySSID); + return; + } + + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP(BSS) finding:Found a AP(BSS)..\n"); + + if (WLAN_GET_CAP_INFO_ESS(cpu_to_le16(pCurr->wCapInfo))){ + + if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) { + /* + if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { + if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); + // encryption mode error + pMgmt->eCurrState = WMAC_STATE_IDLE; + return; + } + } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { + if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); + // encryption mode error + pMgmt->eCurrState = WMAC_STATE_IDLE; + return; + } + } + */ + } + + //if(pDevice->bWPASuppWextEnabled == true) + Encyption_Rebuild(pDevice, pCurr); + + // Infrastructure BSS + s_vMgrSynchBSS(pDevice, + WMAC_MODE_ESS_STA, + pCurr, + pStatus + ); + + if (*pStatus == CMD_STATUS_SUCCESS){ + + // Adopt this BSS state vars in Mgmt Object + pMgmt->uCurrChannel = pCurr->uChannel; + + memset(pMgmt->abyCurrSuppRates, 0 , WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); + memset(pMgmt->abyCurrExtSuppRates, 0 , WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); + + if (pCurr->eNetworkTypeInUse == PHY_TYPE_11B) { + uRateLen = WLAN_RATES_MAXLEN_11B; + } + + pItemRates = (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates; + pItemExtRates = (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates; + + // Parse Support Rate IE + pItemRates->byElementID = WLAN_EID_SUPP_RATES; + pItemRates->len = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abySuppRates, + pItemRates, + uRateLen); + + // Parse Extension Support Rate IE + pItemExtRates->byElementID = WLAN_EID_EXTSUPP_RATES; + pItemExtRates->len = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abyExtSuppRates, + pItemExtRates, + uRateLen); + // Stuffing Rate IE + if ((pItemExtRates->len > 0) && (pItemRates->len < 8)) { + for (ii = 0; ii < (unsigned int) (8 - pItemRates->len); ) { + pItemRates->abyRates[pItemRates->len + ii] = + pItemExtRates->abyRates[ii]; + ii++; + if (pItemExtRates->len <= ii) + break; + } + pItemRates->len += (u8)ii; + if (pItemExtRates->len - ii > 0) { + pItemExtRates->len -= (u8)ii; + for (uu = 0; uu < pItemExtRates->len; uu ++) { + pItemExtRates->abyRates[uu] = pItemExtRates->abyRates[uu + ii]; + } + } else { + pItemExtRates->len = 0; + } + } + + RATEvParseMaxRate((void *)pDevice, pItemRates, pItemExtRates, true, + &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, + &byTopCCKBasicRate, &byTopOFDMBasicRate); + vUpdateIFS(pDevice); + // TODO: deal with if wCapInfo the privacy is on, but station WEP is off + // TODO: deal with if wCapInfo the PS-Pollable is on. + pMgmt->wCurrBeaconPeriod = pCurr->wBeaconInterval; + memset(pMgmt->abyCurrSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + memcpy(pMgmt->abyCurrBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); + memcpy(pMgmt->abyCurrSSID, pCurr->abySSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + + pMgmt->eCurrMode = WMAC_MODE_ESS_STA; + + pMgmt->eCurrState = WMAC_STATE_JOINTED; + // Adopt BSS state in Adapter Device Object + pDevice->op_mode = NL80211_IFTYPE_STATION; + memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); + + // Add current BSS to Candidate list + // This should only work for WPA2 BSS, and WPA2 BSS check must be done before. + if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { + bool bResult = bAdd_PMKID_Candidate((void *) pDevice, + pMgmt->abyCurrBSSID, + &pCurr->sRSNCapObj); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate: 1(%d)\n", bResult); + if (bResult == false) { + vFlush_PMKID_Candidate((void *) pDevice); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "vFlush_PMKID_Candidate: 4\n"); + bAdd_PMKID_Candidate((void *) pDevice, + pMgmt->abyCurrBSSID, + &pCurr->sRSNCapObj); + } + } + + // Preamble type auto-switch: if AP can receive short-preamble cap, + // we can turn on too. + if (WLAN_GET_CAP_INFO_SHORTPREAMBLE(pCurr->wCapInfo)) { + pDevice->byPreambleType = pDevice->byShortPreamble; + } + else { + pDevice->byPreambleType = 0; + } + // Change PreambleType must set RSPINF again + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join ESS\n"); + + if (pCurr->eNetworkTypeInUse == PHY_TYPE_11G) { + + if ((pCurr->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION) != pDevice->bProtectMode) {//0000 0010 + pDevice->bProtectMode = (pCurr->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION); + if (pDevice->bProtectMode) { + MACvEnableProtectMD(pDevice); + } else { + MACvDisableProtectMD(pDevice); + } + vUpdateIFS(pDevice); + } + if ((pCurr->sERP.byERP & WLAN_EID_ERP_NONERP_PRESENT) != pDevice->bNonERPPresent) {//0000 0001 + pDevice->bNonERPPresent = (pCurr->sERP.byERP & WLAN_EID_ERP_USE_PROTECTION); + } + if ((pCurr->sERP.byERP & WLAN_EID_ERP_BARKER_MODE) != pDevice->bBarkerPreambleMd) {//0000 0100 + pDevice->bBarkerPreambleMd = (pCurr->sERP.byERP & WLAN_EID_ERP_BARKER_MODE); + //BarkerPreambleMd has higher priority than shortPreamble bit in Cap + if (pDevice->bBarkerPreambleMd) { + MACvEnableBarkerPreambleMd(pDevice); + } else { + MACvDisableBarkerPreambleMd(pDevice); + } + } + } + //DBG_PRN_WLAN05(("wCapInfo: %X\n", pCurr->wCapInfo)); + if (WLAN_GET_CAP_INFO_SHORTSLOTTIME(pCurr->wCapInfo) != pDevice->bShortSlotTime) { + if (pDevice->byBBType == BB_TYPE_11A) { + bShortSlotTime = true; + } + else if (pDevice->byBBType == BB_TYPE_11B) { + bShortSlotTime = false; + } + else { + bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(pCurr->wCapInfo); + } + //DBG_PRN_WLAN05(("Set Short Slot Time: %d\n", pDevice->bShortSlotTime)); + if (bShortSlotTime != pDevice->bShortSlotTime) { + pDevice->bShortSlotTime = bShortSlotTime; + BBvSetShortSlotTime(pDevice); + vUpdateIFS(pDevice); + } + } + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"End of Join AP -- A/B/G Action\n"); + } + else { + pMgmt->eCurrState = WMAC_STATE_IDLE; + }; + + } + else { + // ad-hoc mode BSS + if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { + + if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { + /* + if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) { + // encryption mode error + pMgmt->eCurrState = WMAC_STATE_IDLE; + return; + } + */ + } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { + /* + if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) { + // encryption mode error + pMgmt->eCurrState = WMAC_STATE_IDLE; + return; + } + */ + } else { + // encryption mode error + pMgmt->eCurrState = WMAC_STATE_IDLE; + return; + } + } + + s_vMgrSynchBSS(pDevice, + WMAC_MODE_IBSS_STA, + pCurr, + pStatus + ); + + if (*pStatus == CMD_STATUS_SUCCESS){ + // Adopt this BSS state vars in Mgmt Object + // 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, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + WLAN_RATES_MAXLEN_11B); + // set basic rate + RATEvParseMaxRate((void *)pDevice, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + NULL, true, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, + &byTopCCKBasicRate, &byTopOFDMBasicRate); + vUpdateIFS(pDevice); + pMgmt->wCurrCapInfo = pCurr->wCapInfo; + pMgmt->wCurrBeaconPeriod = pCurr->wBeaconInterval; + memset(pMgmt->abyCurrSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN); + memcpy(pMgmt->abyCurrBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); + memcpy(pMgmt->abyCurrSSID, pCurr->abySSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN); + // pMgmt->wCurrATIMWindow = pCurr->wATIMWindow; + pMgmt->eCurrMode = WMAC_MODE_IBSS_STA; + pMgmt->eCurrState = WMAC_STATE_STARTED; + // Adopt BSS state in Adapter Device Object + pDevice->op_mode = NL80211_IFTYPE_ADHOC; + pDevice->bLinkPass = true; + ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); + memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join IBSS ok:%pM\n", + pMgmt->abyCurrBSSID); + // Preamble type auto-switch: if AP can receive short-preamble cap, + // and if registry setting is short preamble we can turn on too. + + if (WLAN_GET_CAP_INFO_SHORTPREAMBLE(pCurr->wCapInfo)) { + pDevice->byPreambleType = pDevice->byShortPreamble; + } + else { + pDevice->byPreambleType = 0; + } + // Change PreambleType must set RSPINF again + CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); + + // Prepare beacon + bMgrPrepareBeaconToSend((void *) pDevice, pMgmt); + } + else { + pMgmt->eCurrState = WMAC_STATE_IDLE; + }; + }; + return; } /*+ @@ -2538,191 +2538,191 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) * Return Value: * PCM_STATUS * --*/ + -*/ static void s_vMgrSynchBSS(struct vnt_private *pDevice, u32 uBSSMode, - PKnownBSS pCurr, PCMD_STATUS pStatus) + PKnownBSS pCurr, PCMD_STATUS pStatus) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; u8 abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, - 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; - /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M*/ + 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; + /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M*/ u8 abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, - 4, 0x0C, 0x12, 0x18, 0x60}; - /* 6M, 9M, 12M, 48M*/ + 4, 0x0C, 0x12, 0x18, 0x60}; + /* 6M, 9M, 12M, 48M*/ u8 abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, - 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; + 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; u8 abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, - 4, 0x02, 0x04, 0x0B, 0x16}; + 4, 0x02, 0x04, 0x0B, 0x16}; - *pStatus = CMD_STATUS_FAILURE; + *pStatus = CMD_STATUS_FAILURE; - if (s_bCipherMatch(pCurr, - pDevice->eEncryptionStatus, - &(pMgmt->byCSSPK), - &(pMgmt->byCSSGK)) == false) { - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "s_bCipherMatch Fail .......\n"); - return; - } + if (s_bCipherMatch(pCurr, + pDevice->eEncryptionStatus, + &(pMgmt->byCSSPK), + &(pMgmt->byCSSGK)) == false) { + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "s_bCipherMatch Fail .......\n"); + return; + } - pMgmt->pCurrBSS = pCurr; + pMgmt->pCurrBSS = pCurr; - // if previous mode is IBSS. - if(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - MACvRegBitsOff(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); - } + // if previous mode is IBSS. + if(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + MACvRegBitsOff(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); + } - // Init the BSS informations - pDevice->bCCK = true; - pDevice->bProtectMode = false; - MACvDisableProtectMD(pDevice); - pDevice->bBarkerPreambleMd = false; - MACvDisableBarkerPreambleMd(pDevice); - pDevice->bNonERPPresent = false; - pDevice->byPreambleType = 0; - pDevice->wBasicRate = 0; - // Set Basic Rate - CARDbAddBasicRate((void *)pDevice, RATE_1M); + // Init the BSS informations + pDevice->bCCK = true; + pDevice->bProtectMode = false; + MACvDisableProtectMD(pDevice); + pDevice->bBarkerPreambleMd = false; + MACvDisableBarkerPreambleMd(pDevice); + pDevice->bNonERPPresent = false; + pDevice->byPreambleType = 0; + pDevice->wBasicRate = 0; + // Set Basic Rate + CARDbAddBasicRate((void *)pDevice, RATE_1M); - // calculate TSF offset - // TSF Offset = Received Timestamp TSF - Marked Local's TSF - CARDvAdjustTSF(pDevice, pCurr->byRxRate, pCurr->qwBSSTimestamp, pCurr->qwLocalTSF); + // calculate TSF offset + // TSF Offset = Received Timestamp TSF - Marked Local's TSF + CARDvAdjustTSF(pDevice, pCurr->byRxRate, pCurr->qwBSSTimestamp, pCurr->qwLocalTSF); - // set HW beacon interval - MACvWriteBeaconInterval(pDevice, pCurr->wBeaconInterval); + // set HW beacon interval + MACvWriteBeaconInterval(pDevice, pCurr->wBeaconInterval); - // set Next TBTT - // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval - CARDvSetFirstNextTBTT(pDevice, pCurr->wBeaconInterval); + // set Next TBTT + // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval + CARDvSetFirstNextTBTT(pDevice, pCurr->wBeaconInterval); - // set BSSID - MACvWriteBSSIDAddress(pDevice, pCurr->abyBSSID); + // set BSSID + MACvWriteBSSIDAddress(pDevice, pCurr->abyBSSID); - memcpy(pMgmt->abyCurrBSSID, pCurr->abyBSSID, 6); + memcpy(pMgmt->abyCurrBSSID, pCurr->abyBSSID, 6); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:set CurrBSSID address = " - "%pM\n", pMgmt->abyCurrBSSID); - - if (pCurr->eNetworkTypeInUse == PHY_TYPE_11A) { - if ((pDevice->eConfigPHYMode == PHY_TYPE_11A) || - (pDevice->eConfigPHYMode == PHY_TYPE_AUTO)) { - pDevice->byBBType = BB_TYPE_11A; - pMgmt->eCurrentPHYMode = PHY_TYPE_11A; - pDevice->bShortSlotTime = true; - BBvSetShortSlotTime(pDevice); - CARDvSetBSSMode(pDevice); - } else { - return; - } - } else if (pCurr->eNetworkTypeInUse == PHY_TYPE_11B) { - if ((pDevice->eConfigPHYMode == PHY_TYPE_11B) || - (pDevice->eConfigPHYMode == PHY_TYPE_11G) || - (pDevice->eConfigPHYMode == PHY_TYPE_AUTO)) { - pDevice->byBBType = BB_TYPE_11B; - pMgmt->eCurrentPHYMode = PHY_TYPE_11B; - pDevice->bShortSlotTime = false; - BBvSetShortSlotTime(pDevice); - CARDvSetBSSMode(pDevice); - } else { - return; - } - } else { - if ((pDevice->eConfigPHYMode == PHY_TYPE_11G) || - (pDevice->eConfigPHYMode == PHY_TYPE_AUTO)) { - pDevice->byBBType = BB_TYPE_11G; - pMgmt->eCurrentPHYMode = PHY_TYPE_11G; - pDevice->bShortSlotTime = true; - BBvSetShortSlotTime(pDevice); - CARDvSetBSSMode(pDevice); - } else if (pDevice->eConfigPHYMode == PHY_TYPE_11B) { - pDevice->byBBType = BB_TYPE_11B; - pDevice->bShortSlotTime = false; - BBvSetShortSlotTime(pDevice); - CARDvSetBSSMode(pDevice); - } else { - return; - } - } - - if (uBSSMode == WMAC_MODE_ESS_STA) { - MACvRegBitsOff(pDevice, MAC_REG_HOSTCR, HOSTCR_ADHOC); - MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); - pDevice->byRxMode |= RCR_BSSID; - pMgmt->bCurrBSSIDFilterOn = true; - } - - // set channel and clear NAV - CARDbSetMediaChannel(pDevice, pCurr->uChannel); - pMgmt->uCurrChannel = pCurr->uChannel; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel); - - if ((pDevice->bUpdateBBVGA) && - (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0])) { - pDevice->byBBVGACurrent = pDevice->abyBBVGA[0]; - BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); - BBvSetShortSlotTime(pDevice); - } - // - // Notes: - // 1. In Ad-hoc mode : check if received others beacon as jointed indication, - // otherwise we will start own IBSS. - // 2. In Infra mode : Supposed we already synchronized with AP right now. - - if (uBSSMode == WMAC_MODE_IBSS_STA) { - MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_ADHOC); - MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); - pDevice->byRxMode |= RCR_BSSID; - pMgmt->bCurrBSSIDFilterOn = true; - } - - if (pDevice->byBBType == BB_TYPE_11A) { - memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesA[0], sizeof(abyCurrSuppRatesA)); - pMgmt->abyCurrExtSuppRates[1] = 0; - } else if (pDevice->byBBType == BB_TYPE_11B) { - memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesB[0], sizeof(abyCurrSuppRatesB)); - pMgmt->abyCurrExtSuppRates[1] = 0; - } else { - memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesG[0], sizeof(abyCurrSuppRatesG)); - memcpy(pMgmt->abyCurrExtSuppRates, &abyCurrExtSuppRatesG[0], sizeof(abyCurrExtSuppRatesG)); - } - pMgmt->byERPContext = pCurr->sERP.byERP; - - *pStatus = CMD_STATUS_SUCCESS; - - return; + "%pM\n", pMgmt->abyCurrBSSID); + + if (pCurr->eNetworkTypeInUse == PHY_TYPE_11A) { + if ((pDevice->eConfigPHYMode == PHY_TYPE_11A) || + (pDevice->eConfigPHYMode == PHY_TYPE_AUTO)) { + pDevice->byBBType = BB_TYPE_11A; + pMgmt->eCurrentPHYMode = PHY_TYPE_11A; + pDevice->bShortSlotTime = true; + BBvSetShortSlotTime(pDevice); + CARDvSetBSSMode(pDevice); + } else { + return; + } + } else if (pCurr->eNetworkTypeInUse == PHY_TYPE_11B) { + if ((pDevice->eConfigPHYMode == PHY_TYPE_11B) || + (pDevice->eConfigPHYMode == PHY_TYPE_11G) || + (pDevice->eConfigPHYMode == PHY_TYPE_AUTO)) { + pDevice->byBBType = BB_TYPE_11B; + pMgmt->eCurrentPHYMode = PHY_TYPE_11B; + pDevice->bShortSlotTime = false; + BBvSetShortSlotTime(pDevice); + CARDvSetBSSMode(pDevice); + } else { + return; + } + } else { + if ((pDevice->eConfigPHYMode == PHY_TYPE_11G) || + (pDevice->eConfigPHYMode == PHY_TYPE_AUTO)) { + pDevice->byBBType = BB_TYPE_11G; + pMgmt->eCurrentPHYMode = PHY_TYPE_11G; + pDevice->bShortSlotTime = true; + BBvSetShortSlotTime(pDevice); + CARDvSetBSSMode(pDevice); + } else if (pDevice->eConfigPHYMode == PHY_TYPE_11B) { + pDevice->byBBType = BB_TYPE_11B; + pDevice->bShortSlotTime = false; + BBvSetShortSlotTime(pDevice); + CARDvSetBSSMode(pDevice); + } else { + return; + } + } + + if (uBSSMode == WMAC_MODE_ESS_STA) { + MACvRegBitsOff(pDevice, MAC_REG_HOSTCR, HOSTCR_ADHOC); + MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); + pDevice->byRxMode |= RCR_BSSID; + pMgmt->bCurrBSSIDFilterOn = true; + } + + // set channel and clear NAV + CARDbSetMediaChannel(pDevice, pCurr->uChannel); + pMgmt->uCurrChannel = pCurr->uChannel; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel); + + if ((pDevice->bUpdateBBVGA) && + (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0])) { + pDevice->byBBVGACurrent = pDevice->abyBBVGA[0]; + BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); + BBvSetShortSlotTime(pDevice); + } + // + // Notes: + // 1. In Ad-hoc mode : check if received others beacon as jointed indication, + // otherwise we will start own IBSS. + // 2. In Infra mode : Supposed we already synchronized with AP right now. + + if (uBSSMode == WMAC_MODE_IBSS_STA) { + MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_ADHOC); + MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); + pDevice->byRxMode |= RCR_BSSID; + pMgmt->bCurrBSSIDFilterOn = true; + } + + if (pDevice->byBBType == BB_TYPE_11A) { + memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesA[0], sizeof(abyCurrSuppRatesA)); + pMgmt->abyCurrExtSuppRates[1] = 0; + } else if (pDevice->byBBType == BB_TYPE_11B) { + memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesB[0], sizeof(abyCurrSuppRatesB)); + pMgmt->abyCurrExtSuppRates[1] = 0; + } else { + memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesG[0], sizeof(abyCurrSuppRatesG)); + memcpy(pMgmt->abyCurrExtSuppRates, &abyCurrExtSuppRatesG[0], sizeof(abyCurrExtSuppRatesG)); + } + pMgmt->byERPContext = pCurr->sERP.byERP; + + *pStatus = CMD_STATUS_SUCCESS; + + return; }; static void Encyption_Rebuild(struct vnt_private *pDevice, PKnownBSS pCurr) - { +{ struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { + (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { if (pCurr->bWPAValid == true) { /*WPA-PSK */ - pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; - if(pCurr->abyPKType[0] == WPA_TKIP) { - pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP - PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-TKIP]\n"); - } - else if(pCurr->abyPKType[0] == WPA_AESCCMP) { - pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES - PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n"); - } - } - else if(pCurr->bWPA2Valid == true) { //WPA2-PSK - pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; - if(pCurr->abyCSSPK[0] == WLAN_11i_CSS_TKIP) { - pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP - PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-TKIP]\n"); - } - else if(pCurr->abyCSSPK[0] == WLAN_11i_CSS_CCMP) { - pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES - PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-AES]\n"); - } - } - } - // } - return; - } + pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; + if(pCurr->abyPKType[0] == WPA_TKIP) { + pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP + PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-TKIP]\n"); + } + else if(pCurr->abyPKType[0] == WPA_AESCCMP) { + pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES + PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n"); + } + } + else if(pCurr->bWPA2Valid == true) { //WPA2-PSK + pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; + if(pCurr->abyCSSPK[0] == WLAN_11i_CSS_TKIP) { + pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP + PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-TKIP]\n"); + } + else if(pCurr->abyCSSPK[0] == WLAN_11i_CSS_CCMP) { + pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES + PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-AES]\n"); + } + } + } + // } +return; +} /*+ * @@ -2733,7 +2733,7 @@ static void Encyption_Rebuild(struct vnt_private *pDevice, PKnownBSS pCurr) * Return Value: * void * --*/ + -*/ static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) { @@ -2745,50 +2745,50 @@ 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]; - if (!ii) { - // Mask out the broadcast bit which is indicated separately. - bMulticast = (byMap & byMask[0]) != 0; - if(bMulticast) { - pMgmt->sNodeDBTable[0].bRxPSPoll = true; - } - byMap = 0; - } - if (byMap) { - if (!bStartFound) { - bStartFound = true; - wStartIndex = (u16)ii; - } - wEndIndex = (u16)ii; - } - } - - // Round start index down to nearest even number - wStartIndex &= ~BIT0; - - // Round end index up to nearest even number - wEndIndex = ((wEndIndex + 1) & ~BIT0); - - // Size of element payload - - pTIM->len = 3 + (wEndIndex - wStartIndex) + 1; - - // Fill in the Fixed parts of the TIM - pTIM->byDTIMCount = pMgmt->byDTIMCount; - pTIM->byDTIMPeriod = pMgmt->byDTIMPeriod; - pTIM->byBitMapCtl = (bMulticast ? TIM_MULTICAST_MASK : 0) | - (((wStartIndex >> 1) << 1) & TIM_BITMAPOFFSET_MASK); - - // Append variable part of TIM - - for (ii = wStartIndex, jj =0 ; ii <= wEndIndex; ii++, jj++) { - pTIM->byVirtBitMap[jj] = pMgmt->abyPSTxMap[ii]; - } - - // Aid = 0 don't used. - pTIM->byVirtBitMap[0] &= ~BIT0; + // Find size of partial virtual bitmap + for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { + byMap = pMgmt->abyPSTxMap[ii]; + if (!ii) { + // Mask out the broadcast bit which is indicated separately. + bMulticast = (byMap & byMask[0]) != 0; + if(bMulticast) { + pMgmt->sNodeDBTable[0].bRxPSPoll = true; + } + byMap = 0; + } + if (byMap) { + if (!bStartFound) { + bStartFound = true; + wStartIndex = (u16)ii; + } + wEndIndex = (u16)ii; + } + } + + // Round start index down to nearest even number + wStartIndex &= ~BIT0; + + // Round end index up to nearest even number + wEndIndex = ((wEndIndex + 1) & ~BIT0); + + // Size of element payload + + pTIM->len = 3 + (wEndIndex - wStartIndex) + 1; + + // Fill in the Fixed parts of the TIM + pTIM->byDTIMCount = pMgmt->byDTIMCount; + pTIM->byDTIMPeriod = pMgmt->byDTIMPeriod; + pTIM->byBitMapCtl = (bMulticast ? TIM_MULTICAST_MASK : 0) | + (((wStartIndex >> 1) << 1) & TIM_BITMAPOFFSET_MASK); + + // Append variable part of TIM + + for (ii = wStartIndex, jj =0 ; ii <= wEndIndex; ii++, jj++) { + pTIM->byVirtBitMap[jj] = pMgmt->abyPSTxMap[ii]; + } + + // Aid = 0 don't used. + pTIM->byVirtBitMap[0] &= ~BIT0; } /*+ @@ -2800,13 +2800,13 @@ static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) * Return Value: * PTR to frame; or NULL on allocation failure * --*/ + -*/ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, - u32 uCurrChannel, u16 wCurrATIMWinodw, PWLAN_IE_SSID pCurrSSID, - u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates) + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, PWLAN_IE_SSID pCurrSSID, + u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_BEACON sFrame; @@ -2815,139 +2815,139 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, /* prepare beacon frame */ pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_BEACON_FR_MAXLEN); + + WLAN_BEACON_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - // Setup the sFrame structure. - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_BEACON_FR_MAXLEN; - vMgrEncodeBeacon(&sFrame); - // Setup the header - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_BEACON) - )); - - if (pDevice->bEnablePSMode) { - sFrame.pHdr->sA3.wFrameCtl |= cpu_to_le16((u16)WLAN_SET_FC_PWRMGT(1)); - } - - memcpy( sFrame.pHdr->sA3.abyAddr1, abyBroadcastAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pCurrBSSID, WLAN_BSSID_LEN); - *sFrame.pwBeaconInterval = cpu_to_le16(wCurrBeaconPeriod); - *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); - // Copy SSID - sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); - sFrame.len += ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSSID, - pCurrSSID, - ((PWLAN_IE_SSID)pCurrSSID)->len + WLAN_IEHDR_LEN - ); - // Copy the rate set - sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSuppRates, - pCurrSuppRates, - ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN - ); - // DS parameter - if (pDevice->byBBType != BB_TYPE_11A) { - sFrame.pDSParms = (PWLAN_IE_DS_PARMS)(sFrame.pBuf + sFrame.len); - sFrame.len += (1) + WLAN_IEHDR_LEN; - sFrame.pDSParms->byElementID = WLAN_EID_DS_PARMS; - sFrame.pDSParms->len = 1; - sFrame.pDSParms->byCurrChannel = (u8)uCurrChannel; - } - // TIM field - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - sFrame.pTIM = (PWLAN_IE_TIM)(sFrame.pBuf + sFrame.len); - sFrame.pTIM->byElementID = WLAN_EID_TIM; - s_vMgrFormatTIM(pMgmt, sFrame.pTIM); - sFrame.len += (WLAN_IEHDR_LEN + sFrame.pTIM->len); - } - - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - - // IBSS parameter - sFrame.pIBSSParms = (PWLAN_IE_IBSS_PARMS)(sFrame.pBuf + sFrame.len); - sFrame.len += (2) + WLAN_IEHDR_LEN; - sFrame.pIBSSParms->byElementID = WLAN_EID_IBSS_PARMS; - sFrame.pIBSSParms->len = 2; - sFrame.pIBSSParms->wATIMWindow = wCurrATIMWinodw; - if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { - /* RSN parameter */ - sFrame.pRSNWPA = (PWLAN_IE_RSN_EXT)(sFrame.pBuf + sFrame.len); - sFrame.pRSNWPA->byElementID = WLAN_EID_RSN_WPA; - sFrame.pRSNWPA->len = 12; - sFrame.pRSNWPA->abyOUI[0] = 0x00; - sFrame.pRSNWPA->abyOUI[1] = 0x50; - sFrame.pRSNWPA->abyOUI[2] = 0xf2; - sFrame.pRSNWPA->abyOUI[3] = 0x01; - sFrame.pRSNWPA->wVersion = 1; - sFrame.pRSNWPA->abyMulticast[0] = 0x00; - sFrame.pRSNWPA->abyMulticast[1] = 0x50; - sFrame.pRSNWPA->abyMulticast[2] = 0xf2; - if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) - sFrame.pRSNWPA->abyMulticast[3] = 0x04;//AES - else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) - sFrame.pRSNWPA->abyMulticast[3] = 0x02;//TKIP - else if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) - sFrame.pRSNWPA->abyMulticast[3] = 0x01;//WEP40 - else - sFrame.pRSNWPA->abyMulticast[3] = 0x00;//NONE - - // Pairwise Key Cipher Suite - sFrame.pRSNWPA->wPKCount = 0; - // Auth Key Management Suite - *((u16 *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len))=0; - sFrame.pRSNWPA->len +=2; - - // RSN Capabilites - *((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; - sFrame.pERP->byElementID = WLAN_EID_ERP; - sFrame.pERP->len = 1; - sFrame.pERP->byContext = 0; - if (pDevice->bProtectMode == true) - sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; - if (pDevice->bNonERPPresent == true) - sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; - if (pDevice->bBarkerPreambleMd == true) - sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; - } - if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { - sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pExtSuppRates, - pCurrExtSuppRates, - ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN - ); - } - // hostapd wpa/wpa2 IE - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { - if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { - if (pMgmt->wWPAIELen != 0) { - sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); - memcpy(sFrame.pRSN, pMgmt->abyWPAIE, pMgmt->wWPAIELen); - sFrame.len += pMgmt->wWPAIELen; - } - } - } - - /* Adjust the length fields */ - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - - return pTxPacket; + + sizeof(struct vnt_tx_mgmt)); + // Setup the sFrame structure. + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_BEACON_FR_MAXLEN; + vMgrEncodeBeacon(&sFrame); + // Setup the header + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_BEACON) + )); + + if (pDevice->bEnablePSMode) { + sFrame.pHdr->sA3.wFrameCtl |= cpu_to_le16((u16)WLAN_SET_FC_PWRMGT(1)); + } + + memcpy( sFrame.pHdr->sA3.abyAddr1, abyBroadcastAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pCurrBSSID, WLAN_BSSID_LEN); + *sFrame.pwBeaconInterval = cpu_to_le16(wCurrBeaconPeriod); + *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); + // Copy SSID + sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); + sFrame.len += ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSSID, + pCurrSSID, + ((PWLAN_IE_SSID)pCurrSSID)->len + WLAN_IEHDR_LEN + ); + // Copy the rate set + sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSuppRates, + pCurrSuppRates, + ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN + ); + // DS parameter + if (pDevice->byBBType != BB_TYPE_11A) { + sFrame.pDSParms = (PWLAN_IE_DS_PARMS)(sFrame.pBuf + sFrame.len); + sFrame.len += (1) + WLAN_IEHDR_LEN; + sFrame.pDSParms->byElementID = WLAN_EID_DS_PARMS; + sFrame.pDSParms->len = 1; + sFrame.pDSParms->byCurrChannel = (u8)uCurrChannel; + } + // TIM field + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + sFrame.pTIM = (PWLAN_IE_TIM)(sFrame.pBuf + sFrame.len); + sFrame.pTIM->byElementID = WLAN_EID_TIM; + s_vMgrFormatTIM(pMgmt, sFrame.pTIM); + sFrame.len += (WLAN_IEHDR_LEN + sFrame.pTIM->len); + } + + if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + + // IBSS parameter + sFrame.pIBSSParms = (PWLAN_IE_IBSS_PARMS)(sFrame.pBuf + sFrame.len); + sFrame.len += (2) + WLAN_IEHDR_LEN; + sFrame.pIBSSParms->byElementID = WLAN_EID_IBSS_PARMS; + sFrame.pIBSSParms->len = 2; + sFrame.pIBSSParms->wATIMWindow = wCurrATIMWinodw; + if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { + /* RSN parameter */ + sFrame.pRSNWPA = (PWLAN_IE_RSN_EXT)(sFrame.pBuf + sFrame.len); + sFrame.pRSNWPA->byElementID = WLAN_EID_RSN_WPA; + sFrame.pRSNWPA->len = 12; + sFrame.pRSNWPA->abyOUI[0] = 0x00; + sFrame.pRSNWPA->abyOUI[1] = 0x50; + sFrame.pRSNWPA->abyOUI[2] = 0xf2; + sFrame.pRSNWPA->abyOUI[3] = 0x01; + sFrame.pRSNWPA->wVersion = 1; + sFrame.pRSNWPA->abyMulticast[0] = 0x00; + sFrame.pRSNWPA->abyMulticast[1] = 0x50; + sFrame.pRSNWPA->abyMulticast[2] = 0xf2; + if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) + sFrame.pRSNWPA->abyMulticast[3] = 0x04;//AES + else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) + sFrame.pRSNWPA->abyMulticast[3] = 0x02;//TKIP + else if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) + sFrame.pRSNWPA->abyMulticast[3] = 0x01;//WEP40 + else + sFrame.pRSNWPA->abyMulticast[3] = 0x00;//NONE + + // Pairwise Key Cipher Suite + sFrame.pRSNWPA->wPKCount = 0; + // Auth Key Management Suite + *((u16 *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len))=0; + sFrame.pRSNWPA->len +=2; + + // RSN Capabilites + *((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; + sFrame.pERP->byElementID = WLAN_EID_ERP; + sFrame.pERP->len = 1; + sFrame.pERP->byContext = 0; + if (pDevice->bProtectMode == true) + sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; + if (pDevice->bNonERPPresent == true) + sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; + if (pDevice->bBarkerPreambleMd == true) + sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; + } + if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { + sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pExtSuppRates, + pCurrExtSuppRates, + ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN + ); + } + // hostapd wpa/wpa2 IE + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { + if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { + if (pMgmt->wWPAIELen != 0) { + sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); + memcpy(sFrame.pRSN, pMgmt->abyWPAIE, pMgmt->wWPAIELen); + sFrame.len += pMgmt->wWPAIELen; + } + } + } + + /* Adjust the length fields */ + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + + return pTxPacket; } /*+ @@ -2959,115 +2959,115 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, * Return Value: * PTR to frame; or NULL on allocation failure * --*/ + -*/ static struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, - u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, - PWLAN_IE_SSID pCurrSSID, u8 *pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates, u8 byPHYType) + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, + PWLAN_IE_SSID pCurrSSID, u8 *pCurrBSSID, + PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates, u8 byPHYType) { 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); + + WLAN_PROBERESP_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - // Setup the sFrame structure. - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_PROBERESP_FR_MAXLEN; - vMgrEncodeProbeResponse(&sFrame); - // Setup the header - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBERESP) - )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pDstAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pCurrBSSID, WLAN_BSSID_LEN); - *sFrame.pwBeaconInterval = cpu_to_le16(wCurrBeaconPeriod); - *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); - - if (byPHYType == BB_TYPE_11B) { - *sFrame.pwCapInfo &= cpu_to_le16((u16)~(WLAN_SET_CAP_INFO_SHORTSLOTTIME(1))); - } - - // Copy SSID - sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); - sFrame.len += ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSSID, - pCurrSSID, - ((PWLAN_IE_SSID)pCurrSSID)->len + WLAN_IEHDR_LEN - ); - // Copy the rate set - sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - - sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSuppRates, - pCurrSuppRates, - ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN - ); - - // DS parameter - if (pDevice->byBBType != BB_TYPE_11A) { - sFrame.pDSParms = (PWLAN_IE_DS_PARMS)(sFrame.pBuf + sFrame.len); - sFrame.len += (1) + WLAN_IEHDR_LEN; - sFrame.pDSParms->byElementID = WLAN_EID_DS_PARMS; - sFrame.pDSParms->len = 1; - sFrame.pDSParms->byCurrChannel = (u8)uCurrChannel; - } - - if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) { - // IBSS parameter - sFrame.pIBSSParms = (PWLAN_IE_IBSS_PARMS)(sFrame.pBuf + sFrame.len); - sFrame.len += (2) + WLAN_IEHDR_LEN; - sFrame.pIBSSParms->byElementID = WLAN_EID_IBSS_PARMS; - sFrame.pIBSSParms->len = 2; - sFrame.pIBSSParms->wATIMWindow = 0; - } - if (pDevice->byBBType == BB_TYPE_11G) { - sFrame.pERP = (PWLAN_IE_ERP)(sFrame.pBuf + sFrame.len); - sFrame.len += 1 + WLAN_IEHDR_LEN; - sFrame.pERP->byElementID = WLAN_EID_ERP; - sFrame.pERP->len = 1; - sFrame.pERP->byContext = 0; - if (pDevice->bProtectMode == true) - sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; - if (pDevice->bNonERPPresent == true) - sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; - if (pDevice->bBarkerPreambleMd == true) - sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; - } - - if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { - sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pExtSuppRates, - pCurrExtSuppRates, - ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN - ); - } - - // hostapd wpa/wpa2 IE - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { - if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { - if (pMgmt->wWPAIELen != 0) { - sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); - memcpy(sFrame.pRSN, pMgmt->abyWPAIE, pMgmt->wWPAIELen); - sFrame.len += pMgmt->wWPAIELen; - } - } - } - - // Adjust the length fields - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - - return pTxPacket; + + sizeof(struct vnt_tx_mgmt)); + // Setup the sFrame structure. + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_PROBERESP_FR_MAXLEN; + vMgrEncodeProbeResponse(&sFrame); + // Setup the header + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBERESP) + )); + memcpy( sFrame.pHdr->sA3.abyAddr1, pDstAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pCurrBSSID, WLAN_BSSID_LEN); + *sFrame.pwBeaconInterval = cpu_to_le16(wCurrBeaconPeriod); + *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); + + if (byPHYType == BB_TYPE_11B) { + *sFrame.pwCapInfo &= cpu_to_le16((u16)~(WLAN_SET_CAP_INFO_SHORTSLOTTIME(1))); + } + + // Copy SSID + sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); + sFrame.len += ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSSID, + pCurrSSID, + ((PWLAN_IE_SSID)pCurrSSID)->len + WLAN_IEHDR_LEN + ); + // Copy the rate set + sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + + sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSuppRates, + pCurrSuppRates, + ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN + ); + + // DS parameter + if (pDevice->byBBType != BB_TYPE_11A) { + sFrame.pDSParms = (PWLAN_IE_DS_PARMS)(sFrame.pBuf + sFrame.len); + sFrame.len += (1) + WLAN_IEHDR_LEN; + sFrame.pDSParms->byElementID = WLAN_EID_DS_PARMS; + sFrame.pDSParms->len = 1; + sFrame.pDSParms->byCurrChannel = (u8)uCurrChannel; + } + + if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) { + // IBSS parameter + sFrame.pIBSSParms = (PWLAN_IE_IBSS_PARMS)(sFrame.pBuf + sFrame.len); + sFrame.len += (2) + WLAN_IEHDR_LEN; + sFrame.pIBSSParms->byElementID = WLAN_EID_IBSS_PARMS; + sFrame.pIBSSParms->len = 2; + sFrame.pIBSSParms->wATIMWindow = 0; + } + if (pDevice->byBBType == BB_TYPE_11G) { + sFrame.pERP = (PWLAN_IE_ERP)(sFrame.pBuf + sFrame.len); + sFrame.len += 1 + WLAN_IEHDR_LEN; + sFrame.pERP->byElementID = WLAN_EID_ERP; + sFrame.pERP->len = 1; + sFrame.pERP->byContext = 0; + if (pDevice->bProtectMode == true) + sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; + if (pDevice->bNonERPPresent == true) + sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; + if (pDevice->bBarkerPreambleMd == true) + sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; + } + + if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { + sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pExtSuppRates, + pCurrExtSuppRates, + ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN + ); + } + + // hostapd wpa/wpa2 IE + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { + if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { + if (pMgmt->wWPAIELen != 0) { + sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); + memcpy(sFrame.pRSN, pMgmt->abyWPAIE, pMgmt->wWPAIELen); + sFrame.len += pMgmt->wWPAIELen; + } + } + } + + // Adjust the length fields + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + + return pTxPacket; } /*+ @@ -3079,14 +3079,14 @@ static struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, * Return Value: * A ptr to frame or NULL on allocation failure * --*/ + -*/ static struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, - u16 wListenInterval, - PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates) + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, + PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_ASSOCREQ sFrame; @@ -3095,227 +3095,227 @@ static struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_ASSOCREQ_FR_MAXLEN); + + WLAN_ASSOCREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - // Setup the sFrame structure. - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_ASSOCREQ_FR_MAXLEN; - // format fixed field frame structure - vMgrEncodeAssocRequest(&sFrame); - // Setup the header - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ASSOCREQ) - )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pDAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - - // Set the capability and listen interval - *(sFrame.pwCapInfo) = cpu_to_le16(wCurrCapInfo); - *(sFrame.pwListenInterval) = cpu_to_le16(wListenInterval); - - // sFrame.len point to end of fixed field - sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); - sFrame.len += pCurrSSID->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSSID, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); - - pMgmt->sAssocInfo.AssocInfo.RequestIELength = pCurrSSID->len + WLAN_IEHDR_LEN; - pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); - pbyIEs = pMgmt->sAssocInfo.abyIEs; - memcpy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); - pbyIEs += pCurrSSID->len + WLAN_IEHDR_LEN; - - // Copy the rate set - sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - if ((pDevice->byBBType == BB_TYPE_11B) && (pCurrRates->len > 4)) - sFrame.len += 4 + WLAN_IEHDR_LEN; - else - sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); - - // Copy the extension rate set - if ((pDevice->byBBType == BB_TYPE_11G) && (pCurrExtSuppRates->len > 0)) { - sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN); - } - - pMgmt->sAssocInfo.AssocInfo.RequestIELength += pCurrRates->len + WLAN_IEHDR_LEN; - 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)) && - (pMgmt->pCurrBSS != NULL)) { - /* WPA IE */ - sFrame.pRSNWPA = (PWLAN_IE_RSN_EXT)(sFrame.pBuf + sFrame.len); - sFrame.pRSNWPA->byElementID = WLAN_EID_RSN_WPA; - sFrame.pRSNWPA->len = 16; - sFrame.pRSNWPA->abyOUI[0] = 0x00; - sFrame.pRSNWPA->abyOUI[1] = 0x50; - sFrame.pRSNWPA->abyOUI[2] = 0xf2; - sFrame.pRSNWPA->abyOUI[3] = 0x01; - sFrame.pRSNWPA->wVersion = 1; - //Group Key Cipher Suite - sFrame.pRSNWPA->abyMulticast[0] = 0x00; - sFrame.pRSNWPA->abyMulticast[1] = 0x50; - sFrame.pRSNWPA->abyMulticast[2] = 0xf2; - if (pMgmt->byCSSGK == KEY_CTL_WEP) { - sFrame.pRSNWPA->abyMulticast[3] = pMgmt->pCurrBSS->byGKType; - } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { - sFrame.pRSNWPA->abyMulticast[3] = WPA_TKIP; - } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { - sFrame.pRSNWPA->abyMulticast[3] = WPA_AESCCMP; - } else { - sFrame.pRSNWPA->abyMulticast[3] = WPA_NONE; - } - // Pairwise Key Cipher Suite - sFrame.pRSNWPA->wPKCount = 1; - sFrame.pRSNWPA->PKSList[0].abyOUI[0] = 0x00; - sFrame.pRSNWPA->PKSList[0].abyOUI[1] = 0x50; - sFrame.pRSNWPA->PKSList[0].abyOUI[2] = 0xf2; - if (pMgmt->byCSSPK == KEY_CTL_TKIP) { - sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_TKIP; - } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { - sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_AESCCMP; - } else { - sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_NONE; - } - // Auth Key Management Suite - pbyRSN = (u8 *)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len); - *pbyRSN++=0x01; - *pbyRSN++=0x00; - *pbyRSN++=0x00; - - *pbyRSN++=0x50; - *pbyRSN++=0xf2; - if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) { - *pbyRSN++=WPA_AUTH_PSK; - } - else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA) { - *pbyRSN++=WPA_AUTH_IEEE802_1X; - } - else { - *pbyRSN++=WPA_NONE; - } - - sFrame.pRSNWPA->len +=6; - - // RSN Capabilites - - *pbyRSN++=0x00; - *pbyRSN++=0x00; - sFrame.pRSNWPA->len +=2; - - sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; - // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION - pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; - memcpy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN); - pbyIEs += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; - - } else if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && - (pMgmt->pCurrBSS != NULL)) { - unsigned int ii; - u16 * pwPMKID; - - // WPA IE - sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); - sFrame.pRSN->byElementID = WLAN_EID_RSN; - sFrame.pRSN->len = 6; //Version(2)+GK(4) - sFrame.pRSN->wVersion = 1; - //Group Key Cipher Suite - sFrame.pRSN->abyRSN[0] = 0x00; - sFrame.pRSN->abyRSN[1] = 0x0F; - sFrame.pRSN->abyRSN[2] = 0xAC; - if (pMgmt->byCSSGK == KEY_CTL_WEP) { - sFrame.pRSN->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK; - } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { - sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_TKIP; - } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { - sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_CCMP; - } else { - sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_UNKNOWN; - } - - // Pairwise Key Cipher Suite - sFrame.pRSN->abyRSN[4] = 1; - sFrame.pRSN->abyRSN[5] = 0; - sFrame.pRSN->abyRSN[6] = 0x00; - sFrame.pRSN->abyRSN[7] = 0x0F; - sFrame.pRSN->abyRSN[8] = 0xAC; - if (pMgmt->byCSSPK == KEY_CTL_TKIP) { - sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_TKIP; - } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { - sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_CCMP; - } else if (pMgmt->byCSSPK == KEY_CTL_NONE) { - sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_USE_GROUP; - } else { - sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_UNKNOWN; - } - sFrame.pRSN->len += 6; - - // Auth Key Management Suite - sFrame.pRSN->abyRSN[10] = 1; - sFrame.pRSN->abyRSN[11] = 0; - sFrame.pRSN->abyRSN[12] = 0x00; - sFrame.pRSN->abyRSN[13] = 0x0F; - sFrame.pRSN->abyRSN[14] = 0xAC; - if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) { - sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_PSK; - } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { - sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_802_1X; - } else { - sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN; - } - sFrame.pRSN->len +=6; - - // RSN Capabilites - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { - memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); - } else { - sFrame.pRSN->abyRSN[16] = 0; - sFrame.pRSN->abyRSN[17] = 0; - } - sFrame.pRSN->len +=2; - - if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { - // RSN PMKID - pbyRSN = &sFrame.pRSN->abyRSN[18]; - 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++) { - if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], - pMgmt->abyCurrBSSID, - ETH_ALEN)) { - (*pwPMKID)++; - memcpy(pbyRSN, - pDevice->gsPMKID.BSSIDInfo[ii].PMKID, - 16); - pbyRSN += 16; + + sizeof(struct vnt_tx_mgmt)); + // Setup the sFrame structure. + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_ASSOCREQ_FR_MAXLEN; + // format fixed field frame structure + vMgrEncodeAssocRequest(&sFrame); + // Setup the header + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ASSOCREQ) + )); + memcpy( sFrame.pHdr->sA3.abyAddr1, pDAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + + // Set the capability and listen interval + *(sFrame.pwCapInfo) = cpu_to_le16(wCurrCapInfo); + *(sFrame.pwListenInterval) = cpu_to_le16(wListenInterval); + + // sFrame.len point to end of fixed field + sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); + sFrame.len += pCurrSSID->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSSID, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); + + pMgmt->sAssocInfo.AssocInfo.RequestIELength = pCurrSSID->len + WLAN_IEHDR_LEN; + pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); + pbyIEs = pMgmt->sAssocInfo.abyIEs; + memcpy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); + pbyIEs += pCurrSSID->len + WLAN_IEHDR_LEN; + + // Copy the rate set + sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + if ((pDevice->byBBType == BB_TYPE_11B) && (pCurrRates->len > 4)) + sFrame.len += 4 + WLAN_IEHDR_LEN; + else + sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); + + // Copy the extension rate set + if ((pDevice->byBBType == BB_TYPE_11G) && (pCurrExtSuppRates->len > 0)) { + sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN); + } + + pMgmt->sAssocInfo.AssocInfo.RequestIELength += pCurrRates->len + WLAN_IEHDR_LEN; + 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)) && + (pMgmt->pCurrBSS != NULL)) { + /* WPA IE */ + sFrame.pRSNWPA = (PWLAN_IE_RSN_EXT)(sFrame.pBuf + sFrame.len); + sFrame.pRSNWPA->byElementID = WLAN_EID_RSN_WPA; + sFrame.pRSNWPA->len = 16; + sFrame.pRSNWPA->abyOUI[0] = 0x00; + sFrame.pRSNWPA->abyOUI[1] = 0x50; + sFrame.pRSNWPA->abyOUI[2] = 0xf2; + sFrame.pRSNWPA->abyOUI[3] = 0x01; + sFrame.pRSNWPA->wVersion = 1; + //Group Key Cipher Suite + sFrame.pRSNWPA->abyMulticast[0] = 0x00; + sFrame.pRSNWPA->abyMulticast[1] = 0x50; + sFrame.pRSNWPA->abyMulticast[2] = 0xf2; + if (pMgmt->byCSSGK == KEY_CTL_WEP) { + sFrame.pRSNWPA->abyMulticast[3] = pMgmt->pCurrBSS->byGKType; + } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { + sFrame.pRSNWPA->abyMulticast[3] = WPA_TKIP; + } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { + sFrame.pRSNWPA->abyMulticast[3] = WPA_AESCCMP; + } else { + sFrame.pRSNWPA->abyMulticast[3] = WPA_NONE; + } + // Pairwise Key Cipher Suite + sFrame.pRSNWPA->wPKCount = 1; + sFrame.pRSNWPA->PKSList[0].abyOUI[0] = 0x00; + sFrame.pRSNWPA->PKSList[0].abyOUI[1] = 0x50; + sFrame.pRSNWPA->PKSList[0].abyOUI[2] = 0xf2; + if (pMgmt->byCSSPK == KEY_CTL_TKIP) { + sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_TKIP; + } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { + sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_AESCCMP; + } else { + sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_NONE; + } + // Auth Key Management Suite + pbyRSN = (u8 *)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len); + *pbyRSN++=0x01; + *pbyRSN++=0x00; + *pbyRSN++=0x00; + + *pbyRSN++=0x50; + *pbyRSN++=0xf2; + if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) { + *pbyRSN++=WPA_AUTH_PSK; + } + else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA) { + *pbyRSN++=WPA_AUTH_IEEE802_1X; + } + else { + *pbyRSN++=WPA_NONE; + } + + sFrame.pRSNWPA->len +=6; + + // RSN Capabilites + + *pbyRSN++=0x00; + *pbyRSN++=0x00; + sFrame.pRSNWPA->len +=2; + + sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; + // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION + pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; + memcpy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN); + pbyIEs += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; + + } else if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && + (pMgmt->pCurrBSS != NULL)) { + unsigned int ii; + u16 * pwPMKID; + + // WPA IE + sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); + sFrame.pRSN->byElementID = WLAN_EID_RSN; + sFrame.pRSN->len = 6; //Version(2)+GK(4) + sFrame.pRSN->wVersion = 1; + //Group Key Cipher Suite + sFrame.pRSN->abyRSN[0] = 0x00; + sFrame.pRSN->abyRSN[1] = 0x0F; + sFrame.pRSN->abyRSN[2] = 0xAC; + if (pMgmt->byCSSGK == KEY_CTL_WEP) { + sFrame.pRSN->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK; + } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { + sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_TKIP; + } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { + sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_CCMP; + } else { + sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_UNKNOWN; } + + // Pairwise Key Cipher Suite + sFrame.pRSN->abyRSN[4] = 1; + sFrame.pRSN->abyRSN[5] = 0; + sFrame.pRSN->abyRSN[6] = 0x00; + sFrame.pRSN->abyRSN[7] = 0x0F; + sFrame.pRSN->abyRSN[8] = 0xAC; + if (pMgmt->byCSSPK == KEY_CTL_TKIP) { + sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_TKIP; + } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { + sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_CCMP; + } else if (pMgmt->byCSSPK == KEY_CTL_NONE) { + sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_USE_GROUP; + } else { + sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_UNKNOWN; + } + sFrame.pRSN->len += 6; + + // Auth Key Management Suite + sFrame.pRSN->abyRSN[10] = 1; + sFrame.pRSN->abyRSN[11] = 0; + sFrame.pRSN->abyRSN[12] = 0x00; + sFrame.pRSN->abyRSN[13] = 0x0F; + sFrame.pRSN->abyRSN[14] = 0xAC; + if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) { + sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_PSK; + } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { + sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_802_1X; + } else { + sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN; + } + sFrame.pRSN->len +=6; + + // RSN Capabilites + if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { + memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); + } else { + sFrame.pRSN->abyRSN[16] = 0; + sFrame.pRSN->abyRSN[17] = 0; + } + sFrame.pRSN->len +=2; + + if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { + // RSN PMKID + pbyRSN = &sFrame.pRSN->abyRSN[18]; + 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++) { + if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], + pMgmt->abyCurrBSSID, + ETH_ALEN)) { + (*pwPMKID)++; + memcpy(pbyRSN, + pDevice->gsPMKID.BSSIDInfo[ii].PMKID, + 16); + pbyRSN += 16; + } + } + if (*pwPMKID != 0) { + sFrame.pRSN->len += (2 + (*pwPMKID)*16); + } + } + + sFrame.len += sFrame.pRSN->len + WLAN_IEHDR_LEN; + // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION + pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSN->len + WLAN_IEHDR_LEN; + memcpy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN); + pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN; } - if (*pwPMKID != 0) { - sFrame.pRSN->len += (2 + (*pwPMKID)*16); - } - } - - sFrame.len += sFrame.pRSN->len + WLAN_IEHDR_LEN; - // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION - pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSN->len + WLAN_IEHDR_LEN; - memcpy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN); - 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; + + // Adjust the length fields + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + return pTxPacket; } /*+ @@ -3327,13 +3327,13 @@ static struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, * Return Value: * A ptr to frame or NULL on allocation failure * --*/ + -*/ static struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, - u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates) + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_REASSOCREQ sFrame; @@ -3342,227 +3342,227 @@ static struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) - + WLAN_REASSOCREQ_FR_MAXLEN); + + WLAN_REASSOCREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - /* Setup the sFrame structure. */ - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_REASSOCREQ_FR_MAXLEN; - - // format fixed field frame structure - vMgrEncodeReassocRequest(&sFrame); - - /* Setup the header */ - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_REASSOCREQ) - )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pDAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - - /* Set the capability and listen interval */ - *(sFrame.pwCapInfo) = cpu_to_le16(wCurrCapInfo); - *(sFrame.pwListenInterval) = cpu_to_le16(wListenInterval); - - memcpy(sFrame.pAddrCurrAP, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - /* Copy the SSID */ - /* sFrame.len point to end of fixed field */ - sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); - sFrame.len += pCurrSSID->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSSID, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); - - pMgmt->sAssocInfo.AssocInfo.RequestIELength = pCurrSSID->len + WLAN_IEHDR_LEN; - pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); - pbyIEs = pMgmt->sAssocInfo.abyIEs; - memcpy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); - pbyIEs += pCurrSSID->len + WLAN_IEHDR_LEN; - - /* Copy the rate set */ - /* sFrame.len point to end of SSID */ - sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); - - // Copy the extension rate set - if ((pMgmt->eCurrentPHYMode == PHY_TYPE_11G) && (pCurrExtSuppRates->len > 0)) { - sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN); - } - - pMgmt->sAssocInfo.AssocInfo.RequestIELength += pCurrRates->len + WLAN_IEHDR_LEN; - 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)) && - (pMgmt->pCurrBSS != NULL)) { - /* WPA IE */ - sFrame.pRSNWPA = (PWLAN_IE_RSN_EXT)(sFrame.pBuf + sFrame.len); - sFrame.pRSNWPA->byElementID = WLAN_EID_RSN_WPA; - sFrame.pRSNWPA->len = 16; - sFrame.pRSNWPA->abyOUI[0] = 0x00; - sFrame.pRSNWPA->abyOUI[1] = 0x50; - sFrame.pRSNWPA->abyOUI[2] = 0xf2; - sFrame.pRSNWPA->abyOUI[3] = 0x01; - sFrame.pRSNWPA->wVersion = 1; - //Group Key Cipher Suite - sFrame.pRSNWPA->abyMulticast[0] = 0x00; - sFrame.pRSNWPA->abyMulticast[1] = 0x50; - sFrame.pRSNWPA->abyMulticast[2] = 0xf2; - if (pMgmt->byCSSGK == KEY_CTL_WEP) { - sFrame.pRSNWPA->abyMulticast[3] = pMgmt->pCurrBSS->byGKType; - } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { - sFrame.pRSNWPA->abyMulticast[3] = WPA_TKIP; - } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { - sFrame.pRSNWPA->abyMulticast[3] = WPA_AESCCMP; - } else { - sFrame.pRSNWPA->abyMulticast[3] = WPA_NONE; - } - // Pairwise Key Cipher Suite - sFrame.pRSNWPA->wPKCount = 1; - sFrame.pRSNWPA->PKSList[0].abyOUI[0] = 0x00; - sFrame.pRSNWPA->PKSList[0].abyOUI[1] = 0x50; - sFrame.pRSNWPA->PKSList[0].abyOUI[2] = 0xf2; - if (pMgmt->byCSSPK == KEY_CTL_TKIP) { - sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_TKIP; - } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { - sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_AESCCMP; - } else { - sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_NONE; - } - // Auth Key Management Suite - pbyRSN = (u8 *)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len); - *pbyRSN++=0x01; - *pbyRSN++=0x00; - *pbyRSN++=0x00; - - *pbyRSN++=0x50; - *pbyRSN++=0xf2; - if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) { - *pbyRSN++=WPA_AUTH_PSK; - } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA) { - *pbyRSN++=WPA_AUTH_IEEE802_1X; - } else { - *pbyRSN++=WPA_NONE; - } - - sFrame.pRSNWPA->len +=6; - - // RSN Capabilites - *pbyRSN++=0x00; - *pbyRSN++=0x00; - sFrame.pRSNWPA->len +=2; - - sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; - // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION - pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; - memcpy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN); - pbyIEs += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; - - } else if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && - (pMgmt->pCurrBSS != NULL)) { - unsigned int ii; - u16 * pwPMKID; - - /* WPA IE */ - sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); - sFrame.pRSN->byElementID = WLAN_EID_RSN; - sFrame.pRSN->len = 6; //Version(2)+GK(4) - sFrame.pRSN->wVersion = 1; - //Group Key Cipher Suite - sFrame.pRSN->abyRSN[0] = 0x00; - sFrame.pRSN->abyRSN[1] = 0x0F; - sFrame.pRSN->abyRSN[2] = 0xAC; - if (pMgmt->byCSSGK == KEY_CTL_WEP) { - sFrame.pRSN->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK; - } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { - sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_TKIP; - } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { - sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_CCMP; - } else { - sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_UNKNOWN; - } - - // Pairwise Key Cipher Suite - sFrame.pRSN->abyRSN[4] = 1; - sFrame.pRSN->abyRSN[5] = 0; - sFrame.pRSN->abyRSN[6] = 0x00; - sFrame.pRSN->abyRSN[7] = 0x0F; - sFrame.pRSN->abyRSN[8] = 0xAC; - if (pMgmt->byCSSPK == KEY_CTL_TKIP) { - sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_TKIP; - } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { - sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_CCMP; - } else if (pMgmt->byCSSPK == KEY_CTL_NONE) { - sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_USE_GROUP; - } else { - sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_UNKNOWN; - } - sFrame.pRSN->len += 6; - - // Auth Key Management Suite - sFrame.pRSN->abyRSN[10] = 1; - sFrame.pRSN->abyRSN[11] = 0; - sFrame.pRSN->abyRSN[12] = 0x00; - sFrame.pRSN->abyRSN[13] = 0x0F; - sFrame.pRSN->abyRSN[14] = 0xAC; - if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) { - sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_PSK; - } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { - sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_802_1X; - } else { - sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN; - } - sFrame.pRSN->len +=6; - - // RSN Capabilites - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { - memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); - } else { - sFrame.pRSN->abyRSN[16] = 0; - sFrame.pRSN->abyRSN[17] = 0; - } - sFrame.pRSN->len +=2; - - if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { - // RSN PMKID - pbyRSN = &sFrame.pRSN->abyRSN[18]; - 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++) { - if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], - pMgmt->abyCurrBSSID, - ETH_ALEN)) { - (*pwPMKID)++; - memcpy(pbyRSN, - pDevice->gsPMKID.BSSIDInfo[ii].PMKID, - 16); - pbyRSN += 16; - } - } - if (*pwPMKID != 0) { - sFrame.pRSN->len += (2 + (*pwPMKID)*16); - } - } - - sFrame.len += sFrame.pRSN->len + WLAN_IEHDR_LEN; - // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION - pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSN->len + WLAN_IEHDR_LEN; - memcpy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN); - 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; + + sizeof(struct vnt_tx_mgmt)); + /* Setup the sFrame structure. */ + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_REASSOCREQ_FR_MAXLEN; + + // format fixed field frame structure + vMgrEncodeReassocRequest(&sFrame); + + /* Setup the header */ + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_REASSOCREQ) + )); + memcpy( sFrame.pHdr->sA3.abyAddr1, pDAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + + /* Set the capability and listen interval */ + *(sFrame.pwCapInfo) = cpu_to_le16(wCurrCapInfo); + *(sFrame.pwListenInterval) = cpu_to_le16(wListenInterval); + + memcpy(sFrame.pAddrCurrAP, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + /* Copy the SSID */ + /* sFrame.len point to end of fixed field */ + sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); + sFrame.len += pCurrSSID->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSSID, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); + + pMgmt->sAssocInfo.AssocInfo.RequestIELength = pCurrSSID->len + WLAN_IEHDR_LEN; + pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); + pbyIEs = pMgmt->sAssocInfo.abyIEs; + memcpy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); + pbyIEs += pCurrSSID->len + WLAN_IEHDR_LEN; + + /* Copy the rate set */ + /* sFrame.len point to end of SSID */ + sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); + + // Copy the extension rate set + if ((pMgmt->eCurrentPHYMode == PHY_TYPE_11G) && (pCurrExtSuppRates->len > 0)) { + sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN); + } + + pMgmt->sAssocInfo.AssocInfo.RequestIELength += pCurrRates->len + WLAN_IEHDR_LEN; + 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)) && + (pMgmt->pCurrBSS != NULL)) { + /* WPA IE */ + sFrame.pRSNWPA = (PWLAN_IE_RSN_EXT)(sFrame.pBuf + sFrame.len); + sFrame.pRSNWPA->byElementID = WLAN_EID_RSN_WPA; + sFrame.pRSNWPA->len = 16; + sFrame.pRSNWPA->abyOUI[0] = 0x00; + sFrame.pRSNWPA->abyOUI[1] = 0x50; + sFrame.pRSNWPA->abyOUI[2] = 0xf2; + sFrame.pRSNWPA->abyOUI[3] = 0x01; + sFrame.pRSNWPA->wVersion = 1; + //Group Key Cipher Suite + sFrame.pRSNWPA->abyMulticast[0] = 0x00; + sFrame.pRSNWPA->abyMulticast[1] = 0x50; + sFrame.pRSNWPA->abyMulticast[2] = 0xf2; + if (pMgmt->byCSSGK == KEY_CTL_WEP) { + sFrame.pRSNWPA->abyMulticast[3] = pMgmt->pCurrBSS->byGKType; + } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { + sFrame.pRSNWPA->abyMulticast[3] = WPA_TKIP; + } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { + sFrame.pRSNWPA->abyMulticast[3] = WPA_AESCCMP; + } else { + sFrame.pRSNWPA->abyMulticast[3] = WPA_NONE; + } + // Pairwise Key Cipher Suite + sFrame.pRSNWPA->wPKCount = 1; + sFrame.pRSNWPA->PKSList[0].abyOUI[0] = 0x00; + sFrame.pRSNWPA->PKSList[0].abyOUI[1] = 0x50; + sFrame.pRSNWPA->PKSList[0].abyOUI[2] = 0xf2; + if (pMgmt->byCSSPK == KEY_CTL_TKIP) { + sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_TKIP; + } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { + sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_AESCCMP; + } else { + sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_NONE; + } + // Auth Key Management Suite + pbyRSN = (u8 *)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len); + *pbyRSN++=0x01; + *pbyRSN++=0x00; + *pbyRSN++=0x00; + + *pbyRSN++=0x50; + *pbyRSN++=0xf2; + if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) { + *pbyRSN++=WPA_AUTH_PSK; + } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA) { + *pbyRSN++=WPA_AUTH_IEEE802_1X; + } else { + *pbyRSN++=WPA_NONE; + } + + sFrame.pRSNWPA->len +=6; + + // RSN Capabilites + *pbyRSN++=0x00; + *pbyRSN++=0x00; + sFrame.pRSNWPA->len +=2; + + sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; + // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION + pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; + memcpy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN); + pbyIEs += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; + + } else if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && + (pMgmt->pCurrBSS != NULL)) { + unsigned int ii; + u16 * pwPMKID; + + /* WPA IE */ + sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); + sFrame.pRSN->byElementID = WLAN_EID_RSN; + sFrame.pRSN->len = 6; //Version(2)+GK(4) + sFrame.pRSN->wVersion = 1; + //Group Key Cipher Suite + sFrame.pRSN->abyRSN[0] = 0x00; + sFrame.pRSN->abyRSN[1] = 0x0F; + sFrame.pRSN->abyRSN[2] = 0xAC; + if (pMgmt->byCSSGK == KEY_CTL_WEP) { + sFrame.pRSN->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK; + } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { + sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_TKIP; + } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { + sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_CCMP; + } else { + sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_UNKNOWN; + } + + // Pairwise Key Cipher Suite + sFrame.pRSN->abyRSN[4] = 1; + sFrame.pRSN->abyRSN[5] = 0; + sFrame.pRSN->abyRSN[6] = 0x00; + sFrame.pRSN->abyRSN[7] = 0x0F; + sFrame.pRSN->abyRSN[8] = 0xAC; + if (pMgmt->byCSSPK == KEY_CTL_TKIP) { + sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_TKIP; + } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { + sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_CCMP; + } else if (pMgmt->byCSSPK == KEY_CTL_NONE) { + sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_USE_GROUP; + } else { + sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_UNKNOWN; + } + sFrame.pRSN->len += 6; + + // Auth Key Management Suite + sFrame.pRSN->abyRSN[10] = 1; + sFrame.pRSN->abyRSN[11] = 0; + sFrame.pRSN->abyRSN[12] = 0x00; + sFrame.pRSN->abyRSN[13] = 0x0F; + sFrame.pRSN->abyRSN[14] = 0xAC; + if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) { + sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_PSK; + } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { + sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_802_1X; + } else { + sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN; + } + sFrame.pRSN->len +=6; + + // RSN Capabilites + if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { + memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); + } else { + sFrame.pRSN->abyRSN[16] = 0; + sFrame.pRSN->abyRSN[17] = 0; + } + sFrame.pRSN->len +=2; + + if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { + // RSN PMKID + pbyRSN = &sFrame.pRSN->abyRSN[18]; + 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++) { + if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], + pMgmt->abyCurrBSSID, + ETH_ALEN)) { + (*pwPMKID)++; + memcpy(pbyRSN, + pDevice->gsPMKID.BSSIDInfo[ii].PMKID, + 16); + pbyRSN += 16; + } + } + if (*pwPMKID != 0) { + sFrame.pRSN->len += (2 + (*pwPMKID)*16); + } + } + + sFrame.len += sFrame.pRSN->len + WLAN_IEHDR_LEN; + // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION + pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSN->len + WLAN_IEHDR_LEN; + memcpy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN); + 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; } /*+ @@ -3574,61 +3574,61 @@ static struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, * Return Value: * PTR to frame; or NULL on allocation failure * --*/ + -*/ static struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, - u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates) + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { 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); + + WLAN_ASSOCREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - // Setup the sFrame structure - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; - vMgrEncodeAssocResponse(&sFrame); - // Setup the header - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ASSOCRESP) - )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pDstAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - - *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); - *sFrame.pwStatus = cpu_to_le16(wAssocStatus); - *sFrame.pwAid = cpu_to_le16((u16)(wAssocAID | BIT14 | BIT15)); - - // Copy the rate set - sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSuppRates, - pCurrSuppRates, - ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN - ); - - if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { - sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pExtSuppRates, - pCurrExtSuppRates, - ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN - ); - } - - // Adjust the length fields - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - - return pTxPacket; + + sizeof(struct vnt_tx_mgmt)); + // Setup the sFrame structure + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; + vMgrEncodeAssocResponse(&sFrame); + // Setup the header + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ASSOCRESP) + )); + memcpy( sFrame.pHdr->sA3.abyAddr1, pDstAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + + *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); + *sFrame.pwStatus = cpu_to_le16(wAssocStatus); + *sFrame.pwAid = cpu_to_le16((u16)(wAssocAID | BIT14 | BIT15)); + + // Copy the rate set + sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSuppRates, + pCurrSuppRates, + ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN + ); + + if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { + sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pExtSuppRates, + pCurrExtSuppRates, + ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN + ); + } + + // Adjust the length fields + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + + return pTxPacket; } /*+ @@ -3640,61 +3640,61 @@ static struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, * Return Value: * PTR to frame; or NULL on allocation failure * --*/ + -*/ static struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, - u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates) + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { 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); + + WLAN_ASSOCREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket - + sizeof(struct vnt_tx_mgmt)); - // Setup the sFrame structure - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; - vMgrEncodeReassocResponse(&sFrame); - // Setup the header - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_REASSOCRESP) - )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pDstAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - - *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); - *sFrame.pwStatus = cpu_to_le16(wAssocStatus); - *sFrame.pwAid = cpu_to_le16((u16)(wAssocAID | BIT14 | BIT15)); - - // Copy the rate set - sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSuppRates, - pCurrSuppRates, - ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN - ); - - if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { - sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pExtSuppRates, - pCurrExtSuppRates, - ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN - ); - } - - // Adjust the length fields - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - - return pTxPacket; + + sizeof(struct vnt_tx_mgmt)); + // Setup the sFrame structure + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; + vMgrEncodeReassocResponse(&sFrame); + // Setup the header + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_REASSOCRESP) + )); + memcpy( sFrame.pHdr->sA3.abyAddr1, pDstAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy( sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + + *sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo); + *sFrame.pwStatus = cpu_to_le16(wAssocStatus); + *sFrame.pwAid = cpu_to_le16((u16)(wAssocAID | BIT14 | BIT15)); + + // Copy the rate set + sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSuppRates, + pCurrSuppRates, + ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN + ); + + if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { + sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pExtSuppRates, + pCurrExtSuppRates, + ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN + ); + } + + // Adjust the length fields + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + + return pTxPacket; } /*+ @@ -3706,10 +3706,10 @@ static struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, * Return Value: * none. * --*/ + -*/ static void s_vMgrRxProbeResponse(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { PKnownBSS pBSSList = NULL; WLAN_FR_PROBERESP sFrame; @@ -3717,105 +3717,105 @@ 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 = (u8 *)pRxPacket->p80211Header; - vMgrDecodeProbeResponse(&sFrame); - - if ((sFrame.pqwTimestamp == NULL) - || (sFrame.pwBeaconInterval == NULL) - || (sFrame.pwCapInfo == NULL) - || (sFrame.pSSID == NULL) - || (sFrame.pSuppRates == NULL)) { + memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP)); + // decode the frame + sFrame.len = pRxPacket->cbMPDULen; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; + vMgrDecodeProbeResponse(&sFrame); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p]\n", - pRxPacket->p80211Header); - return; - } + if ((sFrame.pqwTimestamp == NULL) + || (sFrame.pwBeaconInterval == NULL) + || (sFrame.pwCapInfo == NULL) + || (sFrame.pSSID == NULL) + || (sFrame.pSuppRates == NULL)) { - if(sFrame.pSSID->len == 0) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p]\n", + pRxPacket->p80211Header); + return; + } - //{{ RobertYu:20050201, 11a byCurrChannel != sFrame.pDSParms->byCurrChannel mapping - if( byCurrChannel > CB_MAX_CHANNEL_24G ) - { - if (sFrame.pDSParms) { - if (byCurrChannel == - RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]) + 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 ) + { + if (sFrame.pDSParms) { + if (byCurrChannel == + RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]) + bChannelHit = true; + byCurrChannel = + RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]; + } else { bChannelHit = true; - byCurrChannel = - RFaby11aChannelIndex[sFrame.pDSParms->byCurrChannel-1]; - } else { - bChannelHit = true; - } - } else { - if (sFrame.pDSParms) { - if (byCurrChannel == sFrame.pDSParms->byCurrChannel) + } + } else { + if (sFrame.pDSParms) { + if (byCurrChannel == sFrame.pDSParms->byCurrChannel) + bChannelHit = true; + byCurrChannel = sFrame.pDSParms->byCurrChannel; + } else { bChannelHit = true; - byCurrChannel = sFrame.pDSParms->byCurrChannel; + } + } + //RobertYu:20050201 + + if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) + return; + + if (sFrame.pERP) { + sERP.byERP = sFrame.pERP->byContext; + sERP.bERPExist = true; + } else { + sERP.bERPExist = false; + sERP.byERP = 0; + } + + // update or insert the bss + pBSSList = BSSpAddrIsInBSSList((void *) pDevice, + sFrame.pHdr->sA3.abyAddr3, + sFrame.pSSID); + if (pBSSList) { + BSSbUpdateToBSSList((void *) pDevice, + *sFrame.pqwTimestamp, + *sFrame.pwBeaconInterval, + *sFrame.pwCapInfo, + byCurrChannel, + bChannelHit, + sFrame.pSSID, + sFrame.pSuppRates, + sFrame.pExtSuppRates, + &sERP, + sFrame.pRSN, + sFrame.pRSNWPA, + sFrame.pIE_Country, + sFrame.pIE_Quiet, + pBSSList, + sFrame.len - WLAN_HDR_ADDR3_LEN, + /* payload of probresponse */ + sFrame.pHdr->sA4.abyAddr4, + (void *) pRxPacket); } else { - bChannelHit = true; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Probe resp/insert: RxChannel = : %d\n", byCurrChannel); + BSSbInsertToBSSList((void *) pDevice, + sFrame.pHdr->sA3.abyAddr3, + *sFrame.pqwTimestamp, + *sFrame.pwBeaconInterval, + *sFrame.pwCapInfo, + byCurrChannel, + sFrame.pSSID, + sFrame.pSuppRates, + sFrame.pExtSuppRates, + &sERP, + sFrame.pRSN, + sFrame.pRSNWPA, + sFrame.pIE_Country, + sFrame.pIE_Quiet, + sFrame.len - WLAN_HDR_ADDR3_LEN, + sFrame.pHdr->sA4.abyAddr4, /* payload of beacon */ + (void *) pRxPacket); } - } - //RobertYu:20050201 - -if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) - return; - - if (sFrame.pERP) { - sERP.byERP = sFrame.pERP->byContext; - sERP.bERPExist = true; - } else { - sERP.bERPExist = false; - sERP.byERP = 0; - } - - // update or insert the bss - pBSSList = BSSpAddrIsInBSSList((void *) pDevice, - sFrame.pHdr->sA3.abyAddr3, - sFrame.pSSID); - if (pBSSList) { - BSSbUpdateToBSSList((void *) pDevice, - *sFrame.pqwTimestamp, - *sFrame.pwBeaconInterval, - *sFrame.pwCapInfo, - byCurrChannel, - bChannelHit, - sFrame.pSSID, - sFrame.pSuppRates, - sFrame.pExtSuppRates, - &sERP, - sFrame.pRSN, - sFrame.pRSNWPA, - sFrame.pIE_Country, - sFrame.pIE_Quiet, - pBSSList, - sFrame.len - WLAN_HDR_ADDR3_LEN, - /* payload of probresponse */ - sFrame.pHdr->sA4.abyAddr4, - (void *) pRxPacket); - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Probe resp/insert: RxChannel = : %d\n", byCurrChannel); - BSSbInsertToBSSList((void *) pDevice, - sFrame.pHdr->sA3.abyAddr3, - *sFrame.pqwTimestamp, - *sFrame.pwBeaconInterval, - *sFrame.pwCapInfo, - byCurrChannel, - sFrame.pSSID, - sFrame.pSuppRates, - sFrame.pExtSuppRates, - &sERP, - sFrame.pRSN, - sFrame.pRSNWPA, - sFrame.pIE_Country, - sFrame.pIE_Quiet, - sFrame.len - WLAN_HDR_ADDR3_LEN, - sFrame.pHdr->sA4.abyAddr4, /* payload of beacon */ - (void *) pRxPacket); - } - return; + return; } @@ -3828,73 +3828,73 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) * Return Value: * none. * --*/ + -*/ static void s_vMgrRxProbeRequest(struct vnt_private *pDevice, - struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { WLAN_FR_PROBEREQ sFrame; CMD_STATUS Status; struct vnt_tx_mgmt *pTxPacket; u8 byPHYType = BB_TYPE_11B; - // STA in Ad-hoc mode: when latest TBTT beacon transmit success, - // STA have to response this request. - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || - ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && pDevice->bBeaconSent)) { + // STA in Ad-hoc mode: when latest TBTT beacon transmit success, + // STA have to response this request. + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || + ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && pDevice->bBeaconSent)) { - memset(&sFrame, 0, sizeof(WLAN_FR_PROBEREQ)); - // decode the frame - sFrame.len = pRxPacket->cbMPDULen; - sFrame.pBuf = (u8 *)pRxPacket->p80211Header; - vMgrDecodeProbeRequest(&sFrame); -/* - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request rx:MAC addr:%pM\n", - sFrame.pHdr->sA3.abyAddr2); -*/ - if (sFrame.pSSID->len != 0) { - if (sFrame.pSSID->len != ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) - return; - if (memcmp(sFrame.pSSID->abySSID, - ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, - ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) != 0) { - return; - } - } - - if ((sFrame.pSuppRates->len > 4) || (sFrame.pExtSuppRates != NULL)) { - byPHYType = BB_TYPE_11G; - } - - // Probe response reply.. - pTxPacket = s_MgrMakeProbeResponse - ( - pDevice, - pMgmt, - pMgmt->wCurrCapInfo, - pMgmt->wCurrBeaconPeriod, - pMgmt->uCurrChannel, - 0, - sFrame.pHdr->sA3.abyAddr2, - (PWLAN_IE_SSID)pMgmt->abyCurrSSID, - (u8 *)pMgmt->abyCurrBSSID, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, - byPHYType - ); - if (pTxPacket != NULL ){ - /* send the frame */ - Status = csMgmt_xmit(pDevice, pTxPacket); - if (Status != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx failed\n"); - } - else { -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx sending..\n"); - } - } - } - - return; + memset(&sFrame, 0, sizeof(WLAN_FR_PROBEREQ)); + // decode the frame + sFrame.len = pRxPacket->cbMPDULen; + sFrame.pBuf = (u8 *)pRxPacket->p80211Header; + vMgrDecodeProbeRequest(&sFrame); + /* + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request rx:MAC addr:%pM\n", + sFrame.pHdr->sA3.abyAddr2); + */ + if (sFrame.pSSID->len != 0) { + if (sFrame.pSSID->len != ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) + return; + if (memcmp(sFrame.pSSID->abySSID, + ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, + ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) != 0) { + return; + } + } + + if ((sFrame.pSuppRates->len > 4) || (sFrame.pExtSuppRates != NULL)) { + byPHYType = BB_TYPE_11G; + } + + // Probe response reply.. + pTxPacket = s_MgrMakeProbeResponse + ( + pDevice, + pMgmt, + pMgmt->wCurrCapInfo, + pMgmt->wCurrBeaconPeriod, + pMgmt->uCurrChannel, + 0, + sFrame.pHdr->sA3.abyAddr2, + (PWLAN_IE_SSID)pMgmt->abyCurrSSID, + (u8 *)pMgmt->abyCurrBSSID, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, + byPHYType + ); + if (pTxPacket != NULL ){ + /* send the frame */ + Status = csMgmt_xmit(pDevice, pTxPacket); + if (Status != CMD_STATUS_PENDING) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx failed\n"); + } + else { + // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx sending..\n"); + } + } + } + + return; } /*+ @@ -3909,7 +3909,7 @@ static void s_vMgrRxProbeRequest(struct vnt_private *pDevice, * Return Value: * none. * --*/ + -*/ void vMgrRxManagePacket(struct vnt_private *pDevice, struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) @@ -3919,128 +3919,128 @@ 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; - } - - switch( WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) ){ - - case WLAN_FSTYPE_ASSOCREQ: - // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocreq\n"); - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && - (eNodeState < NODE_AUTH)) { - // send deauth notification - // reason = (6) class 2 received from nonauth sta - vMgrDeAuthenBeginSta(pDevice, - pMgmt, - pRxPacket->p80211Header->sA3.abyAddr2, - (6), - &Status - ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 1\n"); - } - else { - s_vMgrRxAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex); - } - break; - - case WLAN_FSTYPE_ASSOCRESP: - // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp1\n"); - s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, false); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp2\n"); - break; - - case WLAN_FSTYPE_REASSOCREQ: - // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocreq\n"); - // Todo: reassoc - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && - (eNodeState < NODE_AUTH)) { - // send deauth notification - // reason = (6) class 2 received from nonauth sta - vMgrDeAuthenBeginSta(pDevice, - pMgmt, - pRxPacket->p80211Header->sA3.abyAddr2, - (6), - &Status - ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 2\n"); - - } - s_vMgrRxReAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex); - break; - - case WLAN_FSTYPE_REASSOCRESP: - // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocresp\n"); - s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, true); - break; - - case WLAN_FSTYPE_PROBEREQ: - // Frame Clase = 0 - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx probereq\n"); - s_vMgrRxProbeRequest(pDevice, pMgmt, pRxPacket); - break; - - case WLAN_FSTYPE_PROBERESP: - // Frame Clase = 0 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx proberesp\n"); - - s_vMgrRxProbeResponse(pDevice, pMgmt, pRxPacket); - break; - - case WLAN_FSTYPE_BEACON: - // Frame Clase = 0 - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx beacon\n"); - if (pMgmt->eScanState != WMAC_NO_SCANNING) { - bInScan = true; - } - s_vMgrRxBeacon(pDevice, pMgmt, pRxPacket, bInScan); - break; - - case WLAN_FSTYPE_ATIM: - // Frame Clase = 1 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx atim\n"); - break; - - case WLAN_FSTYPE_DISASSOC: - // Frame Clase = 2 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx disassoc\n"); - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && - (eNodeState < NODE_AUTH)) { - // send deauth notification - // reason = (6) class 2 received from nonauth sta - vMgrDeAuthenBeginSta(pDevice, - pMgmt, - pRxPacket->p80211Header->sA3.abyAddr2, - (6), - &Status - ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 3\n"); - } - s_vMgrRxDisassociation(pDevice, pMgmt, pRxPacket); - break; - - case WLAN_FSTYPE_AUTHEN: - // Frame Clase = 1 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx authen\n"); - s_vMgrRxAuthentication(pDevice, pMgmt, pRxPacket); - break; - - case WLAN_FSTYPE_DEAUTHEN: - // Frame Clase = 1 - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx deauthen\n"); - s_vMgrRxDeauthentication(pDevice, pMgmt, pRxPacket); - break; - - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx unknown mgmt\n"); - } - - return; + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) + eNodeState = pMgmt->sNodeDBTable[uNodeIndex].eNodeState; + } + + switch( WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) ){ + + case WLAN_FSTYPE_ASSOCREQ: + // Frame Clase = 2 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocreq\n"); + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && + (eNodeState < NODE_AUTH)) { + // send deauth notification + // reason = (6) class 2 received from nonauth sta + vMgrDeAuthenBeginSta(pDevice, + pMgmt, + pRxPacket->p80211Header->sA3.abyAddr2, + (6), + &Status + ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 1\n"); + } + else { + s_vMgrRxAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex); + } + break; + + case WLAN_FSTYPE_ASSOCRESP: + // Frame Clase = 2 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp1\n"); + s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, false); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp2\n"); + break; + + case WLAN_FSTYPE_REASSOCREQ: + // Frame Clase = 2 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocreq\n"); + // Todo: reassoc + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && + (eNodeState < NODE_AUTH)) { + // send deauth notification + // reason = (6) class 2 received from nonauth sta + vMgrDeAuthenBeginSta(pDevice, + pMgmt, + pRxPacket->p80211Header->sA3.abyAddr2, + (6), + &Status + ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 2\n"); + + } + s_vMgrRxReAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex); + break; + + case WLAN_FSTYPE_REASSOCRESP: + // Frame Clase = 2 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocresp\n"); + s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, true); + break; + + case WLAN_FSTYPE_PROBEREQ: + // Frame Clase = 0 + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx probereq\n"); + s_vMgrRxProbeRequest(pDevice, pMgmt, pRxPacket); + break; + + case WLAN_FSTYPE_PROBERESP: + // Frame Clase = 0 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx proberesp\n"); + + s_vMgrRxProbeResponse(pDevice, pMgmt, pRxPacket); + break; + + case WLAN_FSTYPE_BEACON: + // Frame Clase = 0 + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx beacon\n"); + if (pMgmt->eScanState != WMAC_NO_SCANNING) { + bInScan = true; + } + s_vMgrRxBeacon(pDevice, pMgmt, pRxPacket, bInScan); + break; + + case WLAN_FSTYPE_ATIM: + // Frame Clase = 1 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx atim\n"); + break; + + case WLAN_FSTYPE_DISASSOC: + // Frame Clase = 2 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx disassoc\n"); + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && + (eNodeState < NODE_AUTH)) { + // send deauth notification + // reason = (6) class 2 received from nonauth sta + vMgrDeAuthenBeginSta(pDevice, + pMgmt, + pRxPacket->p80211Header->sA3.abyAddr2, + (6), + &Status + ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 3\n"); + } + s_vMgrRxDisassociation(pDevice, pMgmt, pRxPacket); + break; + + case WLAN_FSTYPE_AUTHEN: + // Frame Clase = 1 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx authen\n"); + s_vMgrRxAuthentication(pDevice, pMgmt, pRxPacket); + break; + + case WLAN_FSTYPE_DEAUTHEN: + // Frame Clase = 1 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx deauthen\n"); + s_vMgrRxDeauthentication(pDevice, pMgmt, pRxPacket); + break; + + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx unknown mgmt\n"); + } + + return; } /*+ @@ -4053,41 +4053,41 @@ void vMgrRxManagePacket(struct vnt_private *pDevice, struct vnt_manager *pMgmt, * Return Value: * true if success; false if failed. * --*/ + -*/ int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, - struct vnt_manager *pMgmt) + struct vnt_manager *pMgmt) { struct vnt_tx_mgmt *pTxPacket; -// pDevice->bBeaconBufReady = false; - if (pDevice->bEncryptionEnable || pDevice->bEnable8021x){ - pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1); - } - else { - pMgmt->wCurrCapInfo &= ~WLAN_SET_CAP_INFO_PRIVACY(1); - } - pTxPacket = s_MgrMakeBeacon - ( - pDevice, - pMgmt, - pMgmt->wCurrCapInfo, - pMgmt->wCurrBeaconPeriod, - pMgmt->uCurrChannel, - pMgmt->wCurrATIMWindow, //0, - (PWLAN_IE_SSID)pMgmt->abyCurrSSID, - (u8 *)pMgmt->abyCurrBSSID, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, - (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates - ); - - if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && - (pMgmt->abyCurrBSSID[0] == 0)) - return false; - - csBeacon_xmit(pDevice, pTxPacket); - MACvRegBitsOn(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); - - return true; + // pDevice->bBeaconBufReady = false; + if (pDevice->bEncryptionEnable || pDevice->bEnable8021x){ + pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1); + } + else { + pMgmt->wCurrCapInfo &= ~WLAN_SET_CAP_INFO_PRIVACY(1); + } + pTxPacket = s_MgrMakeBeacon + ( + pDevice, + pMgmt, + pMgmt->wCurrCapInfo, + pMgmt->wCurrBeaconPeriod, + pMgmt->uCurrChannel, + pMgmt->wCurrATIMWindow, //0, + (PWLAN_IE_SSID)pMgmt->abyCurrSSID, + (u8 *)pMgmt->abyCurrBSSID, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, + (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates + ); + + if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && + (pMgmt->abyCurrBSSID[0] == 0)) + return false; + + csBeacon_xmit(pDevice, pTxPacket); + MACvRegBitsOn(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); + + return true; } /*+ @@ -4101,53 +4101,53 @@ int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, * Return Value: * none. * --*/ + -*/ static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus) { - switch( wStatus ){ - case WLAN_MGMT_STATUS_UNSPEC_FAILURE: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Unspecified error.\n"); - break; - case WLAN_MGMT_STATUS_CAPS_UNSUPPORTED: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Can't support all requested capabilities.\n"); - break; - case WLAN_MGMT_STATUS_REASSOC_NO_ASSOC: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Reassoc denied, can't confirm original Association.\n"); - break; - case WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, undefine in spec\n"); - break; - case WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Peer doesn't support authen algorithm.\n"); - break; - case WLAN_MGMT_STATUS_RX_AUTH_NOSEQ: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen frame received out of sequence.\n"); - break; - case WLAN_MGMT_STATUS_CHALLENGE_FAIL: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, challenge failure.\n"); - break; - case WLAN_MGMT_STATUS_AUTH_TIMEOUT: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, timeout waiting for next frame.\n"); - break; - case WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, AP too busy.\n"); - break; - case WLAN_MGMT_STATUS_ASSOC_DENIED_RATES: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we haven't enough basic rates.\n"); - break; - case WLAN_MGMT_STATUS_ASSOC_DENIED_SHORTPREAMBLE: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support short preamble.\n"); - break; - case WLAN_MGMT_STATUS_ASSOC_DENIED_PBCC: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support PBCC.\n"); - break; - case WLAN_MGMT_STATUS_ASSOC_DENIED_AGILITY: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support channel agility.\n"); - break; - default: - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Unknown status code %d.\n", wStatus); - break; - } + switch( wStatus ){ + case WLAN_MGMT_STATUS_UNSPEC_FAILURE: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Unspecified error.\n"); + break; + case WLAN_MGMT_STATUS_CAPS_UNSUPPORTED: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Can't support all requested capabilities.\n"); + break; + case WLAN_MGMT_STATUS_REASSOC_NO_ASSOC: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Reassoc denied, can't confirm original Association.\n"); + break; + case WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, undefine in spec\n"); + break; + case WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Peer doesn't support authen algorithm.\n"); + break; + case WLAN_MGMT_STATUS_RX_AUTH_NOSEQ: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen frame received out of sequence.\n"); + break; + case WLAN_MGMT_STATUS_CHALLENGE_FAIL: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, challenge failure.\n"); + break; + case WLAN_MGMT_STATUS_AUTH_TIMEOUT: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, timeout waiting for next frame.\n"); + break; + case WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, AP too busy.\n"); + break; + case WLAN_MGMT_STATUS_ASSOC_DENIED_RATES: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we haven't enough basic rates.\n"); + break; + case WLAN_MGMT_STATUS_ASSOC_DENIED_SHORTPREAMBLE: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support short preamble.\n"); + break; + case WLAN_MGMT_STATUS_ASSOC_DENIED_PBCC: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support PBCC.\n"); + break; + case WLAN_MGMT_STATUS_ASSOC_DENIED_AGILITY: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support channel agility.\n"); + break; + default: + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Unknown status code %d.\n", wStatus); + break; + } } /* @@ -4165,49 +4165,49 @@ static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus) * * Return Value: none. * --*/ + -*/ int bAdd_PMKID_Candidate(struct vnt_private *pDevice, u8 *pbyBSSID, - PSRSNCapObject psRSNCapObj) + PSRSNCapObject psRSNCapObj) { PPMKID_CANDIDATE pCandidateList; int ii = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); - - if ((pDevice == NULL) || (pbyBSSID == NULL) || (psRSNCapObj == NULL)) - return false; - - if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) - return false; - - // Update Old Candidate - for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { - pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; - if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) { - if ((psRSNCapObj->bRSNCapExist == true) - && (psRSNCapObj->wRSNCap & BIT0)) { - pCandidateList->Flags |= - NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; - } else { - pCandidateList->Flags &= - ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + + if ((pDevice == NULL) || (pbyBSSID == NULL) || (psRSNCapObj == NULL)) + return false; + + if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) + return false; + + // Update Old Candidate + for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { + pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; + if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) { + if ((psRSNCapObj->bRSNCapExist == true) + && (psRSNCapObj->wRSNCap & BIT0)) { + pCandidateList->Flags |= + NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; + } else { + pCandidateList->Flags &= + ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); + } + return true; } - return true; - } - } - - // New Candidate - pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates]; - if ((psRSNCapObj->bRSNCapExist == true) && (psRSNCapObj->wRSNCap & BIT0)) { - pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; - } else { - pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); - } - memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN); - pDevice->gsPMKIDCandidate.NumCandidates++; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); - return true; + } + + // New Candidate + pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates]; + if ((psRSNCapObj->bRSNCapExist == true) && (psRSNCapObj->wRSNCap & BIT0)) { + pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; + } else { + pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); + } + memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN); + pDevice->gsPMKIDCandidate.NumCandidates++; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + return true; } /* @@ -4223,7 +4223,7 @@ int bAdd_PMKID_Candidate(struct vnt_private *pDevice, u8 *pbyBSSID, * * Return Value: none. * --*/ + -*/ void vFlush_PMKID_Candidate(struct vnt_private *pDevice) { @@ -4235,154 +4235,153 @@ void vFlush_PMKID_Candidate(struct vnt_private *pDevice) return; } -static bool + static bool s_bCipherMatch ( - PKnownBSS pBSSNode, - NDIS_802_11_ENCRYPTION_STATUS EncStatus, - u8 * pbyCCSPK, - u8 * pbyCCSGK - ) + PKnownBSS pBSSNode, + NDIS_802_11_ENCRYPTION_STATUS EncStatus, + u8 * pbyCCSPK, + u8 * pbyCCSGK + ) { - u8 byMulticastCipher = KEY_CTL_INVALID; - u8 byCipherMask = 0x00; - int i; - - if (pBSSNode == NULL) - return false; - - // check cap. of BSS - if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && - (EncStatus == Ndis802_11Encryption1Enabled)) { - // default is WEP only - byMulticastCipher = KEY_CTL_WEP; - } - - if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && - (pBSSNode->bWPA2Valid == true) && - - ((EncStatus == Ndis802_11Encryption3Enabled) || - (EncStatus == Ndis802_11Encryption2Enabled))) { - //WPA2 - // check Group Key Cipher - if ((pBSSNode->byCSSGK == WLAN_11i_CSS_WEP40) || - (pBSSNode->byCSSGK == WLAN_11i_CSS_WEP104)) { - byMulticastCipher = KEY_CTL_WEP; - } else if (pBSSNode->byCSSGK == WLAN_11i_CSS_TKIP) { - byMulticastCipher = KEY_CTL_TKIP; - } else if (pBSSNode->byCSSGK == WLAN_11i_CSS_CCMP) { - byMulticastCipher = KEY_CTL_CCMP; - } else { - byMulticastCipher = KEY_CTL_INVALID; - } - - /* check Pairwise Key Cipher */ - for (i = 0; i < pBSSNode->wCSSPKCount; i++) { - if ((pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_WEP40) || - (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_WEP104)) { - /* this should not happen as defined 802.11i */ - byCipherMask |= 0x01; - } else if (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_TKIP) { - byCipherMask |= 0x02; - } else if (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_CCMP) { - byCipherMask |= 0x04; - } else if (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_USE_GROUP) { - /* use group key only ignore all others */ - byCipherMask = 0; - i = pBSSNode->wCSSPKCount; + u8 byMulticastCipher = KEY_CTL_INVALID; + u8 byCipherMask = 0x00; + int i; + + if (pBSSNode == NULL) + return false; + + // check cap. of BSS + if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && + (EncStatus == Ndis802_11Encryption1Enabled)) { + // default is WEP only + byMulticastCipher = KEY_CTL_WEP; + } + + if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && + (pBSSNode->bWPA2Valid == true) && + + ((EncStatus == Ndis802_11Encryption3Enabled) || + (EncStatus == Ndis802_11Encryption2Enabled))) { + //WPA2 + // check Group Key Cipher + if ((pBSSNode->byCSSGK == WLAN_11i_CSS_WEP40) || + (pBSSNode->byCSSGK == WLAN_11i_CSS_WEP104)) { + byMulticastCipher = KEY_CTL_WEP; + } else if (pBSSNode->byCSSGK == WLAN_11i_CSS_TKIP) { + byMulticastCipher = KEY_CTL_TKIP; + } else if (pBSSNode->byCSSGK == WLAN_11i_CSS_CCMP) { + byMulticastCipher = KEY_CTL_CCMP; + } else { + byMulticastCipher = KEY_CTL_INVALID; } - } - - } else if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && - (pBSSNode->bWPAValid == true) && - ((EncStatus == Ndis802_11Encryption2Enabled) || (EncStatus == Ndis802_11Encryption3Enabled))) { - //WPA - // check Group Key Cipher - if ((pBSSNode->byGKType == WPA_WEP40) || - (pBSSNode->byGKType == WPA_WEP104)) { - byMulticastCipher = KEY_CTL_WEP; - } else if (pBSSNode->byGKType == WPA_TKIP) { - byMulticastCipher = KEY_CTL_TKIP; - } else if (pBSSNode->byGKType == WPA_AESCCMP) { - byMulticastCipher = KEY_CTL_CCMP; - } else { - byMulticastCipher = KEY_CTL_INVALID; - } - - /* check Pairwise Key Cipher */ - for (i = 0; i < pBSSNode->wPKCount; i++) { - if (pBSSNode->abyPKType[i] == WPA_TKIP) { - byCipherMask |= 0x02; - } else if (pBSSNode->abyPKType[i] == WPA_AESCCMP) { - byCipherMask |= 0x04; - } else if (pBSSNode->abyPKType[i] == WPA_NONE) { - /* use group key only ignore all others */ - byCipherMask = 0; - i = pBSSNode->wPKCount; + + /* check Pairwise Key Cipher */ + for (i = 0; i < pBSSNode->wCSSPKCount; i++) { + if ((pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_WEP40) || + (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_WEP104)) { + /* this should not happen as defined 802.11i */ + byCipherMask |= 0x01; + } else if (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_TKIP) { + byCipherMask |= 0x02; + } else if (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_CCMP) { + byCipherMask |= 0x04; + } else if (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_USE_GROUP) { + /* use group key only ignore all others */ + byCipherMask = 0; + i = pBSSNode->wCSSPKCount; + } } - } - } - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%d, %d, %d, %d, EncStatus:%d\n", - byMulticastCipher, byCipherMask, pBSSNode->bWPAValid, pBSSNode->bWPA2Valid, EncStatus); - - // mask our cap. with BSS - if (EncStatus == Ndis802_11Encryption1Enabled) { - - // For supporting Cisco migration mode, don't care pairwise key cipher - //if ((byMulticastCipher == KEY_CTL_WEP) && - // (byCipherMask == 0)) { - if ((byMulticastCipher == KEY_CTL_WEP) && - (byCipherMask == 0)) { - *pbyCCSGK = KEY_CTL_WEP; - *pbyCCSPK = KEY_CTL_NONE; - return true; - } else { - return false; - } - - } else if (EncStatus == Ndis802_11Encryption2Enabled) { - if ((byMulticastCipher == KEY_CTL_TKIP) && - (byCipherMask == 0)) { - *pbyCCSGK = KEY_CTL_TKIP; - *pbyCCSPK = KEY_CTL_NONE; - return true; - } else if ((byMulticastCipher == KEY_CTL_WEP) && - ((byCipherMask & 0x02) != 0)) { - *pbyCCSGK = KEY_CTL_WEP; - *pbyCCSPK = KEY_CTL_TKIP; - return true; - } else if ((byMulticastCipher == KEY_CTL_TKIP) && - ((byCipherMask & 0x02) != 0)) { - *pbyCCSGK = KEY_CTL_TKIP; - *pbyCCSPK = KEY_CTL_TKIP; - return true; - } else { - return false; - } - } else if (EncStatus == Ndis802_11Encryption3Enabled) { - if ((byMulticastCipher == KEY_CTL_CCMP) && - (byCipherMask == 0)) { - // When CCMP is enable, "Use group cipher suite" shall not be a valid option. - return false; - } else if ((byMulticastCipher == KEY_CTL_WEP) && - ((byCipherMask & 0x04) != 0)) { - *pbyCCSGK = KEY_CTL_WEP; - *pbyCCSPK = KEY_CTL_CCMP; - return true; - } else if ((byMulticastCipher == KEY_CTL_TKIP) && - ((byCipherMask & 0x04) != 0)) { - *pbyCCSGK = KEY_CTL_TKIP; - *pbyCCSPK = KEY_CTL_CCMP; - return true; - } else if ((byMulticastCipher == KEY_CTL_CCMP) && - ((byCipherMask & 0x04) != 0)) { - *pbyCCSGK = KEY_CTL_CCMP; - *pbyCCSPK = KEY_CTL_CCMP; - return true; - } else { - return false; - } - } - return true; -} + } else if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && + (pBSSNode->bWPAValid == true) && + ((EncStatus == Ndis802_11Encryption2Enabled) || (EncStatus == Ndis802_11Encryption3Enabled))) { + //WPA + // check Group Key Cipher + if ((pBSSNode->byGKType == WPA_WEP40) || + (pBSSNode->byGKType == WPA_WEP104)) { + byMulticastCipher = KEY_CTL_WEP; + } else if (pBSSNode->byGKType == WPA_TKIP) { + byMulticastCipher = KEY_CTL_TKIP; + } else if (pBSSNode->byGKType == WPA_AESCCMP) { + byMulticastCipher = KEY_CTL_CCMP; + } else { + byMulticastCipher = KEY_CTL_INVALID; + } + + /* check Pairwise Key Cipher */ + for (i = 0; i < pBSSNode->wPKCount; i++) { + if (pBSSNode->abyPKType[i] == WPA_TKIP) { + byCipherMask |= 0x02; + } else if (pBSSNode->abyPKType[i] == WPA_AESCCMP) { + byCipherMask |= 0x04; + } else if (pBSSNode->abyPKType[i] == WPA_NONE) { + /* use group key only ignore all others */ + byCipherMask = 0; + i = pBSSNode->wPKCount; + } + } + } + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%d, %d, %d, %d, EncStatus:%d\n", + byMulticastCipher, byCipherMask, pBSSNode->bWPAValid, pBSSNode->bWPA2Valid, EncStatus); + + // mask our cap. with BSS + if (EncStatus == Ndis802_11Encryption1Enabled) { + + // For supporting Cisco migration mode, don't care pairwise key cipher + //if ((byMulticastCipher == KEY_CTL_WEP) && + // (byCipherMask == 0)) { + if ((byMulticastCipher == KEY_CTL_WEP) && + (byCipherMask == 0)) { + *pbyCCSGK = KEY_CTL_WEP; + *pbyCCSPK = KEY_CTL_NONE; + return true; + } else { + return false; + } + + } else if (EncStatus == Ndis802_11Encryption2Enabled) { + if ((byMulticastCipher == KEY_CTL_TKIP) && + (byCipherMask == 0)) { + *pbyCCSGK = KEY_CTL_TKIP; + *pbyCCSPK = KEY_CTL_NONE; + return true; + } else if ((byMulticastCipher == KEY_CTL_WEP) && + ((byCipherMask & 0x02) != 0)) { + *pbyCCSGK = KEY_CTL_WEP; + *pbyCCSPK = KEY_CTL_TKIP; + return true; + } else if ((byMulticastCipher == KEY_CTL_TKIP) && + ((byCipherMask & 0x02) != 0)) { + *pbyCCSGK = KEY_CTL_TKIP; + *pbyCCSPK = KEY_CTL_TKIP; + return true; + } else { + return false; + } + } else if (EncStatus == Ndis802_11Encryption3Enabled) { + if ((byMulticastCipher == KEY_CTL_CCMP) && + (byCipherMask == 0)) { + // When CCMP is enable, "Use group cipher suite" shall not be a valid option. + return false; + } else if ((byMulticastCipher == KEY_CTL_WEP) && + ((byCipherMask & 0x04) != 0)) { + *pbyCCSGK = KEY_CTL_WEP; + *pbyCCSPK = KEY_CTL_CCMP; + return true; + } else if ((byMulticastCipher == KEY_CTL_TKIP) && + ((byCipherMask & 0x04) != 0)) { + *pbyCCSGK = KEY_CTL_TKIP; + *pbyCCSPK = KEY_CTL_CCMP; + return true; + } else if ((byMulticastCipher == KEY_CTL_CCMP) && + ((byCipherMask & 0x04) != 0)) { + *pbyCCSGK = KEY_CTL_CCMP; + *pbyCCSPK = KEY_CTL_CCMP; + return true; + } else { + return false; + } + } + return true; + } diff --git a/drivers/staging/vt6656/wmgr.h b/drivers/staging/vt6656/wmgr.h index 26ba47d..099ff4d 100644 --- a/drivers/staging/vt6656/wmgr.h +++ b/drivers/staging/vt6656/wmgr.h @@ -80,7 +80,7 @@ typedef struct _NDIS_802_11_AI_REQFI { u16 Capabilities; u16 ListenInterval; - NDIS_802_11_MAC_ADDRESS CurrentAPAddress; + NDIS_802_11_MAC_ADDRESS CurrentAPAddress; } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI; typedef struct _NDIS_802_11_AI_RESFI @@ -113,40 +113,40 @@ typedef struct tagSAssocInfo { typedef enum tagWMAC_AUTHENTICATION_MODE { - WMAC_AUTH_OPEN, - WMAC_AUTH_SHAREKEY, - WMAC_AUTH_AUTO, - WMAC_AUTH_WPA, - WMAC_AUTH_WPAPSK, - WMAC_AUTH_WPANONE, - WMAC_AUTH_WPA2, - WMAC_AUTH_WPA2PSK, - WMAC_AUTH_MAX // Not a real mode, defined as upper bound + WMAC_AUTH_OPEN, + WMAC_AUTH_SHAREKEY, + WMAC_AUTH_AUTO, + WMAC_AUTH_WPA, + WMAC_AUTH_WPAPSK, + WMAC_AUTH_WPANONE, + WMAC_AUTH_WPA2, + WMAC_AUTH_WPA2PSK, + 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 { - WMAC_CONFIG_ESS_STA, - WMAC_CONFIG_IBSS_STA, - WMAC_CONFIG_AUTO, - WMAC_CONFIG_AP + WMAC_CONFIG_ESS_STA, + WMAC_CONFIG_IBSS_STA, + WMAC_CONFIG_AUTO, + WMAC_CONFIG_AP } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE; typedef enum tagWMAC_SCAN_TYPE { - WMAC_SCAN_ACTIVE, - WMAC_SCAN_PASSIVE, - WMAC_SCAN_HYBRID + WMAC_SCAN_ACTIVE, + WMAC_SCAN_PASSIVE, + WMAC_SCAN_HYBRID } WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE; typedef enum tagWMAC_SCAN_STATE { - WMAC_NO_SCANNING, - WMAC_IS_SCANNING, - WMAC_IS_PROBEPENDING + WMAC_NO_SCANNING, + WMAC_IS_SCANNING, + WMAC_IS_PROBEPENDING } WMAC_SCAN_STATE, *PWMAC_SCAN_STATE; @@ -162,31 +162,31 @@ typedef enum tagWMAC_SCAN_STATE { typedef enum tagWMAC_BSS_STATE { - WMAC_STATE_IDLE, - WMAC_STATE_STARTED, - WMAC_STATE_JOINTED, - WMAC_STATE_AUTHPENDING, - WMAC_STATE_AUTH, - WMAC_STATE_ASSOCPENDING, - WMAC_STATE_ASSOC + WMAC_STATE_IDLE, + WMAC_STATE_STARTED, + WMAC_STATE_JOINTED, + WMAC_STATE_AUTHPENDING, + WMAC_STATE_AUTH, + WMAC_STATE_ASSOCPENDING, + WMAC_STATE_ASSOC } WMAC_BSS_STATE, *PWMAC_BSS_STATE; // WMAC selected running mode typedef enum tagWMAC_CURRENT_MODE { - WMAC_MODE_STANDBY, - WMAC_MODE_ESS_STA, - WMAC_MODE_IBSS_STA, - WMAC_MODE_ESS_AP + WMAC_MODE_STANDBY, + WMAC_MODE_ESS_STA, + WMAC_MODE_IBSS_STA, + WMAC_MODE_ESS_AP } WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE; typedef enum tagWMAC_POWER_MODE { - WMAC_POWER_CAM, - WMAC_POWER_FAST, - WMAC_POWER_MAX + WMAC_POWER_CAM, + WMAC_POWER_FAST, + WMAC_POWER_MAX } WMAC_POWER_MODE, *PWMAC_POWER_MODE; @@ -297,7 +297,7 @@ struct vnt_manager { int bInTIMWake; u8 *pbyPSPacketPool; u8 byPSPacketPool[sizeof(struct vnt_tx_mgmt) - + WLAN_NULLDATA_FR_MAXLEN]; + + WLAN_NULLDATA_FR_MAXLEN]; int bRxBeaconInTBTTWake; u8 abyPSTxMap[MAX_NODE_NUM + 1]; @@ -308,7 +308,7 @@ struct vnt_manager { /* management packet pool */ u8 *pbyMgmtPacketPool; u8 byMgmtPacketPool[sizeof(struct vnt_tx_mgmt) - + WLAN_A3FR_MAXLEN]; + + WLAN_A3FR_MAXLEN]; /* Temporarily Rx Mgmt Packet Descriptor */ struct vnt_rx_mgmt sRxPacket; @@ -339,9 +339,9 @@ struct vnt_manager { PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep; u32 uLengthOfRepEIDs; u8 abyCurrentMSRReq[sizeof(struct vnt_tx_mgmt) - + WLAN_A3FR_MAXLEN]; + + WLAN_A3FR_MAXLEN]; u8 abyCurrentMSRRep[sizeof(struct vnt_tx_mgmt) - + WLAN_A3FR_MAXLEN]; + + WLAN_A3FR_MAXLEN]; u8 abyIECountry[WLAN_A3FR_MAXLEN]; u8 abyIBSSDFSOwner[6]; u8 byIBSSDFSRecovery; @@ -359,38 +359,38 @@ void vMgrReAssocBeginSta(struct vnt_private *pDevice, struct vnt_manager *, PCMD_STATUS pStatus); void vMgrDisassocBeginSta(struct vnt_private *pDevice, - struct vnt_manager *, u8 *abyDestAddress, u16 wReason, - PCMD_STATUS pStatus); + struct vnt_manager *, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus); void vMgrAuthenBeginSta(struct vnt_private *pDevice, - struct vnt_manager *, PCMD_STATUS pStatus); + struct vnt_manager *, PCMD_STATUS pStatus); void vMgrCreateOwnIBSS(struct vnt_private *pDevice, - PCMD_STATUS pStatus); + PCMD_STATUS pStatus); void vMgrJoinBSSBegin(struct vnt_private *pDevice, - PCMD_STATUS pStatus); + PCMD_STATUS pStatus); void vMgrRxManagePacket(struct vnt_private *pDevice, - struct vnt_manager *, struct vnt_rx_mgmt *); + struct vnt_manager *, struct vnt_rx_mgmt *); /* -void -vMgrScanBegin( - void *hDeviceContext, - PCMD_STATUS pStatus - ); -*/ + void + vMgrScanBegin( + void *hDeviceContext, + PCMD_STATUS pStatus + ); + */ void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, - struct vnt_manager *, u8 *abyDestAddress, u16 wReason, - PCMD_STATUS pStatus); + struct vnt_manager *, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus); int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, - struct vnt_manager *); + struct vnt_manager *); int bAdd_PMKID_Candidate(struct vnt_private *pDevice, - u8 *pbyBSSID, PSRSNCapObject psRSNCapObj); + u8 *pbyBSSID, PSRSNCapObject psRSNCapObj); void vFlush_PMKID_Candidate(struct vnt_private *pDevice); diff --git a/drivers/staging/vt6656/wpa.c b/drivers/staging/vt6656/wpa.c index 403c295..7f4c1d8 100644 --- a/drivers/staging/vt6656/wpa.c +++ b/drivers/staging/vt6656/wpa.c @@ -63,26 +63,26 @@ static const u8 abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 }; * * Return Value: none. * --*/ + -*/ -void + void WPA_ClearRSN( - PKnownBSS pBSSList - ) + PKnownBSS pBSSList + ) { - int ii; - pBSSList->byGKType = WPA_TKIP; - for (ii=0; ii < 4; ii ++) - pBSSList->abyPKType[ii] = WPA_TKIP; - pBSSList->wPKCount = 0; - for (ii=0; ii < 4; ii ++) - pBSSList->abyAuthType[ii] = WPA_AUTH_IEEE802_1X; - pBSSList->wAuthCount = 0; - pBSSList->byDefaultK_as_PK = 0; - pBSSList->byReplayIdx = 0; - pBSSList->sRSNCapObj.bRSNCapExist = false; - pBSSList->sRSNCapObj.wRSNCap = 0; - pBSSList->bWPAValid = false; + int ii; + pBSSList->byGKType = WPA_TKIP; + for (ii=0; ii < 4; ii ++) + pBSSList->abyPKType[ii] = WPA_TKIP; + pBSSList->wPKCount = 0; + for (ii=0; ii < 4; ii ++) + pBSSList->abyAuthType[ii] = WPA_AUTH_IEEE802_1X; + pBSSList->wAuthCount = 0; + pBSSList->byDefaultK_as_PK = 0; + pBSSList->byReplayIdx = 0; + pBSSList->sRSNCapObj.bRSNCapExist = false; + pBSSList->sRSNCapObj.wRSNCap = 0; + pBSSList->bWPAValid = false; } /*+ @@ -99,124 +99,124 @@ WPA_ClearRSN( * * Return Value: none. * --*/ -void + -*/ + void WPA_ParseRSN( - PKnownBSS pBSSList, - PWLAN_IE_RSN_EXT pRSN - ) + PKnownBSS pBSSList, + PWLAN_IE_RSN_EXT pRSN + ) { - PWLAN_IE_RSN_AUTH pIE_RSN_Auth = NULL; - int i, j, m, n = 0; - u8 * pbyCaps; + PWLAN_IE_RSN_AUTH pIE_RSN_Auth = NULL; + int i, j, m, n = 0; + u8 * pbyCaps; - WPA_ClearRSN(pBSSList); + WPA_ClearRSN(pBSSList); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA_ParseRSN: [%d]\n", pRSN->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA_ParseRSN: [%d]\n", pRSN->len); - // information element header makes sense - if ((pRSN->len >= 6) // oui1(4)+ver(2) - && (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) - && (pRSN->wVersion == 1)) { + // information element header makes sense + if ((pRSN->len >= 6) // oui1(4)+ver(2) + && (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) + && (pRSN->wVersion == 1)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Legal RSN\n"); - // update each variable if pRSN is long enough to contain the variable - if (pRSN->len >= 10) //oui1(4)+ver(2)+GKSuite(4) - { - if ( !memcmp(pRSN->abyMulticast, abyOUI01, 4)) - pBSSList->byGKType = WPA_WEP40; - else if ( !memcmp(pRSN->abyMulticast, abyOUI02, 4)) - pBSSList->byGKType = WPA_TKIP; - else if ( !memcmp(pRSN->abyMulticast, abyOUI03, 4)) - pBSSList->byGKType = WPA_AESWRAP; - else if ( !memcmp(pRSN->abyMulticast, abyOUI04, 4)) - pBSSList->byGKType = WPA_AESCCMP; - else if ( !memcmp(pRSN->abyMulticast, abyOUI05, 4)) - pBSSList->byGKType = WPA_WEP104; - else - // any vendor checks here - pBSSList->byGKType = WPA_NONE; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Legal RSN\n"); + // update each variable if pRSN is long enough to contain the variable + if (pRSN->len >= 10) //oui1(4)+ver(2)+GKSuite(4) + { + if ( !memcmp(pRSN->abyMulticast, abyOUI01, 4)) + pBSSList->byGKType = WPA_WEP40; + else if ( !memcmp(pRSN->abyMulticast, abyOUI02, 4)) + pBSSList->byGKType = WPA_TKIP; + else if ( !memcmp(pRSN->abyMulticast, abyOUI03, 4)) + pBSSList->byGKType = WPA_AESWRAP; + else if ( !memcmp(pRSN->abyMulticast, abyOUI04, 4)) + pBSSList->byGKType = WPA_AESCCMP; + else if ( !memcmp(pRSN->abyMulticast, abyOUI05, 4)) + pBSSList->byGKType = WPA_WEP104; + else + // any vendor checks here + pBSSList->byGKType = WPA_NONE; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byGKType: %x\n", pBSSList->byGKType); - } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byGKType: %x\n", pBSSList->byGKType); + } - if (pRSN->len >= 12) //oui1(4)+ver(2)+GKS(4)+PKSCnt(2) - { - j = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType)); - for (i = 0; (i < pRSN->wPKCount) && - (j < ARRAY_SIZE(pBSSList->abyPKType)); i++) { - if(pRSN->len >= 12+i*4+4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i) - if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4)) - pBSSList->abyPKType[j++] = WPA_NONE; - else if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI02, 4)) - pBSSList->abyPKType[j++] = WPA_TKIP; - else if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI03, 4)) - pBSSList->abyPKType[j++] = WPA_AESWRAP; - else if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI04, 4)) - pBSSList->abyPKType[j++] = WPA_AESCCMP; - else - // any vendor checks here - ; - } - else - break; - //DBG_PRN_GRP14(("abyPKType[%d]: %X\n", j-1, pBSSList->abyPKType[j-1])); - } //for - pBSSList->wPKCount = (u16)j; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d\n", pBSSList->wPKCount); - } + if (pRSN->len >= 12) //oui1(4)+ver(2)+GKS(4)+PKSCnt(2) + { + j = 0; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType)); + for (i = 0; (i < pRSN->wPKCount) && + (j < ARRAY_SIZE(pBSSList->abyPKType)); i++) { + if(pRSN->len >= 12+i*4+4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i) + if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4)) + pBSSList->abyPKType[j++] = WPA_NONE; + else if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI02, 4)) + pBSSList->abyPKType[j++] = WPA_TKIP; + else if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI03, 4)) + pBSSList->abyPKType[j++] = WPA_AESWRAP; + else if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI04, 4)) + pBSSList->abyPKType[j++] = WPA_AESCCMP; + else + // any vendor checks here + ; + } + else + break; + //DBG_PRN_GRP14(("abyPKType[%d]: %X\n", j-1, pBSSList->abyPKType[j-1])); + } //for + pBSSList->wPKCount = (u16)j; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d\n", pBSSList->wPKCount); + } - m = pRSN->wPKCount; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"m: %d\n", m); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"14+m*4: %d\n", 14+m*4); + m = pRSN->wPKCount; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"m: %d\n", m); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"14+m*4: %d\n", 14+m*4); - if (pRSN->len >= 14+m*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2) - // overlay IE_RSN_Auth structure into correct place - pIE_RSN_Auth = (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI; - j = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n", - pIE_RSN_Auth->wAuthCount, sizeof(pBSSList->abyAuthType)); - for (i = 0; (i < pIE_RSN_Auth->wAuthCount) && - (j < ARRAY_SIZE(pBSSList->abyAuthType)); i++) { - if(pRSN->len >= 14+4+(m+i)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i) - if ( !memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI01, 4)) - pBSSList->abyAuthType[j++] = WPA_AUTH_IEEE802_1X; - else if ( !memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI02, 4)) - pBSSList->abyAuthType[j++] = WPA_AUTH_PSK; - else - // any vendor checks here - ; - } - else - break; - //DBG_PRN_GRP14(("abyAuthType[%d]: %X\n", j-1, pBSSList->abyAuthType[j-1])); - } - if(j > 0) - pBSSList->wAuthCount = (u16)j; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d\n", pBSSList->wAuthCount); - } + if (pRSN->len >= 14+m*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2) + // overlay IE_RSN_Auth structure into correct place + pIE_RSN_Auth = (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI; + j = 0; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n", + pIE_RSN_Auth->wAuthCount, sizeof(pBSSList->abyAuthType)); + for (i = 0; (i < pIE_RSN_Auth->wAuthCount) && + (j < ARRAY_SIZE(pBSSList->abyAuthType)); i++) { + if(pRSN->len >= 14+4+(m+i)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i) + if ( !memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI01, 4)) + pBSSList->abyAuthType[j++] = WPA_AUTH_IEEE802_1X; + else if ( !memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI02, 4)) + pBSSList->abyAuthType[j++] = WPA_AUTH_PSK; + else + // any vendor checks here + ; + } + else + break; + //DBG_PRN_GRP14(("abyAuthType[%d]: %X\n", j-1, pBSSList->abyAuthType[j-1])); + } + if(j > 0) + pBSSList->wAuthCount = (u16)j; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d\n", pBSSList->wAuthCount); + } - if (pIE_RSN_Auth != NULL) { + if (pIE_RSN_Auth != NULL) { - n = pIE_RSN_Auth->wAuthCount; + n = pIE_RSN_Auth->wAuthCount; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"n: %d\n", n); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"14+4+(m+n)*4: %d\n", 14+4+(m+n)*4); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"n: %d\n", n); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"14+4+(m+n)*4: %d\n", 14+4+(m+n)*4); - 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 = (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 = *(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)); - } - } - pBSSList->bWPAValid = true; - } + 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 = (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 = *(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)); + } + } + pBSSList->bWPAValid = true; + } } /*+ @@ -234,51 +234,51 @@ WPA_ParseRSN( * * Return Value: none. * --*/ -bool + -*/ + bool WPA_SearchRSN( - u8 byCmd, - u8 byEncrypt, - PKnownBSS pBSSList - ) + u8 byCmd, + u8 byEncrypt, + PKnownBSS pBSSList + ) { - int ii; - u8 byPKType = WPA_NONE; + int ii; + u8 byPKType = WPA_NONE; - if (pBSSList->bWPAValid == false) - return false; + if (pBSSList->bWPAValid == false) + return false; - switch(byCmd) { - case 0: + switch(byCmd) { + case 0: - if (byEncrypt != pBSSList->byGKType) - return false; + if (byEncrypt != pBSSList->byGKType) + return false; - if (pBSSList->wPKCount > 0) { - for (ii = 0; ii < pBSSList->wPKCount; ii ++) { - if (pBSSList->abyPKType[ii] == WPA_AESCCMP) - byPKType = WPA_AESCCMP; - else if ((pBSSList->abyPKType[ii] == WPA_TKIP) && (byPKType != WPA_AESCCMP)) - byPKType = WPA_TKIP; - else if ((pBSSList->abyPKType[ii] == WPA_WEP40) && (byPKType != WPA_AESCCMP) && (byPKType != WPA_TKIP)) - byPKType = WPA_WEP40; - else if ((pBSSList->abyPKType[ii] == WPA_WEP104) && (byPKType != WPA_AESCCMP) && (byPKType != WPA_TKIP)) - byPKType = WPA_WEP104; - } - if (byEncrypt != byPKType) - return false; - } - return true; -// if (pBSSList->wAuthCount > 0) -// for (ii=0; ii < pBSSList->wAuthCount; ii ++) -// if (byAuth == pBSSList->abyAuthType[ii]) -// break; - break; + if (pBSSList->wPKCount > 0) { + for (ii = 0; ii < pBSSList->wPKCount; ii ++) { + if (pBSSList->abyPKType[ii] == WPA_AESCCMP) + byPKType = WPA_AESCCMP; + else if ((pBSSList->abyPKType[ii] == WPA_TKIP) && (byPKType != WPA_AESCCMP)) + byPKType = WPA_TKIP; + else if ((pBSSList->abyPKType[ii] == WPA_WEP40) && (byPKType != WPA_AESCCMP) && (byPKType != WPA_TKIP)) + byPKType = WPA_WEP40; + else if ((pBSSList->abyPKType[ii] == WPA_WEP104) && (byPKType != WPA_AESCCMP) && (byPKType != WPA_TKIP)) + byPKType = WPA_WEP104; + } + if (byEncrypt != byPKType) + return false; + } + return true; + // if (pBSSList->wAuthCount > 0) + // for (ii=0; ii < pBSSList->wAuthCount; ii ++) + // if (byAuth == pBSSList->abyAuthType[ii]) + // break; + break; - default: - break; - } - return false; + default: + break; + } + return false; } /*+ @@ -294,21 +294,20 @@ WPA_SearchRSN( * * Return Value: none. * --*/ -bool + -*/ + bool WPAb_Is_RSN( - PWLAN_IE_RSN_EXT pRSN - ) + PWLAN_IE_RSN_EXT pRSN + ) { - if (pRSN == NULL) - return false; + if (pRSN == NULL) + return false; - if ((pRSN->len >= 6) && // oui1(4)+ver(2) - (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) && - (pRSN->wVersion == 1)) { - return true; - } - else - return false; + if ((pRSN->len >= 6) && // oui1(4)+ver(2) + (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) && + (pRSN->wVersion == 1)) { + return true; + } + else + return false; } - diff --git a/drivers/staging/vt6656/wpa.h b/drivers/staging/vt6656/wpa.h index 2a724c0..a8097e3 100644 --- a/drivers/staging/vt6656/wpa.h +++ b/drivers/staging/vt6656/wpa.h @@ -48,25 +48,25 @@ void WPA_ClearRSN( - PKnownBSS pBSSList - ); + PKnownBSS pBSSList + ); void WPA_ParseRSN( - PKnownBSS pBSSList, - PWLAN_IE_RSN_EXT pRSN - ); + PKnownBSS pBSSList, + PWLAN_IE_RSN_EXT pRSN + ); bool WPA_SearchRSN( - u8 byCmd, - u8 byEncrypt, - PKnownBSS pBSSList - ); + u8 byCmd, + u8 byEncrypt, + PKnownBSS pBSSList + ); bool WPAb_Is_RSN( - PWLAN_IE_RSN_EXT pRSN - ); + PWLAN_IE_RSN_EXT pRSN + ); #endif /* __WPA_H__ */ diff --git a/drivers/staging/vt6656/wpa2.c b/drivers/staging/vt6656/wpa2.c index df55417..c120c1c 100644 --- a/drivers/staging/vt6656/wpa2.c +++ b/drivers/staging/vt6656/wpa2.c @@ -59,25 +59,25 @@ static const u8 abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; * * Return Value: none. * --*/ -void + -*/ + void WPA2_ClearRSN ( - PKnownBSS pBSSNode - ) + PKnownBSS pBSSNode + ) { - int ii; - - pBSSNode->bWPA2Valid = false; - - pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP; - for (ii=0; ii < 4; ii ++) - pBSSNode->abyCSSPK[ii] = WLAN_11i_CSS_CCMP; - pBSSNode->wCSSPKCount = 1; - for (ii=0; ii < 4; ii ++) - pBSSNode->abyAKMSSAuthType[ii] = WLAN_11i_AKMSS_802_1X; - pBSSNode->wAKMSSAuthCount = 1; - pBSSNode->sRSNCapObj.bRSNCapExist = false; - pBSSNode->sRSNCapObj.wRSNCap = 0; + int ii; + + pBSSNode->bWPA2Valid = false; + + pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP; + for (ii=0; ii < 4; ii ++) + pBSSNode->abyCSSPK[ii] = WLAN_11i_CSS_CCMP; + pBSSNode->wCSSPKCount = 1; + for (ii=0; ii < 4; ii ++) + pBSSNode->abyAKMSSAuthType[ii] = WLAN_11i_AKMSS_802_1X; + pBSSNode->wAKMSSAuthCount = 1; + pBSSNode->sRSNCapObj.bRSNCapExist = false; + pBSSNode->sRSNCapObj.wRSNCap = 0; } /*+ @@ -94,142 +94,142 @@ WPA2_ClearRSN ( * * Return Value: none. * --*/ -void + -*/ + void WPA2vParseRSN ( - PKnownBSS pBSSNode, - PWLAN_IE_RSN pRSN - ) + PKnownBSS pBSSNode, + PWLAN_IE_RSN pRSN + ) { - int i, j; - u16 m = 0, n = 0; - u8 * pbyOUI; - bool bUseGK = false; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA2_ParseRSN: [%d]\n", pRSN->len); - - WPA2_ClearRSN(pBSSNode); - - if (pRSN->len == 2) { // ver(2) - if ((pRSN->byElementID == WLAN_EID_RSN) && (pRSN->wVersion == 1)) { - pBSSNode->bWPA2Valid = true; - } - return; - } - - if (pRSN->len < 6) { // ver(2) + GK(4) - // invalid CSS, P802.11i/D10.0, p31 - return; - } - - // information element header makes sense - if ((pRSN->byElementID == WLAN_EID_RSN) && - (pRSN->wVersion == 1)) { - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Legal 802.11i RSN\n"); - - pbyOUI = &(pRSN->abyRSN[0]); - if ( !memcmp(pbyOUI, abyOUIWEP40, 4)) - pBSSNode->byCSSGK = WLAN_11i_CSS_WEP40; - else if ( !memcmp(pbyOUI, abyOUITKIP, 4)) - pBSSNode->byCSSGK = WLAN_11i_CSS_TKIP; - else if ( !memcmp(pbyOUI, abyOUICCMP, 4)) - pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP; - else if ( !memcmp(pbyOUI, abyOUIWEP104, 4)) - pBSSNode->byCSSGK = WLAN_11i_CSS_WEP104; - else if ( !memcmp(pbyOUI, abyOUIGK, 4)) { - // invalid CSS, P802.11i/D10.0, p32 - return; - } else - // any vendor checks here - pBSSNode->byCSSGK = WLAN_11i_CSS_UNKNOWN; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"802.11i CSS: %X\n", pBSSNode->byCSSGK); - - if (pRSN->len == 6) { - pBSSNode->bWPA2Valid = true; - return; - } - - if (pRSN->len >= 8) { // ver(2) + GK(4) + PK count(2) - pBSSNode->wCSSPKCount = *((u16 *) &(pRSN->abyRSN[4])); - j = 0; - pbyOUI = &(pRSN->abyRSN[6]); - - 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)) { - pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_USE_GROUP; - bUseGK = true; - } else if ( !memcmp(pbyOUI, abyOUIWEP40, 4)) { - // Invalid CSS, continue parsing - } else if ( !memcmp(pbyOUI, abyOUITKIP, 4)) { - if (pBSSNode->byCSSGK != WLAN_11i_CSS_CCMP) - pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_TKIP; - else - ; // Invalid CSS, continue parsing - } else if ( !memcmp(pbyOUI, abyOUICCMP, 4)) { - pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_CCMP; - } else if ( !memcmp(pbyOUI, abyOUIWEP104, 4)) { - // Invalid CSS, continue parsing - } else { - // any vendor checks here - pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN; - } - pbyOUI += 4; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]); - } else - break; - } //for - - if (bUseGK == true) { - if (j != 1) { - // invalid CSS, This should be only PK CSS. - return; - } - if (pBSSNode->byCSSGK == WLAN_11i_CSS_CCMP) { - // invalid CSS, If CCMP is enable , PK can't be CSSGK. - return; - } - } - if ((pBSSNode->wCSSPKCount != 0) && (j == 0)) { - // invalid CSS, No valid PK. - return; - } - pBSSNode->wCSSPKCount = (u16)j; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wCSSPKCount: %d\n", pBSSNode->wCSSPKCount); - } - - 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 = *((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(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; - else if ( !memcmp(pbyOUI, abyOUIPSK, 4)) - pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_PSK; - else - // any vendor checks here - pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_UNKNOWN; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyAKMSSAuthType[%d]: %X\n", j-1, pBSSNode->abyAKMSSAuthType[j-1]); - } else - break; - } - pBSSNode->wAKMSSAuthCount = (u16)j; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount); - - 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 = *((u16 *) &(pRSN->abyRSN[8+4*m+4*n])); - } - } - //ignore PMKID lists bcs only (Re)Assocrequest has this field - pBSSNode->bWPA2Valid = true; - } + int i, j; + u16 m = 0, n = 0; + u8 * pbyOUI; + bool bUseGK = false; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA2_ParseRSN: [%d]\n", pRSN->len); + + WPA2_ClearRSN(pBSSNode); + + if (pRSN->len == 2) { // ver(2) + if ((pRSN->byElementID == WLAN_EID_RSN) && (pRSN->wVersion == 1)) { + pBSSNode->bWPA2Valid = true; + } + return; + } + + if (pRSN->len < 6) { // ver(2) + GK(4) + // invalid CSS, P802.11i/D10.0, p31 + return; + } + + // information element header makes sense + if ((pRSN->byElementID == WLAN_EID_RSN) && + (pRSN->wVersion == 1)) { + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Legal 802.11i RSN\n"); + + pbyOUI = &(pRSN->abyRSN[0]); + if ( !memcmp(pbyOUI, abyOUIWEP40, 4)) + pBSSNode->byCSSGK = WLAN_11i_CSS_WEP40; + else if ( !memcmp(pbyOUI, abyOUITKIP, 4)) + pBSSNode->byCSSGK = WLAN_11i_CSS_TKIP; + else if ( !memcmp(pbyOUI, abyOUICCMP, 4)) + pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP; + else if ( !memcmp(pbyOUI, abyOUIWEP104, 4)) + pBSSNode->byCSSGK = WLAN_11i_CSS_WEP104; + else if ( !memcmp(pbyOUI, abyOUIGK, 4)) { + // invalid CSS, P802.11i/D10.0, p32 + return; + } else + // any vendor checks here + pBSSNode->byCSSGK = WLAN_11i_CSS_UNKNOWN; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"802.11i CSS: %X\n", pBSSNode->byCSSGK); + + if (pRSN->len == 6) { + pBSSNode->bWPA2Valid = true; + return; + } + + if (pRSN->len >= 8) { // ver(2) + GK(4) + PK count(2) + pBSSNode->wCSSPKCount = *((u16 *) &(pRSN->abyRSN[4])); + j = 0; + pbyOUI = &(pRSN->abyRSN[6]); + + 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)) { + pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_USE_GROUP; + bUseGK = true; + } else if ( !memcmp(pbyOUI, abyOUIWEP40, 4)) { + // Invalid CSS, continue parsing + } else if ( !memcmp(pbyOUI, abyOUITKIP, 4)) { + if (pBSSNode->byCSSGK != WLAN_11i_CSS_CCMP) + pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_TKIP; + else + ; // Invalid CSS, continue parsing + } else if ( !memcmp(pbyOUI, abyOUICCMP, 4)) { + pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_CCMP; + } else if ( !memcmp(pbyOUI, abyOUIWEP104, 4)) { + // Invalid CSS, continue parsing + } else { + // any vendor checks here + pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN; + } + pbyOUI += 4; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]); + } else + break; + } //for + + if (bUseGK == true) { + if (j != 1) { + // invalid CSS, This should be only PK CSS. + return; + } + if (pBSSNode->byCSSGK == WLAN_11i_CSS_CCMP) { + // invalid CSS, If CCMP is enable , PK can't be CSSGK. + return; + } + } + if ((pBSSNode->wCSSPKCount != 0) && (j == 0)) { + // invalid CSS, No valid PK. + return; + } + pBSSNode->wCSSPKCount = (u16)j; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wCSSPKCount: %d\n", pBSSNode->wCSSPKCount); + } + + 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 = *((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(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; + else if ( !memcmp(pbyOUI, abyOUIPSK, 4)) + pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_PSK; + else + // any vendor checks here + pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_UNKNOWN; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyAKMSSAuthType[%d]: %X\n", j-1, pBSSNode->abyAKMSSAuthType[j-1]); + } else + break; + } + pBSSNode->wAKMSSAuthCount = (u16)j; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount); + + 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 = *((u16 *) &(pRSN->abyRSN[8+4*m+4*n])); + } + } + //ignore PMKID lists bcs only (Re)Assocrequest has this field + pBSSNode->bWPA2Valid = true; + } } diff --git a/drivers/staging/vt6656/wpa2.h b/drivers/staging/vt6656/wpa2.h index dc505ce..e19a4bb 100644 --- a/drivers/staging/vt6656/wpa2.h +++ b/drivers/staging/vt6656/wpa2.h @@ -38,8 +38,8 @@ #define MAX_PMKID_CACHE 16 typedef struct tagsPMKIDInfo { - u8 abyBSSID[6]; - u8 abyPMKID[16]; + u8 abyBSSID[6]; + u8 abyPMKID[16]; } PMKIDInfo, *PPMKIDInfo; typedef struct tagSPMKIDCache { diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c index f4a8a5c..04e23f8 100644 --- a/drivers/staging/vt6656/wpactl.c +++ b/drivers/staging/vt6656/wpactl.c @@ -73,8 +73,8 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) if (param->u.wpa_key.alg_name > WPA_ALG_CCMP) return -EINVAL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d \n", - param->u.wpa_key.alg_name); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d\n", + param->u.wpa_key.alg_name); if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pDevice->bEncryptionEnable = false; @@ -109,7 +109,7 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) NULL, abyKey, KEY_CTL_WEP - ); + ); } pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; @@ -172,14 +172,14 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) // Check TKIP key length if ((byKeyDecMode == KEY_CTL_TKIP) && - (param->u.wpa_key.key_len != MAX_KEY_LEN)) { + (param->u.wpa_key.key_len != MAX_KEY_LEN)) { // TKIP Key must be 256 bits DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return - TKIP Key must be 256 bits!\n"); return -EINVAL; - } + } // Check AES key length if ((byKeyDecMode == KEY_CTL_CCMP) && - (param->u.wpa_key.key_len != AES_KEY_LEN)) { + (param->u.wpa_key.key_len != AES_KEY_LEN)) { // AES Key must be 128 bits DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return - AES Key must be 128 bits\n"); return -EINVAL; @@ -190,19 +190,19 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n"); if ((KeybSetAllGroupKey(pDevice, &(pDevice->sKey), dwKeyIndex, - param->u.wpa_key.key_len, - &KeyRSC, - (u8 *)abyKey, - byKeyDecMode - ) == true) && - (KeybSetDefaultKey(pDevice, - &(pDevice->sKey), - dwKeyIndex, - param->u.wpa_key.key_len, - &KeyRSC, - (u8 *)abyKey, - byKeyDecMode - ) == true) ) { + param->u.wpa_key.key_len, + &KeyRSC, + (u8 *)abyKey, + byKeyDecMode + ) == true) && + (KeybSetDefaultKey(pDevice, + &(pDevice->sKey), + dwKeyIndex, + param->u.wpa_key.key_len, + &KeyRSC, + (u8 *)abyKey, + byKeyDecMode + ) == true) ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n"); } else { return -EINVAL; @@ -221,9 +221,9 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) return -EINVAL; } if (KeybSetKey(pDevice, &(pDevice->sKey), ¶m->addr[0], - dwKeyIndex, param->u.wpa_key.key_len, - &KeyRSC, (u8 *)abyKey, byKeyDecMode - ) == true) { + dwKeyIndex, param->u.wpa_key.key_len, + &KeyRSC, (u8 *)abyKey, byKeyDecMode + ) == true) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); } else { // Key Table Full @@ -245,4 +245,3 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) return ret; } - -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel